모든 매크로 호출 나열

모든 매크로 호출 나열

전체 문서에서 , 등 \AAA여러 매크로를 사용하는 큰 문서가 있다고 가정합니다 .\BBB

최종 PDF에 이러한 모든 매크로 목록을 포함할 수 있는 방법이 있습니까? \AAA예를 들어, 문서를 작성하는 동안 매우 빠르게 살펴보기 위해 처음에 모든 호출을 반복하고 싶습니다 .

선택적 기능은 하이퍼참조를 사용하여 \AAA목록 중 하나를 클릭하여 매크로가 실제로 사용되는 PDF 페이지로 직접 이동하는 것입니다.

답변1

이름이 카운터를 사용하는 \hypertarget모든 호출에 a를 넣을 수 있습니다 . \AAA나중에는 로 참조할 수 있습니다 \hyperlink.

예제에서 \AAA No. 1등은 클릭 가능한 링크입니다.

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{pgffor,hyperref}
\newcount\countAAA
\countAAA=0
\newcommand*\AAA{%
    \advance\countAAA by 1%
    \hypertarget{AAA\the\countAAA}{}%
    AAA% your replacement text goes here
}
\newcommand\blindtext{\par\noindent Lorem ipsum dolor sit amet \par\noindent}
\begin{document}
\section{Some text with \texttt{\string\AAA} macros}
\blindtext
\AAA
\blindtext
\AAA
\blindtext
\AAA
\blindtext
\AAA
\section{List of \texttt{\string\AAA} calls}
There are \the\countAAA\ calls of \texttt{\string\AAA} throughout the document.

\foreach \i in {1,...,\the\countAAA} {
    \hyperlink{AAA\i}{\texttt{\string\AAA} No.\ \i}
}
\end{document}

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

관련 정보