
코드를 고려해보세요:
\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\begin{pspicture}(-5,-5)(5,12)%
\psframe[linecolor=black,linewidth=4pt](-5,-5)(5,12)%
\rput(0,3.5){\includegraphics[width=.86\linewidth,height=1.49\linewidth]{example-image-a}}
\end{pspicture}
\end{document}
생산하는
출력은 내가 원하는 것입니다. 하지만 제가 그것을 얻기 위해 사용한 방법은시행 착오. 좀 더 구체적으로 이미지를 중심으로 하여 pspicture
거기 에 (0,3.5)
도달할 때까지 다양한 값을 시도했는데 원하는 결과가 나온 것 같습니다 width=.86\linewidth
.height=1.49\linewidth
pspicture
질문: 제가 설명한 것과 같은 이미지를 자동으로 완벽하게 맞추기 위해 시행착오를 거치지 않고 사용할 수 있는 더 편리한 접근 방식이 있습니까 ?
.xelatex
감사합니다.
답변1
나는 lualatex
. 원점은 왼쪽 아래에 넣어주세요!
\RequirePackage{pdfmanagement-testphase}% For opacity and lualatex
\DocumentMetadata{} % For opacity and lualatex
\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\begin{pspicture}(-5,-5)(5,12)%
\psframe[linecolor=black,linewidth=4pt,dimen=inner](-5,-5)(5,12)%
\rput[lb](-5,-5){\includegraphics[width=10cm,height=17cm]{example-image-a}}
\psframe*[opacity=0.2,linecolor=red](-5,-5)(5,12)
\end{pspicture}
\end{document}
답변2
TeX으로 값을 계산하시겠습니까?
%! TEX program = lualatex
\documentclass[a5paper,12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0.7in,vmargin=0.75in]{geometry}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\begin{pspicture}(-5,-5)(5,12)%
\psframe[linecolor=black,linewidth=4pt](-5,-5)(5,12)%
\rput(0,3.5){\includegraphics[width=\dimexpr10cm-8pt\relax,height=\dimexpr17cm-8pt\relax]{example-image-a}}
\end{pspicture}
\end{document}
여기서 10cm
및는 17cm
해당 좌표를 빼서 계산되며 값의 8pt
두 배입니다 linewidth
. (당신은 또한 쓸 수 있습니다 4pt*2
)