
首先,對這個糟糕的標題感到抱歉,但我搜尋了十分鐘,但找不到更好的標題。
我用來fancyhdr
在文件中設定一些自訂頁首和頁尾LaTeX
。
我想讓左上角的圖像與自動產生的標題行重疊。明確地說,我希望艾菲爾鐵塔與下圖中的線條重疊:
我目前獲得此結果的程式碼非常簡單,但我不知道如何解決我的目標:
\fancyhead[L]{\includegraphics[scale=0.15]{logo.png}}
答案1
\raisebox{<len>}[0pt][0pt]{\includegraphics[..]{...}}
與底片一起使用<len>
可將影像拖曳至所需的距離。
這是一個例子:
\documentclass{report}
\usepackage{fancyhdr,graphicx}
\usepackage{lipsum}
\fancyhf{}% Clear fancy header/footer
\fancyhead[L]{\raisebox{-.7\height}[0pt][0pt]{\includegraphics[scale=0.1]{example-image}}}
\fancyhead[R]{\leftmark}
\pagestyle{fancy}
\begin{document}
\chapter{A chapter}
\lipsum[1-5]
\end{document}
在範例中,影像下降了其自身高度的 70% ( \height
)。有關 語法的協助\raisebox
,請參閱source2e
(部分57 個 LaTeX 框指令,第 232 頁):
\raisebox{<distance>}[<height>][<depth>]{<box>}
:
<box>
按長度升高(如果為<distance>
負則降低)。使 TeX 認為新框<height>
在線上上方和<depth>
下方延伸,總垂直長度為<height>
+<depth>
。<height>
&的預設值<depth>
= 新位置中框的實際高度和深度。