29 Comments

  1. Michalis

    Cheers, great page and great resource on latex issues overall. It has helped me so many times ;-). Thanks again!

  2. Ana

    I need some help on the use of figures in tables, I have done something like this

    \begin{tabular}{cc}
            \hspace{0.5em}\scalebox{1.25}{\includegraphics[height=7em]{a.png}} &
            \hspace{0.5em}\scalebox{1.25}{\includegraphics[height=7em]{b.png}}
           \end{tabular}\\

    But I cannot put the captions, wherever I try to use the \caption all I get is errors… Any idea to put properly the captions?

    • Hi Ana,

      You will not be able to add a caption to your pictures, since the caption has to go in the floating environment like “figure” or “table”. However, it is not possible to add a floating environment into the cell of a table.
      In the worst case however, you can try to something like this within your cell, even though it is really bad style:

      \parbox{4cm}{\includegraphics[scale=0.1]{image}%
      \addtocounter{figure}{1} \\ %
      Figure \thefigure: bla%
      \addcontentsline{lof}{figure}{Figure \thefigure: bla}}
      • 1. Defining a box within the cell
      • 2. Add the image to the cell
      • 3. Increase the image counter
      • 4. Linebreak
      • 5. Add a caption
      • 6. Add caption to the list of figures

      If you want a caption to your “tabular” however, than you simply need to add a floating environment “table” around it.

      Cheers,
      Tom.

  3. You can also wrap your tabular in a figure (at least in TeXLive 2009-7) to get access to a global caption and labels.

    \begin{figure}
    \caption{A table arranging images}
    \centering
    \begin{tabular}{cc}
    \includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
    \newline
    \includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
    \end{tabular}
    \label{tab:gt}
    \caption{some caption here}
    \end{figure}
  4. adam

    Just for the record, with the \captionof{}{} command of the caption package you can also access the global captions and labels without needing to place your figure in a float environment.

    \usepackage{caption}
    
    \centering
    \begin{tabular}{cc}
    \includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
    \newline
    \includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
    \end{tabular}
    \label{tab:gt}
    \captionof{figure}{some caption here}
  5. sarvesh

    Dear Sir, Is there any command to draw curly bracket in figure environment using latex. I want to use it on two vertical box drawn using

    \put(-2,-2){\framebox(2,1)[c]{\shortstack[c]{Detection}}}
    \put(-1,-2){\vector(0,-1){1.0}}
    \put(-2,-4){\framebox(2,1)[c]{\shortstack[c]{Tracking}}}

    Please suggest me.

  6. sarvesh

    Dear Sir,
    Please find herewith the code on which i am working. I wanted to cover the “motion segmentation” and “object classification” block together by using curly bracket to indicate “Human Detection Low-level Vision” statement at right side of curly bracket But i could not do it as the size of curly bracket (using this command {\Bigg\}}) is limited. It just fall short. I want to make it larger to fit according to dimension of my two block as stated above.

    \begin{figure}[!htp]
    \centering
    \setlength{\unitlength}{1.6em}
    \begin{picture}(5.000000,11.0000)(-2.000,-9.0000)
    \scriptsize
    \put(-4.0000,-2.0000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Motion Segmentation}}}
    \put(-1.500,-2.000){\vector(0,-1){0.75000}}
    \put(1.1,-2.5){\Bigg\}}
    \put(1.75,-2.250){\tiny{$Human\;Detection$}}
    \put(1.75,-2.650){\tiny{$(Low-level\;Vision)$}}
    \put(-4.0000,-3.75000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Object Classification}}}
    \put(-1.500,-3.75000){\vector(0,-1){0.75000}}
    \put(-4.0000,-5.5000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Human Tracking}}}
    \put(-1.500,-5.5000){\vector(0,-1){0.75000}}
    \put(1.1,-5.12500){\Big\}}%\bigg\}}
    \put(1.75,-5.0){\tiny{$Human\;Tracking$}}
    \put(1.75,-5.400){\tiny{$(Intermediate-level\;Vision)$}}
    \put(-4.0000,-7.250000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Action Recognition}}}
    \put(-1.500,-7.250000){\vector(0,-1){0.75000}}
    \put(-4.0000,-9.0000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Semantic Description}}}
    \put(1.1,-7.7500){\Bigg\}}
    \put(1.75,-7.350){\tiny{$Behavior\;Understanding$}}
    \put(1.75,-7.7500){\tiny{$(High-level\;Vision)$}}
    \end{picture}
    \caption{\small{A general framework of human motion analysis}}
    \label{fig:featurebaseddecision}
    \end{figure}

    Please help me to get desired output.
    Thanks & Regards

    • Hi Sarvesh,

      I adapted the first brace using TikZ (see code below). You can change the second brace accordingly. You will need to typeset the document twice to get everything right. Cheers, Tom.

      \documentclass[11pt]{article}
      \usepackage{tikz}
      \usetikzlibrary{decorations.pathreplacing}
      \begin{document}
      \begin{figure}[!htp]
      \centering
      \setlength{\unitlength}{1.6em}
      \begin{picture}(5.000000,11.0000)(-2.000,-9.0000)
      \scriptsize
      \put(-4.0000,-2.0000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Motion Segmentation}}}
      \put(1.0,-1.0){\tikz[remember picture] \node[coordinate, xshift=1em] (n1) {};}
      \put(-1.500,-2.000){\vector(0,-1){0.75000}}
      \put(-4.0000,-3.75000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Object Classification}}}
      \put(-4.0000,-3.75000){\tikz[remember picture] \node[coordinate] (n2) {};}
      \begin{tikzpicture}[overlay,remember picture]
            \path (n2) -| node[coordinate] (n3) {} (n1);
            \draw[thick,decorate,decoration={brace,amplitude=3pt}]
                  (n1) -- (n3) node[midway, right=5pt, align=left] {Human Detection\\ Low-level Vision};
        \end{tikzpicture}
      \end{picture}
      \end{figure}
      \end{document}
      • sarvesh

        Dear Sir,
        Thanks a lot for the help. your code is working well on “bare_jrnl.tex V1.3 2007/01/11″ by Michael Shell (http://www.michaelshell.org/).
        But its showing error “1.104 \pgfsetplottension{0.5}” while i am trying to compile it with “ieeecls SPECIFICATION FOR COMMON IEEE STYLES” by Gregory L. Plett, Istvan Kollar.

        Thank you very much for your guidance and help.

        with regards
        Sarvesh

  7. Hi, thanks for this!

    I am trying to place graphics in the last column of a table. The other columns are text, and when I \includegraphics the text in the first three columns ends up at the bottom of the cell, even if I define the cells as paragraph. Is there anything I can do to center the text within the columns?

    • Hi!

      The array package with it’s column type “m” should do the trick. Best, Tom.

      \documentclass[11pt]{article}
      \usepackage{array, blindtext}
      \begin{document}
      \begin{table}[ht]
      \caption{A table arranging  images}
      \centering
      \begin{tabular}{*{2}{m{0.48\textwidth}}}
      \hline
      This is some text&\begin{center}\rule{0.4\textwidth}{0.3\textwidth}\end{center}\\
      \hline
      \blindtext&\begin{center}\rule{0.4\textwidth}{0.3\textwidth}\end{center}\\
      \hline
      \end{tabular}
      \label{tab:gt}
      \end{table}
      \end{document}

Leave a Reply