2

For my master thesis I need to adress a large amount of variables for my statistical model. Since there are some margin restrictions to the paper I used longtable to split the table efficiently over several pages. I'm quite unsatisfied with the result. At the end there will be a MWE to see what I achieved but I would appreciate a more dense and stylish solution if possible. Any recommendations are welcome!

PS: Some parts of the table were commented since they are in the dataset but not used in the model.

EDIT : Clarification of "dense and stylish" : I would appreciate if the table would be as small as possible without loosing reading quality. The latter again is a broad term but could be defined that a printed version of the table would be readable without extreme focus.

The term "stylish" addresses the overall look of the table. I would like to have no gaps on the side. I want the bottomrole to be the part of the table without an extra line. Further, I would appreciate other styling ideas to present the information in a clear, understandable and easy to read design.

MWE :

\documentclass{article}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{geometry}[lmargin = 3 cm,rmargin = 2.5cm,tmargin=2.5cm,bmargin=2.5cm]

\begin{document}
    \begin{longtable}{|l|p{5cm}|l|}
        \toprule
        Variable name &
        Description & Variable type \\ \midrule
        \endhead
        %
        id &
        the website ID of the athlete. & \textit{factor} \\ 
        \midrule
        %date &
        %  Date of the the website activity & \textit{POSIXct} \\
        %  \midrule
        distance &
        Distance of the training session in km. & \textit{numeric} \\
        \midrule
        %mov\_time &
        %  The moving time feature is defined as the passed time of an activity. the website recognizes this feature in either two ways. If the athlete paused his ride during a %stop manually on the tracking device or if a rider falls under a specific (movement) threshold defined by the website. This threshold is not specified by the website publicly. %& \textit{character} \\ \midrule
        elevation &
        Amount of meters of the route which contains elevation. & \textit{numeric} \\ 
        \midrule
        %relativeEffort &
        %  Intensity across sport types. A the website specific metric which tells the athlete how intense his activity (training) was %compared other sports activities. &  \textit{numeric} \\ 
        %  \midrule
        avg\_power\_weig &
        Adjusted avg. power of the ride where a the website algorithm corrects possible outliers in the data due to environmental impacts such as terrain, grade, wind and other factors. & \textit{numeric} \\
        \midrule
        work\_total &
        The sum of watts generated during the rid, expressed in kilojoules(kJ). & \textit{numeric} \\ 
        \midrule
        training\_load &
        Indicator for how long an athlete should rest after an activity. Power of a ride is compared to an individual functional threshold power. The latter is defined as the highest power output a road cyclist can preserve in a semisteady state for approximately 60 minutes.  & \textit{numeric} \\
        \midrule
        intensity &
        An indicator to express the level of difficulty of a ride compared to the functional threshhold power. E.g. if the weigh. avg. power was 250W and your FTP 300W the intensity would be 83\%. For short and intensive rides such as sprints values greater than 100\% are possible  & \textit{numeric} \\ 
        \midrule
        estAvgPower &
        Another estimate of the avg power of an activity generated by the website. No further information about the calculation was found. & \textit{numeric} \\ 
        \midrule
        avg\_speed &
        Average speed of the ride. & \textit{numeric} \\ 
        \midrule
        max\_speed &
        Max speed of the ride. & \textit{numeric} \\ 
        \midrule
        avg\_cadence &
        Average pedalling rate, average number of revolutions of the crank during the activity. & \textit{numeric} \\ 
        \midrule
        max\_cadence &
        Max pedalling rate, maximal number of revolutions of the crank during the activity. & \textit{numeric} \\ 
        \midrule
        avg\_hearRate &
        Average heart rate during the ride. & \textit{numeric} \\
        \midrule
        max\_heartRate &
        Max heart rate during the ride. & \textit{numeric} \\
        \midrule
        avg\_power &
        Average power in watt generated during the ride. & \textit{numeric} \\
        \midrule
        max\_power &
        Max power in watt generated during the ride. & \textit{numeric}  \\
        \midrule
        avg\_calories &
        Average calories burned during the ride. & \textit{numeric} \\
        \midrule
        avg\_temperature &
        Average temperature during the ride. & \textit{numeric}\\ 
        \midrule
        avg\_elap\_time\_sec &
        Average  elapsed time in seconds during the ride. & \textit{character} \\ 
        \midrule
        age &
        The age of the athlete. & \textit{numeric} \\
        \midrule
        type &
        Categorical variable indicating if an cyclists is either of type 'climber','sprinter' or 'mixed' & \textit{factor} \\
        \midrule 
        height &
        The height of the athlete. \\ 
        \midrule
        season &
        Season of the year of the activity : spring, summer, autumn, winter. & \textit{factor} \\
        \midrule
        year &
        Categorical variable indicating the year of the activity. & \textit{factor} \\ 
        \midrule
        UCI\_points\_weekly &
        Indicates the weekly UCI points an athlete had on the in that week  of the training activity.  & \textit{numeric} \\
        \midrule
        %energy\_output &
        %  An indicator for the amount of work an athlete has done during a ride expressed in kilojoules(KJ). Mixture of how %fast, how much  and with how much force an athlete is pedaling. & \textit{numeric} \\ 
        %  \midrule
        bicycle\_computer\_model &
        Model of the bicycle computer. & \textit{factor} \\ \bottomrule
        \label{tab:variable_list}
    \end{longtable}
\end{document}
5
  • Horizontal lines from the booktabs package were designed to be used without vertical lines. Hence the gaps around the intersections.
    – leandriis
    Commented Jan 15, 2022 at 11:23
  • Please clarify what you want your output to look like. What exactly does "more dense and stylish" mean?
    – leandriis
    Commented Jan 15, 2022 at 11:24
  • @leandriis Clarified the undefined terms in an edit!
    – mugdi
    Commented Jan 15, 2022 at 11:31
  • 1
    Thanks for the update. Would the following suit your needs? i.sstatic.net/gCbr3.png
    – leandriis
    Commented Jan 15, 2022 at 11:37
  • Yes! That looks like a result I could be satisfied with.
    – mugdi
    Commented Jan 15, 2022 at 11:47

2 Answers 2

1

Here are two suggestions. The first one is closer to your original with vertical and horizontal lines but makes more efficient use of the page by extending the table all the way to the margin allowing for a wider description column. In order to avoid gaps in the lines, I replaced the booktabs lines with \hline commands.

The second example uses a different approach closer to the output a description list would result in. In this example, I also used a smaller font size and adjusted horizontal and vertical spaces within the table. With these adjustments, you can fit the entire table onto a single page:

enter image description here

enter image description here

\documentclass{article}
\usepackage{geometry}[lmargin = 3 cm,rmargin = 2.5cm,tmargin=2.5cm,bmargin=2.5cm]

%%% Used in first and second example %%%
\usepackage{makecell}

%%% Only used in the first example%%%
\usepackage{xltabular}
\setcellgapes{2pt}

%%% only used in second example %%%
\usepackage{tabularx}
\usepackage{booktabs}
\setlength{\defaultaddspace}{3.5pt}


\begin{document}
{\makegapedcells
\renewcommand{\theadfont}{\normalsize}
    \begin{xltabular}{\linewidth}{|l|X|l|}
    \caption{caption text}        \label{tab:variable_list}\\
        \hline
        \thead[l]{Variable name} &
        \thead[l]{Description} & 
        \thead[l]{Variable\\ type} \\ \hline
        \endfirsthead
\caption[]{caption text - continued from previous page}\\
        \hline
        \thead[l]{Variable name} &
        \thead[l]{Description} & 
        \thead[l]{Variable\\ type} \\ \hline
        \endhead
        %
        id &
        the website ID of the athlete. & \textit{factor} \\ 
        \hline
        %date &
        %  Date of the the website activity & \textit{POSIXct} \\
        %  \hline
        distance &
        Distance of the training session in km. & \textit{numeric} \\
        \hline
        %mov\_time &
        %  The moving time feature is defined as the passed time of an activity. the website recognizes this feature in either two ways. If the athlete paused his ride during a %stop manually on the tracking device or if a rider falls under a specific (movement) threshold defined by the website. This threshold is not specified by the website publicly. %& \textit{character} \\ \hline
        elevation &
        Amount of meters of the route which contains elevation. & \textit{numeric} \\ 
        \hline
        %relativeEffort &
        %  Intensity across sport types. A the website specific metric which tells the athlete how intense his activity (training) was %compared other sports activities. &  \textit{numeric} \\ 
        %  \hline
        avg\_power\_weig &
        Adjusted avg. power of the ride where a the website algorithm corrects possible outliers in the data due to environmental impacts such as terrain, grade, wind and other factors. & \textit{numeric} \\
        \hline
        work\_total &
        The sum of watts generated during the rid, expressed in kilojoules(kJ). & \textit{numeric} \\ 
        \hline
        training\_load &
        Indicator for how long an athlete should rest after an activity. Power of a ride is compared to an individual functional threshold power. The latter is defined as the highest power output a road cyclist can preserve in a semisteady state for approximately 60 minutes.  & \textit{numeric} \\
        \hline
        intensity &
        An indicator to express the level of difficulty of a ride compared to the functional threshhold power. E.g. if the weigh. avg. power was 250W and your FTP 300W the intensity would be 83\%. For short and intensive rides such as sprints values greater than 100\% are possible  & \textit{numeric} \\ 
        \hline
        estAvgPower &
        Another estimate of the avg power of an activity generated by the website. No further information about the calculation was found. & \textit{numeric} \\ 
        \hline
        avg\_speed &
        Average speed of the ride. & \textit{numeric} \\ 
        \hline
        max\_speed &
        Max speed of the ride. & \textit{numeric} \\ 
        \hline
        avg\_cadence &
        Average pedalling rate, average number of revolutions of the crank during the activity. & \textit{numeric} \\ 
        \hline
        max\_cadence &
        Max pedalling rate, maximal number of revolutions of the crank during the activity. & \textit{numeric} \\ 
        \hline
        avg\_hearRate &
        Average heart rate during the ride. & \textit{numeric} \\
        \hline
        max\_heartRate &
        Max heart rate during the ride. & \textit{numeric} \\
        \hline
        avg\_power &
        Average power in watt generated during the ride. & \textit{numeric} \\
        \hline
        max\_power &
        Max power in watt generated during the ride. & \textit{numeric}  \\
        \hline
        avg\_calories &
        Average calories burned during the ride. & \textit{numeric} \\
        \hline
        avg\_temperature &
        Average temperature during the ride. & \textit{numeric}\\ 
        \hline
        avg\_elap\_time\_sec &
        Average  elapsed time in seconds during the ride. & \textit{character} \\ 
        \hline
        age &
        The age of the athlete. & \textit{numeric} \\
        \hline
        type &
        Categorical variable indicating if an cyclists is either of type 'climber','sprinter' or 'mixed' & \textit{factor} \\
        \hline 
        height &
        The height of the athlete.  & \\ 
        \hline
        season &
        Season of the year of the activity : spring, summer, autumn, winter. & \textit{factor} \\
        \hline
        year &
        Categorical variable indicating the year of the activity. & \textit{factor} \\ 
        \hline
        UCI\_points\_weekly &
        Indicates the weekly UCI points an athlete had on the in that week  of the training activity.  & \textit{numeric} \\
        \hline
        %energy\_output &
        %  An indicator for the amount of work an athlete has done during a ride expressed in kilojoules(KJ). Mixture of how %fast, how much  and with how much force an athlete is pedaling. & \textit{numeric} \\ 
        %  \hline
        bicycle\_computer\_model &
        Model of the bicycle computer. & \textit{factor} \\ \hline
    \end{xltabular}
}    
    

\begin{table}
\small
\renewcommand{\theadfont}{\small}
\caption{caption text}\label{tab:variable_list}
\begin{tabularx}{\linewidth}{@{}>{\hangindent=1em}X>{\itshape}l@{}}
    \toprule
      \thead[l]{\textbf{Variable name} Description}&
      \upshape\thead[l]{Variable\\ type} \\ 
    \midrule
      \textbf{id}
        the website ID of the athlete. 
        & factor \\ 
    \addlinespace
      \textbf{distance}
        Distance of the training session in km. 
        & numeric \\
    \addlinespace
      \textbf{elevation}
        Amount of meters of the route which contains elevation. 
        & numeric \\ 
    \addlinespace
      \textbf{avg\_power\_weig}
        Adjusted avg. power of the ride where a the website algorithm corrects possible outliers in the data due to environmental impacts such as terrain, grade, wind and other factors. 
        & numeric \\
    \addlinespace
      \textbf{work\_total}
        The sum of watts generated during the rid, expressed in kilojoules(kJ). 
        & numeric \\ 
    \addlinespace
      \textbf{training\_load}
        Indicator for how long an athlete should rest after an activity. Power of a ride is compared to an individual functional threshold power. The latter is defined as the highest power output a road cyclist can preserve in a semisteady state for approximately 60 minutes.  
        & numeric \\
    \addlinespace
        \textbf{intensity}
        An indicator to express the level of difficulty of a ride compared to the functional threshhold power. E.g. if the weigh. avg. power was 250W and your FTP 300W the intensity would be 83\%. For short and intensive rides such as sprints values greater than 100\% are possible  
        & numeric \\ 
    \addlinespace
        \textbf{estAvgPower}
        Another estimate of the avg power of an activity generated by the website. No further information about the calculation was found. 
        & numeric \\ 
    \addlinespace
        \textbf{avg\_speed}
        Average speed of the ride. 
        & numeric \\ 
    \addlinespace
        \textbf{max\_speed}
        Max speed of the ride. 
        & numeric \\ 
    \addlinespace
        \textbf{avg\_cadence}
        Average pedalling rate, average number of revolutions of the crank during the activity. 
        & numeric \\ 
    \addlinespace
        \textbf{max\_cadence}
        Max pedalling rate, maximal number of revolutions of the crank during the activity. 
        & numeric \\ 
    \addlinespace
        \textbf{avg\_hearRate}
        Average heart rate during the ride. 
        & numeric \\
    \addlinespace
        \textbf{max\_heartRate}
        Max heart rate during the ride. 
        & numeric \\
    \addlinespace
        \textbf{avg\_power}
        Average power in watt generated during the ride. 
        & numeric \\
    \addlinespace
        \textbf{max\_power}
        Max power in watt generated during the ride. 
        & numeric  \\
    \addlinespace
        \textbf{avg\_calories}
        Average calories burned during the ride. 
        & numeric \\
    \addlinespace
        \textbf{avg\_temperature}
        Average temperature during the ride. 
        & numeric\\ 
    \addlinespace
        \textbf{avg\_elap\_time\_sec}
        Average  elapsed time in seconds during the ride. 
        & character \\ 
    \addlinespace
        \textbf{age}
        The age of the athlete. 
        & numeric \\
    \addlinespace
        \textbf{type}
        Categorical variable indicating if an cyclists is either of type 'climber','sprinter' or 'mixed' 
        & factor \\
    \addlinespace 
        \textbf{height}
        The height of the athlete. \\ 
    \addlinespace
        \textbf{season}
        Season of the year of the activity : spring, summer, autumn, winter. 
        & factor \\
    \addlinespace
        \textbf{year}
        Categorical variable indicating the year of the activity. 
        & factor \\ 
    \addlinespace
        \textbf{UCI\_points\_weekly}
        Indicates the weekly UCI points an athlete had on the in that week  of the training activity.  
        & numeric \\
    \addlinespace
        \textbf{bicycle\_computer\_model}
        Model of the bicycle computer. 
        & factor \\ \bottomrule
\end{tabularx}
\end{table}
\end{document}
3
  • \begin{tabular}{\linewidth}{@{}>{\hangindent=1em}X>{\itshape}l@{}} \toprule \thead[l]{\textbf{Variable name} Description}& In this section LaTeX (MikTex) throws me the following error : Package array Error: Illegal pream-token (\linewidth): `c' used. \begin{tabular}{\linewidth}
    – mugdi
    Commented Jan 15, 2022 at 12:13
  • Its \begin{tabularx} not \begin{tabular}. (Notice the x at the end of the environment name).
    – leandriis
    Commented Jan 15, 2022 at 12:17
  • Thanks a lot. I new this was a tiny thing I deleted by accident! Very good work.
    – mugdi
    Commented Jan 15, 2022 at 12:20
1

Using the tabularray package.

\documentclass{article}

\usepackage{geometry}[lmargin = 3 cm,rmargin = 2.5cm,tmargin=2.5cm,bmargin=2.5cm]
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\NewTblrTheme{MyTheme}{
    \DefTblrTemplate{contfoot}{FootRule}{%
            \bottomrule%
    }
    \SetTblrTemplate{contfoot}{FootRule}%
    \DefTblrTemplate{caption}{NoCaption}{%
    %
    }
    \SetTblrTemplate{caption}{NoCaption}%
    \DefTblrTemplate{conthead}{NoContHead}{%
    %
    }
    \SetTblrTemplate{conthead}{NoContHead}%
    \DefTblrTemplate{capcont}{NoCapCont}{%
    %
    }%
    \SetTblrTemplate{capcont}{NoCapCont}{%
    }%
}

\begin{document}
    \begin{longtblr}[
        theme={MyTheme},
        label={tab:variable_list},
    ]{
        stretch = 1.5,
        colspec = {@{}X[0.5,l,m] X[l,m] X[0.25,l,m]@{}},
        column{1}={font=\bfseries},
        column{3}={font=\em},
        row{1} = {font=\normalfont},
        rowhead = 1,
    }
     \toprule
        Variable name &
        Description & Variable type \\ \midrule%
        id &
        the website ID of the athlete. & factor \\
        %\midrule
        %date &
        %  Date of the the website activity & {POSIXct} \\
        %  %\midrule
        distance &
        Distance of the training session in km. & numeric \\
        %\midrule
        %mov\_time &
        %  The moving time feature is defined as the passed time of an activity. the website recognizes this feature in either two ways. If the athlete paused his ride during a %stop manually on the tracking device or if a rider falls under a specific (movement) threshold defined by the website. This threshold is not specified by the website publicly. %& {character} \\ %\midrule
        elevation &
        Amount of meters of the route which contains elevation. & numeric \\
        %\midrule
        %relativeEffort &
        %  Intensity across sport types. A the website specific metric which tells the athlete how intense his activity (training) was %compared other sports activities. &  numeric \\
        %  %\midrule
        avg\_power\_weig &
        Adjusted avg. power of the ride where a the website algorithm corrects possible outliers in the data due to environmental impacts such as terrain, grade, wind and other factors. & numeric \\
        %\midrule
        work\_total &
        The sum of watts generated during the rid, expressed in kilojoules(kJ). & numeric \\
        %\midrule
        training\_load &
        Indicator for how long an athlete should rest after an activity. Power of a ride is compared to an individual functional threshold power. The latter is defined as the highest power output a road cyclist can preserve in a semisteady state for approximately 60 minutes.  & numeric \\
        %\midrule
        intensity &
        An indicator to express the level of difficulty of a ride compared to the functional threshhold power. E.g. if the weigh. avg. power was 250W and your FTP 300W the intensity would be 83\%. For short and intensive rides such as sprints values greater than 100\% are possible  & numeric \\
        %\midrule
        estAvgPower &
        Another estimate of the avg power of an activity generated by the website. No further information about the calculation was found. & numeric \\
        %\midrule
        avg\_speed &
        Average speed of the ride. & numeric \\
        %\midrule
        max\_speed &
        Max speed of the ride. & numeric \\
        %\midrule
        avg\_cadence &
        Average pedalling rate, average number of revolutions of the crank during the activity. & numeric \\
        %\midrule
        max\_cadence &
        Max pedalling rate, maximal number of revolutions of the crank during the activity. & numeric \\
        %\midrule
        avg\_hearRate &
        Average heart rate during the ride. & numeric \\
        %\midrule
        max\_heartRate &
        Max heart rate during the ride. & numeric \\
        %\midrule
        avg\_power &
        Average power in watt generated during the ride. & numeric \\
        %\midrule
        max\_power &
        Max power in watt generated during the ride. & numeric  \\
        %\midrule
        avg\_calories &
        Average calories burned during the ride. & numeric \\
        %\midrule
        avg\_temperature &
        Average temperature during the ride. & numeric\\
        %\midrule
        avg\_elap\_time\_sec &
        Average  elapsed time in seconds during the ride. & {character} \\
        %\midrule
        age &
        The age of the athlete. & numeric \\
        %\midrule
        type &
        Categorical variable indicating if an cyclists is either of type 'climber','sprinter' or 'mixed' & factor \\
        %\midrule
        height &
        The height of the athlete. \\
        %\midrule
        season &
        Season of the year of the activity : spring, summer, autumn, winter. & factor \\
        %\midrule
        year &
        Categorical variable indicating the year of the activity. & factor \\
        %\midrule
        UCI\_points\_weekly &
        Indicates the weekly UCI points an athlete had on the in that week  of the training activity.  & numeric \\
        %\midrule
        %energy\_output &
        %  An indicator for the amount of work an athlete has done during a ride expressed in kilojoules(KJ). Mixture of how %fast, how much  and with how much force an athlete is pedaling. & numeric \\
        %  %\midrule
        bicycle\_computer\_model &
        Model of the bicycle computer. & factor \\ \bottomrule
    \end{longtblr}
\end{document} 

1st page:

enter image description here

2nd page:

enter image description here

You must log in to answer this question.

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