0

How can I center a figure vertically within a full page, when using the svmono class? The traditional solutions I found in the forum doensn't seem to work with this class. Please note this is NOT for actual submission to the publisher, but for private use.

Thanks and regards, Jorge.

P.S. The svmono class can be downloaded here.

Example (UPDATED):

\documentclass[graybox,envcountchap,vecarrow,twoside]{svmono}
\usepackage[paperheight=240mm,paperwidth=170mm,top=2.5cm,inner=2.5cm]{geometry}

\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{floatrow}

\begin{document}

% Some text
\lipsum[1-5]

% A figure in an new page
\clearpage
\begin{figure}[p]   %doesn't work
%\begin{figure}[H]  %doesn't work
\centering
\sidesubfloat[]{\includegraphics[height=6cm,width=8cm]{example-image-a}}

\vspace{1cm}
\sidesubfloat[]{\includegraphics[height=6cm,width=8cm]{example-image-b}}
\caption{This figure should be centered vertically}
\end{figure}

% Some text in an new page
\clearpage
\lipsum[6-10]

\end{document}

Actual output: enter image description here

Desired output: enter image description here

  • 1
    If you're writing something for Springer, then leave it alone. It might very well be a design choice from Springer. Remember, you are the content provider, not the document designer. – daleif Oct 16 '18 at 13:55
  • And that also includes messing with the margins, if this is going to be submitted to Springer, then do not mess with the layout given to you even if you do not like it. It is not up to you. (those at the other end gets quite annoyed when authors start to mess with layouts thye have been given to use). – daleif Oct 16 '18 at 13:57
  • Thanks for point that out, daleif. This is actually for private use, not intended to be sent to the publisher of the class. I've updated the question to mention this. – dontpanic Oct 16 '18 at 14:01
  • Then I would use another class, like the standard book, memoir (that's the one we use) or one of the koma classes, don't try to modify something not meant to be modified – daleif Oct 16 '18 at 14:25
  • 1
    What about \clearpage\null\vfil with \begin{figure}[h]? – Sigur Oct 16 '18 at 17:26
2

Here is a way that doesn't use the figure environment but caption package instead:

\documentclass[graybox,envcountchap,vecarrow,twoside]{article}
\usepackage[paperheight=240mm,paperwidth=170mm,top=2.5cm,inner=2.5cm]{geometry}

\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{caption}

%This code makes thhe whole job of vertical centering the image
% #1 includegraphics options
% #2 image name
% #3 image caption
\newsavebox{\mysavebox}
\newlength{\myvspace}
\newcommand\addCenteredImage[3][]{%
\clearpage
\savebox\mysavebox{\vbox{\phantom{.}\par\includegraphics[#1]{#2}}}%
\setlength\myvspace{\dimexpr(\paperheight-\dimexpr(\ht\mysavebox+\dp\mysavebox))/4\relax}%
\phantom{.}\vspace{\myvspace}\par\usebox\mysavebox\captionof{figure}{#3}\clearpage%
}


\begin{document}

% Some text
\lipsum[1-5]

% A figure in an new page
\addCenteredImage[height=10cm,width=10cm]{example-image-a}{This figure should be centered vertically}

\lipsum[6-10]

\end{document}

It is a way with simple commands as far as I can understand them.

The output is the desired of your image.

Edit for subfigures: (After OP's edit)

\documentclass[graybox,envcountchap,vecarrow,twoside]{article}
\usepackage[paperheight=240mm,paperwidth=170mm,top=2.5cm,inner=2.5cm]{geometry}

\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{caption}

%This code makes thhe whole job of vertical centering the image
% #1 includegraphics options
% #2 image name
% #3 image caption
\newsavebox{\mysavebox}
\newlength{\myvspace}
\newcommand\addCenteredImage[1]{%
\clearpage
\savebox\mysavebox{\vbox{\phantom{.}\par #1}}%
\setlength\myvspace{\dimexpr(\paperheight-\dimexpr(\ht\mysavebox+\dp\mysavebox))/4\relax}%
\phantom{.}\vspace{\myvspace}\par\usebox\mysavebox\clearpage%
}


\begin{document}

% Some text
\lipsum[1-5]

% A figure in an new page
\addCenteredImage{%
\centering
\includegraphics[height=3cm,width=8cm]{example-image-a}
\captionof{subfigure}{Test 1}
\vspace{1cm}
\includegraphics[height=3cm,width=8cm]{example-image-b}
\captionof{subfigure}{Test 2}
\captionof{figure}{This figure should be centered vertically}
}

\lipsum[6-10]

\end{document}

Output:

enter image description here

  • The code should work in any class that accepts caption package – koleygr Oct 16 '18 at 14:48
  • Thanks for the solution, koleygr. Unfortunately, this doesn't work for more complex figures (in reality I have many subfloats in my figures). I have updated the MWE to reflect this. – dontpanic Oct 16 '18 at 15:48
  • 1
    @dontpanic, just replace in my whole inludegraphics command with #1, the parameters from [3][] to [1] and.delete the captionof command. Then you may use it with your includegrapcics commands and captionof commands in the place of the new command's argument. Wrote from mobile.. any user with edit rights may edit my post to help you – koleygr Oct 16 '18 at 16:46
  • 1
    @dontpanic... I found a wi-fi here and added the comment's solution for your case (still using caption package) – koleygr Oct 16 '18 at 17:22
2

A page float is typeset using

\vspace*{\@fptop}

<material of the float>

\vspace*{\@fpbot}

The svmono class sets \@fptop to zero, leaving \@fpbot to the default value of 0pt plus 1fil.

Just add the proper setting.

\documentclass[graybox,envcountchap,vecarrow,twoside]{svmono}
\usepackage[paperheight=240mm,paperwidth=170mm,top=2.5cm,inner=2.5cm]{geometry}

\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{floatrow}

\makeatletter
\setlength\@fptop{0pt plus 1fil} % <--- restore the values
\makeatother

\begin{document}

% Some text
\lipsum[1-5]

% A figure in an new page
\clearpage
\begin{figure}[p]   %doesn't work
%\begin{figure}[H]  %doesn't work
\centering
\sidesubfloat[]{\includegraphics[height=6cm,width=8cm]{example-image-a}}

\vspace{1cm}
\sidesubfloat[]{\includegraphics[height=6cm,width=8cm]{example-image-b}}
\caption{This figure should be centered vertically}
\end{figure}

% Some text in an new page
\clearpage
\lipsum[6-10]

\end{document}

enter image description here

1

Thanks everyone for your kind suggestions. The solution proposed by Sigur does the trick (see below). Regards, Jorge.

\documentclass[graybox,envcountchap,vecarrow,twoside]{svmono}
\usepackage[paperheight=240mm,paperwidth=170mm,top=2.5cm,inner=2.5cm]{geometry}

\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{floatrow}


\begin{document}

% Some text
\lipsum[1-5]

% A figure in an new page
\clearpage\null\vfil
\begin{figure}[h]
\centering
\sidesubfloat[]{\includegraphics[height=6cm,width=8cm]{example-image-a}}

\vspace{1cm}
\sidesubfloat[]{\includegraphics[height=6cm,width=8cm]{example-image-b}}
\caption{This figure should be centered vertically}
\end{figure}

% Some text in an new page
\clearpage
\lipsum[6-10]

\end{document} 

Output: enter image description here

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.