我希望我的长篇论文可以有一个自动的“结论表”,其中列出了所有关键发现以及它们出现位置的链接。
是否存在这样的事LaTeX
?想象一下:
\finding[The answer was 42.]{42 was the answer to the great question.}
结论表
第一章:
答案是 42。。。。。。第 10 页
答案1
该请求非常简单,易于设置、使用tocloft
和\newlistof
命令。
该\findings
命令类似于\chapter
等。带星号的版本仅打印找到的文本(第三个参数),没有数字,可选参数用于List of Conclusions
并且第三个参数是始终显示的。
\documentclass{book}
\usepackage{xparse}
\usepackage{tocloft}
\newcommand{\listfindingsname}{List of conclusions}
\newlistof[chapter]{findings}{fin}{\listfindingsname}
\NewDocumentCommand{\findings}{so+m}{%
\IfBooleanTF{#1}{%
{\bfseries #3}%
}{%
\refstepcounter{findings}%
{\bfseries\thefindings\ #3}%
\IfValueTF{#2}{%
\addcontentsline{fin}{findings}{\protect\numberline{\thefindings~}#2}%
}{%
\addcontentsline{fin}{findings}{\protect\numberline{\thefindings~}#3}%
}%
}%
}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\listoffindings
\chapter{What should a new user do on TeX.SX}
\findings{He shall provide a MWE}
\chapter{Why should he provide a MWE}
\findings[To ease the work of users here]{To ease the work of users here in order to find some solution and not have to do wild guesses about the request}
\chapter{What do we do with users not providing a MWE}
\findings*{We post a simple solution and keep the better one for us ;-)}
\end{document}