3

I would like to control multiple sub figures width in a single figure, and then set them to the default afterwards, MWE:

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{duckuments}
\usepackage{graphicx}
\newsubfloat{figure}
\begin{document}

\begin{figure}
    \centerfloat
    \subbottom[]{\includegraphics{example-image-duck}}~%
    \subbottom[]{\includegraphics{example-image-duck}}
    \caption{This figure should be of normal width \label{fig}}
\end{figure}


\setkeys{Gin}{width=0.6\textwidth}
\begin{figure}
    \centerfloat
    \subbottom[]{\includegraphics{example-image-duck}}~%
    \subbottom[]{\includegraphics{example-image-duck}}
    \caption{This figure should be wider than in figure \ref{fig}}
\end{figure}
\setkeys{Gin}{} %What should I write here to free the width????

\begin{figure}
    \centerfloat
    \subbottom[]{\includegraphics{example-image-duck}}~%
    \subbottom[]{\includegraphics{example-image-duck}}
    \caption{This figure should be of normal width, like figure \ref{fig}}
\end{figure}

\end{document}

The above produces: enter image description here

1
  • Great picture selection!
    – Skillmon
    Commented May 8, 2019 at 8:03

1 Answer 1

4

The easiest is to put the Gin setting inside the figure, then it will be reset at the end of the group. But beside this: The default value is !:

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{duckuments}
\usepackage{graphicx}
\newsubfloat{figure}
\begin{document}


\begin{figure}
    \centerfloat
    \subbottom[]{\includegraphics{example-image-duck}}~%
    \subbottom[]{\includegraphics{example-image-duck}}
    \caption{This figure should be of normal width \label{fig}}
\end{figure}


\setkeys{Gin}{width=0.6\textwidth}
\begin{figure}

    \centerfloat
    \subbottom[]{\includegraphics{example-image-duck}}~%
    \subbottom[]{\includegraphics{example-image-duck}}
    \caption{This figure should be wider than in figure \ref{fig}}
\end{figure}
\setkeys{Gin}{width=!} %What should I write here to free the width????

\begin{figure}
    \centerfloat
    \subbottom[]{\includegraphics{example-image-duck}}~%
    \subbottom[]{\includegraphics{example-image-duck}}
    \caption{This figure should be of normal width, like figure \ref{fig}}
\end{figure}

\end{document}

enter image description here

1
  • Thank you very much, I'll accept the answer sometime after the timelimit has expired ;-) Commented May 8, 2019 at 8:02

You must log in to answer this question.

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