Oznacz wszystkie rysunki tabelarycznie [duplikat]

Nov 21 2020

Znalazłem ten kod tutaj i muszę wiedzieć, czy ktoś wie, jak oznaczyć wszystkie cyfry, aby móc odnieść się do nich w tekście i pojawić się na przykład: „Na rysunku 1A ...”

\documentclass[12pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{float}

\begin{document}

\begin{figure} [H]
\centering
\begin{tabular}{cccc}
\includegraphics[width=0.3\textwidth]{example-image-a} &
\includegraphics[width=0.3\textwidth]{example-image-b} &
\includegraphics[width=0.3\textwidth]{example-image-c} \\
\textbf{(a)}  & \textbf{(b)} & \textbf{(c)}  \\[6pt]
\end{tabular}
\begin{tabular}{cccc}
\includegraphics[width=0.3\textwidth]{example-image-a} &
\includegraphics[width=0.3\textwidth]{example-image-b} \\
\textbf{(d)}  & \textbf{(e)}  \\[6pt]
\end{tabular}
\caption{ \textbf{(a)} Some text
\textbf{(b)} Some text
\textbf{(c)} Some text
\textbf{(d)} Some text
\textbf{(e)} Some text}
\label{fig:Name}
\end{figure}

\end{document}

Odpowiedzi

2 gernot Nov 21 2020 at 18:57

Jeśli masz kontrolę nad obrazkami i ich etykietami, to zdecydowanie powinieneś zastosować podejście opisane w odpowiedziach na pytanie Jak tworzyć, podpisywać, oznaczać i odnosić się do podrysów? .

Jeśli pięć obrazów i ich podpisy to pojedynczy obraz, którego nie chcesz analizować, możesz zdefiniować polecenie \extralabel{labelname}{subnumber}w preambule:

\makeatletter
\newcommand\extralabel[2]{{\edef\@currentlabel{\@currentlabel#2}\label{#1}}}
\makeatother

a później może odnosić labelnamesię do \ref.

\documentclass{article}
\makeatletter
\newcommand\extralabel[2]{{\edef\@currentlabel{\@currentlabel#2}\label{#1}}}
\makeatother
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{cccc}
\includegraphics[width=0.3\textwidth]{example-image-a} &
\includegraphics[width=0.3\textwidth]{example-image-b} &
\includegraphics[width=0.3\textwidth]{example-image-c} \\
\textbf{(a)}  & \textbf{(b)} & \textbf{(c)}  \\[6pt]
\end{tabular}
\begin{tabular}{cccc}
\includegraphics[width=0.3\textwidth]{example-image-a} &
\includegraphics[width=0.3\textwidth]{example-image-b} \\
\textbf{(d)}  & \textbf{(e)}  \\[6pt]
\end{tabular}
\caption{ \textbf{(a)} Some text
\textbf{(b)} Some text
\textbf{(c)} Some text
\textbf{(d)} Some text
\textbf{(e)} Some text}
\label{fig:Name}
\extralabel{fig:Name:a}{(a)}
\extralabel{fig:Name:b}{(b)}
\extralabel{fig:Name:c}{(c)}
\extralabel{fig:Name:d}{(d)}
\extralabel{fig:Name:e}{(e)}
\end{figure}

See subfigures \ref{fig:Name:a}, \ref{fig:Name:b}, \ref{fig:Name:c}, \ref{fig:Name:d}, \ref{fig:Name:e}.


\end{document}

3 gernot Nov 21 2020 at 19:14

Jeśli masz kontrolę nad pięcioma obrazkami i ich podpisami, możesz pozwolić, aby subcaptionpakiet obsługiwał podtytuły i podbitki.

\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
  \centering  
\begin{tabular}{ccc}
  \subcaptionbox{\label{fig:Name:a}}{\includegraphics[width=0.3\textwidth]{example-image-a}} &
  \subcaptionbox{\label{fig:Name:b}}{\includegraphics[width=0.3\textwidth]{example-image-b}} &
  \subcaptionbox{\label{fig:Name:c}}{\includegraphics[width=0.3\textwidth]{example-image-c}}
\end{tabular}
\medskip

\begin{tabular}{cc}
  \subcaptionbox{\label{fig:Name:d}}{\includegraphics[width=0.3\textwidth]{example-image-a}} &
  \subcaptionbox{\label{fig:Name:e}}{\includegraphics[width=0.3\textwidth]{example-image-c}}
\end{tabular}
\medskip

\caption{ \textbf{(a)} Some text \ref{fig:Name:b}
\textbf{(b)} Some text
\textbf{(c)} Some text
\textbf{(d)} Some text
\textbf{(e)} Some text}
\label{fig:Name}
\end{figure}

See subfigures \ref{fig:Name:a}, \ref{fig:Name:b}, \ref{fig:Name:c}, \ref{fig:Name:d}, \ref{fig:Name:e}.

\end{document}