8

I've been trying to type set a mark scheme using longtblr from tabulararray but I'm running into what I can only describe as a brick wall.

I want to force the page breaks to only happen at after the complete question and a line between sub parts

\documentclass{article} \usepackage{tabularray} \UseTblrLibrary{booktabs} \newcommand{\pbreak}{\nopagebreak\midrule} % Break between parts of a solution \newcommand{\sbreak}{\nopagebreak\midrule} % Breaks between 1a and 1b for example, not allow page breaks \newcommand{\qbreak}{\midrule} % Breaks between questions, allow page breaks \begin{document} \begin{longtblr}{ colspec={l c Q[l]}, width=\linewidth } \toprule Q & Part & Marks \\ \midrule 1 & a & comments \\ \sbreak 1 & b & more comments \\ \qbreak 2 & & question with multi line problems \\ \pbreak & & more working here as well \\ \qbreak 3 & & another question with multi line problems \\ \pbreak & & more working here as well \\ \bottomrule \end{longtblr} \end{document} 

I would expect this to look like:

================================================== Q Part Marks -------------------------------------------------- 1 a comments -------------------------------------------------- 1 b more comments -------------------------------------------------- 2 question with multi line problems more working here as well -------------------------------------------------- 3 another question with multi line problems more working here as well ================================================== 

But instead I get this which is nothing like what I would expect.

enter image description here

1 Answer 1

6

You could take the definition of \midrule from tabularray.sty and define your new macros in the same way:

\documentclass{article} \usepackage{tabularray} \UseTblrLibrary{booktabs} \makeatletter \NewTblrTableCommand\pbreak[1][]{% \nopagebreak\tblr@booktabs@hline[wd=\lightrulewidth, #1]% } \NewTblrTableCommand\sbreak[1][]{% \nopagebreak\tblr@booktabs@hline[wd=\lightrulewidth, #1]% } \NewTblrTableCommand\qbreak[1][]{% \tblr@booktabs@hline[wd=\lightrulewidth, #1]% } \makeatother \begin{document} \begin{longtblr}{ colspec={l c Q[l]}, width=\linewidth } \toprule Q & Part & Marks \\ \midrule 1 & a & comments \\ \sbreak 1 & b & more comments \\ \qbreak 2 & & question with multi line problems \\ \pbreak & & more working here as well \\ \qbreak 3 & & another question with multi line problems \\ \pbreak & & more working here as well \\ \bottomrule \end{longtblr} \end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.