0

I have a question regarding the alignment of my table. As you can see, my table does not align with the rest of my text. The reason I used a table, is because function \tab did not really have a good result, as it leaves a huge blank space. I used the following code to get this result:

\documentclass[10pt]{article}

\usepackage[top=1.5cm,bottom=2.5cm,right=1.5cm,left=1.5cm]{geometry}

\usepackage{tabularx, booktabs}

\begin{document}

\begin{tabularx}{\textwidth}{lX}

Must have & Dit zijn...

Should have & Dit zijn...

%et cetera.

\end{tabularx}

\end{document}

The reason I used this code instead of a standard tabular function, is because otherwise the left column would only align in the center , instead of the top and I wanted multiline cells for my second column. However, after trying several things to align the second column with the paragraph above it, nothing worked.

Does anyone have an idea how I can change the second column length?

As requested, here is the code in all three situations. Since I could not run it with the \begin{tabularx}{\textwidth}{@{}jX{}} you recommended, but I think I may have missed something. I tried to put dimensions in the empty curly brackets, like so: \begin{tabularx}{\textwidth}{@{5cm}jX{10cm}}, but that was more of my own interpretation.

\documentclass[10pt]{article}

\usepackage[top=1.5cm,bottom=2.5cm,right=1.5cm,left=1.5cm]{geometry}
\usepackage{float}
\usepackage{tabularx,booktabs}

\begin{document}

\section{Example 1}

This is a example paragraph, to show where my text aligns. I simply have to fill up one line of text, so you can see what my problem is.\\

\begin{tabularx}{\textwidth}{lX}%I used this code to have the first column aligned to the top of the row.

\textbf{Must have}  &   Dit zijn de eisen die af moeten zijn aan het einde van de stage/ de opdracht. Dit zijn de eisen die minimaal verwacht worden door de opdrachtgever en binnen de gegeven tijd haalbaar zijn. Deze eisen worden als eerste afgehandeld tijdens een opdracht.\\\\

\textbf{Should have} &  Dit zijn de eisen die een minder hoge prioriteit hebben dan de “must have” eisen, maar wel een sterk toegevoegde waarde hebben aan het eindresultaat. Deze eisen worden echter pas verwerkt als de must have is afgerond.\\\\

\textbf{Could have} &   Onder de “Could have” vallen de eisen die niet zozeer nodig zijn om tot een goed resultaat te komen, maar een prettige bonus is voor de opdrachtgever. Ook hier geldt dat deze eisen pas worden gedaan als de “Should have” is afgerond.\\\\

\textbf{Would have} &   Dit zijn eisen waarvan van tevoren bekend is dat het niet in de gegeven tijd af te ronden is en om die reden wordt aangeraden voor een vervolgproject. Deze eisen zullen in dit PVA echter niet verder uitgewerkt worden.

\end{tabularx}

%as you can see, it is just, like 0.5 cm of...

%This is what I get when I use \noindent


\section{Example 2}

This is a example paragraph, to show where my text aligns. I simply have to fill up one line of text, so you can see what my problem is.\\

\noindent
\begin{tabularx}{\textwidth}{lX}%I used this code to have the first column aligned to the top of the row.

\textbf{Must have}  &   Dit zijn de eisen die af moeten zijn aan het einde van de stage/ de opdracht. Dit zijn de eisen die minimaal verwacht worden door de opdrachtgever en binnen de gegeven tijd haalbaar zijn. Deze eisen worden als eerste afgehandeld tijdens een opdracht.\\\\

\textbf{Should have} &  Dit zijn de eisen die een minder hoge prioriteit hebben dan de “must have” eisen, maar wel een sterk toegevoegde waarde hebben aan het eindresultaat. Deze eisen worden echter pas verwerkt als de must have is afgerond.\\\\

\textbf{Could have} &   Onder de “Could have” vallen de eisen die niet zozeer nodig zijn om tot een goed resultaat te komen, maar een prettige bonus is voor de opdrachtgever. Ook hier geldt dat deze eisen pas worden gedaan als de “Should have” is afgerond.\\\\

\textbf{Would have} &   Dit zijn eisen waarvan van tevoren bekend is dat het niet in de gegeven tijd af te ronden is en om die reden wordt aangeraden voor een vervolgproject. Deze eisen zullen in dit PVA echter niet verder uitgewerkt worden.

\end{tabularx}

\section{Example 3}

%As you can see, it is still not perfectly aligned, so that is why I tried the function you described. I put it in % because it gives me errors.

%\begin{tabularx}{\textwidth}{@{}jX{}}

%\textbf{Must have} &   Dit zijn de eisen die af moeten zijn aan het einde van de stage/ de opdracht. Dit zijn de eisen die minimaal verwacht worden door de opdrachtgever en binnen de gegeven tijd haalbaar zijn. Deze eisen worden als eerste afgehandeld tijdens een opdracht.\\\\

%\textbf{Should have} & Dit zijn de eisen die een minder hoge prioriteit hebben dan de “must have” eisen, maar wel een sterk toegevoegde waarde hebben aan het eindresultaat. Deze eisen worden echter pas verwerkt als de must have is afgerond.\\\\

%\textbf{Could have}    &   Onder de “Could have” vallen de eisen die niet zozeer nodig zijn om tot een goed resultaat te komen, maar een prettige bonus is voor de opdrachtgever. Ook hier geldt dat deze eisen pas worden gedaan als de “Should have” is afgerond.\\\\

%\textbf{Would have}    &   Dit zijn eisen waarvan van tevoren bekend is dat het niet in de gegeven tijd af te ronden is en om die reden wordt aangeraden voor een vervolgproject. Deze eisen zullen in dit PVA echter niet verder uitgewerkt worden.

%\end{tabularx}

\end{document}

I hope this makes it more clear.

9
  • Welcome to TeX SX! Where is the rest of the text the table has to be aligned with? And anyway, how can it be aligned, as the table has full text width? Please make your question clearer.
    – Bernard
    Sep 6, 2018 at 12:32
  • Hi, sorry for the late comment. The table starts at "Must have". This is the first row and column. As you can see, the second column is wider than the text, which deviates about 0.5 cm. I want it to be aligned with the paragraph above it. So I am looking for either a way to adjust the length of the second column or literally align it with the text above it.
    – Haddy
    Sep 11, 2018 at 8:23
  • 1
    Your tabularx isn't in a table environment (i.e. it doesn't float)? If that is the case, just add \noindent just before \begin{tabularx}.
    – Bernard
    Sep 11, 2018 at 8:52
  • Thanks, that did indeed help. It is not yet perfectly aligned, but I am happy the way it is :)
    – Haddy
    Sep 11, 2018 at 8:56
  • If you want it to be perfectly aligned, replace the tabularx preamble with \begin{tabularx}{\textwidth}{@{}jX@{}} to suppress the intercolumn spacing on the left and on the right of the environment.
    – Bernard
    Sep 11, 2018 at 9:06

1 Answer 1

0

Sorry for the typo in my comment: the j column type is not defined. Here is a code which works. I slightly improved it. Note that if you use the table environment, \noindent is no more erquired.

\documentclass[10pt]{article}

\usepackage[top=1.5cm,bottom=2.5cm,right=1.5cm,left=1.5cm]{geometry}
\usepackage{float}
\usepackage{tabularx,booktabs}

\begin{document}

\section{Example 3}

As you can see, withe correct tabularx preamble, it is l now perfectly aligned, I’m sorry for the typo in my comment. Won’t do it again! \bigskip

\noindent\begin{tabularx}{\textwidth}{@{} >{\bfseries}lX@{}}

Must have & Dit zijn de eisen die af moeten zijn aan het einde van de stage/ de opdracht. Dit zijn de eisen die minimaal verwacht worden door de opdrachtgever en binnen de gegeven tijd haalbaar zijn. Deze eisen worden als eerste afgehandeld tijdens een opdracht.\\\\

Should have & Dit zijn de eisen die een minder hoge prioriteit hebben dan de “must have” eisen, maar wel een sterk toegevoegde waarde hebben aan het eindresultaat. Deze eisen worden echter pas verwerkt als de must have is afgerond.\\\\

Could have & Onder de “Could have” vallen de eisen die niet zozeer nodig zijn om tot een goed resultaat te komen, maar een prettige bonus is voor de opdrachtgever. Ook hier geldt dat deze eisen pas worden gedaan als de “Should have” is afgerond.\\\\

Would have & Dit zijn eisen waarvan van tevoren bekend is dat het niet in de gegeven tijd af te ronden is en om die reden wordt aangeraden voor een vervolgproject. Deze eisen zullen in dit PVA echter niet verder uitgewerkt worden.

\end{tabularx}

\end{document} 

enter image description here

1
  • Yoi're welcome! Glad to feel helpful!
    – Bernard
    Sep 11, 2018 at 10:15

You must log in to answer this question.

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