使用回忆录在侧边栏添加项目列表时出错

使用回忆录在侧边栏添加项目列表时出错

我尝试使用 tikz 添加项目图例拔出的子弹在 sidecaption 中使用回忆录,使用 Texlive 2013 更新,以及 xelatex,到这个工作的 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}

当我尝试将商品代码移到侧标题中时,就像这样

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

我有这个错误

ABD:EveryShipout 初始化宏 ABD:EverySelectfont 初始化宏(/usr/local/texlive/2013/texmf-dist/tex/latex/amsfonts/umsa.fd)(/usr/local/texlive/2013/texmf-dist/tex/latex/amsfonts/umsb.fd)

!LaTeX 错误:出现错误 — — 可能缺少 \item。

请参阅 LaTeX 手册或 LaTeX Companion 了解解释。输入 H 可立即获得帮助。...

                                               l.112 ^^I\end{sidecaption}

答案1

我怀疑试图在(用技术术语来说)sidecaption中排版文本是非法的。将其包装在:\mbox\hboxitemize\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}

在此处输入图片描述

相关内容