简体   繁体   中英

Underline function not working in MiKTeX?

This seems ridiculous but I'm using LaTeX for the first time in a while and when I attempt to underline like so:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
...
\begin{document}
\maketitle
...
\subsection{}
\underline{ActorName} | Phone, Address, AgentName, Appears-In_Scene
\break
...
\end{document}

I get a math mode error:

! Missing $ inserted.
<inserted text> 
                $
l.15 ...me} Phone, Address, AgentName, Appears-In_
                                                  Scene

Any idea what is causing this and how to fix it? I am not opening a math statement anywhere. Also using BibTeX but I don't think that matters.

I am not opening a math statement anywhere.

Well, that's the problem. You use a _ which is a command which must only be used in math mode to write underscores. If you want to write a _, you can use \textunderscore or escape the underscore with \_

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}


\title{text}
\author{names}

\begin{document}
\maketitle
...
\subsection{}
\underline{ActorName} | Phone, Address, AgentName, Appears-In\textunderscore Scene
\break
...
\end{document}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM