3

I want my table to look like the below table, where the top item(s)/texts are aligned with "General" and "Total marks" respectively.

(HSC Table)

The ideal appearance

And it currently looks like this:

My table

Currently I have the following MWE

\documentclass{article}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{array}
\usepackage{calc}
\begin{document}
\setlist[itemize]{leftmargin=*,itemsep=-4mm,topsep=3mm}

\begin{tabular}[t]{@{}m{19mm}l@{}}%m is the width of the left column (general instructions, total marks)
\cmidrule{1-1}%makes the overline 
\textbf{General Instructions} & \begin{minipage}[t]{\textwidth-16mm} %TODO: Left align general instructions
     \begin{itemize}
        \item Reading time \textendash\ 5 minutes \\
        \item Working time \textendash\ 3 hours \\
        \item Write using black pen \\
        \item Calculators approved by NESA may be used \\
        \item A reference sheet is provided at the back of this paper\\ 
        \item For questions in Section II, show relevant mathematical reasoning and/or calculations\\
        \item  Write your Centre Number and Student Number at the top of this page\\ 
     \end{itemize}
  \end{minipage}\\
\addlinespace[5mm] %Vertical space between the general instructions section and total makrs section 
\cmidrule{1-1}
 \textbf{Total marks: 100} & \begin{minipage}[t]{\textwidth-26mm}
    \textbf{Section I \textendash\ 10 marks} (pages 1-9)
        \begin{itemize}
            \item Attempt Questions 1-10 \\
            \item Allow about 123-456 for this section \\
        \end{itemize}
    \vspace{-4mm} %
    \textbf{Section II \textendash\ 90 marks} (pages 123-456)
        \begin{itemize}
            \item Attempt Questions 11-32 \\
            \item Allow about abc for this section
        \end{itemize}
    \end{minipage} \\
\end{tabular}
\end{document}

(added in placeholder values in place of the variables)

I presume that I would need to move the text "Reading time" and "Section 1" upwards, or to move "General Instructions" and "Total Marks" downwards. I'm quite inexperienced with table packages in general (have just mashed together snippets of code) so other packages are fine as well.

EDIT: Fixed MWE

4
  • 2
    Welcome to TeX.SE! Please make your code snippet be compilable, then we do not have to guess what you are doing ...
    – Mensch
    Commented Aug 8 at 12:46
  • Your code fragment contains undefined commands. Please extend it to small, complete document, which we can compile as it is
    – Zarko
    Commented Aug 8 at 12:54
  • Hi, sorry, fixing right now. Commented Aug 8 at 12:57
  • 1
    Fixed MWE (Adding helvetica isn't necessary for this purpose, right?) Commented Aug 8 at 13:05

3 Answers 3

5

I wouldn't use tabular.

\documentclass{article}
\usepackage{enumitem}

\newlist{qitemize}{itemize}{1}
\setlist[qitemize]{topsep=0pt,leftmargin=*,parsep=0pt,itemsep=2pt,label=\textbullet}

\newenvironment{instructions}[1]{%
  \par
  \rule{22.5mm}{0.4pt}\par\nopagebreak
  \makebox[25mm][l]{%
    \bfseries
    \begin{tabular}[t]{@{}l@{}} #1 \end{tabular}%
  }\begin{minipage}[t]{\dimeval{\textwidth-25mm}}
}{\end{minipage}\par\addvspace{5mm}}

\newcommand{\qhead}[2]{\par\addvspace{\medskipamount}\textbf{#1} (#2)\par}

\setlength{\parindent}{0pt}

\begin{document}

\begin{instructions}{General \\ Instructions}
  \begin{qitemize}
    \item Reading time -- 5 minutes
    \item Working time -- 3 hours
    \item Write using black pen
    \item Calculators approved by NESA may be used
    \item A reference sheet is provided at the back of this paper
    \item For questions in Section II, show relevant mathematical reasoning and/or calculations
    \item  Write your Centre Number and Student Number at the top of this page
  \end{qitemize}
\end{instructions}

\begin{instructions}{Total \\ Marks: \\ 100}
  \qhead{Section I -- 10 marks}{pages 1--9}
  \begin{qitemize}
    \item Attempt Questions 1-10
    \item Allow about 123-456 for this section
  \end{qitemize}

  \qhead{Section II -- 90 marks}{pages 123-456}
  \begin{qitemize}[topsep=0pt,leftmargin=*]
    \item Attempt Questions 11-32
    \item Allow about abc for this section
  \end{qitemize}
\end{instructions}

\end{document}

If you don't use itemize for any other purpose, you may use it with

\setlist[itemize,1]{topsep=0pt,leftmargin=*,parsep=0pt,itemsep=2pt,label=\textbullet}

However, my advice is to use a specific environment.

Note that -- is the same as \textendash and that \\ isn't needed to end an \item.

output

4

Using p{width} instead of m{width}:

\documentclass{article}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{array}
\usepackage{calc}
\begin{document}
\setlist[itemize]{leftmargin=*,itemsep=-4mm,topsep=0mm}

\begin{tabular}[t]{@{}p{19mm}l@{}}%m is the width of the left column (general instructions, total marks)
\cmidrule{1-1}%makes the overline 
\textbf{General Instructions} & \begin{minipage}[t]{\textwidth-16mm} %TODO: Left align general instructions
    \setlist{nosep}
     \begin{itemize}
        \item Reading time \textendash\ 5 minutes \\
        \item Working time \textendash\ 3 hours \\
        \item Write using black pen \\
        \item Calculators approved by NESA may be used \\
        \item A reference sheet is provided at the back of this paper\\ 
        \item For questions in Section II, show relevant mathematical reasoning and/or calculations\\
        \item  Write your Centre Number and Student Number at the top of this page\\ 
     \end{itemize}
  \end{minipage}\\
\addlinespace[5mm] %Vertical space between the general instructions section and total makrs section 
\cmidrule{1-1}
 \textbf{Total marks: 100} & \begin{minipage}[t]{\textwidth-26mm}
    \textbf{Section I \textendash\ 10 marks} (pages 1--9)
        \begin{itemize}
            \item Attempt Questions 1--10 \\
            \item Allow about 123--456 for this section \\
        \end{itemize}
    \vspace{-4mm} %
    \textbf{Section II \textendash\ 90 marks} (pages 123--456)
        \begin{itemize}
            \item Attempt Questions 11--32 \\
            \item Allow about abc for this section
        \end{itemize}
    \end{minipage} \\
\end{tabular}
\end{document}

enter image description here

BTW: One should use en-dash (--) to concatenate two numbers in a range representation.

2
  • Thanks! What's the difference between p & m? Commented Aug 8 at 14:02
  • @hschumanexperience See the array package manual. p{width} is equivalent to \parbox[t]{width}. While m{width} is like \parbox[c]{width}.
    – Stephen
    Commented Aug 8 at 14:13
3

Like this?

enter image description here

With use of the tabularray package this is simple to achieve:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs,
                varwidth}
\usepackage{enumitem}

\begin{document}
    \begin{center}
\setlist[itemize,1]{nosep, leftmargin=*, itemsep=2pt}
\begin{tblr}{colspec = {@{} Q[l, font=\bfseries, wd=26mm] X[l] @{}},
             stretch = -1,
             rowsep  = 5pt,
             measure = vbox
             }
    \cmidrule{1-1}%makes the overline 
General Instructions    
    &   \begin{itemize}
    \item Reading time -- 5 minutes 
    \item Working time -- 3 hours
    \item Write using black pen
    \item Calculators approved by NESA may be used
    \item A reference sheet is provided at the back of this paper 
    \item For questions in Section II, show relevant mathematical reasoning and/or calculations
    \item  Write your Centre Number and Student Number at the top of this page\\ 
        \end{itemize}           \\
%    \addlinespace[5mm] 
    \cmidrule{1-1}
Total marks: 100 
    &   \textbf{Section I -- 10 marks} (pages 1-9)
       \begin{itemize}
            \item Attempt Questions 1-10
            \item Allow about 123-456 for this section
        \end{itemize}           \\
    &   \textbf{Section II -- 90 marks} (pages 123-456)
        \begin{itemize}
            \item Attempt Questions 11-32 
            \item Allow about abc for this section
        \end{itemize}
\end{tblr}
    \end{center}
\end{document}
2
  • Thanks! Is it considered bad practice to use more than one table environment e.g tabular vs. tabularray in the same document? Commented Aug 8 at 14:04
  • 1
    @hschumanexperience, no. For table design was developed many packages like tabularx (enable automatic determininng of columns width), longtable` (for tables long more than one page), xltabora``, which is combination of longtable7and tabularx , etc For more information google for wikibooks about tables. tabularray package is relative new package, which offer the most of features of other packages. Personally recently I stick with it regardless that sometimes (at complex tables) has longer compilation times.
    – Zarko
    Commented Aug 8 at 14:22

You must log in to answer this question.

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