
2개 이상의 하위 피규어로 만든 피규어를 포함시키고 싶습니다. 이것은 내 코드입니다.
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{../figuras/fig1}
\caption{Caption}
\end{subfigure}
\quad
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{../figuras/fig2}
\caption{Caption}
\end{subfigure}
\quad
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{../figuras/fig3}
\caption{Caption}
\end{subfigure}
\caption{Caption}
\end{figure}
그리고 다음 패키지를 가져왔습니다.
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{subcaption}
\usepackage{geometry}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{eucal}
\usepackage{setspace}\singlespacing
모든 \caption 줄에 다음 오류가 있습니다.
누락된 \endcsname이 삽입되었습니다. \caption{Caption} 추가 \endcsname. \caption{캡션}
어떻게 해결할 수 있나요?
답변1
아래 mwe(최소 작업 예제)에서는 귀하의 코드 조각으로 구성했으며, 여기에서 다음과 같이 변경했습니다.
demo
옵션을 추가하세요graphicx
(내가 만들지 않은 이미지 대신 블랙박스를 생성합니다)lipsum
테스트 문서에 더미 텍스트용 패키지 추가- 왼쪽과 오른쪽 텍스트 테두리 사이에 이미지를 등거리로 배치하는
\quad
너비를 바꿉니다 .\hfill
코드를 작성하려면 완료하는 데 도움이 될 수 있는 몇 가지 코드를 추가하세요.음(최소 작업 예)는 다음과 같습니다.
\documentclass[english]{book} % \usepackage[latin1]{inputenc} % better to use \usepackage[utf]{inputenc} % which is newest version of document classes default \usepackage{babel} \usepackage{fancyhdr} \usepackage{subcaption} \usepackage{geometry} \usepackage{makeidx} \usepackage[demo]{graphicx} % in the real document remove option "demo" %\usepackage{latexsym} \usepackage{amssymb} \usepackage{eucal} %\usepackage{setspace}\singlespacing \usepackage{lipsum} % for dummy text, remove in the real document \begin{document} \lipsum[1-5] \begin{figure}[htb] %\centering \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width=\linewidth]{../figuras/fig1} \caption{sub caption} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width=\linewidth]{../figuras/fig2} \caption{sub caption} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width=\linewidth]{../figuras/fig3} \caption{sub caption} \end{subfigure} \caption{Main caption} \end{figure} \lipsum[6-10] \end{document}
이는 다음을 제공합니다:
위에서음그 코드는 오류를 일으키지 않습니다. 문서의 로그 파일을 알 수 없으므로 오류가 어디서 발생했는지 말하기가 어렵습니다. 추가 도움이 필요하면 문서 조각을 위와 같이 작지만 완전한 하나의 문서로 병합하세요.음질문에 추가하세요.
답변2
도움이 되었기를 바랍니다.
\documentclass[12pt,twoside]{book}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{subcaption}
\usepackage{geometry}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{eucal}
\usepackage{setspace}
\singlespacing
\begin{document}
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{../figuras/fig1}
\caption{Caption}
\end{subfigure}
\quad
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{../figuras/fig2}
\caption{Caption}
\end{subfigure}
\quad
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{../figuras/fig3}
\caption{Caption}
\end{subfigure}
\caption{Caption}
\end{figure}
\end{document}
이미지가 없기 때문에 소스 코드에 대해 다음과 같은 출력이 표시됩니다. 참고하실 수 있도록 스크린샷을 첨부합니다.
편집 2: SubFloat
환경을 사용하는 대체 솔루션(13개의 하위 그림이 있는 그림).
\documentclass[12pt,a4paper,twoside,onecolumn]{book}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure*}
\mbox{\subfloat[]{\label{1} \includegraphics[height=2.3cm]{example-image-a}}}
\mbox{\subfloat[]{\label{2} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{3} \includegraphics[height=2.3cm]{example-image-c}}}
\mbox{\subfloat[]{\label{4} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{5} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{6} \includegraphics[height=2.3cm]{example-image-c}}}
\mbox{\subfloat[]{\label{7} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{8} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{9} \includegraphics[height=2.3cm]{example-image-a}}}
\mbox{\subfloat[]{\label{10} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{11} \includegraphics[height=2.3cm]{example-image-c}}}
\mbox{\subfloat[]{\label{12} \includegraphics[height=2.3cm]{example-image-b}}}
\mbox{\subfloat[]{\label{13} \includegraphics[height=2.3cm]{example-image-b}}}
\caption{Normal Models. \protect\subref{subfig:1} SLR. \protect\subref{subfig:2} MLR. \protect\subref{subfig:3} SWR. \protect\subref{subfig:4} OLS. \protect\subref{5} OLS. \protect\subref{6} OS. \protect\subref{7} Ok. \protect\subref{8} hi. \protect\subref{9} hey. \protect\subref{10} MSD. \protect\subref{11} LPY. \protect\subref{12} MSY. \protect\subref{13} Hello.}
\label{fig}
\end{figure*}
\end{document}