별도의 부록 표 - 새 목록에 캡션이 표시되지 않음

별도의 부록 표 - 새 목록에 캡션이 표시되지 않음

나는 이전 접근 방식을 사용하여 TOC에도 표시되는 별도의 부록 목록을 만들었습니다. 여기에 설명되어 있습니다:scrreprt의 부록 - 별도의 부록 표이지만 원래 TOC에는 언급되어 있습니다.

그러나 장이나 절 명령 대신 표/그림 명령을 사용할 때 부록 목록에 새 항목이 생성되도록 몇 가지 수정 작업을 수행했습니다. 이것은 잘 작동하지만 새 부록 목록에 표나 그림 캡션을 포함할 수 없습니다. 지금까지는 "Table S1"만 표시되었습니다.

여기에 이미지 설명을 입력하세요

문제는 다음 줄에서 캡션을 호출하는 명령이 누락되었다는 것입니다.

\newcommand*{\thackedtableaddcontentsline}[3]{\oldaddcontentsline{loa}{#2}{\tableformat~~}}

이 문제를 처리하는 방법을 아는 사람이 있나요? 도움이나 제안을 보내주셔서 감사합니다. 문안 인사

전체 코드는 다음과 같습니다.

\documentclass[listof=totoc, bibliography=totoc,chapterprefix=true,appendixprefix=false]{scrreprt}

\usepackage[english]{babel}
\usepackage[T1]{fontenc}          
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{etoolbox}

% Basic changes to directories
% Continuous numbering 
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}

% "Table/Figure..."
\KOMAoption{listof}{entryprefix}
\newcaptionname{english}{\listoflotentryname}{Table}
\newcaptionname{english}{\listoflofentryname}{Figure}

%% --- List of Appendices ---

% Set the name for the list of appendices (LoA) that can be recalled through the command \listofappendices
\newcommand\appendicesname{Appendices}
\newcommand\listofloaname{List of \appendicesname}
\newcommand*{\listofappendices}{\listoftoc{loa}}

% Redefine LOA 
\preto\listofappendices{%
  \cleardoublepage
  \addtocontents{loa}{~\hfill\textbf{Page}\vspace{2ex}\par}%
}

% Add LoA to ToC
\setuptoc{loa}{totoc}   

%% Redefine all Table or Figure commands so to be added to the LoA instead of to the LOT or LOF, when issuing the \appendix command
\makeatletter
\g@addto@macro\appendix{%
\renewcommand*{\tableformat}{\tablename~S\arabic{table}} 
\renewcommand*{\figureformat}{\figurename~S\arabic{figure}}

\let\oldaddcontentsline\addcontentsline
\newcommand*{\thackedaddcontentsline}[3]{\oldaddcontentsline{loa}{#2}{#3}}
\newcommand*{\thackedtableaddcontentsline}[3]{\oldaddcontentsline{loa}{#2}{\tableformat~~}}

\let\oldaddcontentsline\addcontentsline
\newcommand*{\fhackedaddcontentsline}[3]{\oldaddcontentsline{loa}{#2}{#3}}
\newcommand*{\fhackedtableaddcontentsline}[3]{\oldaddcontentsline{loa}{#2}{\figureformat~~}}

% Redefine Lable for Tables
\let\oldtable\table
\renewcommand*\table{%
\let\addcontentsline\thackedtableaddcontentsline%
\oldtable%
}
\let\oldendtable\endtable
\renewcommand*\endtable{%
\oldendtable%
\let\addcontentsline\oldaddcontentsline%
}
% redefine Lable for Figures
\let\oldfigure\figure
\renewcommand*\figure{%
\let\addcontentsline\fhackedtableaddcontentsline%
\oldfigure%
}
\let\oldendfigure\endfigure
\renewcommand*\endfigure{%
\oldendfigure%
\let\addcontentsline\oldaddcontentsline%
}

}
\makeatother 

% - main document
\begin{document}
\tableofcontents
\listoftables
\listoffigures
\listofappendices
\cleardoublepage

\chapter{Introduction}
\section{Section title}

\begin{table}[!hbt]
\caption[Short caption for LOT]{Long caption in the main text} 
\vspace{1ex}\centering\begin{tabular}{|l|l|}
\hline
Formen & Städte\\
\hline
\hline
Quadrat &  Bunkenstedt \\
\hline
Dreieck &  Laggenbeck\\
\hline
Kreis &  Peine\\
\hline
Raute & Wakaluba \\
\hline
\end{tabular}
\label{table1}
\vspace{2ex}\end{table}

\chapter{Results}
\section{Section title}

\newpage
\begin{figure}[h]
 \centering
 \noindent\includegraphics[width=3cm]{example-image} 
 \caption{Example figure}
 \label{figure1}
\end{figure} 

%% - Appendix 
\cleardoublepage
\appendix

%Reset Figure/Table numbering
\counterwithin{figure}{section}
\counterwithin{table}{section}

\addchap{Appendix}  
\refstepcounter{chapter}
\section*{Supplemental Tables}

\begin{table}[!hbt]
\caption[Caption of Supplemental Table not pictured in LOA]{Long caption in the main text} 
\vspace{1ex}\centering\begin{tabular}{|l|l|}
\hline
Formen & Städte\\
\hline
\hline
Quadrat &  Bunkenstedt \\
\hline
Dreieck &  Laggenbeck\\
\hline
Kreis &  Peine\\
\hline
Raute & Wakaluba \\
\hline
\end{tabular}
\label{Appendix1}
\vspace{2ex}\end{table}

\newpage
\section*{Supplemental Figures}

\begin{figure}[h]
 \centering
 \noindent\includegraphics[width=3cm]{example-image} 
 \caption[Caption of Supplemental Figure not pictured in LOA]{Long caption in the main text}
 \label{Appendix2}
\end{figure}

\end{document}

답변1

당신이 무엇을 하고 싶은지 제가 이해하고 있는지 잘 모르겠습니다. 그러나 scrwfileKOMA-Script 번들의 일부인 패키지를 사용하는 제안은 다음과 같습니다 .

\documentclass[listof=totoc, bibliography=totoc,chapterprefix=true,appendixprefix=false,
  listof=entryprefix,
  english
]{scrreprt}

\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}

% caption names
\newcaptionname{english}{\listoflotaentryname}{\listoflotentryname}
\newcaptionname{english}{\listoflofaentryname}{\listoflofentryname}
\newcaptionname{english}{\appendicesname}{Appendices}
\newcaptionname{english}{\appendixtablename}{Supplemental Tables}
\newcaptionname{english}{\appendixfigurename}{Supplemental Figures}

\usepackage{scrwfile}
\TOCclone[\protect\appendixtablename]{lot}{lota}
\removefromtoclist[TOCclone]{lota}
\addtotoclist[float]{lota}
\setuptoc{lota}{leveldown}
\unsettoc{lota}{totoc}
\addtocontents{lota}{\protect\value{tocdepth}=0}

\TOCclone[\protect\appendixfigurename]{lof}{lofa}
\removefromtoclist[TOCclone]{lofa}
\addtotoclist[float]{lofa}
\setuptoc{lofa}{leveldown}
\unsettoc{lofa}{totoc}
\addtocontents{lofa}{\protect\value{tocdepth}=0}

\usepackage{xpatch}
\xapptocmd{\appendix}{%
  \addchap{\appendicesname}
  \setcounter{figure}{0}
  \setcounter{table}{0}
  \pretocmd\thetable{S}{}{}
  \pretocmd\thefigure{S}{}{}
  \addtocontents{lot}{\protect\value{tocdepth}=0}% note that this is cloned in lota
  \addtocontents{lof}{\protect\value{tocdepth}=0}% note that this is cloned in lofa
  \addtocontents{lota}{\protect\value{tocdepth}=1}%
  \addtocontents{lofa}{\protect\value{tocdepth}=1}%
}{}{}

\usepackage{blindtext}% dummy text
\begin{document}
\tableofcontents
\listoftables
\listoffigures
\addchap{List of \appendicesname}
\listoflota
\listoflofa

\chapter{Introduction}
\section{Section title}
\begin{table}[ht]
  \centering\rule{5cm}{1cm}
  \caption[Short caption for LOT]{Long caption in the main text} 
\end{table}
\Blindtext

\chapter{Results}
\section{Section title}
\begin{figure}[ht]
  \centering\rule{5cm}{1cm}
  \caption{Example figure}
\end{figure} 
\Blindtext
\begin{figure}[ht]
  \centering\rule{5cm}{1cm}
  \caption{Example figure}
\end{figure}
\begin{table}[ht]
  \centering\rule{5cm}{1cm}
  \caption[Short caption for LOT]{Long caption in the main text} 
\end{table}

%% - Appendix 
\appendix
\addsec*{\appendixtablename}
\begin{table}[!hbt]
  \centering\rule{5cm}{1cm}
  \caption[Caption of Supplemental Table not pictured in LOA]{Long caption in the main text} 
\end{table}

\clearpage
\addsec*{\appendixfigurename}
\begin{figure}[!hbt]
  \centering\rule{5cm}{1cm}
  \caption[Caption of Supplemental Figure not pictured in LOA]{Long caption in the main text}
\end{figure}
\begin{figure}[!hbt]
  \centering\rule{5cm}{1cm}
  \caption[Caption of Supplemental Figure not pictured in LOA]{Long caption in the main text}
\end{figure}
\end{document}

결과

여기에 이미지 설명을 입력하세요

관련 정보