목록 패키지: 자동 색인 생성

목록 패키지: 자동 색인 생성

문서를 연구했지만 여러 종류의 키워드를 자동으로 색인화하는 방법을 이해할 만큼 영리하지 않았습니다. 아래에 MWE를 제공합니다. 문서를 실행하면 클래스 [1] 키워드만 색인에 나타납니다. 클래스 [2]는 그렇지 않습니다.

\documentclass{book}
\usepackage{makeidx}\makeindex 
\usepackage{listings}
\begin{document}
\lstset{
classoffset=0,
morekeywords=[1]{
    False   },
morekeywords=[2]{
    AssertionError  },
index=[1][keywords],
index=[2][keywords],
}
\lstinline!False! makes an index entry, but
\lstinline!AssertionError! does not.
\printindex
\end{document}

답변1

첫 번째 선택적 인수의 숫자는 index키워드의 클래스 번호를 참조하는 것이 아니라 인덱스의 클래스 번호를 참조합니다. 이를 통해 다양한 인덱스를 설정할 수 있습니다. 키워드의 클래스 번호는 첫 번째 클래스를 제외하고 이름에 추가됩니다: keywords, keywords2,keywords3 , ...

다음은 작동합니다:

\documentclass{book}
\usepackage{makeidx}\makeindex
\usepackage{listings}
\begin{document}
\lstset{
  classoffset=0,
  morekeywords=[1]{
    False          
  },
  morekeywords=[2]{        
    AssertionError
  },
  index=[1][keywords],
  moreindex=[1][keywords2],
}
\lstinline!False! makes an index entry, but
\lstinline!AssertionError! does not.
\printindex
\end{document}

색인

관련 정보