我有一份大型文档,其中加载了几个包。其中,我有fancyhdr
一个包和一个命令\fancyhead[LE,LO]{\nouppercase{\leftmark}}
,用于将章节标题放在页面顶部,并且不带大写字母。由于我用葡萄牙语书写,所以页面顶部看起来是这样的:
一切都运行正常,但是当我添加了glossaries-extra
包后,现在所有的首页都变成了这种情况:
这个“Í”的问题只发生在头部;脚部没有问题。
有这方面的线索吗?提前致谢!代码:
\documentclass[12pt, a4paper]{report}
\usepackage[a4paper, left=3cm, right=2.5cm, top=3cm, bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\renewcommand{\baselinestretch}{1.5}
\usepackage{fancyhdr}
\usepackage{ifthen}
\usepackage[symbols,nogroupskip,sort=none]{glossaries-extra}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{16pt}
\fancyhead[LE,LO]{\nouppercase{\leftmark}}
\fancyhead[RE,RO]{\thepage}
\renewcommand{\footrulewidth}{0.5pt}
\fancyfoot[L]{\ifthenelse{\isodd{\value{page}}}{{\scriptsize Some text 1. Word Capítulo.}}{{\scriptsize Capítulo. Word Capítulo. Conclusão.}}}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\glsxtrnewsymbol[description={some symbol}]{A}{\ensuremath{A}}
\begin{document}
\renewcommand{\contentsname}{Sumário}
\tableofcontents
\newpage
\thispagestyle{empty}
\printunsrtglossary[type=symbols,style=long,title={Lista de Símbolos}]
\chapter{Este é o início}
\label{inicio1}
Problem in the next page. Capítulo word.
\newpage
Words.
\end{document}
答案1
您可以通过在之前添加来解决问题\begin{document}
\addto\extrasportuguese{\renewcommand{\chaptername}{Cap\'itulo}}
\DeclareUnicodeCharacter{00ED}{\'i}
问题是,glossaries-extra
这\let\MakeUppercase\MakeTextUppercase
会影响命令扩展的工作方式。因此,\protect\MakeUppercase
LaTeX 不会保留左侧标记,而是会查找,\protect\MakeTextUppercase
而\nouppercase
宏不会处理这个问题。
可能fancyhdr
需要更新,以便宏\nouppercase
也无效\MakeTextUppercase
。这是一个合适的补丁。
\documentclass[12pt, a4paper]{report}
\usepackage[a4paper, left=3cm, right=2.5cm, top=3cm, bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\renewcommand{\baselinestretch}{1.5}
\usepackage{fancyhdr}
\usepackage{ifthen}
\usepackage[symbols,nogroupskip,sort=none]{glossaries-extra}
\usepackage{etoolbox}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{16pt}
\fancyhead[LE,LO]{\nouppercase{\leftmark}}
\fancyhead[RE,RO]{\thepage}
\renewcommand{\footrulewidth}{0.5pt}
\fancyfoot[L]{%
\ifthenelse{\isodd{\value{page}}}
{{\scriptsize Some text 1. Word Capítulo.}}
{{\scriptsize Capítulo. Word Capítulo. Conclusão.}}%
}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
%\glsxtrnewsymbol[description={some symbol}]{A}{\ensuremath{A}}
%% fix the wrong uppercasing
\makeatletter
\patchcmd\f@nch@reset
{\let\uppercase}
{%
\let\MakeTextUppercase\relax
\expandafter\let\csname MakeTextUppercase \endcsname\relax
\let\uppercase
}
{}{}
\makeatother
\begin{document}
\renewcommand{\contentsname}{Sumário}
\tableofcontents
\newpage
\thispagestyle{empty}
%\printunsrtglossary[type=symbols,style=long,title={Lista de Símbolos}]
\chapter{Este é o início}
\label{inicio1}
Problem in the next page. Capítulo word.
\newpage
Words.
\end{document}