![완전 초보자, 수치에 대한 도움이 필요함](https://rvso.com/image/476248/%EC%99%84%EC%A0%84%20%EC%B4%88%EB%B3%B4%EC%9E%90%2C%20%EC%88%98%EC%B9%98%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%8F%84%EC%9B%80%EC%9D%B4%20%ED%95%84%EC%9A%94%ED%95%A8.png)
저는 완전 초보자입니다. 나는 라텍스에 대해 잘 모른다. 이미지 위치 지정에 도움이 필요합니다. 기본적으로 6개의 그림이 있는데 두 개가 나란히 있는 하위 그림이 되기를 원합니다. 아래에 코드를 삭제하겠습니다.
\begin{figure}[h]
\centering
\begin{subfigure}[t][0.49\textwidth]
\centering
\includegraphics[width=0.49\textwidth]{pt 900/p900.png}
\caption{$p_T$ spectra of p at 900}
\label{fig:1-a}
\end{subfigure}
\hfill
\begin{subfigure}[t][0.49\textwidth]
\centering
\includegraphics[width=0.49\textwidth]{pt 900/pbar900.png}
\caption{$p_T$ spectra of pbar at 900 GeV}
\label{fig:1-b}
\end{subfigure}
\caption{$p_T$ spectra of identified charged particles at 900 GeV}
\label{fig:1}
\end{figure}
\end{document}
나는 하위 그림을 6번 반복했습니다. 문제는 우선 원하는 결과를 얻지 못하고 있다는 것입니다. 둘째, 모든 하위 그림에 대해 이 두 가지 오류가 발생합니다.
<to be read again>
\protect
l.34 \centering
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
<to be read again>
\protect
l.34 \centering
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
제발 누군가 나를 도와주세요. 나는 모든 것을 시도했지만 그것을 알아낼 수 없는 것 같습니다. 나한테는 이게 급히 필요해.
PS: 내 서문
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{float}
\usepackage{hyperref}
답변1
아마도 다른 하위 부동 소수점 관련 패키지의 표기법/구문을 혼합하고 있을 것입니다. 사용할 때subcaption
subfigure
, 환경 과 유사한 환경을 제공 subcaptionblock
하고 단일 필수 인수를 취합니다. 현재 수직 위치 및 너비 인수를 선택 사항으로 제공하고 있는데, 이것이 문제의 원인입니다.
대신 다음을 사용하세요.
\documentclass{article}
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{0.49\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{$p_T$ spectra of p at 900}
\label{fig:1-a}
\end{subfigure}
\hfill
\begin{subfigure}{0.49\textwidth}
\centering
\includegraphics[width=\linewidth]{example-image-b}
\caption{$p_T$ spectra of pbar at 900 GeV}
\label{fig:1-b}
\end{subfigure}
\caption{$p_T$ spectra of identified charged particles at 900 GeV}
\end{figure}
\end{document}
다음 사항에 유의하세요.
subfigure
하위 그림이 배치될 상자의 너비를 정의하는 단일 필수 인수입니다 (내부적으로는 를 사용함subcaptionblock
).블록 너비를 설정하면(예: 로 ) 크기 조정 에
0.49\textwidth
사용할 수 있으며 블록의 전체 너비를 채울 것입니다.width=\linewidth
\includegraphics
두 하위 그림 사이에 공백이 필요한 것 같으므로
\centering
필요 하지 않습니다\hfill
.