大写标题

大写标题

我想将系列标题的\scshape每个单词的第一个字符都大写。

我怎样才能做到这一点?

答案1

titlecaps软件包可以做到这一点。事实上,它太新了,在 CTAN 搜索中还没有出现,但仍然可以在http://www.ctan.org/pkg/titlecaps

\documentclass{article}
\parindent 0em
\usepackage{titlecaps}
\begin{document}

\titlecap{\scshape this is a (test) of \LARGE titlecaps \normalsize on
\"uml\"auts}\normalfont

But if I don't like words like is of on and a being titled, I use
\verb|\Addlcwords| and try again:

\Addlcwords{is of on a}
\titlecap{\scshape this is a (test) of \LARGE titlecaps \normalsize on
\"uml\"auts}

\end{document}

在此处输入图片描述

答案2

您可以使用以下方式更改所有标题的字体教派。许多字体(包括 Computer Modern)没有粗体小型大写字母,因此您必须指定正常粗细:

\documentclass{article}
\usepackage{sectsty}
\allsectionsfont{\mdseries\scshape}

\begin{document}
\section{A Section Header}
\end{document}

最好手动将标题大写。但如果你真的需要自动解决方案,请尝试以下方法:

\documentclass{article}
\usepackage{stringstrings}
\usepackage{sectsty}
\allsectionsfont{\mdseries\scshape}

\let\oldsection=\section
\def\section#1{\oldsection{\capitalizewords{#1}}}
\let\oldsubsection=\subsection
\def\subsection#1{\oldsubsection{\capitalizewords{#1}}}
% and so on

\begin{document}
\section{a section header}
\end{document}

答案3

@rdhs 的第一个例子也可以用标题安全。它有同样的警告,即不能使用粗体小写字母。事实上,添加\bfseries<format>部分将破坏\scshape

\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}{\scshape\Large}
{\thesection}{1em}{}

\begin{document}
\section{A Section Header}
\end{document}

相关内容