![强制某些 \section 文本不大写](https://linux22.com/image/368661/%E5%BC%BA%E5%88%B6%E6%9F%90%E4%BA%9B%20%5Csection%20%E6%96%87%E6%9C%AC%E4%B8%8D%E5%A4%A7%E5%86%99.png)
我有一个文档,其配置如下。我尝试使用 \MakeLowercase 强制某些部分中的某些文本不大写,但收到警告(下图)。我想知道如何解决这个问题。
\documentclass[
12pt,
openright,
twoside,
a4paper,
chapter=TITLE,
section=TITLE,
english,
french,
spanish,
brazil,
]{abntex2}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
\usepackage{indentfirst}
\usepackage{color}
\usepackage[final]{graphicx}
\usepackage{microtype}
\usepackage[table,xcdraw]{xcolor}
\usepackage{hyperref}
\usepackage{subcaption}
\usepackage{epigraph}
\usepackage{url}
\usepackage{placeins}
\usepackage{multirow}
\usepackage[figuresright]{rotating}
\usepackage{chemfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{bigints}
\usepackage{environ}
\usepackage{listings}
\usepackage[brazilian,hyperpageref]{backref}
\usepackage[alf]{abntex2cite}
\begin{document}
\chapter{Foo}
\section{This is my title \MakeLowercase{this cannot be capitalized!} foo bar}
\end{document}
答案1
以下是适用于 的解决方案hyperref
。如果hyperref
未加载,您可以像\lowercase
这样使用:\section{Foo \lowercase{no upper case} bar}
如果hyperref
加载了,则会导致警告(“PDF 字符串中不允许使用令牌...”),因此我们必须另外使用\texorpdfstring
。我为此定义了一个\titlelowercase
宏。现在您必须使用\section{Foo \titlelowercase{no upper case} bar}
:
\documentclass[
12pt,
openright,
twoside,
a4paper,
chapter=TITLE,
section=TITLE,
english,
french,
spanish,
brazil,
]{abntex2}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
\usepackage{indentfirst}
\usepackage{color}
\usepackage[final]{graphicx}
\usepackage{microtype}
\usepackage[table,xcdraw]{xcolor}
%\usepackage{hyperref}% hyperref is loaded by the class abntex2
\usepackage{subcaption}
\usepackage{epigraph}
\usepackage{url}
\usepackage{placeins}
\usepackage{multirow}
\usepackage[figuresright]{rotating}
\usepackage{chemfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{bigints}
\usepackage{environ}
\usepackage{listings}
\usepackage[brazilian,hyperpageref]{backref}
\usepackage[alf]{abntex2cite}
\newcommand\titlelowercase[1]{\texorpdfstring{\lowercase{#1}}{#1}}
\begin{document}
\tableofcontents
\chapter{Foo}
\section{This is my title \titlelowercase{this cannot be capitalized!} foo bar}
\end{document}
您不妨使用\MakeTextLowercase
而不是\lowercase
。它由包提供(也textcase
由 加载)并且应该处理一些字符(据我所知)。abntex2
\lowercase
答案2
该类使用textcase
提供的命令\MakeTextUppercase
将标题大写。这可用于\NoCaseChange
您不想大写的部分。
\documentclass[
12pt,
openright,
twoside,
a4paper,
chapter=TITLE,
section=TITLE,
english,
french,
spanish,
brazil,
]{abntex2}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{lmodern}
% other packages
% ...
\usepackage{hyperref} % should be last
\begin{document}
\chapter{Foo}
\section{This is my title \NoCaseChange{this cannot be capitalized!} foo bar}
\end{document}