scrpage2 标题中的 \hbox 未满以及一些提示

scrpage2 标题中的 \hbox 未满以及一些提示

我在追踪 \hbox 未满警告时遇到了问题:

Underfull \hbox (badness 10000) has occurred while \output is active
|
\hbox(10.18913+4.36682)x418.25554
.\rule(10.18913+4.36682)x0.0

这个警告出现在每一页上。我用 --- 线标记了重要的部分。

我根据一个旧的大学标题创建了这个 TeX-Header,它是否存在问题或错误?

多米尼克

这是“完整”文件:

\showboxdepth=\maxdimen
\showboxbreadth=\maxdimen

\pdfoutput=1
\pdftrue
\message{pdfLaTeX}
\documentclass[pdftex,11pt,a4paper,twoside,ngerman]{scrbook}
\usepackage{float}
\usepackage[pdftex]{thumbpdf}
\usepackage[pdftex]{pdflscape}
\usepackage[pdftex]{graphicx}
\usepackage[pdftex]{hyperref}
\usepackage{pdfpages}
\pdfoutput=1
\pdfcompresslevel=9
\DeclareGraphicsExtensions{.pdf,.jpg,.png}

% 
\hypersetup
{
 pdfauthor = {\Autor},
 pdftitle = {\Arbeitstitel},
 pdfsubject = {\Arbeitsbezeichnung, Name},
 pdfproducer = {LaTeX},
 pdfview = FitV,
 pdfstartview = FitV,
 pdfhighlight = /I,
 pdfborder = 0 0 0,
 colorlinks = false,
 bookmarksopen,
 bookmarksopenlevel = 1,
 bookmarksnumbered = false,
 plainpages = false
}%
% 
\usepackage[a4paper,left=3.5cm,right=2.5cm,bottom=3.5cm,top=3cm]{geometry}
\setlength{\headheight}{15pt}
% 
% 
\usepackage{amsmath,amssymb}
\usepackage{flafter}    %float never appears before its position
% 
% 
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{\TPHorizModule}
\textblockorigin{0mm}{0mm}
\usepackage{fix-cm}

\usepackage{scrhack}
% 
% 
\usepackage[german,main=ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
% 
% 
\usepackage[numbers,sort,square]{natbib}
% 
% 
\usepackage[babel,german=quotes]{csquotes}
% 
% 
\usepackage{url}
% 
% 
\usepackage[margin=0pt,font=small,labelfont=bf]{caption}
% 
% 
\usepackage{booktabs}
% 
% 
\usepackage{eurosym}
% 
% 
\usepackage[onehalfspacing]{setspace}
\AfterTOCHead{\singlespacing}
\recalctypearea
% 
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.8}

\parindent=0cm

% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
% -------------------------------------------------------------------
% Header & Footer
\usepackage[automark,nouppercase]{scrpage2}

\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}} 

\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\renewcommand{\headfont}{\normalfont\itshape\fontsize{11}{12}\selectfont}
\renewcommand{\pnumfont}{\normalfont\upshape\fontsize{11}{12}\selectfont}


\newpagestyle{fancy}{(0pt,0pt)                          % Outer header line
                {\pagemark \hfill \headmark}   % Even page header
                {\headmark \hfill \pagemark}   % Odd page header
                {}                            % Onesided page header
                (\textwidth,0.5pt)}                 % Inner header line
                {(0pt,0pt)                 % Inner footer line 
                {}                   % Even page footer
                {}                   % Odd page footer
                {}                  % Onesided page footer
                (0pt,0pt)}                  % Outer footer line

\renewpagestyle{plain}{(0pt,0pt)              % Outer header line
                  {}     % Even page header
                  {}      % Odd page header
                  {}                % Onesided page header
                  (0pt,0pt)}              % Inner header line
                  {(0pt,0pt)     % Inner footer line 
                  {}             % Even page footer
                  {}             % Odd page footer
                  {}             % Onesided page footer
                  (0pt,0pt)}              % Outer footer line

\pagestyle{empty}
% -------------------------------------------------------------------
% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
% 
% 
\usepackage{listings}

\lstdefinestyle{C++}
{
language=C++,
backgroundcolor=\color{BrightGray},
keywordstyle=\tt\bfseries,  %\color{TUGreen}\bfseries,
commentstyle=\color{DarkGray},
stringstyle=\color{red},
showstringspaces=false,
basicstyle=\small\color{black},
numbers=left,
captionpos=b,
tabsize=4,
breaklines=true
}
%
% 
\usepackage[plain,chapter]{algorithm}
\usepackage{algorithmic}

\usepackage{enumerate}
%
% 
\renewcommand{\algorithmicrequire}{\textit{Eingabe:}}
\renewcommand{\algorithmicensure}{\textit{Ausgabe:}}
\floatname{algorithm}{Algorithmus}
\renewcommand{\listalgorithmname}{Algorithmenverzeichnis}
\renewcommand{\algorithmiccomment}[1]{\color{grau}{// #1}}
%
% 
\usepackage{esvect}
\usepackage{paralist}
\usepackage{todonotes}
\usepackage{mathtools}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}

\usepackage{subcaption}

\usepackage{makeidx}
\makeindex

\usepackage{tikz}    

\addto\captionsngerman{
    \renewcommand{\figurename}{Abb.}
    \renewcommand{\tablename}{Tab.}
}

\usepackage{lipsum}

\begin{document}
\pagestyle{fancy}
\lipsum
\end{document}

答案1

问题出在样式重新定义上。当 {} 块没有内容时,Tex 会发出未满警告。要修复它,请用不可见的空格填充它们 -> \hfill

\newpagestyle{fancy}{(0pt,0pt)                          % Outer header line
            {\pagemark \hfill \headmark}   % Even page header
            {\headmark \hfill \pagemark}   % Odd page header
            {\hfill}                            % Onesided page header
            (\textwidth,0.5pt)}                 % Inner header line
            {(0pt,0pt)                 % Inner footer line 
            {\hfill}                   % Even page footer
            {\hfill}                   % Odd page footer
            {\hfill}                  % Onesided page footer
            (0pt,0pt)}                  % Outer footer line

\renewpagestyle{plain}{(0pt,0pt)              % Outer header line
              {\hfill}     % Even page header
              {\hfill}      % Odd page header
              {\hfill}                % Onesided page header
              (0pt,0pt)}              % Inner header line
              {(0pt,0pt)     % Inner footer line 
              {\hfill}             % Even page footer
              {\hfill}             % Odd page footer
              {\hfill}             % Onesided page footer
              (0pt,0pt)}              % Outer footer line

相关内容