本地覆盖小型大写字母 \chapter

本地覆盖小型大写字母 \chapter

当我\chapter使用titlesec如下方式自定义格式时(重要的是\bfseries小型大写字母):

\titleformat{\chapter}[block]
    {\titlerule[1pt]\addvspace{0pt}\Large\scshape\bfseries\centering}
    {\thesection\enspace}{0pt}{}[\vspace{2pt}{\titlerule[1pt]}]
\titlespacing{\chapter}%
   {0mm}% How much of \titlerule line to remove from left
   {8mm}% Before \titlerule
   {0mm}% After \titlerule

然后在一个\chapter标题中我想将一个或两个单词(如果可以包括的话会加分\\)改为小写,我该怎么做?

我发现问题,但我无法让它工作。甚至连textcase@DavidCarlisle 帮助了我。

标题示例:

\chapter*{Veľkonočná nedeľa\\ \MakeTextLowercase{alebo}\\ Nedeľa Pánovho zmŕtvychvstania}%

\chapter*{Sobota\\ \MakeTextLowercase{po Piatej pôstnej nedeli}}%

答案1

您需要将“次要形状”轴重置为标准;它由fontaxes包定义,以允许小型大写字母的变化。

\documentclass[a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[slovak]{babel}

\usepackage{titlesec}

\usepackage{libertinus}

\titleformat{\chapter}[block]
  {\titlerule[1pt]\addvspace{0pt}\Large\scshape\bfseries\centering}
  {\thesection\enspace}
  {0pt}
  {}
  [\vspace{2pt}{\titlerule[1pt]}]
\titlespacing{\chapter}%
   {0mm}% How much of \titlerule line to remove from left
   {8mm}% Before \titlerule
   {0mm}% After \titlerule

\begin{document}

\let\cleardoublepage\relax % just to make both titles go in the same page

\chapter*{Veľkonočná nedeľa\\ \textulc{alebo}\\ Nedeľa Pánovho zmŕtvychvstania}

\chapter*{Sobota\\ \textulc{po Piatej pôstnej nedeli}}

\end{document}

在此处输入图片描述

使用 XeLaTeX 你只需要\textup

\documentclass[a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[slovak]{babel}

\usepackage{fontspec}
\usepackage{titlesec}

\setmainfont{Libertinus Serif}

\titleformat{\chapter}[block]
  {\titlerule[1pt]\addvspace{0pt}\Large\scshape\bfseries\centering}
  {\thesection\enspace}
  {0pt}
  {}
  [\vspace{2pt}{\titlerule[1pt]}]
\titlespacing{\chapter}%
   {0mm}% How much of \titlerule line to remove from left
   {8mm}% Before \titlerule
   {0mm}% After \titlerule

\begin{document}

\let\cleardoublepage\relax

\chapter*{Veľkonočná nedeľa\\ \textup{alebo}\\ Nedeľa Pánovho zmŕtvychvstania}

\chapter*{Sobota\\ \textup{po Piatej pôstnej nedeli}}

\end{document}

答案2

正如@Bernard 所建议的,我可以\titleformat在文档的任何地方使用,而不仅仅是在序言中。所以我只是创建了一个新命令(我将其命名为\chapterOther),我将\titleformat命令放在其中而不带\scshape,然后调用,最后我用原始命令\chapter重新格式化。所有这些我都放在了序言中:\chapter\titleformat

\newcommand{\chapterOther}[1]{%
    \titleformat{\chapter}[block]%
        {\titlerule[1pt]\addvspace{0pt}\Large\bfseries\centering}%
        {\thesection\enspace}{0pt}{}[\vspace{2pt}{\titlerule[1pt]}]%
    \titlespacing{\chapter}%
        {0mm}% How much of \titlerule line to remove from left
        {8mm}% Before \titlerule
        {0mm}% After \titlerule

    \chapter*{#1}%

    \titleformat{\chapter}[block]
        {\titlerule[1pt]\addvspace{0pt}\Large\scshape\bfseries\centering}
        {\thesection\enspace}{0pt}{}[\vspace{2pt}{\titlerule[1pt]}]
    \titlespacing{\chapter}%
        {0mm}% How much of \titlerule line to remove from left
        {8mm}% Before \titlerule
        {0mm}% After \titlerule
}

然后,当需要时,我这样调用它:

\chapterOther{\textsc{Veľkonočná nedeľa}\\ alebo\\ \textsc{Nedeľa Pánovho zmŕtvychvstania}}

相关内容