문서 제목 페이지의 머리글과 바닥글에 중앙에 그림을 추가하려고 합니다. 제가 방금 워드 프로세싱 프로그램에서 만든 첫 번째 그림과 같아야 합니다.
나는 LaTeX에서 이 아이디어를 실현하기 위해 두 가지 다른 방법을 시도했습니다.
첫 번째는 를 기반으로 했습니다 scrlayer-scrpage
. 이 패키지를 다음 코드와 함께 사용했습니다.
\documentclass{article}
\usepackage{scrlayer-scrpage, graphicx}
\pagestyle{scrheadings}
\clearpairofpagestyles
\chead{\includegraphics{Picture1.png}}
\begin{document}
\centering{Title}
\end{document}
이 코드와 패키지의 결과는 원하는 것과 같지 않았습니다. 이는 제가 이 게시물에 첨부한 두 번째 사진에서도 볼 수 있습니다. 사진이 너무 왼쪽으로 치우쳐 있습니다. 중앙에 있지 않습니다.
그래서 두 번째 방법을 시도했는데, fancyhdr
. 이 패키지를 위해 다음 코드를 개발했습니다.
\documentclass{article}
\usepackage{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[C]{\includegraphics{Picture1.png}}
\begin{document}
\centering{Title}
\end{document}
세 번째 그림에서 볼 수 있듯이 이 패키지와 개발된 코드도 올바른 솔루션이 아닙니다. 그림이 충분히 높지 않고 오른쪽으로 너무 멀리 떨어져 있기 때문입니다.
그렇기 때문에 LaTeX 파일의 머리글과 바닥글에 그림을 중앙에 배치한다는 내 생각을 실현할 수 있는 다른 솔루션이 있는지 묻고 싶습니다.
편집하다:
답변1
이것은 scrlayer-scrpage
. 아마도 background
또는 패키지를 사용하는 더 간단한 것들이 있을 것입니다 tikz
. 이것의 좋은 점은 원할 때마다 이 페이지 스타일을 적용할 수 있다는 것입니다. 많은 클래스와 geometry
(여백) 레이아웃 과 함께 사용할 수 있습니다 . 통치자는 단지 참고용입니다.
\documentclass[a4paper]{mwart}
\usepackage{scrlayer-scrpage}
\usepackage{graphicx,xcolor}
%\usepackage[margin=2cm,includeheadfoot]{geometry}
\DeclareNewLayer[
background,
topmargin,
% align=t,
height=5cm,
%hoffset=7cm,
%addheight=\headheight,
mode=picture,
contents={\includegraphics[height=5cm]{frog.jpg}}
]{top}
\DeclareNewLayer[
background,
bottommargin,
%addheight=\headheight,
mode=picture,
contents={\includegraphics[height=\layerheight,width=\layerwidth]{example-image-b}}
]{bottom}
\DeclareNewLayer[
background,
%outermargin,
%topmargin,
contents=\layercontentsmeasure
]{measurelayer}
%\defpairofpagestyles[plain.scrheadings]{title}{} %use this if you want plain (bottom number) on 1st page
\defpairofpagestyles{title}{}
\AddLayersToPageStyle{title}{top,bottom,measurelayer}
%\DeclareNewPageStyleByLayers{title}{top,bottom,measurelayer} %an alternative you want to create an empty style
\title{asdf} \author{asdf}
\begin{document}
\maketitle
\thispagestyle{title}
\newpage
\setcounter{page}{1}
asdf
\end{document}