제목 그대로 figure 안에 subfigure를 여러 개 넣을 때 캡션이 길면 붙어있는 현상이 발견되어서 이를 해결하기 위해 방법을 찾았다. stackexchange에서 찾은 내용을 바탕으로 작성한다.
1. subcaption 패키지를 사용할 때
package{subcaption}을 쓰고 있었는데
캡션이 너무 길면 이렇게 찰싹 붙어있는 현상이 있었다.
그림의 크기를 줄여보라는 조언도 있었는데 내가 해본 결과 소용이 없었다.
그래서 subcaption 패키지의 captionsetup을 이용하는 방법이 있었다.
\begin{figure*}[h!]
\captionsetup[subfigure]{position=bottom}
\subcaptionbox{Distribution of training data.
Uncertainty in center of pressure is selected uniformly.\label{fig: dist xcp train}}
{\includegraphics[width=.48\textwidth]{figs/xcp_train_dist}}
\hfill
\subcaptionbox{Distribution of test data. Uncertainty in center of pressure is selected
uniformly. \label{fig: dist xcp test}}
{\includegraphics[width=.48\textwidth]{figs/xcp_test_dist}}
\caption{Distribution information of uncertainty in center of pressure}
\end{figure*}
위 코드를 적용 후
이렇게 떨어뜨릴 수 있다.
2. subfig 패키지 사용
근데 내가 평소에 쓰던 figure 쓰는 방식에 비해 위의 코드 형식은 너무 불편해서
package{subfig}를 써보기로 했다.
\usepackage[margin=20pt]{subfig}
이렇게 package를 import할 때 margin을 설정해준다.
\begin{figure*}
\centering
\subfloat[Distribution of training data. Uncertainty in center of pressure is selected uniformly.]{
\includegraphics[width=0.48\textwidth] {images/contour}%
\label{fig: dist xcp train}
}
\subfloat[Distribution of test data. Uncertainty in center of pressure is selected uniformly.]{
\includegraphics[width=0.48\textwidth] {images/spiral}%
\label{fig: dist xcp test}
}
\end{figure*}
다음과 같이 caption이 잘 떨어져있다.
이 패키지의 장점은 크게 코드 변화 없이도 쉽게 caption의 간격을 둘 수 있다는 점이다.
margin이 없으면
이렇게 캡션이 붙어있는 것을 볼 수 있다.
3. 결론
subfig을 쓰는 게 코드 상으로는 간편하다. subfigure라는 패키지도 있다는데 아래 링크에서 자세하게 설명해주는 거 같아서 나중에 읽고 정리해보겠다!
https://latex-tutorial.com/subfigure-latex/
Subfigure in LaTeX - Full Guide - LaTeX-Tutorial.com
In this tutorial, we are going to see how to deal with subfigure in LaTeX. In case you don't know, subfigures are nothing but a series of figures under the same figure environment.
latex-tutorial.com
'기타 > 논문작성 Writing' 카테고리의 다른 글
[LaTeX] LaTeX로 PPT 만들기 : beamer (1) 자료수집 (0) | 2022.08.15 |
---|---|
[LaTeX] 내가 정의한 함수를 사용할 때 (operatorname) (0) | 2022.05.08 |
[LaTeX] Figure 넣을 때 쓰는 이미지 확장자와 확장자 변환 (0) | 2022.04.30 |
[LaTeX] 알아두면 유용한 문법 (2) matrix 표현 관련 (0) | 2022.03.28 |
[논문작성] comma 쓰는 규칙 (0) | 2022.03.24 |