我想要获得像这样的目录:
但我还没有找到如何指示 LaTeX 格式化这样的目录。我也尝试过另一种方法,放弃目录,改用普通表格。但同样,使用表格,我无法重现这种索引。
更新:我尝试使用所提供的建议,并将它们整合成:
\documentclass{book}
\makeatletter
\newcommand*\l@chapterinfo{\@nodottedtocline{0}{0.0em}{1.5em}}
\def\@nodottedtocline#1#2#3#4#5{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
{\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{#4}\nobreak
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{\,}\mkern \@dotsep
mu$}\hfill
\nobreak
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor }%
\par}%
\fi}
\makeatother
\def\chapterinfo#1{%
\addcontentsline{toc}{chapterinfo}{%
\noexpand\numberline{}#1}%
}
\begin{document}
\tableofcontents
\chapter{First conference}
\chapterinfo{\textit{\textbf{Some place, 12 may 2014}}}
\chapterinfo{Lorem ipsum dolor sit amet, consectetur adipiscing elit.}
But I haven't found yet how to instruct LaTex to format a table of contents ike this. I have also tried a different approach giving up the table of contents and using instead an ordinary table.
\chapter{Second conference}
\chapterinfo{\textit{\textbf{Some place, 22 may 2014}}}
\chapterinfo{Pellentesque pellentesque hendrerit urna, et commodo metus rhoncus ut. Praesent eget magna nec leo rhoncus congue nec non leo.}
But I haven't found yet how to instruct LaTex to format a table of contents like this. I have also tried a different approach giving up the table of contents and using instead an ordinary table. But also with tables I wasn't able to reproduce this kind of index.
\end{document}
但:
- 如何隐藏会议标题前的数字?
- 我该如何输入“某个地方“在右边?
- 我如何在后续页面中隐藏“第 x 章”?
我找不到如何使用这个技巧:
\let\Chapter\chapter \def\chapter#1#2{\Chapter{#1}\chapterinfo{#2}}
在哪里可以找到有关它的一些文档?
答案1
这是一个解决方案。策略是定义一个自定义命令\conference
,允许您包含位置信息、描述等。然后,这会在文件中添加一些命令,\infoa
以便\infob
在.toc
内容行排版时可用。
最后,会议被排版为一章(但如果您愿意,也可以将其排版为一节),不带星号或带星号(以隐藏您提到的数字)。目录页的格式由标题目录包装,页边距中带有和的数字和页面\llap
。\rlap
(字体等的选择需要修复,但我有点符合您的示例。)
如果你不喜欢章节的格式,那么你可以使用标题安全包来定制这些。
我还使用了一些其他有用的软件包,例如电子工具箱延缓扩张和后缀用于定义带星号的命令。
\documentclass{book}
\usepackage{titletoc} % For custom toc formatting
%\usepackage{titlesec} % If you want control of the chapter look
\usepackage{etoolbox} % For \csuse
\usepackage{suffix} % For defining starred commands
%% These are just for convenience: they could be used directly in the
%% \titlecontents command.
\def\confloc{\textit{\infoa}} % Formatting of location
\def\confinfo{\normalsize\textsf{\infob}} % Formatting of info
\def\confpage{Pag.~\thecontentspage} % Formatting of page
\titlecontents{chapter} % Use section if you prefer
[0pt]
{\large} % Overall font
{\llap{\thecontentslabel.\hspace{0.5em}}} % Numbered label before title
{} % Unnumbered label
{\hfill\confloc% % After label (loc and page)
\rlap{\hspace{1em}\confpage}}
[\vspace{\baselineskip} % Below the entry.
\confinfo\csuse{par} % Can't use \par directly
\vspace{\baselineskip}]
%% Usage: \conference[location and date]{Title}{Description}
%% \conference*[location and date]{Title}{Description}
\newcommand{\conference}[3][]{ % Numbered version
\addtocontents{toc}{
\csdef{infoa}{#1}
\csdef{infob}{#3}
}
\chapter{#2} % Could use sections etc. here
}
% Starred version
\WithSuffix\newcommand{\conference}*[3][]{ % Unnumbered starred version
\addtocontents{toc}{
\csdef{infoa}{#1}
\csdef{infob}{#3}
}
\chapter*{#2} % Could use sections etc. here
\addcontentsline{toc}{chapter}{#2}
}
% Change the name from Chapter to Conference
\renewcommand{\chaptername}{Conference}
\begin{document}
\tableofcontents
\conference[Some place, 12 may 2014]%
{First conference}%
{Lorem ipsum dolor sit amet, consectetur adipiscing elit.}%
But I haven't found yet how to instruct LaTex to format a table of contents
like this. I have also tried a different approach giving up the table of
contents and using instead an ordinary table.
\conference*[Some place, 22 may 2014]%
{Second conference}%
{Pellentesque pellentesque hendrerit urna, et commodo metus
rhoncus ut. Praesent eget magna nec leo rhoncus congue nec non
leo.}%
But I haven't found yet how to instruct LaTex to format a table of contents
like this. I have also tried a different approach giving up the table of
contents and using instead an ordinary table. But also with tables I wasn't
able to reproduce this kind of index.
\end{document}
结果如下:
第一个会议有一个编号,\chaptername
我已将其更改为Conference
:
第二次会议没有标签编号,Chapter
因为它使用命令排版为未编号章节\chapter*
。