词汇表或首字母缩略词未显示为附录中的章节标题,因此也不在目录中。
我希望它的目录和附录看起来像这样。
Contents
1 Section Heading
A Appendix Heading
B Glossary
C Acronyms
下面是我正在做的一个简短的例子。
\documentclass[twoside,12pt]{article}
\usepackage[a4paper,top=1in,bottom=1in,left=0.75in,right=0.75in,headheight=110pt]{geometry}
\usepackage[acronym]{glossaries}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{titletoc}
\makeglossaries
\newacronym{cd}{CD}{compact disk}
\newglossaryentry{api}
{
name={API},
plural={APIs},
description={An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API},
first={Application Programming Interface (API)},
long={Application Programming Interface}
}
\title{TOC Example}
\begin{document}
\tableofcontents
\startcontents[mainsection]
\section{Section Heading}
\lipsum[1]
\gls{cd}
\gls{api}
\stopcontents[mainsection]
\appendix
\startcontents[appendices]
\section*{Appendices}
\section{Appendix Heading}
\lipsum[1]
\printglossaries
\end{document}
答案1
从那时起,我已经弄清楚了我想要做什么,并且下面的示例代码可以工作。
该命令\renewcommand*{\glossarysection}[2][]{\section{#1}}
将重写标题使其成为部分,然后将其添加到目录中并带有编号,希望这对某些人有所帮助!
\documentclass[twoside,12pt]{article}
\usepackage[a4paper,top=1in,bottom=1in,left=0.75in,right=0.75in,headheight=110pt]{geometry}
\usepackage[acronym]{glossaries}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{titletoc}
% Make glossaries
\makeglossaries
\renewcommand*{\glossarysection}[2][]{\section{#1}}
\newacronym{cd}{CD}{compact disk}
\newglossaryentry{api}
{
name={API},
plural={APIs},
description={An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API},
first={Application Programming Interface (API)},
long={Application Programming Interface}
}
\title{TOC Example}
\begin{document}
\tableofcontents
% Start mainsection content to be included in table of contents
\startcontents[mainsection]
\section{Section Heading}
\gls{api}
% End mainsection content to be included in table of contents
\stopcontents[mainsection]
\clearpage
\appendix
% Start appendices content to be included in table of contents
\startcontents[appendices]
\section*{Appendices}
\section{Appendix Heading}
\lipsum[1]
\printglossaries
\end{document}
答案2
据我所知,您只是\section{}
错误地标记了 s。如果您用您想要的内容标记它们,那么您就会得到您想要的目录。
\documentclass[twoside,12pt]{article}
\usepackage[a4paper,top=1in,bottom=1in,left=0.75in,right=0.75in,headheight=110pt]{geometry}
\usepackage[acronym]{glossaries}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{titletoc}
% Make glossaries
\makeglossaries
\newacronym{cd}{CD}{compact disk}
\newglossaryentry{api}
{
name={API},
plural={APIs},
description={An Application Programming Interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another particular software program that implements that API},
first={Application Programming Interface (API)},
long={Application Programming Interface}
}
\title{TOC Example}
\begin{document}
\tableofcontents
% Start mainsection content to be included in table of contents
\startcontents[mainsection]
%\printcontents[mainsection]{l}{1}{\section*{Main Sections}\setcounter{tocdepth}{3}}
\section{Section Heading}
\lipsum[1]
% End mainsection content to be included in table of contents
\stopcontents[mainsection]
\clearpage
\appendix
% Start appendices content to be included in table of contents
\startcontents[appendices]
\section*{Appendices}
\section{Appendix Heading}
\lipsum[1]
\section{Glossary}
\lipsum[1]
\section{Acronyms}
\lipsum[1]
\printglossaries
%----------------------------------------------------------------------------------------
\end{document}