wie kann ich im Floatrow-Paket Unterreferenzen erstellen - Hyperref?

wie kann ich im Floatrow-Paket Unterreferenzen erstellen - Hyperref?

Ich habe eine Subfigure-Umgebung, die das Floatrow-Paket verwendet, und ich möchte in meinem Absatz auf jede Figur im Panel einzeln verweisen, und zwar wie folgt:

Abbildung (3a) und Abbildung (3b), aber es funktioniert irgendwie nicht, wenn ich den \subrefBefehl aufrufe.

mein vollständiger Code:

\documentclass[12pt,reqno]{report}
\begin{document}

\usepackage{graphicx}

\usepackage{floatrow}
    \floatsetup[figure]{subcapbesideposition=top}
\usepackage{graphicx}
\usepackage[label font=bf, 
            labelformat=simple]{subfig}
\usepackage{caption}

    \begin{figure}[H]
    \renewcommand\thesubfigure{\Alph{subfigure}}
    \setlength{\labelsep}{2mm}
    \centering
\sidesubfloat[  \label{fig:mHCN2_dime}]%
{
\includegraphics[width=0.4\textwidth]{figs/Fig_edited_figure_A_in_panel.png}\label{fig:a}%
}
\hfill
\sidesubfloat[  \label{fig:non-swapped_mHCN2}]%
{
\includegraphics[width=0.4\textwidth]{figs/mHCN2_cAMP_hidden_rotated_90_non-swapped_packing.png}\label{fig:a}%
}

\caption{Structure of the channel tetramer in the ligand-free state, viewed parallel to the membrane (A) or from the extracellular side (B). Each subunit is shown in a different color. Gray bars represent approximate boundaries of the membrane bilayer.}

\label{fig:mHCN2}
  \end{figure}

\end{document}

Antwort1

Dies stellt eine subcaptionkompatible Version von bereit \sidesubfloat.

Der schwierige Teil besteht darin, dass die Beschriftung (sogar \captiontext) immer den angegebenen Platz ausfüllt. Daher müssen wir den benötigten Platz zunächst messen, indem wir ihn vortäuschen.

\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{subcaption}

\newcommand{\sidesubfloat}[2][\empty]% #1 = caption and \label (optional}, #2 image
{\begin{subcaptiongroup}
  \refstepcounter{subfigure}% get width of caption
  \sbox0{(\thesubfigure)~#1~}% assumed format
  \addtocounter{subfigure}{-1}%
  \sbox1{#2}% get width of image
  \dimen0=\dimexpr \linewidth-\wd1\relax
  \ifdim\dimen0>\wd0
    \dimen0=\wd0
  \fi
  \setbox2=\vbox{\hsize=\dimen0\caption{#1}}%
  \raisebox{\dimexpr \abovecaptionskip+\ht1-\ht2}[\ht1]{\usebox2}#2
\end{subcaptiongroup}}

\begin{document}
    \begin{figure}[ht]
    \renewcommand\thesubfigure{\Alph{subfigure}}
    \setlength{\labelsep}{2mm}
    \centering
\sidesubfloat[  \label{fig:mHCN2_dime}]%
{
\includegraphics[width=0.4\textwidth]{example-image-a}\label{fig:a}%
}
\hfill
\sidesubfloat[  \label{fig:non-swapped_mHCN2}]%
{
\includegraphics[width=0.4\textwidth]{example-image-b}\label{fig:b}%
}

\caption{Structure of the channel tetramer in the ligand-free state, viewed parallel to the membrane (A) or from the extracellular side (B). Each subunit is shown in a different color. Gray bars represent approximate boundaries of the membrane bilayer.}

\label{fig:mHCN2}
  \end{figure}
  
\subref{fig:mHCN2_dime} \subref{fig:a}
\subref{fig:non-swapped_mHCN2} \subref{fig:b}

\ref{fig:mHCN2_dime} \ref{fig:a}
\ref{fig:non-swapped_mHCN2} \ref{fig:b}

\end{document}

Antwort2

Verwenden Sie \ref{fig:a} und \ref{fig:b}(fehlt in Ihrem Code).

A

\documentclass[12pt]{report}

\usepackage{floatrow}
\floatsetup[figure]{subcapbesideposition=top}
\usepackage{graphicx}
\usepackage[label font=bf, labelformat=simple]{subfig}
\usepackage{caption}

\begin{document}        

    \begin{figure}[H]
        \renewcommand\thesubfigure{\Alph{subfigure}}
        \setlength{\labelsep}{2mm}
        \centering
        \sidesubfloat[  \label{fig:mHCN2_dime}]%
        {
            \includegraphics[width=0.4\textwidth]{example-image-a}\label{fig:a}%
        }
        \hfill
        \sidesubfloat[  \label{fig:non-swapped_mHCN2}]%
        {
            \includegraphics[width=0.4\textwidth]{example-image-b}\label{fig:b}%
        }
        
        \caption{Structure of the channel tetramer in the ligand-free state, viewed parallel to the membrane (A) or from the extracellular side (B). Each subunit is shown in a different color. Gray bars represent approximate boundaries of the membrane bilayer.}
                    \label{fig:mHCN2}
    \end{figure}

See subfigures~\ref{fig:a}  and \ref{fig:b}.    
    
\end{document}

verwandte Informationen