![标题规则未位于文本中央,如何修复?](https://linux22.com/image/388365/%E6%A0%87%E9%A2%98%E8%A7%84%E5%88%99%E6%9C%AA%E4%BD%8D%E4%BA%8E%E6%96%87%E6%9C%AC%E4%B8%AD%E5%A4%AE%EF%BC%8C%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%EF%BC%9F.png)
由于某种原因,我添加到文档中的主标尺没有那么长\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
请阅读软件包的文档geometry
(texdoc 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
...