LaTeX에서 배경 이미지를 사용하는 방법은 무엇입니까?

LaTeX에서 배경 이미지를 사용하는 방법은 무엇입니까?

배경 이미지를 사용해야 하는 보고서 하나를 생성 중입니다. 그러나 나는 이미지가 항상 왼쪽에 약간의 여백 공간을 남기기 시작한다는 것을 발견했습니다.

\documentclass{article}
\usepackage{wallpaper}
\usepackage{mdframed}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\begin{document}
 Some content
\ThisLRCornerWallPaper{1.0}{image.jpg}
\end{document} 

전체 페이지를 덮는 배경 이미지를 어떻게 사용할 수 있나요?

답변1

여러 가지 방법으로 이 작업을 수행할 수 있습니다. 세 가지 방법을 더 보여드리겠습니다.

와 함께 tikz:

\documentclass{article}
\usepackage{tikz}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\begin{document}
 Some content
\tikz[remember picture,overlay] \node[opacity=0.3,inner sep=0pt] at (current page.center){\includegraphics[width=\paperwidth,height=\paperheight]{example-image}};
\clearpage
text
\end{document}

와 함께 eso-pic:

\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\begin{document}
 Some content
\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image}};
\clearpage
text
\end{document}

\AddToShipoutPictureBG(대신 \AddToShipoutPictureBG*)은 모든 페이지에 배경을 넣습니다.

패키지 포함 background:

\documentclass{article}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\usepackage[pages=some]{background}

\backgroundsetup{
scale=1,
color=black,
opacity=0.4,
angle=0,
contents={%
  \includegraphics[width=\paperwidth,height=\paperheight]{example-image}
  }%
}
\begin{document}
 \BgThispage
 Some content
 \clearpage
 text
\end{document}

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

답변2

다음은 (상대적으로) 새로운 매크로를 사용하는 솔루션입니다 \AddToHook.

\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}

\AddToHook{shipout/background}{%
    \put (0in,-\paperheight){\includegraphics[width=\paperwidth,height=\paperheight]{mybg.pdf}}%
}

\begin{document}
\lipsum[1-5]
\end{document}

( background이제 패키지는 더 이상 사용되지 않는 매크로를 사용하기 때문에 경고를 표시합니다.)

답변3

특정 페이지의 배경 이미지를 건너뛰는 방법을 한참 찾아보다가 알아낸 것이 있습니다. 나는 이것을 수행하는 가장 좋은 방법은 다음을 사용하는 것임을 발견했습니다.

\usepackage[pages=some]{background}
\backgroundsetup{
scale=0.1,
color=black,
opacity=0.1,
angle=0,
contents={%
  \includegraphics[width=\paperwidth,height=\paperheight]{Picture.png}
  }%
}

----- Page Wanting to Omit -----

Blah Blah Blah

\NoBgThispage % <------- Skips for current page
\BgThispage % <------- Starts bg again for next page

Blah Blah Blah

이것이 누군가에게 도움이 되기를 바랍니다.

관련 정보