Figures occurring after ^ and _ macros (was: LaTeX

2019-05-10 21:24发布

问题:

I've hit an annoying problem in LaTeX. I've got a tex file of about 1000 lines. I've already got a few figures, but when I try to add another figure, It barfs with:

! Undefined control sequence.
<argument> ... \sf@size \z@ \selectfont \@currbox

l.937 \begin{figure}[t]

If I move the figure to other parts of the file, I can get similar errors on different lines:

! Undefined control sequence.
<argument> ... \sf@size \z@ \selectfont \@currbox

l.657 \paragraph
                {A Centering Algorithm}

If I comment out the figure, all is ok.

%\begin{figure}[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
%\end{figure}

If I keep just the begin and end like:

\begin{figure}%[t]
% \caption{Example decision tree, from Reiter and Dale [2000]}
% \label{fig:relation-decision-tree}
% \centering
% \includegraphics[keepaspectratio=true]{./relation-decision-tree.eps}
\end{figure}

I get:

! Undefined control sequence.
<argument> ... \sf@size \z@ \selectfont \@currbox

l.942 \end
          {figure}

At first, I thought maybe LaTeX has hit some limit, and I tried playing with the ulimits, but that didn't help. Any ideas?

i've got other figures with graphics already. my preamble looks like:

\documentclass[acmcsur,acmnow]{acmtrans2n}
\usepackage{array}
\usepackage{lastpage}
\usepackage{pict2e}
\usepackage{amsmath}
\usepackage{varioref}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{qtree}
\usepackage{rotating}
\usepackage{tree-dvips}
\usepackage{mdwlist}
\makecompactlist{quote*}{quote}
\usepackage{verbatim}
\usepackage{ulem}

回答1:

I found, not that it's a problem with \textsuperscript, but that it's with a ^ def I picked up from http://anthony.liekens.net/index.php/LaTeX/SubscriptAndSuperscriptInTextMode . The fix is to put the use of ^ in {}, as in I've put entire sections where I use lots of ^ and _ in {}. Hurrah!



回答2:

During the end of my Master Thesis I also had the problem that after some amount of figures, I got an error without any special error message. After I read you thread, I also tried something with the packages included and in the end I was successful by taking out the \usepackage{pxfonts} and \usepackage{txfonts}. Yeah, finally.. I almost went crazy.. ;)



回答3:

If I Google for "latex undefined control sequence" I get this.

I've successfully included a graphic into LaTeX using something like this:

\usepackage{amsmath,amsthm,graphicx}

...

I just wanted to test adding an image to a \LaTeX file:

\includegraphics[scale=0.60]{basic-info.png} 

I typeset an entire dissertation of 200 pages with lots of figures in LaTeX and didn't run into a limit like that. I'd bet on a syntax problem first before I'd assume a size issue.



回答4:

Your error lies elsewhere. I wouldn't be the least surprised if it turned out to be the document class. Try altering your document for \documentclass{article} and see where you get. If that fixes the problem you can complain to the ACM (ROTFLMAO—I've dealth with ACM).

If that doesn't fix, the problem, slip in a \tracingall somewhat before the offending figure or section, put the results into http://pastebin.com/, and let us know.



回答5:

Please receive the thanks of a (formerly) utterly-confounded graduate student. Quick clarification for other users:

{The quickest ^{way} to put this solution into practice is to bracket all sections of text involving the character ``\^'' as shown here.}