toc, lof 또는 lot과 같은 목록 만들기

toc, lof 또는 lot과 같은 목록 만들기

toc, lof, lot과 같은 목록을 만들고 싶습니다. listofsongs 또는 이와 유사한 이름으로 불러야 합니다. 문제는 유사한 목록을 만들 수 있는 패키지가 있습니까? 아니면 이 모든 작업을 직접 수행해야 합니까?입니다.

LaTeX에서 이미 사용된 파일 확장자 목록이 있습니까? 즉, 목차와 충돌이 발생할 수 있으므로 MyDocument.toc를 사용하면 안 됩니다.

결국, 나는 \listofsongs내가 쓰는 것처럼 쓸 수 있어야 \tableofcontents하고, 그것은 비슷하게 행동해야 한다.

답변1

LaTeX2e-kernel-macros \@starttoc\addtocontents{<file-extension>}{<tokens>}.

\addtocontentsLaTeX 실행이 끝날 때 aux 파일이 처리될 때 파일이 입력을 위해 열려 있는 경우 <tokens>파일에 확장되지 않은 쓰기를 위한 일부 지시어를 aux 파일에 기록(확장되지 않음)합니다 .\jobname.<file-extension>

\@starttoc{<file-extension>}파일이 존재하는 경우 TeX가 파일을 읽고 처리 \jobname.<file-extension>하도록 한 다음 해당 파일을 삭제한 다음 새로 생성하고 입력용으로 열어 LaTeX 실행이 끝날 때 aux 파일이 처리될 때 해당 파일이 열립니다. 입력용.

좀 더 멋진 작업을 수행하고 싶다면 \addcontentslineLaTeX2e 커널의 -macro를 살펴보세요.

기본적으로 LaTeX 실행이 끝날 때 aux 파일이 처리될 때 파일이 입력을 위해 열려 있는 경우 \addcontentsline{<file-extension>}{<command name>}{<tokens>}토큰 시퀀스를 확장되지 않은 상태 로 \contentsline{<command name>}{<tokens>}{<page number>}파일에 쓰기 위한 몇 가지 지시어를 aux 파일에 씁니다. LaTeX 실행이 끝날 때 aux 파일을 처리하는 동안 \jobname.<file-extension>작성한 후 해당 지시문을 찾을 수 있습니다 . 따라서 해당 지시문은 파일을 읽거나 처리할 때 수행됩니다 .\jobname.<file-extension>\contentsline{<command name>}{<tokens>}{<page number>}\@starttoc\jobname.<file-extension>

\contentsline{<command name>}{<tokens>}{<page number>}그러면 \l@<command name>두 개의 인수, 즉 -argument <tokens><page number>-argument를 처리하는 매크로가 호출됩니다.

이 메커니즘을 toc-file 및 sectioning-commands와 함께 사용하면 매크로 실행 과 <command name>유사하거나 section고유 한 루비화 범주에 대해 고유한 -macros를 정의할 수도 있습니다 .subsection\l@section\l@subsection\l@..

\addtocontents...- 메커니즘 \@starttoc{<file-extension>}은 다른 것 아래에서 제어 시퀀스를 정의합니다 \tf@<file-extension>. 따라서 해당 메커니즘이 \write파일 쓰기를 위해 이미 -handle을 할당했는지 여부를 알아내기 위해 -macro를 사용하여 제어 시퀀스가 ​​이미 정의되어 있는지 확인할 \jobname.<file-extension>수 있습니다 .\@ifundefined\tf@<file-extension>

그러나 이것은 scrwfile-package가 사용되지 않는 동안에만 작동합니다. 그런데 문서에 toc, lof 또는 lot과 같은 많은 목록을 만들려는 경우 scrwfile-package에 관심이 있을 수 있습니다. 해당 패키지에 대한 자세한 내용은 CTAN에서 확인할 수 있습니다.https://www.ctan.org/pkg/scrwfile

LaTeX2e 커널에 대한 설명과 설명은 source2e.pdf 파일에 나와 있습니다.https://www.ctan.org/pkg/source2e. - -
메커니즘 과 해당 메커니즘을 활용하는 -macro는 File F ltsect.dtx → 59 섹션화 명령 → 59.3 목차 등의 섹션에 설명되어 있습니다.\addtocontents\@starttoc\addcontentsline

\documentclass{article}
\usepackage{hyperref}
\usepackage{verbatim}
\makeatletter
\newcommand\l@songline[2]{%
  \par Now we have data about another song:\\
  Title of song: #1. Song is printed on page: #2.%
}%
\makeatother
\begin{document}
\LaTeX{} will now write directives to aux-file for writing the first
 line into \jobname.weird. These directives will be carried out at
 the end of the \LaTeX-run when the aux-file is read/processed in
 case at that time the file \jobname.weird is open for writing to it.\\
\addtocontents{weird}{First line in file \jobname.weird.}%
\bigskip

This is what \jobname.weird looks like before calling \verb|\@starttoc|:    \\
\verbatiminput{\jobname.weird}
\bigskip

This is how \verb|\l@songline| is defined:\\{%
  \csname verbatim@font\endcsname\selectfont
  \expandafter\meaning\csname l@songline\endcsname
}%
\bigskip

The file \jobname.weird is \csname @ifundefined\endcsname{tf@weird}{not}{already} allocated.
\bigskip

\LaTeX will now read/process \jobname.weird and then destroy that file
and create it anew and open it for writing. Thus at the end of the
\LaTeX-run, when the aux-file is read/processed, that file will be open
for writing to it:\bigskip

\csname @starttoc\endcsname{weird}%
\bigskip

The file \jobname.weird is \csname @ifundefined\endcsname{tf@weird}{not}{already} allocated.
\bigskip

\LaTeX{} will now write directives to aux-file for writing the second
line into \jobname.weird. These directives will be carried out at
the end of the \LaTeX-run when the aux-file is read/processed in
case at that time the file \jobname.weird is open for writing to it.\\
\addtocontents{weird}{Second line in file \jobname.weird.}%
\bigskip

Now two \verb|\addcontentsline|-entries for writing things to \jobname.weird
that need to be "rubrified" by means of applying the \verb|l@songgline|-macro.
\addcontentsline{weird}{songline}{Morning has broken}
\addcontentsline{weird}{songline}{Final Countdown}

\end{document} 

답변2

불행히도 문제에는 MWE가 없습니다. 그래서 나는 당신이 정말로 무엇을 하고 싶은지 모르겠습니다. 프로필을 읽어보니 scrbook. 따라서 여기에 업데이트된 KOMA 스크립트가 필요한 제안이 있습니다.

\documentclass[listof=totoc,ngerman]{scrbook}[2016/06/14]% needs at least KOMA-Scritp version 3.21
\usepackage{babel}
\DeclareNewTOC[
  type=song,
  tocentryindent=0pt,
  tocentrynumwidth=2.3em,
  tocentrystyle=tocline,
  tocentrylinefill=\hfill,
  tocentryentryformat=\sffamily,
  tocentrypagenumberformat=\sffamily
]{los}
\newcaptionname{ngerman}{\listsongname}{Liederverzeichnis}

\DeclareNewSectionCommand[
  style=chapter,
  level=0,
  beforeskip=-1sp,
  innerskip=0pt,
  afterskip=\baselineskip,
  font=\usekomafont{section},
  prefixfont=\usekomafont{chapter},
  pagestyle=plain
]{song}

\renewcommand\songformat{}
\renewcommand\addsongtocentry[2]{\addxcontentsline{los}{song}{#2}}

\usepackage{hyperref}

\begin{document}
\tableofcontents
\addchap{Einleitung}
Text
\listofsongs
\song{Ein Liedtitel}
\end{document}

다음은 표준 클래스 book와 KOMA 패키지를 사용하는 또 다른 버전입니다 tocbasic. 그러나 \song명령이나 환경을 어떻게 정의하는지 모르겠습니다 song.

\documentclass[ngerman]{book}
\usepackage{babel}

\usepackage{tocbasic}[2016/06/14]% needs at least KOMA-Scritp version 3.21
\DeclareNewTOC[
  type=song,
  tocentryindent=0pt,
  tocentrynumwidth=2.3em,
  tocentrystyle=tocline,
  tocentrylinefill=\hfill,
  tocentryentryformat=\sffamily,
  tocentrypagenumberformat=\sffamily
]{los}
\newcaptionname{ngerman}{\listsongname}{Liederverzeichnis}

\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}
\listofsongs

\clearpage
\phantomsection\addxcontentsline{los}{song}{Ein Liedtitel im Verzeichnis}
\section*{Ein Liedtitel}

\lipsum

\clearpage
\phantomsection\addxcontentsline{los}{song}{Ein anderer Liedtitel im Verzeichnis}
\section*{Ein anderer Liedtitel}
\end{document}

관련 정보