1

For some reason the headruler I added in my document isn't as long as the \textwidth. It doesn't seem to be centered but it could also be that it's asymetrical, and I don't know why?

See the picture and you will see my document in \showframe mode and the headruler not stretching as wide as the text box.

To the left the headruler code is also visible.

So, how to fix this?

enter image description here

PS; The following code example is similar and reproduces the headruler problem.

\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}
  • 3
    Your definition starts with a space (and has several other probably unintended spaces). Try adding a comment at the end of lines that don’t end with control words (lines 65, 67, and 73). Adding a complete example people can compile is helpful too. – TH. Dec 29 '18 at 17:28
  • 3
    Please -- asusual here -- show us a complete compilable code resulting in your error we can copy and test on our own computers ... – Mensch Dec 29 '18 at 17:37
  • 1
    @TH: Well seen! – user31729 Dec 29 '18 at 17:38
  • Added some code :) ^^ It's a complex document so started with a screenshot. But yes, a code is a must in order to find problems. – Victor Ekekrantz Dec 29 '18 at 17:49
  • @VictorEkekrantz: Are you really changing layout parameters and using geometry package together? ;-) – user31729 Dec 29 '18 at 17:54
1

Well, in your given code are some issues, for example you did not show us the used *.bib file, you did not add \title and \author and you used geometry and local settings ...

To solve your issue simple delete/comment the local setings:

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

Please read the documentation of package geometry (type texdoc geometry on your terminal/console) and add with package options the needed margins etc. to geometry. I leave this to you ...

With the following corrected code

\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}

you get the resulting pdf:

enter image description here

BTW: If you use \citep in your code you should call package natbib ... I also used option showframe of package geometry instead package showframe ...

  • Wow, nice thanks very much appreciated :) ^^ The showframe in Geometry I found especially neat. I will accept your answer because it was very helpful and will sort out the problem for any future visitor to this thread. – Victor Ekekrantz Dec 29 '18 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.