1

I am using a documentclass requried by a journal, which also defines the format of a picture. I am using the following code for expanding the figures to the page width and getting badbox error. What am I missing here?

\documentclass[12pt]{spieman}  
\usepackage{graphicx}

\begin{document} 
\section{Introduction}

\begin{figure}[b]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=\textwidth]{pics/figures1.pdf}
\\
\hspace{1.6cm} (a) \hspace{7.4cm} (b) \hspace{2cm}
\end{tabular}
\end{center}
\caption 
{ \label{fig:figures1}
figure caption.} 
\end{figure}

\end{document} 

Thanks for the help.

7
  • You're not taking into account the padding around text at the beginning and at end of the column. Do you really need the tabular environment? Why not simply \begin{figure} \centering \includegraphics[width=\linewidth]{example-image-a}\\ \hspace{1.6cm} (a) \hspace{7.4cm} (b) \hspace{2cm} \caption{\label{fig:figures1}figure caption.} \end{figure}? Commented Oct 27, 2015 at 14:53
  • If a tabular is to be used, remove the padding: \begin{tabular}{@{}c@{}}
    – user31729
    Commented Oct 27, 2015 at 14:58
  • @GonzaloMedina. Yeah, I need it, I guess. It was in the journal sample to have the underlying a and b correctly spaced with caption. Commented Oct 27, 2015 at 14:59
  • Did you try the code I suggested in my comment without the tabular? Commented Oct 27, 2015 at 15:03
  • 1
    @ChristianHupfer OK. Answer added. Commented Oct 27, 2015 at 15:12

1 Answer 1

1

You're not taking into account the padding around text at the beginning and at end of the column; you can remove that space using @{} (notice that I removed the center environment since is not really needed and adds extra vertical spacing):

\begin{figure}
\begin{tabular}{@{}c@{}}
\includegraphics[width=\textwidth]{example-image-a}\\
\hspace{1.6cm} (a) \hspace{7.4cm} (b) \hspace{2cm}
\end{tabular}
\caption{\label{fig:figures1}figure caption.} 
\end{figure}

The use of tabular however is not really necessary, and you could simply use something like

\begin{figure}
\centering
\includegraphics[width=\textwidth]{example-image-a}\\
\hspace{1.6cm} (a) \hspace{7.4cm} (b) \hspace{2cm}
\caption{\label{fig:figures1}figure caption.} 
\end{figure}
0

You must log in to answer this question.

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