0

Good Afternoon LaTeX community!

I am currently writing a lab document and have formatted a subfigure with four different plots all under one figure. However when reading from the graph it only labels each entry as (a), (b),etc. Is there any way I can code it to read as (1a), (1b),(1c), etc so my reader can refer to the correct plot AND figure? Any help would be appreciated! I have attached my code to this post as well.

\begin{figure}[H]
\centering
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{pictures/Fig1.png}
    \caption{Gyroscope Open-Loop Response.}
    \label{fig:fig1a}
  \end{subfigure}
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{pictures/Fig2.png}
    \caption{Gyroscope PI Control ON response tracking at $\alpha = 2 deg$.}
    \label{fig:fig1b}
  \end{subfigure}

  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{pictures/Fig3.png}
    \caption{Relative gyro motion $\alpha$.}
    \label{fig:fig1c}
  \end{subfigure}
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{pictures/Fig4.png}
    \caption{System Input Voltage}
    \label{fig:fig1d}
  \end{subfigure}
  \label{fig:EXP1}
\end{figure}

2
  • Also I apologize, I can't seem to format the code into the post. Also, the attached picture does not seem to be showing up.....I'm relatively new to the LaTeX help forums and still have not figured most things out yet! Thanks again! Apr 2, 2020 at 18:25
  • To format the code,just select it in the edit window and click on the pair of braces icon in the toolbar.
    – Bernard
    Apr 2, 2020 at 18:53

1 Answer 1

2

With the subcaption package, it can be done by declaring a new caption label format, and using \captionsetup to assign this label format to subfigures' captions.

Here's an example.

\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage[textwidth=20cm]{geometry}
\DeclareCaptionLabelFormat{withfigure}{(\arabic{figure}#2)}
\captionsetup[sub]{labelformat=withfigure}
\begin{document}
\begin{figure}
\centering
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{example-image}
    \caption{Gyroscope Open-Loop Response.}
    \label{fig:fig1a}
  \end{subfigure}
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{example-image}
    \caption{Gyroscope PI Control ON response tracking at $\alpha = 2 deg$.}
    \label{fig:fig1b}
  \end{subfigure}
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{example-image}
    \caption{Relative gyro motion $\alpha$.}
    \label{fig:fig1c}
  \end{subfigure}
  \begin{subfigure}{8cm}
    \centering\includegraphics[width=8cm]{example-image}
    \caption{System Input Voltage}
    \label{fig:fig1d}
  \end{subfigure}
  \label{fig:EXP1}
\end{figure}

Referencing subfigures \ref{fig:fig1a} and \ref{fig:fig1d} to test also references.
\end{document}

1
  • Thank you very much! This worked like a charm! Apr 2, 2020 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .