0

enter image description here

You see in row 1. I want to break the row after the last column 1 just like the 2nd row. How can I do that ?

1
  • 1
    Welcome to TeX.SX!. When asking questions it is better to provide a full minimal working example (MWE) both in order to demonstrate what you are trying to do and to help others help you. The MWE should look like \documentclass...\begin{document}...\end{document}, it should compile and contain close to the minimal amount of code needed to explain/demonstrate what you are asking. This saves everyone time:)
    – user30471
    Commented Apr 4, 2015 at 7:02

1 Answer 1

1

It is not entirely clear to me what you are asking. Presumably you just want to typeset this table. I recommend using the booktabs package and, for the reasons discussed in the documentation for this package, I recommend against using vertical lines and, as Mico says, not too many horizontal lines.

I would write this table as:

\documentclass[border=5mm]{standalone}
\usepackage{mwe}
\usepackage{booktabs}
\begin{document}

\begin{tabular}{*{10}c}\toprule
   n & \\\midrule
   1 & 4 & 2 & 1\\
   2 & 1\\
   3 & 10 & 5 & 16 & 18 & 4 & 2 & 1\\
   \bottomrule
\end{tabular}

\end{document}

to produce:

enter image description here

On the other hand, if you insist on having all of these lines in your table and what you are really asking is how to get the missing vertical lines then then answer is simply to add in the extra &'s for the missing columns. Using

\begin{tabular}{*{10}{|c}|}\hline
   n &   &   &    &    &   &   &\\\hline
   1 & 4 & 2 & 1  &    &   &   &\\\hline
   2 & 1 &   &    &    &   &   &\\\hline
   3 & 10& 5 & 16 & 18 & 4 & 2 & 1\\\hline
\end{tabular}

will produce:

enter image description here

Notice that I didn't use booktabs here because \toprule etc do not play well with vertical lines.

1
  • You may also want to state explicitly that you recommend using far fewer horizontal lines as well: Two around the header row, one at the bottom, and no other horizontal lines...
    – Mico
    Commented Apr 4, 2015 at 7:51

You must log in to answer this question.

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