Text Formatting ⇒ filename as text
filename as text
I'm new to the world of Latex and I need some help...
I need to write in my article a filename such as "pippo.txt"
but if I try to compile it Latex gives me this error "missing $ inserted"
I think he tries to find the file pippo.txt...how to avoid this and make latex just print the filename?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
filename as text
welcome to the forum!
This should not be a problem. Test this file, it works:
Code: Select all
\documentclass{article}
\begin{document}
pippo.txt
\end{document}
So, I guess, your actual file name is not pippo.txt but contains special characters like an underscore, such as pippo_1.txt. In that case, you would get this error, because the underscore _ is for subscripts in math mode.
If you would load the
url
package or hyperref
, the path command is handy and fixes it:Code: Select all
\documentclass{article}
\usepackage{url}
\begin{document}
This is the file: \path{pippo_1.txt}
\end{document}
Stefan
Re: filename as text
You got it! The filenames contains the underscore character!
The problem is that i don't have those file, so I don't need to insert the path, I just need to print the files name "arm256_start.elf, arm384_start.elf, arm496_start.elf"
I solved it putting an "\" before the "_" but i don't know if it's the right way to solve the problem
Now my problem is to correct this "( gpu_mem = xx) "
- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
filename as text
\path
can also be used for simple filenames. But \_
should work. It should also work in gnu_mem
. Btw. while the whole expression should be in math mode, gnu_mem
should be text, such as here:Code: Select all
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\text{gpu\_mem} = x$
\end{document}
Re: filename as text
Solved!
Thank you so much!