하위 그림의 레이블

하위 그림의 레이블

그림 1a 대신 그림 1(a)와 같은 레이블을 텍스트로 작성하는 방법.

\documentclass[a4paper,aps,12pt]{revtex4-1}
\usepackage{floatrow}   
\usepackage{subfig}
\usepackage{caption}
\floatsetup[figure]{style=plain,subcapbesideposition=top}   


\usepackage{amsmath}
\usepackage{amsfonts} %for \mathfrak & \mathbb
\usepackage[top=2cm, bottom=2cm,left=1.5cm, right=2cm]{geometry}
\usepackage{graphicx}
\graphicspath{ {myfigures/} }
\usepackage{fancyhdr}
\usepackage{afterpage}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage[modulo]{lineno}
\modulolinenumbers[5]%prints every 5 lines
\renewcommand\linenumberfont{\normalfont\footnotesize\sffamily}
\renewcommand{\baselinestretch}{1.5}
\usepackage{hyperref} %To hyperlink
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,      
urlcolor=cyan,
citecolor=blue
 }    
\usepackage{placeins} % for \FloatBarrier
\renewcommand{\baselinestretch}{1.5}
\setlength{\parindent}{.6cm}
\setlength{\parskip}{0cm}% line spacing for first line in paragraph 
\newcommand{\Author}[2][2]{\begin{center}{{#1, #2}}\end{center}}
\def\Faculty#1#2{\begin{center}{{#1}}, {#2}\end{center}}
\usepackage{ragged2e}
\DeclareCaptionJustification{justified}{\justifying} 
\captionsetup{justification=justified,singlelinecheck=false, position=top, labelfont=large, labelformat=simple}  
\begin{document}
\begin{figure}[h]\centering
      \sidesubfloat[]{\includegraphics[width = 0.5\textwidth]{1a.pdf}   \label{fig:figzoda}}\\[-30pt]
      \sidesubfloat[]{\includegraphics[width = 0.5\textwidth]{1b.pdf}   \label{fig:figzodb}}\\[-30pt]
      \sidesubfloat[]{\includegraphics[width = 0.5\textwidth]{1c.pdf}   \label{fig:figzodc}}


    \end{figure}

\end{document}

답변1

기본적으로 하위 그림에 대한 참조는 문자(예: "a")로만 이루어지며 캡션 레이블은 괄호로 묶입니다. 따라서 괄호를 참조로 이동하려면 이를 일반 표시 형식에 추가하고 캡션 레이블 형식에서 제거하여 이를 변경해야 합니다. 예:

\documentclass[a4paper,aps,12pt]{revtex4-1}
\usepackage[demo]{graphicx}

\usepackage[caption=false,labelformat=simple]{subfig}
  % "labelformat=simple" removes the parenthesis from the caption label
\renewcommand\thesubfigure{(\alph{subfigure})}
  % This one adds parenthesis to the display format

\begin{document}
\ref{fig:figzoda} % Prints now "1(a)"
\begin{figure}[h]\centering
      \subfloat[]{\includegraphics[width = 0.5\textwidth]{1a.pdf}   \label{fig:figzoda}}
      \subfloat[]{\includegraphics[width = 0.5\textwidth]{1b.pdf}   \label{fig:figzodb}}
      \subfloat[]{\includegraphics[width = 0.5\textwidth]{1c.pdf}   \label{fig:figzodc}}
      \caption{Test}
\end{figure}
\end{document}

패키지가 현재 RevTeX 문서 클래스와 완전히 호환되지 않기 때문에 패키지 caption=false를 로드할 때 옵션을 추가했으며 패키지 subfig의 명시적 로드를 삭제했습니다 .captioncaption

Package caption Warning: Unsupported document class (or package) detected,
(caption)                usage of the caption package is not recommended.
See the caption package documentation for explanation.

관련 정보