2

I try to add an item legend using tikz drawed bullet in sidecaption with memoir, using Texlive 2013 updated, and xelatex, to this working MWE

\documentclass[a4paper, 11pt,twoside, openright]{memoir}
\usepackage{mwe} % just for dummy images
\usepackage{amssymb}
\usepackage{amsmath,mathtools}
\usepackage{amstext}    % defines the \text command, needed here
\usepackage{array}
\usepackage{showframe}
\usepackage{tikz}

\usepackage{graphicx}

\sidecapmargin{outer}
\setsidecappos{t}

\newsubfloat{figure}{}
\newsubfloat{table}{}

\captiontitlefont{\normalfont}% title font
\precaption{\raggedright}% for Caption N
\captiondelim{\newline}% newline*
\captionstyle{\raggedright}% for title
\setlength{\belowcaptionskip}{\onelineskip}

\usepackage{ragged2e}

\renewcommand*{\sidecapstyle}{%
 \ifscapmargleft
    \captionstyle{\justifying\scriptsize}%
  \else
    \captionstyle{\justifying\scriptsize}%
  \fi}

% BOX LEGEND 
% some color definitions
\definecolor{tangoBlue1}{RGB}{114,159,207}
\definecolor{tangoOrange1}{RGB}{245,121,0}
\definecolor{tangoRed1}{RGB}{239,41,41}

% normal box
\newcommand{\sqbox}[1]{%
  \begin{tikzpicture}%[baseline={(a.base)}]
     \fill[#1] (0,0) rectangle (1.2ex,1.2ex);
  \end{tikzpicture}%
  }

\begin{document}
\begin{itemize}
        \item \sqbox{tangoBlue1} indique une valeur $v$ minimale, 
        \item \sqbox{tangoRed1} une valeur $v$ maximale, et 
        \item \sqbox{tangoOrange1} les autres valeurs $v$ intermédiaires 
\end{itemize}

\begin{figure}[h]
    \begin{sidecaption}[fortoc]{}[fig:xyspacePspaceOmultimodal]
     \centering
      \subbottom[]{
        \includegraphics[width=0.4\linewidth]{example-image}
        \label{subfig_xyespaceSolutionCandidate:a}}
     \subbottom[bla]{
        \includegraphics[width=.4\linewidth]{example-image}
        \label{subfig_xyespaceSolutionCandidate:b}}\hspace{1em}
     \subbottom[bla]{
        \includegraphics[width=.4\linewidth]{example-image}
        \label{subfig_sxyespaceSolutionCandidate:c}}
    \end{sidecaption}
\end{figure}

\end{document}

When i try to move the item code into sidecaption, like this

\begin{figure}[h]
    \begin{sidecaption}[fortoc]{\begin{itemize}
        \item \sqbox{tangoBlue1} indique une valeur $v$ minimale, 
        \item \sqbox{tangoRed1} une valeur $v$ maximale, et 
        \item \sqbox{tangoOrange1} les autres valeurs $v$ intermédiaires 
\end{itemize}}[fig:xyspacePspaceOmultimodal]
     \centering
      \subbottom[]{
        \includegraphics[width=0.4\linewidth]{example-image}
        \label{subfig_xyespaceSolutionCandidate:a}}
     \subbottom[bla]{
        \includegraphics[width=.4\linewidth]{example-image}
        \label{subfig_xyespaceSolutionCandidate:b}}\hspace{1em}
     \subbottom[bla]{
        \includegraphics[width=.4\linewidth]{example-image}
        \label{subfig_sxyespaceSolutionCandidate:c}}
    \end{sidecaption}
\end{figure}

I have this error

ABD: EveryShipout initializing macros ABD: EverySelectfont initializing macros (/usr/local/texlive/2013/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/local/texlive/2013/texmf-dist/tex/latex/amsfonts/umsb.fd)

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

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

                                               l.112 ^^I\end{sidecaption}
10
  • I get no errors or warnings using TeX Live 2014.
    – daleif
    Feb 5, 2015 at 11:52
  • Hum, so my problem is with xelatex and texlive 2013 recently updated. I try to download the 2014 version. Thanks for information.
    – reyman64
    Feb 5, 2015 at 12:37
  • BTW: often the fact that you are using xelatex would be worth a mention. Just tested, and luckily it does not make a difference in this case.
    – daleif
    Feb 5, 2015 at 12:49
  • Don't understand, my texlive is updated to 2014, error persist, i update my message with my code modified which produce error :( My xelatex version is XeTeX 3.14159265-2.6-0.99991 (TeX Live 2014)
    – reyman64
    Feb 5, 2015 at 12:57
  • Wait a minute, I only tested the first item, not the extra stuff to be added (that is why you are always asked to post full minimal examples not sniplets. Will test the extra data
    – daleif
    Feb 5, 2015 at 13:44

1 Answer 1

2

I suspect that sidecaption tries to typeset the text inside an \mbox (\hbox in TeXnical terms), where itemize is illegal. Wrap it in a \parbox:

\documentclass[a4paper, 11pt,twoside, openright]{memoir}
\usepackage{mwe} % just for dummy images
\usepackage{amssymb}
\usepackage{amsmath,mathtools}
\usepackage{amstext}    % defines the \text command, needed here
\usepackage{array}
\usepackage{showframe}
\usepackage{tikz}

\usepackage{graphicx}

\sidecapmargin{outer}
\setsidecappos{t}

\newsubfloat{figure}{}
\newsubfloat{table}{}

\captiontitlefont{\normalfont}% title font
\precaption{\raggedright}% for Caption N
\captiondelim{\newline}% newline*
\captionstyle{\raggedright}% for title
\setlength{\belowcaptionskip}{\onelineskip}

\usepackage{ragged2e}

\renewcommand*{\sidecapstyle}{%
 \ifscapmargleft
    \captionstyle{\justifying\scriptsize}%
  \else
    \captionstyle{\justifying\scriptsize}%
  \fi}

% BOX LEGEND 
% some color definitions
\definecolor{tangoBlue1}{RGB}{114,159,207}
\definecolor{tangoOrange1}{RGB}{245,121,0}
\definecolor{tangoRed1}{RGB}{239,41,41}

% normal box
\newcommand{\sqbox}[1]{%
  \begin{tikzpicture}%[baseline={(a.base)}]
     \fill[#1] (0,0) rectangle (1.2ex,1.2ex);
  \end{tikzpicture}%
  }

\begin{document}

\begin{figure}[h]
    \begin{sidecaption}[fortoc]{%
\parbox{\marginparwidth}{
\begin{itemize}
        \item \sqbox{tangoBlue1} indique une valeur $v$ minimale, 
        \item \sqbox{tangoRed1} une valeur $v$ maximale, et 
        \item \sqbox{tangoOrange1} les autres valeurs $v$ intermédiaires 
\end{itemize}}}[fig:xyspacePspaceOmultimodal]
     \centering
      \subbottom[]{
        \includegraphics[width=0.4\linewidth]{example-image}
        \label{subfig_xyespaceSolutionCandidate:a}}
     \subbottom[bla]{
        \includegraphics[width=.4\linewidth]{example-image}
        \label{subfig_xyespaceSolutionCandidate:b}}\hspace{1em}
     \subbottom[bla]{
        \includegraphics[width=.4\linewidth]{example-image}
        \label{subfig_sxyespaceSolutionCandidate:c}}
    \end{sidecaption}
\end{figure}

\end{document}

enter image description here

9
  • That's odd, I did test minipage and it failed. Now I tested again and it works....
    – daleif
    Feb 5, 2015 at 13:58
  • @daleif With minipage the spacing is wrong.
    – egreg
    Feb 5, 2015 at 14:00
  • @egreg, why? I thought minipage and \parbox was more or less interchangeable.
    – daleif
    Feb 5, 2015 at 14:08
  • 1
    @daleif In minipage LaTeX sets \@minipagetrue which has some consequences on lists.
    – egreg
    Feb 5, 2015 at 14:15
  • @egreg, does that mean that in general the memoir code ought to be using \parbox internally instead of minipage to encapsulate the sidecaption?
    – daleif
    Feb 16, 2015 at 11:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .