Text FormattingVertical alignment of an asterisk, commands in lstlisting

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
elnoi
Posts: 1
Joined: Fri Feb 26, 2010 1:12 am

Vertical alignment of an asterisk, commands in lstlisting

Post by elnoi »

If a write something like \texttt{abc*} the asterisk will be centered vertically. I found a workaround to put it a little higher and created a \newcommand for it. Now I load some C code into a lstlisting and want all asterisks in it be aligend vertical at top. Is it possible to use \... commands in a lstlisting? Or is there an other way to adjust the vertical alignment of a special character in a lstlisting?

Thank you.
Last edited by elnoi on Fri Feb 26, 2010 3:01 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Vertical alignment of an asterisk, commands in lstlisting

Post by gmedina »

Hi,
elnoi wrote:...Is it possible to use \... commands in a lstlisting?..
Refer to section 4.14 Escaping to LaTeX of the listings documentation.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply