Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a tabular array of four images and I am not able to center it. My images are pushed towards the right edge of the sheet. The centering looks fine for single images , so I am guessing this issue is of centering starting from the margin. How do I make an visually pleasing centering of my images.

\begin{center}

\begin{table}[h]
\begin{tabular}{cc}
\textbf{blah}  & \textbf{text} $m=\pi,n=e$  \\
\includegraphics[height=45mm]{liss0.png} &
\includegraphics[height=45mm]{liss1.png} \\ 
\includegraphics[height=45mm]{liss2.png} & 
\includegraphics[height=45mm]{liss3.png} \\
\textbf{text} & text

\end{tabular}
\end{table}
\end{center}

I would not mind if my image breaks a little off into the left margin.

share|improve this question
add comment

5 Answers

up vote 3 down vote accepted

It's by no means necessary to insert tabular environments in table environments. It appears that you are trying to typeset a "here table", so that it can't float. Then

\begin{center}
\begin{tabular}{@{}cc@{}}
\textbf{blah}  & \textbf{text} $m=\pi,n=e$  \\
\includegraphics[height=45mm]{liss0} &
\includegraphics[height=45mm]{liss1} \\ 
\includegraphics[height=45mm]{liss2} & 
\includegraphics[height=45mm]{liss3} \\
\textbf{text} & text
\end{tabular}
\end{center}

is probably what you need. In case you are satisfied with making the images sticking into the margins, add \makebox[0pt]{ in front of \begin{tabular} and the closing } immediately following \end{tabular}.

However, this might spoil your pagination, if this object falls near a page break. You may consider to use a floating table environment and the subfig or subcaption packages.

share|improve this answer
add comment

Here's an option using the subcaption package which egreg mentioned. From the documentation:

After loading the subcaption package the new environments subfigure and subtable are available, which have the same (optional & mandatory) arguments as the minipage environment. Inside these environments you use the ordinary \caption command for typesetting captions.

example (not from documentation)

\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}
    \begin{subfigure}{0.49\textwidth}
        \centering
        \rule{30pt}{20pt}
        %\includegraphics[height=45mm]{liss0.png}
        \caption{}
    \end{subfigure}
    \begin{subfigure}{0.49\textwidth}
        \centering
        \rule{30pt}{20pt}
        %\includegraphics[height=45mm]{liss1.png}
        \caption{}
    \end{subfigure} \\
    \begin{subfigure}{0.49\textwidth}
        \centering
        \rule{30pt}{20pt}
        %\includegraphics[height=45mm]{liss2.png}
        \caption{}
    \end{subfigure}
    \begin{subfigure}{0.49\textwidth}
        \centering
        \rule{30pt}{20pt}
        %\includegraphics[height=45mm]{liss3.png}
        \caption{}
    \end{subfigure}
    \caption{}
\end{figure}
\end{document}
share|improve this answer
add comment

Try the following:

  • remove the \begin{center} and \end{center} instructions
  • insert the instruction \centering right before \begin{tabular}
  • insert a \\ after the final "text" string and remove the blank line before \end{tabular}

I notice that the text header for the second column is quite a bit wider than the one for the first column; depending on the width of the graphics files, this may also affect the visual appearance of the efforts to place the images on a sheet of paper.

share|improve this answer
add comment

use

\begin{table}[!htb]\centering
\begin{tabular}{@{}c c@{}}
\textbf{blah}  & \textbf{text} $m=\pi,n=e$  \\
\includegraphics[height=45mm]{liss0} &
\includegraphics[height=45mm]{liss1} \\ 
\includegraphics[height=45mm]{liss2} & 
\includegraphics[height=45mm]{liss3} \\
\textbf{text} & text
\end{tabular}
\end{table}

and if the images wider than 0.5\textwidth then you should use

\includegraphics[height=45mm,width=0.49\textwidth,keepaspectratio]{...} 
share|improve this answer
add comment

As @egreg suggested (and this was also the solution that first came to my mind :) ), here is an example using subfig:

\documentclass{article}

\usepackage{graphicx}
\usepackage{subfig}

\begin{document}
\begin{figure}
    \centering
%%----start of first subfigure----
    \subfloat[Caption of subfigure 1]{%
        \label{fig:volt1cnv}%% label for first subfigure
        \includegraphics[width=0.4\linewidth]{liss0.PNG}}
    \hspace{0.02\linewidth}
%%----start of second subfigure----
    \subfloat[Caption of subfigure 2]{%
        \label{fig:crt1cnv}%% label for second subfigure
        \includegraphics[width=0.4\linewidth]{liss1.PNG}}\\
%%----start of third subfigure----
    \subfloat[Caption of subfigure 3]{%
        \label{fig:volt1cnv}%% label for first subfigure
        \includegraphics[width=0.4\linewidth]{liss2.PNG}}
    \hspace{0.02\linewidth}
%%----start of fourth subfigure----
    \subfloat[Caption of subfigure 4]{%
        \label{fig:crt1cnv}%% label for second subfigure
        \includegraphics[width=0.4\linewidth]{liss3.PNG}}
    \caption{Caption of entire figure}
    \label{fig:vi1cnv}%% label for entire figure
\end{figure}
\end{document}

Note that the captions for the subfigures are optional parameters. So if you choose not to have any subfigure captions simply omit that one, like here:

\subfloat{%
    \label{fig:crt1cnv}%% label for second subfigure
    \includegraphics[width=0.4\linewidth]{liss3.PNG}}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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