underscore

StartSearchLaTeX for Beginners F.A.Q. LaTeX Topics

1 latex underscore

Setting an underscore _ in LaTeX is not that easy. Since this is a reserved special character. The underscore is used within math mode for setting indices, so $a_{i}$ becomes ai. To use the underscore within the normal text mode, it must be masked with a backslash, then the underscore _ is set with \_. If the underscore is not masked, the following error message is displayed:
!Missing $ inserted.
<inserted text> 
               $
In the event that the underscore is often used at the document, masking can become quite cumbersome. In such a case you can use the package underscore.

2 underscore Package

The underscore package (version 1.0) from 2006 provides a modified version of the underscore.
The package is integrated with: \usepackage{underscore}

2.1 Advantage

The advantage of the package is that the underscore can now be used as a simple keyboard character _ within text mode and the underscore can still be used in math mode to introduce the indices.

Input:
Word_Word $a_{i}$
Output:
Word_Word ai

2.2 Disadvantage

Using the underscore package has the disadvantage that no external file (images, additional tex file) can be included if it contains a _ in file names. This means that within the commands \input{filename}, \include{filename} and \includegraphics{filename} no filename with an underscore can be used. In addition, problems can also be expected with other commands if an underscore is used.

2.2.1 Option strings

If the package option strings is set, some of the above problems will be fixed and at \input{filename} and \include{filename} filenames with underscore can be used again.

Set the option strings: \usepackage[strings]{underscore}

2.3 Conclusion

Bepart from the new problem, i.e. the limited use of the underscore in file names and commands, the package is a viable alternative to masking each underscore.

3 latex underline

Eng related to the question nor the underscore is the underlining of words, words and paragraphs. If a word is to be underlined, the default LaTeX command \underline{word} can be used, or the \ul{word} command from the soul package. If a whole paragraph is to be underlined, the \uline{paragraph} from the ulem package can be used.


Source:https://www.ctan.org/pkg/underscore

Contact   Privacy Policy   disclosures

accept decline

This website uses cookies and pixel tags to ensure you get the best experience on our website. By using this website, you consent to the use of cookies.learn more about cookies see also our privacy policy