1

my code is here

\begin{table}[t]
 \centering
 \bgroup
 \def\arraystretch{1.2}
\begin{tabular}{|c|c|c|} \hline
Frucht graph & Graph $K_3$ & An homomorphism from Frucht graph to $K_3$\\       \hline
\multirow{12}{*}{\includegraphics[height=4cm]{Frucht.eps}} & \multirow{12}{*}{\includegraphics[height=3cm]{K_3.eps}} &  $f(1)$ = Red\\&&$f(2)$ = Blue\\ &&$f(3)$ = Red\\ &&$f(4)$ = Green\\ &&$f(5)$ = Blue\\ &&$f(6)$ = Green\\ &&$f(7)$ = Blue\\ &&$f(8)$ = Red\\ &&$f(9)$=Blue\\&&$f(10)$=Blue\\&&$f(11)$=Red \\&&$f(12)$=Green\\ \hline
\end{tabular}
\egroup
\caption{Graph isomorphism.}
\end{table}

it appears alike this: enter image description here

However, because the line 'An homomorphism from Frucht graph to $K_3$' is too line, it exceed the width of the document. I prefer to break it into two lines, and let 'Frucht graph' and 'Graph K_3' in the center. How can I do it? Thanks!

Ginger
  • 1,427
  • This is basically the same question as http://tex.stackexchange.com/questions/2441/how-to-add-a-forced-line-break-inside-a-table-cell, isn't it? – Torbjørn T. Sep 08 '13 at 08:29

1 Answers1

4

You can nest \tabular environments, and you can use this idea to improve your table in two ways.

To get the line break in the heading just change the head line to this:

Frucht graph & Graph $K_3$ 
& \begin{tabular}{c}An homomorphism from\\Frucht graph to $K_3$\end{tabular}\\ 

Secondly you can use a nested tabular to make the third data cell and therefore avoid the need for the complicated \multirow set up.

You might also like to use some colour in the text with the xcolor package and to make the equations look a bit better by putting the text inside the maths.

Here is a complete example (albeit with my versions of your graphics clipped from your example).

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\noindent
\begin{tabular}{|c|c|c|}
    \hline
    Frucht graph & Graph $K_3$ & \begin{tabular}{c}An homomorphism from\\Frucht graph to $K_3$\end{tabular}
    \\[8pt]
    \hline
    \lower1.6cm\hbox{\includegraphics[width=3cm]{Frucht.png}}
    &
    \lower1.4cm\hbox{\includegraphics[width=3cm]{K3-graph.png}}
    &
    \begin{tabular}{l}
     \\[-6pt]
     $  f(1) = \color{Red}  \text{Red}  $\\
     $  f(2) = \color{Blue} \text{Blue} $\\ 
     $  f(3) = \color{Red}  \text{Red}  $\\ 
     $  f(4) = \color{Green}\text{Green}$\\ 
     $  f(5) = \color{Blue} \text{Blue} $\\ 
     $  f(6) = \color{Green}\text{Green}$\\ 
     $  f(7) = \color{Blue} \text{Blue} $\\ 
     $  f(8) = \color{Red}  \text{Red}  $\\ 
     $  f(9) = \color{Blue} \text{Blue} $\\
     $ f(10) = \color{Blue} \text{Blue} $\\
     $ f(11) = \color{Red}  \text{Red}  $\\
     $ f(12) = \color{Green}\text{Green}$\\[6pt]  
     \end{tabular}
    \\
    \hline
\end{tabular}
\end{document}

Note the adjustments to the line spacing. And the need to put the graphics into boxes and artificially lower the baselines, so that they line up nicely with the nested tabular. You may need to alter the amount that the boxes are lowered by when you use your own graphics.

The output with my versions of your pictures looks like this:

enter image description here

David Carlisle
  • 757,742
Thruston
  • 42,268