如何在文档结尾重复出现一次LoT与LoF的内容

发布于 2023-06-30 16:38:08

目前.tex文档里\include.cls文件,.cls文件里对图表格式进行了定义,要求只在文末列表汇总显示。

求教需求:修改.cls相关代码,实现图表既在正文提及处显示又在文末列表汇总显示

.cls当前相关代码如下:

\newboolean{BackFigs}
\newboolean{InsideFigs}
\DeclareOption{BackFigs}%
    {\setboolean{BackFigs}{true}\setboolean{InsideFigs}{false}}
\DeclareOption{InsideFigs}%
    {\setboolean{InsideFigs}{true}\setboolean{BackFigs}{false}}
    
\ifthenelse{\boolean{Journal}}
  {\ifthenelse{\boolean{InsideFigs}}{true}{\setboolean{BackFigs}{true}}}
  {\ifthenelse{\boolean{BackFigs}}{true}{\setboolean{InsideFigs}{true}}}

\ifthenelse{\boolean{BackFigs}}
{\typeout{%
  (2) Figures and Tables will be placed together at the end of the manuscript
  (change with the 'InsideFigs' option)}}
{\typeout{%
  (2) Figures and Tables will be placed within the text of the manuscript
  (change with the 'BackFigs' option)}}
  
\ifthenelse{\boolean{BackFigs}}
  {\ifthenelse{\boolean{NoLists}}%                                     11-21-02
    {\RequirePackage[nolists,noheads,nomarkers,tablesfirst]{endfloat}}%11-21-02
    {\RequirePackage[lists,noheads,nomarkers,tablesfirst]{endfloat}}
  }
  
\ifthenelse{\boolean{Journal}\and\boolean{BackFigs}}%
  {\setlength{\Abovecaptionrule}{0.75in}}
  {\setlength{\Abovecaptionrule}{0.05in}}
  
 \ifthenelse{\boolean{BackFigs}}
{\renewcommand\listoftables{%
    \section*{\listtablename
      \@mkboth{%
          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}%
      \ifthenelse{\boolean{DoubleSpace}}%                           02-14-13
        {\doublespacing\@starttoc{lot}\singlespacing}%              02-14-13
        {\@starttoc{lot}}}
 \renewcommand\listoffigures{%
    \section*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}}%
      \ifthenelse{\boolean{DoubleSpace}}%                           02-14-13
        {\doublespacing\@starttoc{lof}\singlespacing}%              02-14-13
        {\@starttoc{lof}}}
    }{}

查看更多

关注者
0
被浏览
2.2k
1 个回答
Sagittarius Rover
Sagittarius Rover 2025-04-14
我要成为Typst糕手/(ㄒoㄒ)/~~

提问请给完整代码....

只给一个切片如何让人知道你所面临问题的全貌....

问题回顾

考古... 你提及:

实现图表既在正文提及处显示,又在文末列表汇总显示

egreg在此处使用寄存器保存figure中的信息,并在文末重新输出:

下面是一个例子:

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{environ}

\makeatletter

\let\@@figure\figure
\let\@@endfigure\endfigure
\let\figure\@undefined
\let\endfigure\@undefined

\let\@@table\table
\let\@@endtable\endtable
\let\table\@undefined
\let\endtable\@undefined

\newtoks\end@figuretoks
\newtoks\end@tabletoks

\NewEnviron{figure}[1][htp]{%
  \@@figure[#1]\BODY\@@endfigure
  \global\end@figuretoks=\expandafter{\the\end@figuretoks\@@figure[p]}%
  \global\end@figuretoks=\expandafter{\the\expandafter\end@figuretoks\BODY\@@endfigure}%
  }
\NewEnviron{table}[1][htp]{%
  \@@table[#1]\BODY\@@endtable
  \global\end@tabletoks=\expandafter{\the\end@tabletoks\@@table[p]}%
  \global\end@tabletoks=\expandafter{\the\expandafter\end@tabletoks\BODY\@@endtable}%
  }

\newcounter{Endfigure}
\AtEndDocument{\clearpage\let\c@figure\c@Endfigure\the\end@figuretoks}
\newcounter{Endtable}
\AtEndDocument{\clearpage\let\c@table\c@Endtable\the\end@tabletoks}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum

\begin{figure}
\centering
\includegraphics{example-image-a}
\caption{def}
\end{figure}

\lipsum

\begin{figure}
\centering
\includegraphics{example-image-b}
\caption{def}
\end{figure}

\lipsum

\begin{figure}
\centering
\includegraphics{example-image-c}
\caption{def}
\end{figure}

\lipsum

\begin{table}
    \centering
    \begin{tabular}
        { | c | c | c | }
        \hline
        Column 1 & Column 2 & Column 3 \\
        \hline
        Row 1 & Row 1 & Row 1 \\
        Row 2 & Row 2 & Row 2 \\
        Row 3 & Row 3 & Row 3 \\
        \hline
    \end{tabular}
    \caption{table1}
\end{table}

\lipsum

 \begin{table}
        \centering
        \begin{tabular}
            { | c | c | c | }
            \hline
            Column 1 & Column 2 & Column 3 \\
            \hline
            Row 1 & Row 1 & Row 1 \\
            Row 2 & Row 2 & Row 2 \\
            Row 3 & Row 3 & Row 3 \\
            \hline
        \end{tabular}
        \caption{table2}
\end{table}

\end{document}

文档前四面:

image.png

文档中间四面:

image.png

文档末三面:

image.png

BTW...如非必要,不要修改模板。除非你是模板作者...那也不应该问出这样子的问题,应该自行提取MWE再提问...

撰写答案

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

发布
问题

分享
好友

手机
浏览

扫码手机浏览