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 created this Table:

enter image description here

via the LaTex source code:

\documentclass[onecolumn,amsmath,amssymb,nofootinbib,superscriptaddress,floatfix]{revtex4}   
\begin{document}
    \begin{table}[!h]
    \begin{tabular}{|c ||c| c| c| c|}  
     \hline
    $(d+1)$D \; & \;  $Z$  & \; $UZ1$ & \; $UZ2$ & \; $U$\\  
                   \; & \;   & \;       \;   & \;       \;   & \;   \\ \hline
    $d=0$         \; & \; 0   & \; 0      \;   & \; $Z$       \;   & \;    \\
                      \; & \;   & \;       \;   & \;  $n \in Z$: $n \int A$     \;     & \;  \\   \hline                 
    $d=1$    \; & \; $Z_2$    & \;       \;   & \;       \;   & \;  \\
                  \; & \;  $S_1=\int x_1{}^2$  & \;       \;   & \;    \;   & \;   \\   \cline{2-5}           
                  \; & \; G  & \;     G  \;   & \; G   \;   & \;  G \\   \hline    
    $d=2$       \; & \;   & \;       \;   & \;     \;   & \;   \\
                      \; & \;   & \;       \;   & \;    \;   & \;   \\   \hline    
     \end{tabular}
    \caption{}
    \end{table}

    \end{document}

Question: What I wish is that to join all the G, G, G, G in the d=1 section into one row. That is I wish to remove the three vertical lines (vline) among four G. How to do that?

I try to use this method from the previous post, but it does not work well. The function I tried is

\multicolumn{4}{ l|}{G}

which does not work. I use revtex4, which should not matter too much.

Thank you, please help!

share|improve this question
    
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill May 23 at 23:21
    
please always post complete documents not fragments, but you want \multicolumn{1}{c}{G} for a G in a cell without vertical lines –  David Carlisle May 23 at 23:21
    
@ David, That is true, somehow I add this \; which makes trouble to me. With \; then \; \multicolumn{4}{l|}{G G G G} cannot compile successfully. But remove \;, it works. –  Idear May 23 at 23:42
    
@DavidCarlisle: Yeah, I just covered both cases. But deleted the comment one I saw you had provided the solution. So perhaps we should remove this comment and yours above {1} not {4} as my comment that you are responding to is no longer there. –  Peter Grill May 23 at 23:46
    
\multicolumn has to be the complete cell if you did want \; it would be \multicolumn{1}{c}{\; G\:} not with the \; outside, but better without them at all. –  David Carlisle May 23 at 23:48

2 Answers 2

up vote 4 down vote accepted

This works:

\documentclass{revtex4}
\usepackage{amsfonts}
\newcommand\Z{\mathbb{Z}}
\begin{document}
  \begin{table}[!h]
\begin{tabular}{|c ||c| c| c| c|}
 \hline
$(d+1) D$  &   $Z$  &  $UZ1$ &  $UZ2$ &  $U$\\
                &   &          &          &   \\ \hline
$d=0$          &  0   &  0        & $\Z$        &     \\
                   &    &           &   $n \in \Z$: $n \int A$          &   \\   \hline
$d=1$     &  $\Z_2$    &           &           &   \\
               &   $S_1=\int x_1{}^2$  &           &        &    \\   \cline{2-5}
               &  \multicolumn{4}{l|}{G        G       G         G} \\   \hline
$d=2$        &    &           &         &    \\
                   &    &           &        &    \\   \hline
 \end{tabular}
\caption{}
\end{table}
\end{document}

enter image description here

Instead of using all those \;, if you want some more space, change \tabcolsep like

\setlength{\tabcolsep}{4pt}

and put it just after \begin{table} so that it is made local.

\begin{table}[!h]
\setlength{\tabcolsep}{4pt}
share|improve this answer
    
If not give full MWE and more details. –  Harish Kumar May 23 at 23:29
    
That is true, somehow I add this \; which makes trouble to me. With \; then \; \multicolumn{4}{l|}{G G G G} cannot compile successfully. But remove \;, it works! Thanks! +1. –  Idear May 23 at 23:43

enter image description here

\documentclass{article}
\usepackage{array}
\setlength\extrarowheight{2pt}
\newcommand\Z{Z}
\begin{document}

\begin{table}[htbp]%never h on its own
\centering
\begin{tabular}{|c ||c| c| c| c|}  
 \hline
$(d+1)$D  &   $Z$  &  $UZ1$ &  $UZ2$ &  $U$\\  
         &    &           &           &    \\ \hline
$d=0$   &  0   &  0         &  $\Z$          &     \\
        &    &           &   $n \in \Z$: $n \int A$          &   \\   \hline                 
$d=1$     &  $\Z_2$    &           &        &   \\
         &   $S_1=\int x_1{}^2$  &           &        &    \\   \cline{2-5}           
      &  \multicolumn{1}{c}{G}  & \multicolumn{1}{c}{G}&  \multicolumn{1}{c}{G}      & G \\   \hline    
$d=2$        &    &           &         &    \\
     &    &           &        &    \\   \hline    
 \end{tabular}
\caption{zzz}
\end{table}
\end{document}
share|improve this answer
    
thanks so much. it works. –  Idear May 23 at 23:43

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.