tilburgsciencehub / website

Learn to work more efficiently on empirical research projects.
https://tilburgsciencehub.com
38 stars 47 forks source link

Dev call: Gallery of latex tables for academic papers #332

Open kleintob opened 2 years ago

kleintob commented 2 years ago

Contact Details

T.J.Klein@uvt.nl

Is your content request related to a problem you've encountered during your research process? Please describe.

It's very important that the tables and figures in a research paper are accessible and pleasant to look at. One principle that more and more people find important are that tables and figures are self-contained. This means that one can browse through the paper and look at a table or figure and understand what's going on without reading the main text of the paper. For this, it's good to have table notes.

I think it would be great to have a building block with an example table (code snippet and screenshot of the final table) that people could use as a starting point for their own tables.

Also, it would be good to at some point link to the tablefill building block and point out that one should make filling in the numbers part of the workflow.

We should also refer to some of the building blocks that we currently have under the heading "write your paper". In particular, the LaTeX template for a paper should probably link to this building block, also the LyX template.

Here is some input for the building block and a starting point to make an example table:

In general, what works well is to use a minipage within the table or figure environment. I usually center the minipage and then play around with the width. Before the minipage I put some extra space, with \vspace.

Alternatively, one can also use the threeparttable package:

\begin{table}
  \begin{center}

    \caption{Likert scale} \label{tab:Likert}
    \vspace{1em}

    \begin{threeparttable}

      \begin{tabular}{cl}
      \toprule
      value & description \\
      \midrule
      7 & completely satisfied \\
      6 & mostly satisfied\\
      5 & somewhat satisfied\\
      4 & neither satisfied, nor dissatisfied\\
      3 & somewhat dissatisfied\\
      2 & mostly dissatisfied\\
      1 & completely dissatisfied, as if no results\\
      \bottomrule
      \end{tabular}

      \begin{tablenotes}[flushleft]
        \item \emph{Notes:} This table shows the Likert scale we used for human assessment by the RA's and the clickworkers.
      \end{tablenotes}  

    \end{threeparttable}

  \end{center}
\end{table}

I don’t think this works for figures though, and in general I did not like the results as much. A tiny bit ugly IMHO.

Then, regarding sideways tables. One way to do this is to use the sidewaystable environment. A nicer (I think) way is to use a normal table, but to then rotate the page in the pdf. For this, you use the landscape option. Here is an example:

\begin{landscape}
\begin{table}
\caption{Probability to receive feedback} 
\label{tab:prob_feedback} 

\bigskip
\centering

% main part of the table
\begin{tabular}{l*{6}{c}}
\toprule
                    &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}&\multicolumn{1}{c}{(5)}&\multicolumn{1}{c}{(6)}\\
                    &\multicolumn{1}{c}{feedback}&\multicolumn{1}{c}{feedback}&\multicolumn{1}{c}{feedback}&\multicolumn{1}{c}{feedback}&\multicolumn{1}{c}{feedback}&\multicolumn{1}{c}{feedback}\\
\midrule
transaction number/10&      -0.491***&      -0.362***&      -0.389***&      -0.325***&      -0.211***&      -0.225***\\
                    &    (0.0316)   &    (0.0529)   &    (0.0523)   &    (0.0556)   &    (0.0743)   &    (0.0759)   \\
\addlinespace
buyer experience    &               &               &               &       2.823***&       3.588***&       3.894***\\
                    &               &               &               &     (0.190)   &     (0.331)   &     (0.322)   \\
\addlinespace
trans. num/10 $\times$  buyer exp.&               &               &               &               &      -0.178** &      -0.184** \\
                    &               &               &               &               &    (0.0762)   &    (0.0753)   \\
\addlinespace
buyer inclination to leave feedback&               &               &               &               &               &       26.90***\\
                    &               &               &               &               &               &     (0.275)   \\
\addlinespace
trans. num/10 $\times$ buyer inc. to leave fdbk&               &               &               &               &               &       0.141** \\
                    &               &               &               &               &               &    (0.0570)   \\
\addlinespace
seller FE           &          No   &         Yes   &         Yes   &         Yes   &         Yes   &         Yes   \\
\addlinespace
month FE            &          No   &         Yes   &         Yes   &         Yes   &         Yes   &         Yes   \\
\addlinespace
leaf category       &          No   &          No   &         Yes   &         Yes   &         Yes   &         Yes   \\
\midrule
adj R-squared       &    0.000671   &      0.0621   &      0.0712   &      0.0656   &      0.0656   &       0.131   \\
observations        &      609310   &      609310   &      607135   &      515978   &      515978   &      515978   \\
number of clusters  &        7085   &        7085   &        7085   &        7083   &        7083   &        7083   \\
\bottomrule
\end{tabular}

\smallskip

% table notes
\begin{minipage}{0.82\columnwidth}
    \begin{spacing}{0.7}
    {\footnotesize \emph{Notes:} Results of regressions of 100 times an indicator for receiving feedback on the transaction number divided by 10, as well as other controls and interaction terms. One observation is a transaction. Standard errors are clustered at the seller level and account for heteroskedasticity. {*}{*}{*} indicates significance at $p \le 0.01$; {*}{*}  $p \le 0.05$; *  $p \le 0.10$.}
    \end{spacing}
\end{minipage}
\end{table}   
\end{landscape}

One has to fiddle around a bit to do this in the right place. A refinement is to use this in combination with a package that executes all this when the next page break comes. I can’t find the name of that package though.

It would also be good to add some advice on tables more generally. Using the booktabs package is nice.

kleintob commented 2 years ago

@hannesdatta can you please review and if you agree that it's ready put the label ready to be worked on?

hannesdatta commented 2 years ago

This sounds all good! I would pitch this as two separate building blocks: a "latex table gallery" and a "latex figure" gallery.

For the tables, it's important you explain the various options that you have to make these tables. See also my own tex templates here: https://github.com/hannesdatta/platformpower/tree/master/paper/code & the code that generates the paper here: https://github.com/hannesdatta/platformpower/blob/master/paper/code/paper.tex.

hannesdatta commented 2 years ago

Desired outline:

1) Overview

In designing the templates, please always adhere to our standard guidelines for tables, such as column names, table notes, etc.

hannesdatta commented 2 years ago

If done, have a building block for a gallery of plots and how to integrate them in a tex doc.

kleintob commented 2 years ago

Sounds all good to me. Just for extra inspiration please see the tables and figures in my working papers: https://www.tobiasklein.ws/working-papers Also, some of the links under the heading "academic writing" may have useful input to develop more content related to writing up a paper or a thesis.

juliehabets commented 1 year ago

@thierrylahaije interesting in picking this up?

thierrylahaije commented 1 year ago

@juliehabets latex is not a thing I am very familiar with, I think other RA's are better at this than I am

hannesdatta commented 6 months ago

@KleinJonasUVT - given your recent thesis experience, would that be something for you to handle?