我正在尝试设置 memoir\legend
命令以使用冒号:
作为标题分隔标签,同时对所有其他标题使用破折号。当我在环境中使用自定义 memoir 命令--
时,就会出现问题。\legend
\multicolumn
! Misplaced \noalign.
\captionsetup ->\noalign
\bgroup \@ifstar \@captionsetup \@captionsetup
l.36 \end{tabularx}
在下图中,您可以看到红色的错误。这是使用引发错误的命令\legend
生成的部分 PDF 。在另外两个绿色文本中,标题和图例的标签已正确分配:\legend
\noalign. \captionsetup ->\noalign
如果删除该行\captionsetup{labelsep=colon}
,则所有内容都可以正常编译,只是所有内容\legends
都将使用默认的破折号--
而不是冒号:
我怎样才能使里面的第一个\legend
标题\multicolumn
使用冒号:
而不是破折号--
?
\documentclass[12pt,a4paper,twoside]{memoir}
\usepackage{caption}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{ragged2e}
\RequirePackage{ltablex}\keepXColumns
\makeatletter
\renewcommand{\legend}[2][var]{%
\M@gettitle{#2}%
\memlegendinfo{#2}%
\par
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\setlength{\belowcaptionskip}{4pt}
\captiondelim{:}
\captionsetup{labelsep=colon}
\@makecaption{ #1}{\ignorespaces #2}\par
\endgroup}
\makeatother
\DeclareCaptionLabelSeparator{barr}{~\textendash~}
\captionsetup{format=hang,labelseparator=barr,}
\begin{document}
\begin{tabularx}{\linewidth}{>{\RaggedRight}p{3cm}|>{\arraybackslash}X}
\hline
\multicolumn{2}{p{\dimexpr\textwidth-2\tabcolsep\relax}}{\legend{O autor}}
\endlastfoot
Cor & Branco \\ \hline
\end{tabularx}
\begin{table}[htb]
\caption{Something}
\begin{tabular}{p{2.6cm}p{6.0cm}}
Meta & Paradigma \\
\end{tabular}
\legend{Something}
\end{table}
\end{document}
答案1
多列不喜欢 \captionsetup 命令,但你可以直接设置分隔符:
\documentclass[12pt,a4paper,twoside]{memoir}
\usepackage{caption}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{ragged2e}
\RequirePackage{ltablex}\keepXColumns
\makeatletter
\renewcommand{\legend}[2][var]{%
\M@gettitle{#2}%
\memlegendinfo{#2}%
\par
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\setlength{\belowcaptionskip}{4pt}%
\caption@setlabelseparator{colon}%
\@makecaption{#1}{\ignorespaces #2}\par
\endgroup}
\makeatother
\DeclareCaptionLabelSeparator{barr}{~\textendash~}
\captionsetup{format=hang,labelseparator=barr,}
\begin{document}
\begin{tabularx}{\linewidth}{>{\RaggedRight}p{3cm}|>{\arraybackslash}X}
\hline
\multicolumn{2}{p{\dimexpr\textwidth-2\tabcolsep\relax}}{\legend{O autor}}
\endlastfoot
Cor & Branco \\ \hline
\end{tabularx}
\begin{table}[htb]
\caption{Something}
\begin{tabular}{p{2.6cm}p{6.0cm}}
Meta & Paradigma \\
\end{tabular}
\legend{Something}
\end{table}
\end{document}