0

I've tried many hints however, none of them worked. Would you help me to fix this? Another thing, please, how can I add a rule under every headnote in every page?

I am using the preamble below:

\documentclass[12pt, a4paper, dutch]{article}
    
    \usepackage{graphicx}
    
    \graphicspath{figures}
    
    \usepackage{geometry}
    
    \geometry{
        paper=a4paper, % Change to letterpaper for US letter
        inner=3cm, % Inner margin
        outer=3cm, % Outer margin
        bindingoffset=.5cm, % Binding offset
        top=2cm, % Top margin
        bottom=2cm, % Bottom margin
        % showframe, % Uncomment to show how the type block is set on the page
    }
    
    
    \setlength\parindent{0pt} 
    
    \usepackage{booktabs} 
    
    \usepackage[table]{xcolor}
    
    \usepackage[english]{babel} 
    
    \newcommand{\emptybox}[2][\textwidth]{%
  \begingroup
  \setlength{\fboxsep}{-\fboxrule}%
  \noindent\framebox[#1]{\rule{0pt}{#2}}%
  \endgroup
}
    \usepackage{fancyhdr}
    
    \pagestyle{fancy}
    
    \fancyhf{}
    
    \lhead{\begin{minipage}[c]{1cm}
            %\includegraphics[width=1.5cm]{image1.png}
        \end{minipage}
        \begin{minipage}[l]{5cm}
            \scriptsize
            %{\scriptsize University} \\
            {\scriptsize Abbi Aled Acupuncture}
        \end{minipage}
        }
    
   \rhead{\emptybox[3cm]{3cm}}
    
    
    
    
    \newcommand{\HRule}{\rule{\linewidth}{0.05mm}}
    
    
    
    \begin{document}
    
    \begin{center}
        \textbf{\large Clinical Record \\ Anamnesis in Traditional Chinese Medicine}\\
    \end{center}
    
    
    \begin{tabular}{l|p{0.728\textwidth}} 
        \toprule
         Name &  \\
         \midrule
         Address &  \\
         \midrule
         Telephone &  \\
         \midrule
         Passport Number &  \\
         \midrule
         E-mail &  \\
         \midrule
         Date of birth &  \\
         \midrule
         Age &  \\
         \midrule
         Marital status &  \\
         \midrule
         Sex &  \\
         \midrule
         Ethnicityt &  \\
         \midrule
         Weight &  \\
         \midrule
         Height &  \\
         \midrule
         Profession &  \\
         \midrule
         Religion &  \\
         \midrule
         Forwarded by &  \\
         \bottomrule
    \end{tabular}
    
    
    \pagebreak
    %---------------------------------------------------------------------------------------------
    
    
    
    \end{document}    

But, I have a problem here:

enter image description here

8
  • 2
    please upload a minimal exmaple which can compile
    – js bibra
    Feb 18 at 15:37
  • Would you please check if now is compiling?
    – Francesca
    Feb 18 at 15:45
  • Please replace Picture1.png and image2.png, e.g., by an example image of package mwe. You can scale it using scale or width or height options to you needs. Or remove the image, if it is not needed to reproduce your problem. Currently we still cannot compile the code. Please see also: I've just been asked to write a minimal working example (MWE), what is that?
    – cabohah
    Feb 18 at 17:44
  • You should read the fancyhdr warning in the log file. I would recommend to either use geometry's option headheight to change the height of the reserved space for the page header, or use \smash{\includegraphics[…]{…} if the image height should be ignored. In both cases, the image could be printed partially outside the page range, if it is too high. So you may also need to increase top value.
    – cabohah
    Feb 18 at 17:51
  • Your additional question about a rule under every page header is unclear, because there is already a rule. See the fancyhdr manual, if you like to increase the thickness of the rule or want to remove it.
    – cabohah
    Feb 18 at 17:54

1 Answer 1

1

As already told in a comment, you should have a look into the log-file of the LaTeX run. You will find there something like:

Package fancyhdr Warning: \headheight is too small (12.0pt): 
(fancyhdr)                Make it at least 89.7083pt, for example:
(fancyhdr)                \setlength{\headheight}{89.7083pt}.
(fancyhdr)                You might also make \topmargin smaller to compensate:

(fancyhdr)                \addtolength{\topmargin}{-77.7083pt}.

This message explains that the space provided for the page header is not high enough for the content used. The height of the page header must therefore be increased. Since you are using the geometry package, you should not do this with \setlength or \addtolength, but rather tell geometry the required height in the options. For this purpose, geometry provides the headheight option (see the manual). In the first step, we assign a suitable value to this option according to the warning:

\documentclass[12pt, a4paper, dutch]{article}
\usepackage{graphicx}
    
\usepackage{geometry}
\geometry{%
  paper=a4paper, % Change to letterpaper for US letter
  inner=3cm, % Inner margin
  outer=3cm, % Outer margin
  bindingoffset=.5cm, % Binding offset
  top=2cm, % Top margin
  headheight=90pt,
  bottom=2cm, % Bottom margin
  % showframe, % Uncomment to show how the type block is set on the page
}
    
\usepackage[english]{babel}% dutch or english???
    
\usepackage{fancyhdr}
\fancyhf{}
\lhead{\begin{minipage}[c]{1cm}
    % \includegraphics[width=1.5cm]{image1.png}
  \end{minipage}
  \begin{minipage}[l]{5cm}
    \scriptsize
    % {\scriptsize University} \\
    {\scriptsize Abbi Aled Acupuncture}
  \end{minipage}
}
\rhead{\includegraphics[width=3cm,height=3cm]{example-image}}
\pagestyle{fancy}
    
\begin{document}
    
\begin{center}
  \large
  \textbf{Clinical Record \\ Anamnesis in Traditional Chinese Medicine}
\end{center}
    
\end{document}    

But as you can see in the result:

first step without overlap

Although the overlap between the page header and the page content has now been removed, the header now protrudes beyond the top edge of the paper. (BTW: Almost the same would happen, if you'd use both commands from the fancyhdr warning.)

So you also need to move the header down. geometry offers several options to, e.g. includehead, headsep, top. You are already using top, so I'd suggest to also increase top:

\documentclass[12pt, a4paper, dutch]{article}
\usepackage{graphicx}
    
\usepackage{geometry}
\geometry{%
  paper=a4paper, % Change to letterpaper for US letter
  inner=3cm, % Inner margin
  outer=3cm, % Outer margin
  bindingoffset=.5cm, % Binding offset
  top=4.5cm, % Top margin
  headheight=90pt,
  bottom=2cm, % Bottom margin
  % showframe, % Uncomment to show how the type block is set on the page
}
    
\usepackage[english]{babel}% dutch or english???
    
\usepackage{fancyhdr}
\fancyhf{}
\lhead{\begin{minipage}[c]{1cm}
    % \includegraphics[width=1.5cm]{image1.png}
  \end{minipage}
  \begin{minipage}[l]{5cm}
    \scriptsize
    % {\scriptsize University} \\
    {\scriptsize Abbi Aled Acupuncture}
  \end{minipage}
}
\rhead{\includegraphics[width=3cm,height=3cm]{example-image}}
\pagestyle{fancy}
    
\begin{document}
    
\begin{center}
  \large
  \textbf{Clinical Record \\ Anamnesis in Traditional Chinese Medicine}
\end{center}
    
\end{document}    

suggested solution

(BTW: Almost the same could happen with only the first command from the fancyhdr warning. But then the bottom margin would become smaller, too. So you would need to additionally use something like \addtolength{\textheight}{-88.7083pt} to reduce the height of the text area and therefore keep the bottom margin.)

Please note: I've removed several code from your example, that is not needed to show the problem or my suggestions. I've also remove setting of \parskip to 0, because this is not really recommended and there are better solutions to not use first line indent of paragraphs (page also available in German). I've also replaced the frame code by an example image of package mwe. Every helper has this package installed and it is also recommended for questioners for easy replacement of images.

1
  • Perfect Cabohah, thank you very much. I had another problem with the footnote, but with the information about \textheight you provided, I solved both. Congratulations. I read about fancyhdr at ctan.org/pkg/fancyhdr?lang=en. However, I misunderstood the commands.
    – Francesca
    Feb 19 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .