サブ図のラベル

サブ図のラベル

テキストで図 .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(パッケージの明示的なロードを削除しましたcaption)たことに注意してください。caption

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.

関連情報