我正在用 LaTex 编写文档,但是标题有问题。我需要在文件标题中插入两张图片以及几行文本。到目前为止,我的代码:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{graphicx}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\includegraphics{departamentulCalc.png}
}
\fancyhead[RE,LO]{\includegraphics{SIglaUTCN.png}
}
\setlength\headheight{61pt}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\begin{document}
\section{First Section}
Hello, here is some text without a meaning. This
text should show what a printed text will look like at
this place. If you read this text, you will get no information.
Really? Is there no information? Is there a difference between
this ...
\end{document}
有办法修复这个问题吗?谢谢!
答案1
您的代码(在回答此问题时)不可编译。我认为它应该是这样的
\documentclass[twoside]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{graphicx}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{26pt}
\fancyhead[LE,RO]{
\includegraphics{departamentulCalc.png}
}
\fancyhead[RE,LO]{
\includegraphics{SIglaUTCN.png}
}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\begin{document}
\section{First Section}
Hello, here is some text without a meaning. This
text should show what a printed text will look like at
this place. If you read this text, you will get no information.
Really? Is there no information? Is there a difference between
this ...
\end{document}
当你编译它时,你会收到一些类似这样的警告:
Package Fancyhdr Warning: \headheight is too small (26.0pt):
Make it at least 60.70523pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
严格按照它告诉你的去做:\setlength\headheight{61pt}
。它会解决问题。
\documentclass[twoside]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{graphicx}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{61pt}
\fancyhead[LE,RO]{
\includegraphics[scale=.5]{example-image-duck}
}
\fancyhead[RE,LO]{
\includegraphics[scale=.5]{example-image-duck}
}
\fancyfoot[CE,CO]{\leftmark}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
\begin{document}
\section{First Section}
Hello, here is some text without a meaning. This
text should show what a printed text will look like at
this place. If you read this text, you will get no information.
Really? Is there no information? Is there a difference between
this ...
\end{document}