
Yo uso hyperref
y autoref
, pero redefino los nombres de autoref. Estoy poniendo nombres de capítulos y secciones en los encabezados de mis páginas usando scrlayer-scrpage
. Hay un espacio no deseado, siempre en el lado izquierdo del título... no importa si estoy en una página par o impar. Es especialmente evidente cuando los nombres de los capítulos o secciones son demasiado largos para caber en el título. En el ejemplo, en principio podrían caber, pero no lo hacen debido al espacio.
Si no cambio el nombre de la autoref
s, todo está bien. ¿Qué está pasando aquí y cómo puedo solucionarlo?
He intentado"gluglú", antes y después del nuevo \...autorefname
, pero eso no ayuda.
\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}
Respuesta1
Puedes 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*
está definido por el paquete scrlfile
que las clases KOMA-Script cargan automáticamente. \renewcaptionname
También es un comando KOMA-Script.
Además, cambiaría la configuración del diseño de página a
\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}}}
Ejemplo:
\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}
Actualizar:Otro ejemplo sobre un comentario:
\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}
Tenga en cuenta que no puede utilizar \MakeTextLowercase
en \setkomafont
o \addtokomafont
. Por lo tanto hay que insertar \spacedlowsmallcaps
en \lehead
cualquier \rohead
.
Respuesta2
Cualquiera de las \renewcommand*{\....autorefname}{...}
declaraciones generará un carácter de espacio adicional ya que se realiza dentro del \extraenglish
lugar donde se llama durante la composición tipográfica y no en el preámbulo.
Agregue un %
al final de cada una de esas líneas.
\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}