我需要使用正常大小的字体将文档前面部分的一些部分居中,但章节标题除外。因此,我需要将“目录”、“表格列表”和“图片列表”居中,并全部大写,放在相应条目列表之前。然后,当我有章节标题(1 和 1.1)时,这些标题需要位于页面左侧(不居中,大小写混合,也使用正常大小的字体)。末尾的参考文献也需要像“目录”一样居中。目录列表都需要使用普通字体(如图所示)。因此,基本上,我需要将“目录”、“图片列表”等和“参考文献”居中,而不会干扰其他任何内容。另外要注意的是,“目录”等应该全部大写...章节标题应该是大小写混合。任何帮助都非常感谢。
%% LyX 2.0.7 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{titlesec}
\titleformat*{\section}{\bfseries\normalsize}
\titleformat*{\subsection}{\bfseries\normalsize}
\titleformat*{\subsubsection}{\bfseries\normalsize}
\usepackage{titletoc}
\titlecontents{section} % set formatting for \section - \subsection must be formatted separately
[2.3em] % adjust left margin
{\rmfamily} % font formatting
{\contentslabel{2.3em}} % section label and offset
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}
\makeatother
\usepackage{babel}
\begin{document}
This is a test...
\tableofcontents
\listoffigures
and this is after the table of contents
\section{This is a section}
test one two three as seen on TV
\subsection{this is sub}
test sub...
\section{this is the second section}
\addcontentsline{toc}{section}{\protect\underline{\refname}}
\bibliographystyle{plain}
\bibliography{C:/Users/csibona/Documents/SocialNetwork}
\appendix
\addcontentsline{toc}{section}{\protect\underline{Appendix}}
\pagebreak
\section{Ah, an appendix}
\end{document}
答案1
这是一种可能性,使用titlesec
包。这个想法是定义两个命令,允许您根据需要多次切换章节标题格式;\CentSections
为您提供居中的大写标题,并\StdSections
为您提供标准的齐平句子大小写标题。
\documentclass[english]{article}
\usepackage{babel}
\usepackage{titlesec}
\usepackage{titletoc}
\titleformat*{\section}{\bfseries\normalsize}
\titleformat*{\subsection}{\bfseries\normalsize}
\titleformat*{\subsubsection}{\bfseries\normalsize}
\titlecontents{section} % set formatting for \section - \subsection must be formatted separately
[2.3em] % adjust left margin
{\rmfamily} % font formatting
{\contentslabel{2.3em}} % section label and offset
{\hspace*{-2.3em}}
{\titlerule*[1pc]{.}\contentspage}
\newcommand\CentSections{
\titleformat{\section}
{\normalfont\bfseries\normalsize\centering}{\thesection}{1em}{\MakeUppercase}
}
\newcommand\StdSections{
\titleformat{\section}
{\normalfont\bfseries\normalsize}{\thesection}{1em}{}
}
\begin{document}
\CentSections
\tableofcontents
\listoffigures
\listoftables
\StdSections
\section{This is a standard section}
\subsection{This is a subsection}
\section{This is the second standard section}
\subsection{This is another subsection}
\CentSections
\addcontentsline{toc}{section}{\protect\underline{\refname}}
\bibliographystyle{plain}
\bibliography{biblio}
\StdSections
\appendix
\section{An appendix}
\end{document}
生成的文档的图像: