각주의 각 페이지에 용어집 항목이 있는 문서를 만들고 싶습니다. 그렇게 할 수 있었습니다(아래 MWE 참조). 그러나 각주 주석을 알파벳순으로 정렬하고 싶지만 각주를 정렬하는 방법을 찾을 수 없습니다. 반대로, 페이지당 용어집이 있나요?
MWE:
\documentclass{book}
\usepackage[nonumberlist]{glossaries}
\usepackage{xifthen}
\usepackage{everypage}
\makeglossaries
% enable counting the words
\glsenableentrycount
% reset counts every page
\AddEverypageHook{\glsresetall}
% populate some entries
\newglossaryentry{uno}{name=uno,description=one}
\newglossaryentry{dos}{name=dos,description=two}
\newglossaryentry{tres}{name=tres,description=three}
\newglossaryentry{quatro}{name=quatro,description=four}
\newglossaryentry{cinco}{name=cinco,description=five}
% displaying glossary entries
\newcommand\glossdisplay[2]{%
\ifthenelse{\glsentrycurrcount{\glslabel} = 0}{%
% first time we've seen this word on this page so add a footnote
#1\let\thefootnote\relax\footnote{\textbf{\glslabel} #2}%
}{%
% not the first definition on this page so just display the word
#1%
}%
}
\renewcommand\glsdisplayfirst[4]{\glossdisplay{#1}{#2}}
\renewcommand\glsdisplay[4]{\glossdisplay{#1}{#2}}
\newcommand\gloss[2][\relax]{\glsdisp{#1}{#2}}
\begin{document}
Counting to three in Spanish, \gloss[uno]{uno}, \gloss[dos]{dos}, \gloss[tres]{tres}.
Counting to five in Spanish, \gloss[uno]{uno}, \gloss[dos]{dos}, \gloss[tres]{tres}, \gloss[quatro]{quatro}, \gloss[cinco]{cinco}.\\
Notice how \gloss[uno]{uno}, \gloss[dos]{dos}, and \gloss[tres]{tres} only appear once in the footnotes despite being glossed three times.
Now the real question: \textit{How do I sort the per-page glossary alphabetically?} Perhaps there is a per-page option for the glossaries package?
\end{document}
생성된 문서에서는 각주/용어집 항목이 정렬됩니다.
- 우노
- 해야 할 일
- 트레스
- 콰트로
- 친코
하지만 보고 싶어
- 친코
- 해야 할 일
- 콰트로
- 트레스
- 우노
또한 도움이 된다면 다음을 사용하여 문서를 작성했습니다.
pdflatex repro.tex
makeindex -s repro.ist -o repro.gls repro.glo
pdflatex repro.tex
답변1
이것이 내가 얻을 수 있었던 가장 가까운 것입니다. 나는 사용했다glossaries-extra
패키지를 확장하고 패키지의 문서 전체 계산 glossaries
외에도 단위당 계산을 제공합니다 . glossaries
이렇게 하면 페이지당 계산이 더 쉬워집니다.
\documentclass{book}
\usepackage{everypage}
\usepackage{glossaries-extra}
\AddEverypageHook{%
\gdef\entrylabellist{}%
}
\GlsXtrEnableEntryUnitCounting{general}{0}{page}
\newcommand*{\entrylabellist}{}
\makeatletter
\def\@glo@sortinghandler{\@glo@sorthandler@word}%
\newcommand*{\sortpageentries}{%
\forglsentries{\thisentry}{%
\ifnum\glsentryprevcount{\thisentry}>0\relax
\expandafter\@glo@sortedinsert\expandafter\entrylabellist\expandafter
{\thisentry}%
\fi
}%
}
\newcommand*{\glsxtrpostlinkgeneral}{%
\ifnum\glsentrycurrcount{\glslabel}=1\relax
\footnotemark[1]%
\ifdefempty\entrylabellist
{%
\sortpageentries
\footnotetext[1]{\@for\thisentry:=\entrylabellist\do{%
\glsentryname{\thisentry} \glsentrydesc{\thisentry}. }}%
}%
{}%
\fi
}
\makeatother
\newglossaryentry{uno}{name=uno,description=one}
\newglossaryentry{dos}{name=dos,description=two}
\newglossaryentry{tres}{name=tres,description=three}
\newglossaryentry{quatro}{name=quatro,description=four}
\newglossaryentry{cinco}{name=cinco,description=five}
\begin{document}
Counting to three in Spanish, \gls{uno}, \gls{dos},
\gls{tres}. Counting to five in Spanish, \gls{uno},
\gls{dos}, \gls{tres}, \gls{quatro}, \gls{cinco}.
Notice how \gls{uno}, \gls{dos}, and \gls{tres} only appear once in
the footnotes despite being glossed three times.
\newpage
Test next page.
\gls{tres}, \gls{quatro} and \gls{cinco}.
And again:
\gls{tres}, \gls{quatro} and \gls{cinco}.
\end{document}
이전 실행의 총 개수를 저장하기 위해 보조 파일을 사용하므로 LaTeX를 두 번 실행해야 하므로 첫 번째 인스턴스에는 각주가 표시되지 않습니다. 문서의 시작이나 끝 부분에 완전한 용어집을 추가로 원하지 않는 한 makeindex
/가 필요하지 않습니다 . xindy
정렬은 (에서 제공 )을 datatool-base
통해 액세스되는 의 정렬된 삽입 명령을 사용하여 수행됩니다 . 이는 적절한 비교 핸들러( 이 경우) 로 설정되어야 합니다.\@glo@sortedinsert
glossaries
\@glo@sortinghandler
\@glo@sorthandler@word
위의 예는
첫 페이지 상단에 있습니다. 페이지 하단의 각주가 다음과 같이 나타납니다.
줄을 편집하여 서식을 조정할 수 있습니다.
\footnotetext[1]{\@for\thisentry:=\entrylabellist\do{%
\glsentryname{\thisentry} \glsentrydesc{\thisentry}. }}%
두 번째 페이지 상단에 다음과 같이 나타납니다.
각주와 함께
경고:TeX의 비동기 출력 루틴으로 인해 페이지 나누기에 걸쳐 있는 단락의 끝 부분에 있는 항목에 대해서는 제대로 작동하지 않을 수 있습니다.