从昨天开始我遇到了一个奇怪的问题。我正在用 Lyx 写论文。我使用的是基于 KOMA-Script 的模板。
嗯,昨天我从文档中删除了一些表格。再次编译后,我收到以下错误消息:
LaTeX Error: Something's wrong--perhaps a missing \item.
错误发生在一行连续的表格上,这些表格直接位于已删除表格之后。在此之前,它们工作正常。我正在tabularx
为表格使用该包。
表的定义类似于以下代码:
\makeatletter
\def\MPT{\@minipagetrue}
\makeatother
\begin{tabularx}{\textwidth}{|>{\columncolor{Gray}}lX|}
\hline % oberste Linie, vor erster Spalte
\rowcolor{Gray}
\textbf{Blabla} & \textbf{} \\ \hline \hline
IST-Zustand
&
\vspace{-1\topsep}
\begin{list}{$\bullet$}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}\setlength{\leftmargin}{4mm}\setlength{\topsep}{0mm}}
\MPT
\item blaaa
\end{list}
\vspace{-1\topsep} ~
\\ \hline
\caption{blabla}
\end{tabularx}
经过长时间的尝试,我发现,当我用X
类似这样的固定列宽替换用定义的列时p{...cm}
,它突然又可以工作了。
在没有任何实际例子的情况下是否可以解释这一点(我可以稍后交一个)?
编辑:
这是我的文档的序言:
% verschieden Symbole, Zeichen wie (c), €
\usepackage{textcomp}
\usepackage{ %a4wide,
ellipsis, fixltx2e, mparhack, %Fehlerkorrektur für Marginalien
booktabs, longtable %schönere Tabellen
}
\usepackage[automark]{scrpage2}
%\automark[chapter]{chapter}
\clearscrheadfoot
\ohead{\\\headmark}
\ihead{\includegraphics[scale=0.25]{pics/logo_schwarz.pdf}}%\pagemark}
\ofoot[\pagemark]{\pagemark}
%Kurzfassung und Abstract (englisch) auf eine Seite
\renewenvironment{abstract}{
\@beginparpenalty\@lowpenalty
\begin{center}
\normalfont\sectfont\nobreak\abstractname
\@endparpenalty\@M
\end{center}
}{
\par
}
% schönerer Blocksatz!!
\usepackage{microtype}
\usepackage{ifpdf} % part of the hyperref bundle
\ifpdf % if pdflatex is used
%set fonts for nicer pdf view
\IfFileExists{lmodern.sty}{\usepackage{lmodern}}
{\usepackage[scaled=0.92]{helvet}
\usepackage{mathptmx}
\usepackage{courier} }
\fi
% the pages of the TOC are numbered roman
% and a pdf-bookmark for the TOC is added
\pagenumbering{roman}
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{
%\pdfbookmark[1]{Contents}{}
\myTOC
\clearpage
\pagenumbering{arabic}}
%Bezeichungen anpassen
%Babelpaket muß zuvor geladen werden
\usepackage[ngerman]{babel}
\addto\captionsngerman{
\renewcommand{\figurename}{Abb.}%
\renewcommand{\tablename}{Tab.}%
\renewcommand{\abstractname}{Kurzfassung}
%\renewcommand{\nomname}{Abkürzungen}
}
% Alle Querverweise und URLs als Link darstellen
% In der PDF-Ausgabe
\usepackage[colorlinks=true, bookmarks, bookmarksnumbered, bookmarksopen, bookmarksopenlevel=1,
linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,
pdfpagelayout=OneColumn, pdfnewwindow=true,
pdfstartview=XYZ, plainpages=false, pdfpagelabels,
pdfauthor={LyX Team}, pdftex,
pdftitle={LyX's Figure, Table, Floats, Notes, and Boxes manual},
pdfsubject={LyX-documentation about figures, tables, floats, notes, and boxes},
pdfkeywords={LyX, Tables, Figures, Floats, Boxes, Notes}]{hyperref}
%mehr Platz zwischen Überschrift und Tabelle
\newcommand{\@ldtable}{}
\let\@ldtable\table
\renewcommand{\table}{ %
\setlength{\@tempdima}{\abovecaptionskip} %
\setlength{\abovecaptionskip}{\belowcaptionskip} %
\setlength{\belowcaptionskip}{\@tempdima} %
\@ldtable}
%Farbigen Hintergrund erstellen
\usepackage{color, colortbl}
\definecolor{Gray}{gray}{0.9}
%Tabularx package
\usepackage{ltablex}
\usepackage{multirow, rotating, array, paralist}
\usepackage{caption}
%damit URLs als solche erkannt werden
\usepackage{url}
\usepackage{wrapfig} %damit grafiken umflossen werden
\usepackage{scrhack}
\usepackage{hyperref}
@Marco Daniel:
这是日志文件:
...
Package caption Info: KOMA-Script document class.
\c@ContinuedFloat=\count114
Package caption Info: hyperref package is loaded.
Package caption Info: longtable package is loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\caption\ltcaption.sty"
Package: ltcaption 2013/02/03 v1.3-62 longtable captions (AR)
)
Package caption Info: rotating package is loaded.
) ("C:\Program Files\MiKTeX 2.9\tex\latex\wrapfig\wrapfig.sty"
\wrapoverhang=\dimen140
\WF@size=\dimen141
\c@WF@wrappedlines=\count115
\WF@box=\box32
\WF@everypar=\toks24
Package: wrapfig 2003/01/31 v 3.6
) ("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrhack.sty"
Package: scrhack 2012/07/29 v3.11b KOMA-Script package (hacking other packages)
Package scrhack Info: hyperref hack deactivated because of
(scrhack) detection of hyperref version, that doesn't
(scrhack) need that hack, on input line 131.
)
No file Neues_Dokument1.aux.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 116.
LaTeX Font Info: Try loading font information for TS1+cmr on input line 116.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1cmr.fd"
File: ts1cmr.fd 1999/05/25 v2.5h Standard LaTeX font definitions
)
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 116.
LaTeX Font Info: ... okay on input line 116.
LaTeX Font Info: Try loading font information for T1+lmr on input line 116.
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\t1lmr.fd"
File: t1lmr.fd 2009/10/30 v1.6 Font defs for Latin Modern
)
LaTeX Info: Redefining \dots on input line 116.
LaTeX Info: Redefining \microtypecontext on input line 116.
Package microtype Info: Generating PDF output.
Package microtype Info: Character protrusion enabled (level 2).
Package microtype Info: Using default protrusion set `alltext'.
Package microtype Info: Automatic font expansion enabled (level 2),
(microtype) stretch: 20, shrink: 20, step: 1, non-selected.
Package microtype Info: Using default expansion set `basictext'.
Package microtype Info: No adjustment of tracking.
Package microtype Info: No adjustment of interword spacing.
Package microtype Info: No adjustment of character kerning.
("C:\Program Files\MiKTeX 2.9\tex\latex\microtype\mt-cmr.cfg"
File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman
(RS)
)
\AtBeginShipoutBox=\box33
Package hyperref Info: Link coloring ON on input line 116.
("C:\Program Files\MiKTeX 2.9\tex\latex\hyperref\nameref.sty"
Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\gettitlestring.sty"
Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO)
)
\c@section@level=\count116
)
LaTeX Info: Redefining \ref on input line 116.
LaTeX Info: Redefining \pageref on input line 116.
LaTeX Info: Redefining \nameref on input line 116.
(C:\Users\Marin\AppData\Local\Temp\lyx_tmpdir.p10112\lyx_tmpbuf4\Neues_Dokument
1.out)
(C:\Users\Marin\AppData\Local\Temp\lyx_tmpdir.p10112\lyx_tmpbuf4\Neues_Dokument
1.out)
\@outlinefile=\write3
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count117
\scratchdimen=\dimen142
\scratchbox=\box34
\nofMPsegments=\count118
\nofMParguments=\count119
\everyMPshowfont=\toks25
\MPscratchCnt=\count120
\MPscratchDim=\dimen143
\MPnumerator=\count121
\makeMPintoPDFobject=\count122
\everyMPtoPDFconversion=\toks26
)
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: wrapfig package is loaded.
Package caption Info: End \AtBeginDocument code.
("C:\Program Files\MiKTeX 2.9\tex\latex\lm\ot1lmr.fd") ("C:\Program Files\MiKTe
X 2.9\tex\latex\lm\omllmm.fd") ("C:\Program Files\MiKTeX 2.9\tex\latex\lm\omslm
sy.fd") ("C:\Program Files\MiKTeX 2.9\tex\latex\lm\omxlmex.fd")
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.161 \end{tabularx}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Underfull \vbox (badness 10000) detected at line 161
[]
[1
{C:/Users/Marin/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 163.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 163.
(C:\Users\Marin\AppData\Local\Temp\lyx_tmpdir.p10112\lyx_tmpbuf4\Neues_Dokument
1.aux
Package mparhack Warning: Marginpars may have changed.
(mparhack) Rerun to get them right.
)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 163.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 163.
Package rerunfilecheck Info: File `Neues_Dokument1.out' has not changed.
(rerunfilecheck) Checksum: D41D8CD98F00B204E9800998ECF8427E;0.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 163.
)
Here is how much of TeX's memory you used:
11186 strings out of 493921
176087 string characters out of 3147282
326371 words of memory out of 3000000
14277 multiletter control sequences out of 15000+200000
23043 words of font info for 44 fonts, out of 3000000 for 9000
841 hyphenation exceptions out of 8191
40i,12n,46p,526b,439s stack positions out of 5000i,500n,10000p,200000b,50000s
{C:/Program Files/MiKTeX 2.9/fonts/enc/dvips/lm/lm-mathsy.enc}{C:/Program Fil
es/MiKTeX 2.9/fonts/enc/dvips/lm/lm-ec.enc}<C:/Program Files/MiKTeX 2.9/fonts/t
ype1/public/lm/lmbx10.pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/public/lm/lm
r10.pfb><C:/Program Files/MiKTeX 2.9/fonts/type1/public/lm/lmsy10.pfb>
Output written on Neues_Dokument1.pdf (1 page, 64188 bytes).
PDF statistics:
27 PDF objects out of 1000 (max. 8388607)
4 named destinations out of 1000 (max. 500000)
5633 words of extra memory for PDF output out of 10000 (max. 10000000)
答案1
不幸的是,您没有提供一个最小的工作示例。
基于包的错误ltablex
。文档提供了以下提示:
添加的另一个功能是将 X 列视为“l”列(如果表格内容允许这样做且不超过表格的指定宽度)。
列类型l
列表环境是不允许的。所以你会得到一个错误。你可以用以下语句来抑制这个重新定义:\keepXColumns
。
所以我的mwe可以修改为:
\documentclass{scrartcl}
\usepackage{ltablex}
\usepackage{xcolor, colortbl}
\keepXColumns
\begin{document}
\makeatletter
\def\MPT{\@minipagetrue}
\makeatother
\begin{table}[!ht]
\caption{blabla}
\begin{tabularx}{\textwidth}{|>{\columncolor{gray}}lX|}
\hline % oberste Linie, vor erster Spalte
\rowcolor{gray}
\textbf{Blabla} & \textbf{} \\ \hline \hline
IST-Zustand
&
\MPT\begin{list}{$\bullet$}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}\setlength{\leftmargin}{4mm}\setlength{\topsep}{0mm}}
\item blaaa
\end{list}
\\ \hline
\end{tabularx}
\end{table}
\end{document}
原始答案
我截取了你的代码片段并提供了一个最小工作示例(MWE)修改如下:
- 我把
\caption
命令放在了 外面tabularx
。 - 我把所有东西都放在浮动物体中
table
- 我把命令放在
\MPT
“列表”前面 - 我删除了
\vspace
:
这里是例子
\documentclass{scrartcl}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\begin{document}
\makeatletter
\def\MPT{\@minipagetrue}
\makeatother
\begin{table}[!ht]
\caption{blabla}
\begin{tabularx}{\textwidth}{|>{\columncolor{gray}}lX|}
\hline % oberste Linie, vor erster Spalte
\rowcolor{gray}
\textbf{Blabla} & \textbf{} \\ \hline \hline
IST-Zustand
&
\MPT\begin{list}{$\bullet$}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}\setlength{\leftmargin}{4mm}\setlength{\topsep}{0mm}}
\item blaaa
\end{list}
\\ \hline
\end{tabularx}
\end{table}
\end{document}