[Tex/LaTex] Automatic table width doesn’t work anymore

ltablextablestabularx

I got an odd problem since yesterday.
I'm writing my thesis with Lyx. I'm using a template based on the KOMA-Script.

Well, yesterday I've deleted a number of tables from my document. After compiling again, I've received following error message:

LaTeX Error: Something's wrong--perhaps a missing \item.

The error occurs on a row of consecutive tables, which are positioned directly after the deleted tables. Before that, they worked without any problems. I'm using the tabularx package for the tables.

The tables are defined like the following code:

\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}

After a long time of trying I found out, that when I replace the columns which are defined with X, by a fix column width like p{...cm}, it suddenly works again.

Is this somehow explainable without any working example (I could hand one in later)?

Edit:

Here's the preambel of my document:

% 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:

Here's the log file:

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)

Best Answer

Unfortunately you aren't providing a minimal working example.

The error based on the package ltablex. The documentation provides the following hint:

Another feature that has been added is to treat the X columns like ‘l’ columns if the table contents would allow that to happen without exceeding the specified width of the table.

Inside the column type l list environments aren't allowed. So you get an error. You can suppress this redefinition by saying: \keepXColumns.

So my mwe can be modified as:

\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}

Original answer

I took your code snippet and provided a minimal working example (MWE) with the following modifications:

  • I placed the \caption command outside of tabularx.
  • I put everything in the floatings object table
  • I put the command \MPT in front of `list``
  • I removed \vspace:

Here the example

\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}