Text Formatting ⇒ Lost formatting in algorithm2e
Lost formatting in algorithm2e
E.g.:
\If{$r^\texttt{b}>0$}{}
is printed exactly the same as
\If{$r^b>0$}{}
Can anyone help how to solve this?
BR,
Greg.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Lost formatting in algorithm2e
Code: Select all
\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}
\If{$r^\texttt{b}>0$}{}
\If{$r^b>0$}{}
\end{algorithm}
\end{document}
And those are clearly not the same. (Perhaps you wanted an upright typewriter font; then you could use \texttt{\textup{b}}.)
Re: Lost formatting in algorithm2e
2. Sorry for not providing a min. working example, as I should.
3. I was not aware that a typewriter font can be other than upright, so I did not see the difference you show in my document. Really. Maybe a small font size had something to do with it

4. Thanks again.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Lost formatting in algorithm2e
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10