Text FormattingInsert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
felipoc
Posts: 6
Joined: Thu Dec 25, 2008 1:35 pm

Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by felipoc »

Hi folks,

I would like to insert the file name "nK_Gr9.5e4_ABBDI3_1" in latex, so that it is reproduced exactly. I get Error-Messages if I write it like this in TexnicCenter and i don´t want it as math-mode.

Can Anybody help me ?

Thank you very much, Philipp

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by phi »

Hi,
use a verbatim environment or command:

Code: Select all

\documentclass{article}
\begin{document}
\verb$nK_Gr9.5e4_ABBDI3_1$
\end{document}
felipoc
Posts: 6
Joined: Thu Dec 25, 2008 1:35 pm

Re: Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by felipoc »

Thank you phi,

Is there a possibility that the name appears in the same font as the rest of the text ?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by Stefan Kottwitz »

Hi Philipp,

you could use \_ for the underscore symbol:

Code: Select all

nK\_Gr9.5e4\_ABBDI3\_1
Stefan
LaTeX.org admin
felipoc
Posts: 6
Joined: Thu Dec 25, 2008 1:35 pm

Re: Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by felipoc »

Thank you Stefan,

that´s exactly what I was looking for.
Last edited by felipoc on Sun Dec 28, 2008 11:58 pm, edited 1 time in total.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by phi »

felipoc wrote:Is there a possibility that the name appears in the same font as the rest of the text ?

Code: Select all

\detokenize{....}
This is technically different than the verbatim solution, but should be acceptable in this case.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Re: Insert file name "nK_Gr9.5e4_ABBDI3_1" in Latex

Post by Stefan Kottwitz »

Hi phi,

just two remarks, I think \detokenize requires eTeX, but that would probably be used. With OT1 encoding the result might not be as expected, but with T1 encoding (and eTeX) \detokenize should work well with this example, so it's a good recommendation, that macro can also be useful to solve more problems (toc etc.).

Stefan
LaTeX.org admin
Post Reply