我可以使用以下标签生成句子列表这. 如何枚举列表?
编辑 1:差不多。
以下受到 GIGANTIC TAB 的影响。我宁愿没有这个问题。
\documentclass{article}
\usepackage{hyperref}
\usepackage[english]{babel} % English language/hyphenation
\makeatletter
\newcounter{sentence}
\newcommand\listofsentences{\@starttoc{los}}
\newcommand\addsentence[1]{%
\refstepcounter{sentence}%
\par\csname phantomsection\endcsname\addcontentsline{los}{sentence}{\numberline{\thesentence}#1}#1\par}
\newcommand\l@sentence[2]{\par\noindent#1}
\makeatother
\begin{document}
\addsentence{This is a test sentence.}
\addsentence{This is another test sentence.}
\listofsentences
\end{document}
答案1
像这样?您为句子创建一个新的计数器,在\addsentence
宏中步进其值,然后使用它\thesentence
在列表中打印计数器值。
\documentclass{article}
\usepackage{hyperref}
\usepackage[english]{babel} % English language/hyphenation
\makeatletter
\newcounter{sentence}
\newcommand\listofsentences{\@starttoc{los}}
\newcommand\addsentence[1]{%
\refstepcounter{sentence}%
\par\csname phantomsection\endcsname\addcontentsline{los}{sentence}{\thesentence\ #1}#1\par}
\newcommand\l@sentence[2]{\par\noindent#1}
\makeatother
\begin{document}
\addsentence{This is a test sentence.}
\addsentence{This is another test sentence.}
\listofsentences
\end{document}