6

How do I remove row lines in the column to furthest to the right. I have seen examples where they do it the left. I would like the "powers" from the table here to be on the right side instead of the left.

I have the following code:

\documentclass[a4paper,oneside,11pt]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{multirow}
\begin{document}
\renewcommand{\arraystretch}{1.5}%controls the space between the rows
\begin{table}[h!]
    \begin{center}
            \begin{tabular}{ | l | l | l | l |}
            \hline
            \textbf{header one} & \textbf{header two} & \textbf{header three} & \textbf{header four}\\ \hline
             r1c1 & r1c2 & r1c3 &  \multirow{4}{*}{ no row lines in the first four rows}\\ \hline
            r2c1 & r2c2 & r2c3 & \\ \hline
            r3c1 & r3c2 & r3c3 &\\ \hline
            r4c1 & r4c2 & r4c3 &\\ \hline
            r5c1 & r5c2 & r5c3 &\\ \hline
            r6c1 & r6c2 & r6c3 &\\ \hline
            r7c1 & r7c2 & r7c3 &\\ \hline
            \end{tabular}
        \caption{my caption}
        \label{tab:test}
    \end{center}
\end{table}
\end{document}

The text "no row lines in the first four rows" should have... well no row lines - it should be one "big box" :o) All help is greatly appricated!

  • Welcome to TeX.SX. – Claudio Fiandrino Apr 5 '13 at 14:15
  • Maybe it should be mentioned that such "excel style" tables with a grid-like rules between all the cells are considered t6o be bad style in typography. Maybe you want to have a look into the quite comprehensive documentation of the booktabs package that elaborates a bit more on this topic and gives some nice alternatives. – Benedikt Bauer Apr 5 '13 at 14:15
5

Use

\cline{1-3}

in rows 2-4 instead of \hline

screenshot

% arara: pdflatex
\documentclass{article}
\usepackage{multirow}
\begin{document}
\renewcommand{\arraystretch}{1.5}%controls the space between the rows
\begin{table}[h!]
    \begin{center}
            \begin{tabular}{ | l | l | l | l |}
            \hline
            \textbf{header one} & \textbf{header two} & \textbf{header three} & \textbf{header four}\\ \hline
            r1c1 & r1c2 & r1c3 &  \multirow{4}{*}{ no row lines in the first four rows}\\ \cline{1-3}
             r2c1 & r2c2 & r2c3 & \\ \cline{1-3}
             r3c1 & r3c2 & r3c3 &\\\cline{1-3}
            r4c1 & r4c2 & r4c3 &\\ \hline
            r5c1 & r5c2 & r5c3 &\\ \hline
            r6c1 & r6c2 & r6c3 &\\ \hline
            r7c1 & r7c2 & r7c3 &\\ \hline
            \end{tabular}
        \caption{my caption}
        \label{tab:test}
    \end{center}
\end{table}
\end{document}

Further enhancements to your table can be made by employing the booktabs package, and also noting the answers from

screenshot

% arara: pdflatex
% !arara: indent: {overwrite: true}
\documentclass{article}
\usepackage{multirow}
\usepackage{booktabs}
\begin{document}
\renewcommand{\arraystretch}{1.5}%controls the space between the rows
\begin{table}[h!]
    \centering
    \caption{my caption}
    \label{tab:test}
    \begin{tabular}{  l  l  l  l }
        \toprule
        \textbf{header one} & \textbf{header two} & \textbf{header three} & \textbf{header four}                                  \\ \midrule
        r1c1                & r1c2                & r1c3                  & \multirow{4}{*}{ no row lines in the first four rows} \\ \cmidrule{1-3}
        r2c1                & r2c2                & r2c3                  &                                                       \\ \cmidrule{1-3}
        r3c1                & r3c2                & r3c3                  &                                                       \\\cmidrule{1-3}
        r4c1                & r4c2                & r4c3                  &                                                       \\ \midrule
        r5c1                & r5c2                & r5c3                  &                                                       \\ \midrule
        r6c1                & r6c2                & r6c3                  &                                                       \\ \midrule
        r7c1                & r7c2                & r7c3                  &                                                       \\ \bottomrule
    \end{tabular}
\end{table}
\end{document}
  • After your edit I wished there was a possibility to hit the upvote button a second time. Please add another thought upvote to your account ;-) – Benedikt Bauer Apr 5 '13 at 14:16
  • @BenediktBauer thanks a lot, you're very kind :) – cmhughes Apr 5 '13 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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