1

My document compiled normally, but it seems that there is an incompatibility between the packages etoc and pgfplots. The latex compiles, but not to recompile to get the references and the table of contents. I wrote this MWE. (the heatmap code is from Drawing heatmaps using TikZ)

\documentclass{report}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.10}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\usepackage{etoc}
\usepackage{appendix}

\pgfplotstableset{
    /color cells/min/.initial=0,
    /color cells/max/.initial=1000,
    /color cells/textcolor/.initial=,
    %
    % Usage: 'color cells={min=<value which is mapped to lowest color>, 
    %   max = <value which is mapped to largest>}
    color cells/.code={%
        \pgfqkeys{/color cells}{#1}%
        \pgfkeysalso{%
            postproc cell content/.code={%
                %
                \begingroup
                %
                % acquire the value before any number printer changed
                % it:
                \pgfkeysgetvalue{/pgfplots/table/@preprocessed cell content}\value
                \ifx\value\empty
                    \endgroup
                \else
                \pgfmathfloatparsenumber{\value}%
                \pgfmathfloattofixed{\pgfmathresult}%
                \let\value=\pgfmathresult
                %
                % map that value:
                \pgfplotscolormapaccess
                    [\pgfkeysvalueof{/color cells/min}:\pgfkeysvalueof{/color cells/max}]
                    {\value}
                    {\pgfkeysvalueof{/pgfplots/colormap name}}%
                % now, \pgfmathresult contains {<R>,<G>,<B>}
                % 
                % acquire the value AFTER any preprocessor or
                % typesetter (like number printer) worked on it:
                \pgfkeysgetvalue{/pgfplots/table/@cell content}\typesetvalue
                \pgfkeysgetvalue{/color cells/textcolor}\textcolorvalue
                %
                % tex-expansion control
                % see https://tex.stackexchange.com/questions/12668/where-do-i-start-latex-programming/27589#27589
                \toks0=\expandafter{\typesetvalue}%
                \xdef\temp{%
                    \noexpand\pgfkeysalso{%
                        @cell content={%
                            \noexpand\cellcolor[rgb]{\pgfmathresult}%
                            \noexpand\definecolor{mapped color}{rgb}{\pgfmathresult}%
                            \ifx\textcolorvalue\empty
                            \else
                                \noexpand\color{\textcolorvalue}%
                            \fi
                            \the\toks0 %
                        }%
                    }%
                }%
                \endgroup
                \temp
                \fi
            }%
        }%
    }
}

\begin{document}

\etoctableofcontents

\part{SOCIOECONOMIC}
\localtableofcontents
\chapter{EDUCATION}

Look the Table \ref{tab:mediatur}.

\begin{table}
\centering
\caption{Average class size - students per class}
\label{tab:mediatur}
\pgfplotstabletypeset[%
    color cells={min=28,max=35, textcolor= - mapped color!100! black},
    /pgfplots/colormap={whiteblue}{rgb255(0cm)=(255,255,255); rgb255(1cm)=(255,50,0)},
%
    col sep=&,
    row sep=\\,
% fix number format
    /pgf/number format/precision=1,
    /pgf/number format/fixed,
    /pgf/number format/fixed zerofill,
    /pgf/number format/set decimal separator = {,},
    columns/EMPTY/.style={
        column name={},
        assign cell content/.code={
            \ifnum\pgfplotstablerow=0
                \pgfkeyssetvalue{/pgfplots/table/@cell content}{\multirow{2}{*}{##1}}%
            \else
                \pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
            \fi},reset styles, string type},
% row formatting
    every row no  0/.style = {before row = \bfseries Kindergarten\\\cmidrule{1-1}},
    every row no  2/.style = {before row = \bfseries Primary Education\\\cmidrule{1-1}},
    every row no 11/.style = {before row = \bfseries High School\\\cmidrule{1-1}},
%
    every head row/.style={before row=\toprule
\multirow{2}{*}{\bfseries Series} & \multicolumn{7}{c}{\bfseries Period}\\\cmidrule{2-8} ,after row=\midrule},
    every last row/.style={after row=\bottomrule},
% columns formatting
    display columns/1/.style={column type = r},%
    display columns/2/.style={column type = r},%
    display columns/3/.style={column type = r},%
    display columns/4/.style={column type = r},%
    display columns/5/.style={column type = r},%
    display columns/6/.style={column type = r},%
    display columns/7/.style={column type = r},%
    display columns/8/.style={column type = r},%
]{
   EMPTY & 2007 & 2008 & 2009 & 2010 & 2011 & 2012 & 2013\\
%Kindergarten &  &  &  &  &  &  &  &  & 
Nursery     & 15.7 & 17.5 & 15.8 & 17.7 & 18.7 & 17.4 & 17.1\\
Pre School & 20.0 & 20.0 & 20.1 & 20.9 & 19.5 & 20.2 & 19.9\\
%Primary Education 8 and 9 years  &  &  &  &  &  &  &  &  & 
 1st year    & 23.6 & 21.9 & 24.4 & 22.1 & 20.7 & 23.5 & 20.4\\
 2nd year    & 21.7 & 23.3 & 26.7 & 23.0 & 22.3 & 24.0 & 22.7\\
 3rd year    & 27.2 & 25.7 & 20.6 & 24.4 & 23.9 & 24.4 & 23.2\\
 4th year    & 24.8 & 24.6 & 24.7 & 24.2 & 24.4 & 23.9 & 24.4\\
 5th year    & 25.4 & 29.0 & 27.7 & 27.1 & 22.3 & 24.1 & 24.1\\
 6th year    & 31.7 & 33.5 & 29.7 & 29.8 & 31.4 & 26.5 & 26.3\\
 7th year    & 32.2 & 32.8 & 33.3 & 30.1 & 29.1 & 29.3 & 25.8\\
 8th year    & 31.3 & 34.2 & 33.1 & 30.8 & 28.9 & 29.6 & 30.3\\
 9th year    & 33.7 & 36.6 & 33.2 & 32.1 & 32.4 & 29.6 & 29.5\\
%High School  &  &  &  &  &  &  &  &  & 
 1st grade  & 39.1 & 38.9 & 36.3 & 34.2 & 32.4 & 35.1 & 31.2\\
 2nd grade  & 33.2 & 34.8 & 28.7 & 32.0 & 30.3 & 25.6 & 26.9\\
 3rd grade  & 29.6 & 30.4 & 29.5 & 28.2 & 29.5 & 28.7 & 27.6\\
 4th grade  &   0  & 28.0 & 23.7 & 18.7 & 20.7 & 24.3 & 17.8\\
}
\end{table}


\appendix

\part*{APPENDICES}

\etoctoccontentsline*{appendixplaceholder}{APPENDIX}{-1}
\etocsettocdepth{chapter}
\renewcommand{\thechapter}{\Alph{chapter}}
\setcounter{chapter}{0} 

\localtableofcontents

\chapter{Document One}
Test 1.

\chapter{Document Two}
Test 2.

\end{document}

How can I solve it?

  • This is not an MWE. If you suspect the incompatibility of two packages, then you are loading 5 packages too much in order to show that error. You are tagging pgfplotstable so everything around the table should not be needed. And the error will appear for one table line as well... (just giving some tips in order to reduce the code and to get an answer more quickly). – LaRiFaRi Aug 15 '14 at 6:13
  • It is not about pgfplotstable package. etoc has problems in the appendix. Remove the appendices and delete the .aux file and it compiles. – percusse Aug 15 '14 at 8:35
  • @percusse That sounds much like an answer... – Christian Feuersänger Aug 16 '14 at 21:09
  • @percusse see my answer, the problem originated in a user \etoctoccontentsline* command with a dummy sectioning unit name appendixplaceholder which had not been declared to etoc. – user4686 Dec 20 '14 at 14:20
3

The problem was with your

\etoctoccontentsline*{appendixplaceholder}{APPENDIX}{-1}

near the end of the document. The problem is simply that appendixplaceholder stands for some dummy sectioning unit but has not been declared to etoc. To fix this you could add:

\etocsetlevel{appendixplaceholder}{6} % 6 = invisible

in the preamble, and then before the \localtableofcontents in the Appendix part, or rather right after the main TOC, you would insert \etocsetlevel{appendixplaceholder}{-1}. (my hesitation is because I am not sure what you were trying to achieve; avoid Appendix heading to appear in the main TOC but gets the two appendices nevertheless listed?)

This being said a leaner solution is to forget entirely about this appendixplaceholder and \etoctoccontentsline* business and do simply this:

\appendix

\part*{APPENDICES}

\addcontentsline{toc}{part}{APPENDIX}% add unnumbered part to TOC

\etocsettocdepth{chapter}
\renewcommand{\thechapter}{\Alph{chapter}}
\setcounter{chapter}{0} 

\localtableofcontents % works because there is the APPENDIX as part in TOC

This produces this global TOC:

global TOC with Appendices

and the local one in the Appendix part too. Works with hyperref loaded too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.