하위 캡션 - 그림 옆의 캡션

하위 캡션 - 그림 옆의 캡션

패키지 를 사용하려고 합니다 subcaption(~ 아니다 subfig) 그림 옆에 있는 하위 그림의 레이블을 생성합니다.

비슷한 질문을 많이 찾았지만 모든 답변(예:이 하나) subfigfloatrow. floatrowwith (아래 MWI 참조)를 사용해 보았지만 subcaption동일한 동작을 생성할 수 없습니다. 내가 무엇을 놓치고 있나요?

설명서 subcaption에는 다음과 같이 명시되어 있습니다.

[f]패키지의 하위 자막 기능을 더 자세히 활용하려면 패키지를 caption살펴보세요.floatrow

그러나 매뉴얼에서는 (p.75)를 floatrow사용하여 그림 옆에 캡션의 예만 제공합니다 .subfig

어떤 도움이라도 대단히 감사하겠습니다.

MWE:

\documentclass{scrartcl}

\usepackage{graphicx}
\usepackage[font=footnotesize,figurewithin=none]{caption}
\usepackage{subcaption}
\captionsetup{subrefformat=parens} % will result in references (typeset with \ref) like  1a  but sub-references (typeset with\subref) like  (a)
\usepackage{floatrow}
\floatsetup[subfigure]{style=plain,subcapbesideposition=top}
%\usepackage{subfig} % not compatible with subcaption

\begin{document}

\begin{figure}
  \centering
  \begin{subfigure}[t]{0.7\textwidth}
    \centering
    \includegraphics[width=0.7\textwidth]{example-image-a}
    \caption{}
    \label{subfig:a}
  \end{subfigure}
  \\
  \begin{subfigure}[t]{0.49\textwidth}
    \centering
    \includegraphics[width=\textwidth]{example-image-b}
    \caption{}
    \label{subfig:b}
  \end{subfigure}
  \hfill
  \begin{subfigure}[t]{0.49\textwidth}
    \centering
     \includegraphics[width=\textwidth]{example-image-c}
    \caption{}
    \label{subfig:c}
  \end{subfigure}
  \caption{Caption for all subfigs: \subref{subfig:a},\subref{subfig:b}, \subref{subfig:c}}
  \label{fig}
\end{figure}

\end{document}

MWE의 출력:

MWE의 출력

답변1

작품을 만드는 방법을 알아내는 것보다 floatrow그냥 가짜로 만드는 것이 더 쉬웠습니다.

옵션 [t]subfigure절대 상단이 아닌 첫 번째 기준선을 참조하므로 이 옵션이 수행하는 작업은 캡션 대신 이미지 하단을 정렬하는 것입니다. 상단을 정렬하려면 사용해야 합니다 \raisebox. 사실 이미지를 하위 그림에 넣을 이유가 전혀 없습니다(캡션만 있으면 됩니다).

\raisebox캡션의 기능은 행 사이에 자동으로 간격을 생성하는 것이었습니다.

\documentclass{scrartcl}

\usepackage{graphicx}
\usepackage[font=footnotesize,figurewithin=none]{caption}
\usepackage{subcaption}
\captionsetup{subrefformat=parens} % will result in references (typeset with \ref) like  1a  but sub-references (typeset with\subref) like  (a)
%\usepackage{subfig} % not compatible with subcaption

\newcommand{\sidecaption}[1]% #1 = label name
{\raisebox{\abovecaptionskip}{\begin{subfigure}[t]{1.6em}
  \caption[singlelinecheck=off]{}% do not center
  \label{#1}
\end{subfigure}}\ignorespaces}

\begin{document}

\begin{figure}
  \centering
  \sidecaption{subfig:a}
  \raisebox{-\height}{\includegraphics[width=0.45\textwidth]{example-image-a}}

  \sidecaption{subfig:b}
  \raisebox{-\height}{\includegraphics[width=0.45\textwidth]{example-image-b}}%
  \hfill
  \sidecaption{subfig:c}
  \raisebox{-\height}{\includegraphics[width=0.45\textwidth]{example-image-c}}
  \caption{Caption for all subfigs: \subref{subfig:a},\subref{subfig:b}, \subref{subfig:c}}
  \label{fig}
\end{figure}

\end{document}

데모


이는 측면 캡션의 형식을 지정하는 여러 가지 방법 중 하나일 뿐이라는 점에 유의하세요. 다음은 하위 캡션 패키지를 전혀 사용하지 않습니다. OTOH, 둘 중 하나에 대한 항목을 쓰지 않습니다 \listoffigures.

\newcounter{subfigure}[figure]% not needed with subcaption
\renewcommand{\thesubfigure}{\alph{subfigure}}

\newcommand{\sidecaption}[1]% #1 = label name
{\rule{0pt}{\abovecaptionskip}% create gap between rows
  \refstepcounter{subfigure}%
  \raisebox{-\height}{(\thesubfigure)~}% align
  \label{#1}\ignorespaces}

관련 정보