4

Background: Up to recently, I was the only one that read the sources of my LaTeX document. However, I now need to collaborate with others for co-authoring papers, as well as with journals editors.
I noticed very different layouts in .tex files for what concerns tables.

The basic structure I currently use to format my tables is:

\begin{tabular}{<columns-definitions>}
   \toprule
      <cell content>
      &
      <cell content>
      &
      <cell content>
   \\\midrule
      <cell content>
      &
      <cell content>
      &
      <cell content>
   \\
      <cell content>
      &
      <cell content>
      &
      <cell content>
   \\\bottomrule
\end{tabular}

Even if it's easy to find this or that cell content, the code spans over numerous lines. If there are many cells in a row, it is also uneasy to switch from one cell to the one under it.

Thus, I'd like to know how to format my .tex source-code in order to make easy for others to edit my tables?
Of course, I know this question can be seen as opinion based. However, I don't want to know what you do or you prefer, but rather what is the most efficient.

(I here neglected all refinement using other environment for tables (e.g., tabularx), formating it nicely using the booktabs package, etc. These advices do not fall into the frame of this question.)

  • 1
    I prefer \tabularnewline instead of `\\` to emphasize the newline, and I place any rule command in the next line, but this very opinion-based – user31729 Sep 8 '16 at 17:46
  • 6
    it depends a lot on your <cell contents> if they are paragraph based things (as ought to be the case with tabularx for example) I'd set it out as you have it (but always a newline after \\ rather than \\\toprule) but for data tables with moderate numbers of columns I'd set each row on one line, with the & lined up so it looks like a table. – David Carlisle Sep 8 '16 at 18:18
4

It depends a lot on your <cell contents> if they are paragraph based things (as ought to be the case with tabularx for example) I'd set it out as you have it (but always a newline after \\ rather than \\\toprule) but for data tables with moderate numbers of columns I'd set each row on one line, with the & lined up so it looks like a table.

1

The source code of any larger tabular environment in an editor always is a messy thing. I suggest to use Excel or LibreOffice Calc for the tabulars and export them to the *.tex file in due time, when you are done with them.

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.