每次我打开一个新的,listing
编译器都会对此抱怨。
尝试编译以下示例
% !TEX options = -shell-escape
\documentclass[%
corpo=12pt,
twoside,
oldstyle,
tipotesi=magistrale,
greek,
evenboxes,
]{toptesi}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{hyperref}
\hypersetup{%
pdfpagemode={UseOutlines},
bookmarksopen,
pdfstartview={FitH},
colorlinks,
linkcolor={blue},
citecolor={blue},
urlcolor={blue}
}
\usepackage{geometry}
\usepackage{caption}
\usepackage{svg}
\usepackage{minted}
\setmintedinline{breaklines,breakanywhere}
\usepackage{tikz}
\usepackage{tikz-uml}
\usepackage{adjustbox}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\begin{document}
\mainmatter
\begin{listing}
\end{listing}
\end{document}
日志文件将输出这些错误
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: float package is loaded.
Package caption Info: End \AtBeginDocument code.
()
Runaway argument?
d:/asant/Desktop/master-thesis/mre.tex:45: Paragraph ended before \FVC@VerbatimInput was complete.
<to be read again>
\par
l.45
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
d:/asant/Desktop/master-thesis/mre.tex:46: Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup
\color@endbox
l.46 \end{listing}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
d:/asant/Desktop/master-thesis/mre.tex:46: Too many }'s.
\color@endbox ->\color@endgroup \egroup
l.46 \end{listing}
You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.
d:/asant/Desktop/master-thesis/mre.tex:46: Undefined control sequence.
\endlisting ...floatbox \global \setbox \@currbox
\float@makebox \columnwidt...
l.46 \end{listing}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
d:/asant/Desktop/master-thesis/mre.tex:46: Missing number, treated as zero.
<to be read again>
\vbox
l.46 \end{listing}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
d:/asant/Desktop/master-thesis/mre.tex:46: Undefined control sequence.
\caption@ORI@float@makebox ...boxrestore \@fs@pre
\@fs@iftopcapt \ifvoid \@f...
l.46 \end{listing}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
d:/asant/Desktop/master-thesis/mre.tex:46: Undefined control sequence.
\caption@ORI@float@makebox ...@pre \@fs@iftopcapt
\ifvoid \@floatcapt \else ...
l.46 \end{listing}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
d:/asant/Desktop/master-thesis/mre.tex:46: Undefined control sequence.
\caption@ORI@float@makebox ...i \unvbox \@currbox
\else \unvbox \@currbox \i...
l.46 \end{listing}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
d:/asant/Desktop/master-thesis/mre.tex:46: Extra \else.
\caption@ORI@float@makebox ...box \@currbox \else
\unvbox \@currbox \ifvoid ...
l.46 \end{listing}
I'm ignoring this; it doesn't match any \if.
d:/asant/Desktop/master-thesis/mre.tex:46: Missing number, treated as zero.
<to be read again>
\unvbox
l.46 \end{listing}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
d:/asant/Desktop/master-thesis/mre.tex:46: Undefined control sequence.
\caption@ORI@float@makebox ...e \unvbox \@currbox
\ifvoid \@floatcapt \else ...
l.46 \end{listing}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
d:/asant/Desktop/master-thesis/mre.tex:46: Extra \fi.
\caption@ORI@float@makebox ...\@floatcapt \fi \fi
\par \@fs@post \vskip \z@ }
l.46 \end{listing}
I'm ignoring this; it doesn't match any \if.
d:/asant/Desktop/master-thesis/mre.tex:46: Missing number, treated as zero.
<to be read again>
\scan_stop:
l.46 \end{listing}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
d:/asant/Desktop/master-thesis/mre.tex:46: Undefined control sequence.
\caption@ORI@float@makebox ... \fi \par \@fs@post
\vskip \z@ }
l.46 \end{listing}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
d:/asant/Desktop/master-thesis/mre.tex:46: LaTeX Error: \begin{document} ended by \end{listing}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.46 \end{listing}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
d:/asant/Desktop/master-thesis/mre.tex:46: Extra \endgroup.
<recently read> \endgroup
l.46 \end{listing}
Things are pretty mixed up, but I think the worst is over.
(mre.aux)
Package rerunfilecheck Warning: File `mre.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.
Package rerunfilecheck Info: Checksums for `mre.out':
(rerunfilecheck) Before: <no file>
(rerunfilecheck) After: D41D8CD98F00B204E9800998ECF8427E;0.
)
Here is how much of TeX's memory you used:
33278 strings out of 478927
666289 string characters out of 2852535
1096849 words of memory out of 3000000
50535 multiletter control sequences out of 15000+600000
407491 words of font info for 30 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
138i,1n,136p,522b,131s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.
pdfTeX warning: pdflatex: dangling objects discarded, no output file produced.
PDF statistics:
29 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
109 words of extra memory for PDF output out of 10000 (max. 10000000)
有没有什么办法可以解决这个问题?
答案1
不幸的是,它toptesi.cls
定义了它自己的含义\listing
,实际上topcoman.sty
它会自动加载。在第 83 行(当前版本 2020-09-06 v.6.4.06)我们读到
\let\listing\VerbatimInput
不幸的是,topcoman
文档也是在开始处加载的,因此之后minted
用来\newfloat
定义listing
环境。
我认为没有理由将作为 的别名toptesi
提供,但它就在那里。\listing
\VerbatimInput
除了制作自己的副本topcoman.sty
删除有问题的行之外,我还可以提供一种解决方法。
\documentclass[%
corpo=12pt,
twoside,
oldstyle,
tipotesi=magistrale,
greek,
evenboxes,
]{toptesi}
%%% Packages and libraries
%\usepackage[utf8]{inputenc} % no longer needed
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{geometry}
\usepackage{caption}
%\usepackage{svg} % No inkscape on my machine
\usepackage{minted}
%%% workaround for listing
% save the current meaning of \listing
\let\savedlisting\listing
% at the right spot, restore the meaning
\AtBeginDocument{\let\listing\savedlisting}
%%% end of workaround
\usepackage{tikz}
%\usepackage{tikz-uml} % no tikz-uml on my machine
\usepackage{adjustbox}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
% hyperref should be last
\usepackage{hyperref}
\hypersetup{
pdfpagemode={UseOutlines},
bookmarksopen,
pdfstartview={FitH},
colorlinks,
linkcolor={blue},
citecolor={blue},
urlcolor={blue},
}
%%% Settings
\setmintedinline{breaklines,breakanywhere}
\begin{document}
\mainmatter
\begin{listing}
\end{listing}
\end{document}
(我将其注释掉,因为如果假设的inputenc
话,它不再需要;也因为这台机器上我没有,而且因为我必须下载它;取消对它们的注释。)utf8
svg
inkscape
tikz-uml
当然很多如果topcoman
有就更好了
\@ifundefined{listing}{\let\listing\VerbatimInput}{}