2

I'm trying to create two tables: the first column should align left with .25 linewidth and the second column should align left with .69 linewidth while wrapping if the text becomes too long. The actual width of the column is irrelevant as long as they are similar.

The following code does all I want except for aligning left:

\begin{table}[ht]
\begin{tabular}{p{0.25\linewidth} p{0.69\linewidth}}
\hline
\rowcolor[HTML]{EFEFEF}
Category                    & Description                                                                                               \\ \hline
Instance duration           & Limits the duration in which a control-flow rule instance must hold.                                      \\ \hline
Delay between instances     & Limits the delay between two subsequent instances of a control-flow rule                                  \\ \hline
Validity                    & Limits the time length in which an activity can be executed.                                              \\ \hline
Time restricted existence   & Limits the execution time of an activity based on some calendar.                                          \\ \hline
Repetition                  & Limits the delay between execution of two subsequent activities.                                          \\ \hline
Time dependent variability  & Limits choice of a process path among several ones with respect to temporal aspects.                      \\ \hline
Overlap                     & Limits the start and completion of an activity w.r.t. the start and the completion of another activity.   \\ \hline
\end{tabular}
\caption{\label{tab:temporal}Categorization of temporal compliance rules \cite{ramezani2017understanding, caron2013comprehensive}.}
\end{table}

How can I align the first column to the left?

2
  • Welcome to TeX.SE.
    – Mico
    Jan 17, 2021 at 16:01
  • 1
    With this current setup and depending on the combination of font and margin sizes, the approach of two columns with 0.25 and 0.69\textwidth could end up in a table that is slightly wider than the textwidth. You can get a table that is exactly as wide as the textwidth by using \begin{tabular}{>{\raggedright\arraybackslash}p{\dimexpr 0.25\linewidth-2\tabcolsep} p{\dimexpr 0.75\linewidth-2\tabcolsep}} or \begin{tabular}{>{\raggedright\arraybackslash}p{\dimexpr 0.3\linewidth-2\tabcolsep} p{\dimexpr 0.7\linewidth-2\tabcolsep}} instead.
    – leandriis
    Jan 17, 2021 at 16:08

2 Answers 2

1

You are asking for something like that?

tt

\documentclass[12pt,a4paper]{article}

\usepackage[table]{xcolor}

\begin{document}
    \begin{table}[ht]
        \begin{tabular}{>{\raggedright}p{0.25\linewidth} p{0.69\linewidth}}
            \hline
            \rowcolor[HTML]{EFEFEF}
            Category                    & Description                                                                                               \\ \hline
            Instance duration           & Limits the duration in which a control-flow rule instance must hold.                                      \\ \hline
            Delay between instances     & Limits the delay between two subsequent instances of a control-flow rule                                  \\ \hline
            Validity                    & Limits the time length in which an activity can be executed.                                              \\ \hline
            Time restricted existence   & Limits the execution time of an activity based on some calendar.                                          \\ \hline
            Repetition                  & Limits the delay between execution of two subsequent activities.                                          \\ \hline
            Time dependent variability  & Limits choice of a process path among several ones with respect to temporal aspects.                      \\ \hline
            Overlap                     & Limits the start and completion of an activity w.r.t. the start and the completion of another activity.   \\ \hline
        \end{tabular}
        \caption{\label{tab:temporal}Categorization of temporal compliance rules \cite{ramezani2017understanding, caron2013comprehensive}.}
    \end{table} 
    
\end{document}
1

In addition to forcing the cell -contents to be typeset ragged-right rather than fully justfied, you may also want to (a) switch to a tabularx environment to maximize the line length available to the second columns and (b) give the table a more open "look" by replacing most instances of \hline with \addlinespace, a directive provided by the booktabs package.

enter image description here

\documentclass{article} 
\usepackage[table]{xcolor}
\usepackage{ragged2e} % for '\RaggedRight' macro
\usepackage{tabularx} % for 'tabularx' env. and 'X' column type
\usepackage{booktabs} % for \addlinespace and \bottomrule macros
\begin{document}
\begin{table}[ht]
\begin{tabularx}{\textwidth}{ >{\RaggedRight}p{0.25\linewidth} >{\RaggedRight}X }
\hline
\rowcolor[HTML]{EFEFEF}
Category                    & Description \\ \hline \addlinespace
Instance duration           & Limits the duration in which a control-flow rule instance must hold. \\ \addlinespace
Delay between instances     & Limits the delay between two subsequent instances of a control-flow rule \\ \addlinespace
Validity                    & Limits the time length in which an activity can be executed. \\ \addlinespace
Time restricted existence   & Limits the execution time of an activity based on some calendar. \\ \addlinespace
Repetition                  & Limits the delay between execution of two subsequent activities. \\ \addlinespace
Time dependent variability  & Limits choice of a process path among several ones with respect to temporal aspects. \\ \addlinespace
Overlap                     & Limits the start and completion of an activity w.r.t. the start and the completion of another activity.   \\ 
\bottomrule
\end{tabularx}
\caption{Categorization of temporal compliance rules \cite{ramezani2017understanding, caron2013comprehensive}.}
\label{tab:temporal}
\end{table}
\end{document}

You must log in to answer this question.

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