2

I have many figures: the sizes are the same, but captions are not. How can I fix my problem with the different locations of the figure? Maybe there is an easy way to to that, because I have many figures...

The doc is twosided and single column.

The result should look like here (Since the captions have different lengths, I cannot horizontally align the subfigures), but for one page - one figure, without any subfigures.

Thank you.enter image description here

  • 3
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – ebosi May 19 '17 at 16:57
  • You seem to have two floats that are positionned with (among other) p (i.e., on a dedicated "float page"). Since there are one float (figure + caption) per page, each of them is vertically centered. // You might want to read How to influence the position of float environments like figure and table in LaTeX? for more details. – ebosi May 19 '17 at 16:59
  • 1
    If (1) all figures are inserted with the same height, if (2) all figures are on pages of their own, like in the image, then you could wrap all the figure caption in \begin{minipage}[t][6cm][t]{1.0\linewidth} for some yet to be determined length other than 6cm. The [t] part make sure that the alignment inside the` minipage` is at the top and [6cm] that they all have a height of 6cm. – daleif May 22 '17 at 12:49
  • Duplicate?? tex.stackexchange.com/questions/370183/… – Steven B. Segletes May 22 '17 at 13:14
1

The simplest might be to just wrap the \caption in a minipage of a specific (to be determined) height.

Something like:

 \fbox{\begin{minipage}[t][5cm][t]{1.0\linewidth}
    \caption{This is a short caption}
  \end{minipage}}

I added a \fbox to show the size of this minipage. Of couse the 6cm part has to be adjusted and probably best stored in a length such that we don't have to change 6cm by hand al over the pace (left as an excersize).

Below I've added a MWE showing what this looks like. I've also added how one should redefine \cation to do this automatically. This of course assumes \caption is only used in this contrex, that is no figures that are not full page figures, and no tables.

\documentclass[a4paper]{memoir}
\usepackage{kantlipsum}
\begin{document}

sdf % to get to a LH page

\newpage

% \fbox added to show the size of the caption minipage

\begin{figure}[p]
  \centering
      \rule{0.7\textwidth}{10cm}
      \fbox{\begin{minipage}[t][6cm][t]{1.0\linewidth}
        \caption{\kant*[1]}
      \end{minipage}}
\end{figure}

\clearpage

\begin{figure}[p]
  \centering
  \rule{0.7\textwidth}{10cm}
  \fbox{\begin{minipage}[t][5cm][t]{1.0\linewidth}
    \caption{This is a short caption}
  \end{minipage}}
\end{figure}

\clearpage

% automatic, assumes \caption are only used in constructions like
% above
\let\normalcaption\caption
% this will loose the [] option for \caption
\renewcommand\caption[1]{
  \begin{minipage}[t][5cm][t]{1.0\linewidth}
    % now call the normal caption to make the formatting
    \normalcaption{#1}
  \end{minipage}
}



\begin{figure}[p]
  \centering
  \rule{0.7\textwidth}{10cm}
  \caption{\kant*[1]}
\end{figure}

\clearpage

\begin{figure}[p]
  \centering
  \rule{0.7\textwidth}{10cm}
  \caption{This is a short caption}
\end{figure}
\end{document}

enter image description here

1

enter image description here

\documentclass{article}
\usepackage{graphicx}

\usepackage{lipsum}
%---------------------------------------------------------------%
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
    \begin{figure}[ht]
\vspace*{2cm}
    \centering
\includegraphics[height=0.5\linewidth,width=\linewidth]{example-image-a}
    \caption{\protect\lipsum*[11]}
    \end{figure}

\clearpage
    \begin{figure}[ht]
\vspace*{2cm}
    \centering
\includegraphics[height=0.5\linewidth,width=\linewidth]{example-image-b}
    \caption{short caption}
    \end{figure}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.