전체 페이지에 그림을 넣습니다.

전체 페이지에 그림을 넣습니다.

페이지의 100%를 차지하도록 사진을 포함하고 싶습니다. 가장자리부터 가장자리까지 공백 없이 그림만 표시됩니다. 저는 A4 용지(유럽 스타일)를 사용하고 사진도 A4 형식이므로 문제가 되지 않습니다.

내가 원하는 목표:

  • 한 페이지: 그림으로 가득 차 있습니다.
  • 다음 페이지: 또 다른 작은 그림

그림을 xx(큰) 및 yy(작은)라고 부르겠습니다. 내 관심은 오직 xx에게만 있습니다

나는 이 MWE를 가지고 있다

\documentclass[a4paper]{scrreprt}

\usepackage{geometry}
\usepackage{graphicx}
\pagestyle{empty}
\parindent0pt

\begin{document}

    
\newgeometry{left=0mm, right=0mm, top=0mm, bottom=0mm}
\includegraphics[width=.999\textwidth,height=.999\textheight,keepaspectratio]{xx}

\newgeometry{left=10mm, right=10mm, top=10mm, bottom=10mm}
\includegraphics[width=12cm]{yy}    

\newgeometry{left=0mm, right=0mm, top=0mm, bottom=0mm}
\includegraphics[width=1\textwidth,height=1\textheight,keepaspectratio]{xx}

\newgeometry{left=10mm, right=10mm, top=10mm, bottom=10mm}
\includegraphics[width=8cm]{yy}

\end{document}

첫 번째 사진의 문제는 오른쪽과 아래쪽 가장자리에 작지만 성가신 흰줄이 있다는 것입니다. 두 번째 큰 그림의 문제점은 그림이 있는 실제 페이지 앞에 빈 페이지가 생성된다는 것입니다. 그러나 나는 이유를 모른다. 어떡해?

이것은 내가 사용하는 사진입니다(xx로). yy 사진은 정말 상관하지 않습니다. 문제가 되지 않습니다.

여기에 이미지 설명을 입력하세요

답변1

약간 과잉일 수 있지만 TikZ를 사용하여 이미지 위치를 지정하면 페이지 형상을 앞뒤로 변경하는 것에 대해 걱정할 필요가 없습니다.

페이지를 정확하게 채우고 싶다면 keepaspectratio옵션을 버리겠습니다. 이미지가 약간 왜곡될 수 있지만 이미지 크기가 정확히 맞지 않으면 흰색 가장자리가 나타나지 않습니다.

\documentclass[a4paper]{scrreprt}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[remember picture,overlay,inner sep=0pt,outer sep=0pt]
\node at (current page.center) {\includegraphics[width=\paperwidth,height=\paperheight]{example-image-duck}};
\end{tikzpicture}

\clearpage

next page

\end{document}

답변2

1.0 height=\pageheight가짜 페이지를 배출하지 않으려는 경우에만 사용하십시오. 이미지가 왜곡되지 않도록 하려면 이미지의 가로 세로 비율이 페이지와 동일해야 합니다.

2.0 이미지를 0pt 상자에 넣고 Tikz를 사용하여 페이지 중앙에 배치하거나 LaTeX2e의 shipout 후크를 사용하여 picture.

3.0 모든 여백에 대해 기하학을 0pt로 설정하면 다음을 사용할 수 있습니다.

\newpage
\ExplSyntaxOn
\dim_set:Nn\l_tmpa_dim{\paperwidth/2}
\hspace*{\l_tmpa_dim}\makebox[0pt]{\includegraphics[height=\paperheight]{example-image-duck}}
\ExplSyntaxOff

또는 단순히 \hspace*{105mm}절반인 경우 \pagewidth이 솔루션에는 Tikz가 필요하지 않습니다.

여기에 이미지 설명을 입력하세요

\documentclass[a4paper]{scrreprt}
\usepackage{tikz}
\begin{document}
\null     % leave a blank to view double page in pdf viewer
\newpage  %
\begin{tikzpicture}[remember picture,overlay,inner sep=0pt,outer sep=0pt]
\node at (current page.center) {\makebox[0pt]{\includegraphics[height=\paperheight]{example-image-duck}}};
\end{tikzpicture}
\newpage
\begin{tikzpicture}[remember picture,overlay,inner sep=0pt,outer sep=0pt]
\node at (current page.center) {\makebox[0pt]{\includegraphics[height=\paperheight]{roots}}};
\end{tikzpicture}
\newpage
\begin{tikzpicture}[remember picture,overlay,inner sep=0pt,outer sep=0pt]
\node at (current page.center) {\makebox[0pt]{\includegraphics[width=\paperheight]{roots}}};
\end{tikzpicture}
\newpage
\begin{tikzpicture}[remember picture,overlay,inner sep=0pt,outer sep=0pt]
\node at (current page.center) {\makebox[0pt]{\includegraphics[width=\paperheight,height=\paperheight]{roots}}};
\end{tikzpicture}
\end{document}

관련 정보