2

I am given these requirements and I am not really sure what they mean. I need some help figuring out what they mean in terms of Latex code:

-Tables must be cell based; do not merge rows.

- Vertically merged cells are prohibited by our table guidelines. Certain LaTeX table formatting techniques, such as using \multirow or containing a tabular environment within another tabular environment, will result in vertically merged cells and should therefore be avoided.

-Tables cannot contain graphics or colors. (This one seems clear)

-Do not use \hline for new lines within a cell. This will result in data being split between two different shaded rows. Instead, allow text to wrap within a cell.

So suppose I have this table, what is violated in here? Also is there an alternative for \hline if I need lines between different rows to make it easier for readability?

\begin{table}[!htpb]
\caption{
\bf{I am writing something here}}
\begin{tabular}{|c|c|}
something1 & test1\\
something2 &  test2\\
\end{tabular}
\begin{flushleft}%Empty Caption
\end{flushleft}
\label{tab:label}
\end{table}
  • In you above table, none of those rules is violated. Of topic, your usage of \bf isn't correct. Make it \caption{\bfseries I am writing ....} – user11232 Nov 8 '14 at 0:26
  • @HarishKumar Thanks. Is there a way to separate the rows without using \hline? or would that violate one of the rules? I guess I just don't understand what it means to be vertically merged. – kolonel Nov 8 '14 at 0:31
  • You can change 1.3 in \renewcommand\arraystretch{1.3} or if you use booktabs, there is \addlinespace[1em] (change 1em suitably). But I think these won't be necessary as rows are separated enough by default. – user11232 Nov 8 '14 at 0:37
2

-Tables must be cell based; do not merge rows.

means do not use \multirow from the multirow package.

  • Vertically merged cells are prohibited by our table guidelines. Certain LaTeX table formatting techniques, such as using \multirow or containing a tabular environment within another tabular environment, will result in vertically merged cells and should therefore be avoided.

means the same

-Tables cannot contain graphics or colors. (This one seems clear)

as it says.

-Do not use \hline for new lines within a cell. This will result in data being split between two different shaded rows. Instead, allow text to wrap within a cell.

don't use \hline


\caption{ \bf{I am writing something here}}

never put formatting commands in the argument of \caption or \section etc, the style of captions should be defined elsewhere and the caption may need differet format on the caption and the list of tables. \bf should not be used in latex anyway but if it is used the syntax is {\bf bold} not \bf{bold}

1

In your example the rules are not violated. You have (near) no chance to violate rule 1 or 2, if you are not using \multicolumn or command like \multirow (after calling an additional package). \hline is not needed, because rows will be separated by different shading.

0

Do not use \hline for new lines within a cell. This will result in data being split between two different shaded rows. Instead, allow text to wrap within a cell.

I do not think this means that you cannot use \hline although they may also prefer you not to. I think they are telling you not to split data from a single logical cell between two different rows of the tabular. If you do this, when they format the tabular, you'll end up with half of the contents shaded one way and half of it shaded the other. It isn't entirely clear, because this is not something you could do with \hline anyway. So there is some confusion here on their part.

Suppose you had this:

\documentclass{article}

\begin{document}
  \begin{tabular}{cc}
    Some row label & Some long piece of data which will spill out of the tabular if we do not do something or other about it.\\
  \end{tabular}
\end{document}

Then the tabular will be too wide for the page so you would need to make the second cell use multiple lines. That is, you want something like this:

multiline cell

They are telling you not to do this by putting part of the cell contents into a new row. That is, do not write:

Some row label & Some long piece of data which will spill out of the tabular\\
 & if we do not do something or other\\
 & about it.\\

Instead, define the tabular so that LaTeX allows multiple lines of text within the cell. For example:

  \begin{tabular}{cp{.6\linewidth}}
    Some row label & Some long piece of data which will spill out of the tabular if we do not do something or other about it.\\
  \end{tabular}

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.