[Tex/LaTex] Avoid page break for multicols

itemizemulticolpage-breaking

I'm trying to add a Scrum user story to a latex file, but the page break at the end of the page breaks the flow. For example, I am trying to achieve:
enter image description here

However, when the columns reach a page break, they become distorted and become like this:enter image description here

This is basically what I have in my latex file:

\begin{multicols}{2}
[
\textbf{Priority:} \textit{5}\hfill \textbf{Size Estimate:} \textit{2}
\linebreak As a \textit{developer}, I want to \textit{implement a basic local database with a single table} in order to \textit{have a basis for storing more information and expanding it at a later point}.
]
\textbf{Set of Tasks}
\begin{itemize}
    \item Research the setup process for a local database.
    \item Create database.
    \item Add restrictions to the database.
    \item Add new entry in the form of a table.
\end{itemize}

\columnbreak

\textbf{Acceptance Criteria}
\begin{itemize}
    \itemsep0em 
    \item Test the functionality of the table.
    \item Test restrictions concerning password, access and privileges.
    \item Successful queries to the table with simple INSERT, SELECT, UPDATE and DELETE operations.
\end{itemize}
\end{multicols}

I have tried to bypass it by creating a table, but tables seem to not accept itemized sections. Is there any way to bypass this pagebreak or any other solution to this problem? Any help would be highly appreciated!

Best Answer

You can't really have it both ways. In some sense you are misusing multicol (which tries to balance material and adds page breaks if necessary, while what you seem to want is a two-column "table" with "tasks" on the left and "criterias" on the right.

To achieve that you explicitly force a column break between the two. But to make that work your whole material needs to fits the space remaining on the page, in particular there must remain enough space to fit the task material fully into the first column.

As that is not the case, the \columnbreak ends up in the second column and ends it. So you have to make up your mind what you really want to see in that case

  • manually correct (for example with \enlargethispage or the spacing parameters of multicols) or do you require an automated (database) solution?
  • start a new page if the user story doesn't fit into a single page
  • change the behavior of the user story when it appears across a page break (fairly difficult if it should work automatically)

If you always want a user story always on a single page then you can put the whole story in a box (minipage) so that it can't break and separate the stories with something like

   \vfil\penalty9999\vfilneg

this way TeX would break before a story if it doesn't fit fully (assuming that stories are never longer than a page).

Update

I should probably say that for your case using a tabular would in fact be simpler, eg

\usepackage{tabularx}
\newcolumntype{Y}{>{\fussy}X}

\noindent\begin{tabularx}{\textwidth}{YY}
\textbf{Set of Tasks}
\begin{itemize}
    \item Research the setup process for a local database.
    \item Create database.
    \item Add restrictions to the database.
    \item Add new entry in the form of a table.
\end{itemize}
&
\textbf{Acceptance Criteria}
\begin{itemize}
    \itemsep0em 
    \item Test the functionality of the table.
    \item Test restrictions concerning password, access and privileges.
    \item Successful queries to the table with simple INSERT, SELECT, UPDATE and DELETE operations.
\end{itemize}
\end{tabularx}

or a suitable variation thereof (the above would only keep tasks an criterias together)