
Eu uso hyperref
e autoref
, mas redefino os autorefnames. Estou colocando nomes de capítulos e seções em meus cabeçalhos de página usando scrlayer-scrpage
. Há algum espaço indesejado, sempre no lado esquerdo do título... não importa se estou na página par ou ímpar. É especialmente aparente quando os nomes dos capítulos ou seções são muito longos para caber no título. No exemplo, eles poderiam, em princípio, caber, mas não cabem, por causa do espaço.
Se eu não renomear o autoref
s, está tudo bem. O que está acontecendo aqui e como posso consertar isso?
eu tentei"devorando", antes e depois do new \...autorefname
, mas isso não ajuda.
\documentclass[pdfa,a4paper,
11pt,
bibliography=totoc,
numbers=noenddot,
twoside,openright,
parskip=half]{scrbook}
\usepackage{lipsum}
% ********************************************************************
% Languages, Typesetting
% ********************************************************************
\usepackage[ngerman, english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} %windows: latin9, linux: utf8
% ********************************************************************
% page layout
% ********************************************************************
\usepackage[]{scrlayer-scrpage}
\renewcommand{\chapterpagestyle}{empty} % no headings or footings on first chapter page
\renewcommand{\chaptermark}[1]{\markboth{{#1}}{{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\upshape{\thesection}\enspace{#1}}}
\lehead{\mbox{\llap{\small\upshape\thepage\kern2em}\scshape\headmark\hfil}}
\rohead{\mbox{\hfil{\scshape\headmark}\rlap{\small\kern2em\upshape\thepage}}}
\chead{}\ifoot{}\cfoot{}\ofoot{}
\pagestyle{scrheadings}
% ********************************************************************
% Hyperreferences, always load last
% ********************************************************************
\usepackage[]{hyperref}
% Commenting this whole block fixes the problem
\makeatletter
\@ifpackageloaded{babel}
{
\addto\extrasenglish{
\renewcommand*{\figureautorefname}{Figure}
\renewcommand*{\tableautorefname}{Table}
\renewcommand*{\partautorefname}{Part}
\renewcommand*{\chapterautorefname}{Chapter}
\renewcommand*{\sectionautorefname}{Section}
\renewcommand*{\subsectionautorefname}{Section}
\renewcommand*{\subsubsectionautorefname}{Section}
\renewcommand*{\appendixautorefname}{Appendix}
}
}{\relax}
\makeatother
\begin{document}
\part{Intro}
\chapter{Short chapter name}
\lipsum[1]
\section{Short section name}
\lipsum
\lipsum
\chapter{Very long chapter name just not fitting into the headline}
\lipsum[1]
\section{Very long section name just not fitting into the headline}
\lipsum
\lipsum
\end{document}
Responder1
Você pode usar
\AfterPackage*{babel}
{
\renewcaptionname{english}{\figureautorefname}{Figure}
\renewcaptionname{english}{\tableautorefname}{Table}
\renewcaptionname{english}{\partautorefname}{Part}
\renewcaptionname{english}{\chapterautorefname}{Chapter}
\renewcaptionname{english}{\sectionautorefname}{Section}
\renewcaptionname{english}{\subsectionautorefname}{Section}
\renewcaptionname{english}{\subsubsectionautorefname}{Section}
\renewcaptionname{english}{\appendixautorefname}{Appendix}
}
\AfterPackage*
é definido pelo pacote scrlfile
que é carregado automaticamente pelas classes KOMA-Script. \renewcaptionname
também é um comando KOMA-Script.
Além disso, eu alteraria as configurações do layout da página para
\renewcommand{\chapterpagestyle}{empty} % no headers or footers on first chapter page
\usepackage[]{scrlayer-scrpage}
\automark[chapter]{chapter}
\automark*[section]{}
\renewcommand\chaptermarkformat{}% no chapter number in header/footer
\addtokomafont{pagehead}{\scshape}
\addtokomafont{pagenumber}{\small}
\clearmainofpairofpagestyles
\lehead{\mbox{\llap{\pagemark\kern2em}\headmark}}
\rohead{\mbox{{\ifstr{\leftmark}{\rightmark}{}{\upshape}\headmark}\rlap{\kern2em\pagemark}}}
Exemplo:
\documentclass[pdfa,a4paper,
11pt,
bibliography=totoc,
numbers=noenddot,
twoside,openright,
parskip=half]{scrbook}
\usepackage{lipsum}
% ********************************************************************
% Languages, Typesetting
% ********************************************************************
\usepackage[ngerman, english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% ********************************************************************
% page layout
% ********************************************************************
\renewcommand{\chapterpagestyle}{empty} % no headers or footers on first chapter page
\usepackage[]{scrlayer-scrpage}
\automark[chapter]{chapter}
\automark*[section]{}
\renewcommand\chaptermarkformat{}% no chapter number in header/footer
\addtokomafont{pagehead}{\scshape}
\addtokomafont{pagenumber}{\small}
\clearmainofpairofpagestyles
\lehead{\mbox{\llap{\pagemark\kern2em}\headmark}}
\rohead{\mbox{{\ifstr{\leftmark}{\rightmark}{}{\upshape}\headmark}\rlap{\kern2em\pagemark}}}
% ********************************************************************
% Hyperreferences, always load last
% ********************************************************************
\usepackage[]{hyperref}
\AfterPackage*{babel}
{
\renewcaptionname{english}{\figureautorefname}{Figure}
\renewcaptionname{english}{\tableautorefname}{Table}
\renewcaptionname{english}{\partautorefname}{Part}
\renewcaptionname{english}{\chapterautorefname}{Chapter}
\renewcaptionname{english}{\sectionautorefname}{Section}
\renewcaptionname{english}{\subsectionautorefname}{Section}
\renewcaptionname{english}{\subsubsectionautorefname}{Section}
\renewcaptionname{english}{\appendixautorefname}{Appendix}
}
\begin{document}
\part{Intro}
\chapter{Short chapter name}
\lipsum[1]
\section{Short section name}
\lipsum
\lipsum
\chapter{Very long chapter name just not fitting into the headline}
\lipsum[1]
\section{Very long section name just not fitting into the headline}
\lipsum
\lipsum
\end{document}
Atualizar:Outro exemplo sobre um comentário:
\documentclass[pdfa,a4paper,
11pt,
bibliography=totoc,
numbers=noenddot,
twoside,openright,
parskip=half]{scrbook}
\usepackage{lipsum}
% ********************************************************************
% Languages, Typesetting
% ********************************************************************
\usepackage[ngerman, english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage{textcase}
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textls[80]{\scshape\MakeTextLowercase{#1}}}
% ********************************************************************
% page layout
% ********************************************************************
\renewcommand{\chapterpagestyle}{empty} % no headers or footers on first chapter page
\usepackage[]{scrlayer-scrpage}
\automark[chapter]{chapter}
\automark*[section]{}
\renewcommand*\chaptermarkformat{}% no chapter number in header/footer
\renewcommand*\sectionmarkformat{{\small\thesection\autodot\enskip}}% section number using \small
\addtokomafont{pagenumber}{\small}% page number using \small
\clearmainofpairofpagestyles% remove all default entries for page style scrheadings
\lehead{\mbox{\llap{\pagemark\kern2em}\spacedlowsmallcaps{\headmark}}}
\rohead{\mbox{\spacedlowsmallcaps{\headmark}\rlap{\kern2em\pagemark}}}
% ********************************************************************
% Hyperreferences, always load last
% ********************************************************************
\usepackage[]{hyperref}
\AfterPackage*{babel}
{
\renewcaptionname{english}{\figureautorefname}{Figure}
\renewcaptionname{english}{\tableautorefname}{Table}
\renewcaptionname{english}{\partautorefname}{Part}
\renewcaptionname{english}{\chapterautorefname}{Chapter}
\renewcaptionname{english}{\sectionautorefname}{Section}
\renewcaptionname{english}{\subsectionautorefname}{Section}
\renewcaptionname{english}{\subsubsectionautorefname}{Section}
\renewcaptionname{english}{\appendixautorefname}{Appendix}
}
\begin{document}
\part{Intro}
\chapter{Short chapter name}
\lipsum[1]
\section{Short section name}
\lipsum
\lipsum
\chapter{Very long chapter name just not fitting into the headline}
\lipsum[1]
\section{Very long section name just not fitting into the headline}
\lipsum
\lipsum
\end{document}
Observe que você não pode usar \MakeTextLowercase
in \setkomafont
ou \addtokomafont
. Portanto você tem que inserir \spacedlowsmallcaps
em \lehead
qualquer arquivo \rohead
.
Responder2
Qualquer uma das \renewcommand*{\....autorefname}{...}
instruções causará um caractere de espaço extra, pois é feito dentro \extraenglish
do qual é chamado durante a composição e não já no preâmbulo.
Adicione um %
no final de cada uma dessas linhas.
\documentclass[pdfa,a4paper,
11pt,
bibliography=totoc,
numbers=noenddot,
twoside,openright,
parskip=half]{scrbook}
\usepackage{lipsum}
% ********************************************************************
% Languages, Typesetting
% ********************************************************************
\usepackage[ngerman, english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} %windows: latin9, linux: utf8
% ********************************************************************
% page layout
% ********************************************************************
\usepackage[]{scrlayer-scrpage}
\renewcommand{\chapterpagestyle}{empty} % no headings or footings on first chapter page
\renewcommand{\chaptermark}[1]{\markboth{{#1}}{{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\upshape{\thesection}\enspace{#1}}}
\lehead{\mbox{\llap{\small\upshape\thepage\kern2em}\scshape\headmark\hfil}}
\rohead{\mbox{\hfil{\scshape\headmark}\rlap{\small\kern2em\upshape\thepage}}}
\chead{}\ifoot{}\cfoot{}\ofoot{}
\pagestyle{scrheadings}
% ********************************************************************
% Hyperreferences, always load last
% ********************************************************************
\usepackage[]{hyperref}
% Commenting this whole block fixes the problem
\makeatletter
\@ifpackageloaded{babel}
{
\addto\extrasenglish{%
\renewcommand*{\figureautorefname}{Figure}%
\renewcommand*{\tableautorefname}{Table}%
\renewcommand*{\partautorefname}{Part}%
\renewcommand*{\chapterautorefname}{Chapter}%
\renewcommand*{\sectionautorefname}{Section}%
\renewcommand*{\subsectionautorefname}{Section}%
\renewcommand*{\subsubsectionautorefname}{Section}%
\renewcommand*{\appendixautorefname}{Appendix}%
}%
}{\relax}
\makeatother
\begin{document}
\part{Intro}
\chapter{Short chapter name}
\lipsum[1]
\section{Short section name}
\lipsum
\lipsum
\chapter{Very long chapter name just not fitting into the headline}
\lipsum[1]
\section{Very long section name just not fitting into the headline}
\lipsum
\lipsum
\end{document}