페이지 중앙에 그림 찾기

페이지 중앙에 그림 찾기

나는 "elsarticle" 클래스를 사용하고 페이지 중앙에서 그림(PDF 파일)을 찾기 위해 다음 코드를 사용합니다.

\begin{figure}\label{Fig:7}
\centering
{\includegraphics[width=17cm,height=20cm,keepaspectratio]{Figs/f}}
\caption{Caption.} 
\end{figure}

그러나 아쉽게도 그 그림은 중앙에 배치되지 않고 페이지 오른쪽으로 기울어져 있습니다. 특히, 이미지 크기가 커지면 이미지의 일부가 페이지 오른쪽에 숨겨집니다. 이것은 이전 게시물 중 하나의 솔루션이지만 나에게는 작동하지 않습니다. 어떻게 수정될 수 있나요?

업데이트 @Mico가 제안한 솔루션은 다음과 같은 결과를 생성합니다.

답변1

elsarticle클래스에 옵션이 로드된 경우 텍스트 블록의 기본 너비는 345pt=12.125cm입니다. 설정을 고집하면 width=17cm너비가 4.875cm인 그래픽밖에 얻을 수 없습니다. 나를 믿지 못합니까? 일부 \hbox가 138.69684pt너무 넓다 는 경고를 찾을 수 있는 로그 파일을 참조하십시오 . 빠른 계산을 통해 138.69684pt=4.875cm.

무엇을 해야 할까요? 내가 이미 의견에서 제안한 대로 수행하십시오. 즉, 교체하십시오.

\includegraphics[width=17cm,height=20cm,keepaspectratio]{Figs/f}

~와 함께

\includegraphics[width=\textwidth,height=0.95\textheight,keepaspectratio]{Figs/f}

height=0.95\textheight말보다는 왜 height=1\textheight? 캡션을 위한 공간을 확보해야 하기 때문입니다.


전체 MWE(최소 작업 예):

\documentclass[demo]{elsarticle} % remove 'demo' option in real document
\usepackage{graphicx}
\begin{document}
\begin{figure}[p]
\centering
\includegraphics[width=\textwidth,
                 height=0.95\textheight, % leave space for caption
                 keepaspectratio]%
                {Figs/f}
\caption{Caption.}  
\label{Fig:7x} % always place \label after, not before, \caption
\end{figure}
\end{document}

관련 정보