标题规则未位于文本中央,如何修复?

标题规则未位于文本中央,如何修复?

由于某种原因,我添加到文档中的主标尺没有那么长\textwidth。它似乎没有居中,但也可能是不对称的,我不知道为什么?

看图片你会看到我的文档处于\showframe模式中并且头部标尺没有像文本框那样宽。

左侧还可以看到主标尺代码。

那么,如何解决这个问题?

在此处输入图片描述

PS;下面的代码示例类似,并重现了headruler问题。

\documentclass[10pt,titlepage,twoside]{article}
\usepackage[a6paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\sloppy
\usepackage{graphicx}

\usepackage{fancybox}
\usepackage{fancyhdr}
\pagestyle{fancy}
    \lhead[]{}
    \chead[]{}
    \rhead[]{}

\usepackage[
    cam,
    width=11.1truecm,
    height=15.4truecm,
    center,
    pdflatex,
    ]{crop}

\usepackage{showframe}
\evensidemargin = -10mm
\oddsidemargin = -11mm
\headsep = 5mm
\textheight = 124mm
\textwidth = 75mm
\marginparwidth = 0pt
\footskip = 5mm

\usepackage{fourier-orns}
\renewcommand\headrule{%
\hrulefill%
        \raisebox{0pt}[10pt][10pt]{%
            \quad%
            \decofourleft%
            \decotwo%
            \decofourright%
            \quad}%
        \hrulefill}

\begin{document}

\maketitle

\section{Introduction}
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.
There is another theory which states that this has already happened.

\begin{figure}[h!]
\centering
\includegraphics[scale=1.7]{universe}
\caption{The Universe}
\label{fig:universe}
\end{figure}

\section{Conclusion}
``I always thought something was fundamentally wrong with the universe'' \citep{adams1995hitchhiker}

\bibliographystyle{plain}
\bibliography{references}
\end{document}

答案1

嗯,在您给出的代码中存在一些问题,例如您没有向我们显示使用的*.bib文件,您没有添加\title并且\author您使用了geometry本地设置......

要解决您的问题,只需删除/注释本地设置:

%\evensidemargin = -10mm % <============================================
%\oddsidemargin = -11mm
%\headsep = 5mm
%\textheight = 124mm
%\textwidth = 75mm
%\marginparwidth = 0pt
%\footskip = 5mm

请阅读软件包的文档geometrytexdoc geometry在您的终端/控制台上输入)并使用软件包选项添加所需的边距等geometry。我把这个留给你...

使用以下更正后的代码

\documentclass[10pt,titlepage,twoside]{article}
\usepackage[% 
  a6paper,
  showframe % <=========================================================
]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[swedish]{babel}
\sloppy
\usepackage{graphicx}

\usepackage{fancybox}
\usepackage{fancyhdr}
\pagestyle{fancy}
    \lhead[]{}
    \chead[]{}
    \rhead[]{}

\usepackage[%
  cam,
  width=11.1truecm,
  height=15.4truecm,
  center,
  pdflatex,
]{crop}

%\evensidemargin = -10mm % <============================================
%\oddsidemargin = -11mm
%\headsep = 5mm
%\textheight = 124mm
%\textwidth = 75mm
%\marginparwidth = 0pt
%\footskip = 5mm

\usepackage{fourier-orns}
\renewcommand\headrule{%
\hrulefill%
\raisebox{0pt}[10pt][10pt]{%
  \quad%
  \decofourleft%
  \decotwo%
  \decofourright%
  \quad}%
\hrulefill}


\begin{document}

\title{test}
\author{test}

\maketitle

\section{Introduction}
There is a theory which states that if ever anyone discovers exactly 
what the Universe is for and why it is here, it will instantly disappear 
and be replaced by something even more bizarre and inexplicable.
There is another theory which states that this has already happened.

\begin{figure}[h!]
\centering
\includegraphics[width=5cm]{example-image}
\caption{The Universe}
\label{fig:universe}
\end{figure}

\section{Conclusion}
``I always thought something was fundamentally wrong with the universe'' %\citep{adams1995hitchhiker}

%\bibliographystyle{plain}
%\bibliography{references}
\end{document}

您将获得最终的 pdf:

在此处输入图片描述

顺便说一句:如果您\citep在代码中使用,您应该调用包natbib...我还使用了showframe包选项geometry 而不是包showframe...

相关内容