内容目录和表格目录分栏

发布于 2023-01-19 13:11:01

在一开始使用 multitoc,让目录分栏,但是 multitoc 抑制了 listoftables 的 generate ,有什么好的方法,让 multitoc 和 listoftables 同时起作用?

\documentclass{ctexbook}
\usepackage{tabularray}
\usepackage[toc]{multitoc}
\begin{document}
    \listoftables\let\cleardoublepage\clearpage

\NewTblrTheme{fancy}{
    \SetTblrStyle{firsthead}{font=\bfseries}
    \SetTblrStyle{firstfoot}{fg=blue2}
    \SetTblrStyle{middlefoot}{\itshape}
    \SetTblrStyle{caption-tag}{red2}
}
\begin{longtblr}[
    theme = fancy,
    caption = {A Table},
    entry = {Caption},
    ]{
        colspec = {XXX}
    }
    Head & Head & Head \\
\end{longtblr}
\end{document}

得到如下效果:
image.png

\documentclass{ctexbook}
\usepackage{tabularray}
%\usepackage[toc]{multitoc}
\begin{document}
    \listoftables\let\cleardoublepage\clearpage

\NewTblrTheme{fancy}{
    \SetTblrStyle{firsthead}{font=\bfseries}
    \SetTblrStyle{firstfoot}{fg=blue2}
    \SetTblrStyle{middlefoot}{\itshape}
    \SetTblrStyle{caption-tag}{red2}
}
\begin{longtblr}[
    theme = fancy,
    caption = {A Table},
    entry = {Caption},
    ]{
        colspec = {XXX}
    }
    Head & Head & Head \\
\end{longtblr}
\end{document}

得到如下效果:
image.png
很显然第二幅图才是想要的结果,但是却不得不注释掉 multitoc。

查看更多

关注者
0
被浏览
286
2 个回答
雾月
雾月 2023-01-19
This guy hasn't written anything yet

multitoc 宏包的问题,没有处理 false 分支的情况。
在它后面加上:

\makeatletter
\renewcommand*{\@starttoc}[1]{%
   \ifthenelse{\boolean{@multitoc@toc}\and\equal{#1}{toc}}{%
      \begin{multicols}{\multicolumntoc}%
         \@multitoc@starttoc{#1}%
      \end{multicols}%
      }{%
   \ifthenelse{\boolean{@multitoc@lot}\and\equal{#1}{lot}}{%
      \begin{multicols}{\multicolumnlot}%
         \@multitoc@starttoc{#1}%
      \end{multicols}%
      }{%
   \ifthenelse{\boolean{@multitoc@lof}\and\equal{#1}{lof}}{%
      \begin{multicols}{\multicolumnlof}%
         \@multitoc@starttoc{#1}%
      \end{multicols}%
      }{\@multitoc@starttoc{#1}}%
   }}}
\makeatother
LaTeXStudio
LaTeXStudio 2023-01-19
This guy hasn't written anything yet

我测试的代码正常,看看 multitoc 的说明:

\documentclass{ctexbook}
\usepackage{tabularray}
\usepackage[lot]{multitoc}
\begin{document}
    \listoftables\let\cleardoublepage\clearpage

\NewTblrTheme{fancy}{
    \SetTblrStyle{firsthead}{font=\bfseries}
    \SetTblrStyle{firstfoot}{fg=blue2}
    \SetTblrStyle{middlefoot}{\itshape}
    \SetTblrStyle{caption-tag}{red2}
}
\begin{longtblr}[
    theme = fancy,
    caption = {A Table},
    entry = {Caption},
    ]{
        colspec = {XXX}
    }
    Head & Head & Head \\
\end{longtblr}
\end{document}

image.png

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览