3

I want to create a table like

enter image description here

There are 2 cells in the 4th column which are merged vertically on the right side.

While it is easy to merge them on the left side using multirow, I'm at a loss on how to merge on the right side

Here is my source code (using IEEEtran.cls):

\documentclass[conference]{IEEEtran}
% Add the compsoc option for Computer Society conferences.
% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
   \usepackage[pdftex]{graphicx}
  % declare the path(s) where your graphic files are
  % \graphicspath{{../pdf/}{../jpeg/}}
  % and their extensions so you won't have to specify these with
  % every instance of \includegraphics
   \DeclareGraphicsExtensions{.pdf,.jpeg,.png,.eps}
\else
  % or other class option (dvipsone, dvipdf, if not using dvips). graphicx
  % will default to the driver specified in the system graphics.cfg if no
  % driver is specified.
   \usepackage[dvips]{graphicx}
  % declare the path(s) where your graphic files are
  % \graphicspath{{../eps/}}
  % and their extensions so you won't have to specify these with
  % every instance of \includegraphics
   \DeclareGraphicsExtensions{.eps}
\fi

% correct bad hyphenation here
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{lscape}
\usepackage{multirow}
%\usepackage{subfig}
\usepackage{subfigure}
%\usepackage{subcaption}

\usepackage{tikz}
\def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;}

 \documentclass[conference]{IEEEtran}

    \ifCLASSINFOpdf
       \usepackage[pdftex]{graphicx}

       \DeclareGraphicsExtensions{.pdf,.jpeg,.png,.eps}
    \else
       \usepackage[dvips]{graphicx}
       \DeclareGraphicsExtensions{.eps}
    \fi

    % correct bad hyphenation here
    \hyphenation{op-tical net-works semi-conduc-tor}
    \usepackage{lscape}
    \usepackage{multirow}

    \usepackage{subfigure}

    \begin{document}

    \section{Introduction}

    \section{xxx}

    \begin{table}[h]
    \centering
    \begin{tabular}{ |p{0.6cm}|p{1cm}|p{0.6cm}|p{4cm}| }
    \hline
    {\fontsize{7}{60}\selectfont Source IP} & {\fontsize{7}{60}\selectfont Destination IP} & {\fontsize{7}{60}\selectfont CCN Name} & Example Application Scenarios \\
        \hline
    $\times$ & xx & xx& Content requester wants to hide its location/IP \\
        \hline
    dul & $\times$ & lus &  \multirow{2}{*}{Content requester wants to hide its location/IP} \\
        \cline{1-3}
    ddd & $\times$ & lus & \\
        \hline
    $\times$ & Lucus & lus & Content requester wants to hide its location/IP \\
        \hline
    $\times$ & Lucus & lus & Content requester wants to hide its location/IP \\
        \hline
    \end{tabular}
    \caption{xxxx}
    \label{tab:header}
    \end{table}

    \begin{thebibliography}{1}

    \end{thebibliography}

    \end{document}

The result is the width of that two cells are not equal.

11
  • 3
    Have a look at the multirow package: en.wikibooks.org/wiki/LaTeX/… Sep 11, 2013 at 10:46
  • the example only shows when the merged column is on the left. I don't know how to use multirow when the merged column is on the right, as in my case Sep 11, 2013 at 14:30
  • 1
    \multirow goes in the upper cell, leave the lower one empty; it doesn't matter in what column you use it.
    – egreg
    Sep 11, 2013 at 16:21
  • @user1944267 Please, add some code you already have for the merged rows in the first column, so it can be taken as a model for the solution. You asked "where's the \hline?", but nobody can know where you want it.
    – egreg
    Sep 11, 2013 at 16:35
  • thx, pls see the update Sep 11, 2013 at 16:50

2 Answers 2

3

@egreg deserves the glory. Here is a MWE:

\begin{tabular}{l|l|l|l}
a1 & a2 & a3 & a4\\ \hline
b1 & b2 & b3 & \multirow{2}{*}{bc4}\\ \cline{1-3}
c1 & c2 & c3 & \\ \hline
d1 & d2 & d3 & d4
\end{tabular}
9
  • where is the \hline ? Sep 11, 2013 at 16:33
  • Horizontal lines are easy, you already got them, too. But that seems to not be your actual problem. Please ask specific questions in order to get good answers...
    – nplatis
    Sep 11, 2013 at 17:24
  • pls see the pic, s9.postimg.org/9no3ivyjj/table.png. these two cells are not equally spaced Sep 12, 2013 at 8:43
  • @user1944267 I think you might update your question and include a Minimal Example that produced this picture. I believe that after you do so, the problem will get solved in no time.
    – yo'
    Sep 12, 2013 at 9:51
  • 1
    Well, you remove and simplify one thing at a time, until you remove something that "breaks" your problem. For example, section headings and bibliography, as well as some if statements could surely be removed without harm.
    – nplatis
    Sep 12, 2013 at 13:43
0

Try the following code:

\begin{table}[h]
\centering
\begin{tabular}{ |p{0.6cm}|p{1cm}|p{0.6cm}|p{4cm}| }
\hline
{\fontsize{7}{60}\selectfont Source IP} & {\fontsize{7}{60}\selectfont Destination IP} & {\fontsize{7}{60}\selectfont CCN Name} & Example Application Scenarios \\
\hline
$\times$ & v & v & Content requester wants to hide its location/IP \\
\hline
dul & $\times$ & lus &  \multirow{2}{*}{\parbox[t]{4cm}{Content requester wants to hide its location/IP}} \\
\cline{1-3}
ddd & $\times$ & lus & \\
\hline
$\times$ & Lucus & lus & Content requester wants to hide its location/IP \\
\hline
$\times$ & Lucus & lus & Content requester wants to hide its location/IP \\
\hline
\end{tabular}
\caption{xxx }
\label{tab:header}
\end{table}
2
  • Please update tyour previous answer if you need to offer alternatives
    – percusse
    Sep 12, 2013 at 13:47
  • thanks. if I put a lot of words in: \multirow{2}{*}{\parbox[t]{4cm}{ I put a lot of words here}}. it will overlap the below cells. how to deal with this? Sep 12, 2013 at 15:49

You must log in to answer this question.

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