How to demonstrate LaTeX tags and code
- Context: LaTeX
- Thread starter jtbell
- Start date
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
13 replies · 697 views
Discussion
Physics news on Phys.org
Mentor
- 29,211
- 4,638
[ plain] is a new [noparse]. But as the MathJax system knows nothing about UBBC tags and ignores them completely, there is currently no good way of showing these things. You can try the cyryllic trick (replacing standard ASCII e with "е") but on some computers it doesn't render correctly.
[tеx]E=mc^2[/tеx]
[tеx]E=mc^2[/tеx]
Staff Emeritus
Science Advisor
Homework Helper
2025 Award
- 16,110
- 8,446
Testing another method suggested by mfb in a report thread:
##E=mc^2##
[tex]E=mc^2[/tex]
Yay! The trick is to wrap each tag in color tags, and make them black. If I use red instead:
[tex]E=mc^2[/tex]
Interestingly, the color tags don't show up when you edit or quote the post.
Oh wait, they do show up if you switch to the BBCode editor. Wow, where did all those duplicate color tags come from? oo)
Let's see if I can use the "Text Color" icon in the palette:
[tex]E=mc^2[/tex]
Yep, that works, too. You don't actually have to type out the color tags.
##E=mc^2##
[tex]E=mc^2[/tex]
Yay! The trick is to wrap each tag in color tags, and make them black. If I use red instead:
[tex]E=mc^2[/tex]
Interestingly, the color tags don't show up when you edit or quote the post.
Oh wait, they do show up if you switch to the BBCode editor. Wow, where did all those duplicate color tags come from? oo)
Let's see if I can use the "Text Color" icon in the palette:
[tex]E=mc^2[/tex]
Yep, that works, too. You don't actually have to type out the color tags.
Last edited:
Mentor
- 38,146
- 10,750
Even changing the text color of one letter to black will work.
Here I have changed the 'x' in tex to black.
[tex]E = mc^2[/tex]
Next, I change the 2nd $ of the first pair to black.
$$E = mc^2$$
This might not work if you have subsequent LaTeX stuff, so might need to also change one $ in the end pair.
Here I have changed the 'x' in tex to black.
[tex]E = mc^2[/tex]
Next, I change the 2nd $ of the first pair to black.
$$E = mc^2$$
This might not work if you have subsequent LaTeX stuff, so might need to also change one $ in the end pair.
Mentor
- 37,518
- 14,395
Yes, outside code tags that works fine. Inside it does not.
Color code does not get parsed:
Same with plain (it is simply treated as regular text):
But itex does get parsed:
Color code does not get parsed:
Code:
[itex[/color]]a^2[/itex]
Same with plain (it is simply treated as regular text):
Code:
[plain][itex]a^2[/itex][/plain]
But itex does get parsed:
Code:
[itex]a^2[/itex]
Staff Emeritus
Science Advisor
Homework Helper
2025 Award
- 16,110
- 8,446
Indeed, the color-tag trick does not work inside code tags. However, it does work inside font tags, so you can put an entire code example in e.g. Courier New instead of the default Ariel:
[tex]E=mc^2[/tex]
Now I wonder what happens if I put the entire example in color tags, which is simpler than doing it for the individual tex tags...
[tex]E=mc^2[/tex]
Nope, you have to do the tags individually.
[tex]E=mc^2[/tex]
Now I wonder what happens if I put the entire example in color tags, which is simpler than doing it for the individual tex tags...
[tex]E=mc^2[/tex]
Nope, you have to do the tags individually.
- 19,984
- 11,099
Code this work?
Code:
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
Code:
##\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)##
Code:
[tex]\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)##[/tex]
- 19,984
- 11,099
https://www.physicsforums.com/threads/how-to-geshi-syntax-highlighter.773407/Borek said:Is this some plugin, or just XenForo?
Staff Emeritus
Science Advisor
Homework Helper
2025 Award
- 16,110
- 8,446
Here's something weird. Consider this code:
[tex] u(x) =<br /> \begin{cases}<br /> \exp{x} & \text{if } x \geq 0 \\<br /> 1 & \text{if } x < 0<br /> \end{cases}[/tex]
which produces this:
[tex] u(x) =<br /> \begin{cases}<br /> \exp{x} & \text{if } x \geq 0 \\<br /> 1 & \text{if } x < 0<br /> \end{cases}[/tex]
If you "colorize" only the [tex]tag, you get this:<br /> <br /> <span style="font-family: 'Courier New'">[tex] u(x) =<br /> \begin{cases}<br /> \exp{x} & \text{if } x \geq 0 \\<br /> 1 & \text{if } x < 0<br /> \end{cases}[/tex]<br /> <br /> To make all the code display as code, you also have to colorize the LaTeX <span style="font-family: 'Courier New'">\begin{cases} command that creates the cases environment. You don't have to colorize the closing <span style="font-family: 'Courier New'">\end{cases} command. This applies to other environments as well (array, matrix, ...).<br /> <br /> You also don't have to colorize the closing </span></span></span>[/tex] tag, just the opening [tex]. I only realized this just now.[/tex]
[tex] u(x) =<br /> \begin{cases}<br /> \exp{x} & \text{if } x \geq 0 \\<br /> 1 & \text{if } x < 0<br /> \end{cases}[/tex]
which produces this:
[tex] u(x) =<br /> \begin{cases}<br /> \exp{x} & \text{if } x \geq 0 \\<br /> 1 & \text{if } x < 0<br /> \end{cases}[/tex]
If you "colorize" only the [tex]tag, you get this:<br /> <br /> <span style="font-family: 'Courier New'">[tex] u(x) =<br /> \begin{cases}<br /> \exp{x} & \text{if } x \geq 0 \\<br /> 1 & \text{if } x < 0<br /> \end{cases}[/tex]<br /> <br /> To make all the code display as code, you also have to colorize the LaTeX <span style="font-family: 'Courier New'">\begin{cases} command that creates the cases environment. You don't have to colorize the closing <span style="font-family: 'Courier New'">\end{cases} command. This applies to other environments as well (array, matrix, ...).<br /> <br /> You also don't have to colorize the closing </span></span></span>[/tex] tag, just the opening [tex]. I only realized this just now.[/tex]
Last edited:
Mentor
- 37,518
- 14,395
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1 & \text{if } x < 0
\end{cases}
Things with begin and end get parsed without any tex tags (for whatever reason). Therefore, you have to mask them separately to prevent parsing.
\exp{x} & \text{if } x \geq 0 \\
1 & \text{if } x < 0
\end{cases}
Things with begin and end get parsed without any tex tags (for whatever reason). Therefore, you have to mask them separately to prevent parsing.
Similar threads
How to demonstrate the linearity of resistance of water vs. test voltage?
- kma
- · Replies 18 ·
- Advanced Physics Homework Help
- Replies
- 18
LaTeX LaTeX tags not rendering in private messages
- Schrodinger's Dog
- · Replies 11 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 11
LaTeX LaTeX tags always display the same equation
- Math Jeans
- · Replies 11 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 11
LaTeX How do I format equations with LaTeX tags in forum posts?
- buhthestuh
- · Replies 2 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 2
Undergrad How to Demonstrate That These Limits Go to Infinity?
- joao_pimentel
- · Replies 13 ·
- Calculus
- Replies
- 13
Mathematica How to type mathematical equations using LaTeX
- Greg Bernhardt
- · Replies 3 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 3
Graduate How to demonstrate the asymptotic charateristic of perturbative QTF Theo?
- ndung200790
- · Replies 3 ·
- Quantum Physics
- Replies
- 3
LaTeX How to use LaTeX at Physics Forums
- Redbelly98
- · Replies 4 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 4
How to Demonstrate [Lk, r^2] = 0?
- jc09
- · Replies 1 ·
- Advanced Physics Homework Help
- Replies
- 1
Chemistry behind airbag deployment. How to demonstrate?
- demode
- · Replies 7 ·
- Chemistry
- Replies
- 7
