1

I am creating a table to record the sponsorship list regarding to the event hosting.

\documentclass[12pt, a4paper]{article}
\usepackage[margin=2.5cm, left=2.4cm, right=1.7cm]{geometry}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{cellspace,multirow}
\usepackage{caption}
\usepackage{tabularx,ragged2e}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\setlength\cellspacetoplimit{1.75pt}    % <----
\setlength\cellspacebottomlimit{1.75pt} % <---- 

\usepackage[table,xcdraw]{xcolor}
\renewcommand{\baselinestretch}{1}

\begin{document}
\afterpage{
\begin{landscape}
\section{Sponsorship List}
\begin{table}[!ht]
\normalsize     % <----
\begin{tabularx}{\textwidth}{|C{0.7cm}|C{2cm}|C{4cm}|C{3.5cm}|C{2.5cm}|C{2.5cm}|C{3cm}|C{3cm}|C{3cm}|C{3cm}|C{3cm}|C{3cm}} 
\hline
\multirow{2}{*}{No.} & \multirow{2}{*}{Date} & \multirow{2}{*}{Company}              & \multirow{2}{*}{Manager} & \multicolumn{2}{c|}{Amount Secured}        & \multirow{2}{*}{Phone Number} & \multicolumn{2}{c|}{Person-in-charge} & \multirow{2}{*}{Status} \\ \cline{5-6} \cline{8-9}
& & & & Cash (RM) & Goods & & Name & Student ID & \\ \hline
1 & 13.05.2019 & XXXX XXX XXXXXXXX Sdn. Bhd. & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected \\ \hline
2 & 17.05.2019 & XXX TUITION CENTER & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected \\ \hline
3 & 17.05.2019 & XXX ESPORT & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected \\ \hline
4 & 20.05.2019 & XXXXX Park & & 0 & - & & XX XXX XXX& XXX0000000 & Rejected \\ \hline
5 & 21.05.2019 & XXXX TUITION CENTER & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected\\ \hline
6 & 23.05.2019 & XdXmy & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected \\ \hline
7 & 25.05.2019 & X\&X & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected\\ \hline
8 & 27.05.2019 & XX XXXXXX ELECTRICAL Sdn. Bhd. & & 200 & - & & XX XXX XXX & XXX0000000 & Confirmed\\ \hline
9 & 27.05.2019 & XXXXXX NYONYA & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected\\ \hline
10 & 28.05.2019 & XXXX MARKETING Sdn. Bhd. & & 0 & - & & XX XXX XXX & XXX0000000 & Rejected\\ \hline
11 & 30.05.2019 & XXXXXXX Coldstorage XXXXXXX Sdn. Bhd. & & - & - & & XX XXX XXX & XXX0000000 & No Response \\ \hline
12 & 06.06.2019 & XXXXXXXXX & & 0 & - & & XX XXX XXX & XXX0000000 & No Response\\ \hline
13 & 13.06.2019 & - & WXXX TXXX TXXX & - & Dinner & +6 XXX XXX XXX & XX XXX XXX & XXX0000000 & Confirmed\\ \hline
\end{tabularx}
\caption{Time Frame for Event}
\end{table}
\end{landscape}}
\end{document}

Because the table is too long for columns, so the complier complies the PDF as below: enter image description here The last column is missing and the horizontal line does not reach column 6- to 10. How could I adjust it so the table is in a page?

5
  • As it is, your table wouldn't even fit on A3 paper! You can set columns to a smaller size, use a smaller font size, set \tabcolsep to a smaller value (by default, it is 6pt). Also you can print it in landscape orientation. Some columns could use the c specifier so they have the minimal width w.r.t. their contents – a typical example being the first two columns.
    – Bernard
    Jun 15, 2019 at 8:50
  • You may try tabulary instead of tabularx. Then use sensible margin and print the tabular sidewise on an A3 page which you enclose as exhibit to the report.
    – Sveinung
    Jun 15, 2019 at 9:28
  • But I need to compile with other '.tex file..
    – weilam06
    Jun 15, 2019 at 9:31
  • 1
    What is your document class? paper format? font size?
    – Bernard
    Jun 15, 2019 at 9:44
  • @Bernard \documentclass[12pt, a4paper]{article}
    – weilam06
    Jun 15, 2019 at 9:49

1 Answer 1

0

With a smaller font size, a reduced \tabcolsep and the proper use of X type columns from the tabularx package you can easily fit the table into the margins. To make the table narrower, I have also introduced symbols for the "Status" column. If your table will contain more entries it might not fit onto the page. In this case, you might want to use the xltabular package to allow for pagebreaks within the table. If you are interested in automating the numbers in the forst column (especially useful if you have to add a row inbetween) you might want to have a look at: https://tex.stackexchange.com/a/21245/134144

enter image description here

\documentclass[12pt, a4paper]{article}
\usepackage[margin=2.5cm, left=2.4cm, right=1.7cm]{geometry}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{cellspace,multirow}
\usepackage{caption}
\usepackage{tabularx,ragged2e}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\setlength\cellspacetoplimit{1.75pt}    % <----
\setlength\cellspacebottomlimit{1.75pt} % <---- 
\newcolumntype{Y}{>{\centering}X}
\usepackage[table,xcdraw,dvipsnames]{xcolor}
\renewcommand{\baselinestretch}{1}

\usepackage{pifont}
\usepackage[outline]{contour}
\contourlength{0.5pt}
\contournumber{10}
\newcommand{\cmark}{\textcolor{Green}{\ding{51}}}
\newcommand{\xmark}{\textcolor{red}{\ding{55}}}
\newcommand{\nmark}{\textcolor{BurntOrange}{\contour{BurntOrange}{--}}}

\begin{document}
\afterpage{
\begin{landscape}
\section{Sponsorship List}
\begin{table}[!ht]
\footnotesize \setlength{\tabcolsep}{3pt}   
\begin{tabularx}{\linewidth}{|c|c|Y|Y|c|c|c|Y|c|c|} 
\hline
\multirow{2}{*}{No.} & \multirow{2}{*}{Date} & \multirow{2}{*}{Company}              & \multirow{2}{*}{Manager} & \multicolumn{2}{c|}{Amount Secured}        & \multirow{2}{*}{Phone Number} & \multicolumn{2}{c|}{Person-in-charge} & \multirow{2}{*}{Status} \\ \cline{5-6} \cline{8-9}
& & & & Cash (RM) & Goods & & Name & Student ID & \\ \hline
1 & 13.05.2019 & XXXX XXX XXXXXXXX Sdn. Bhd. & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
2 & 17.05.2019 & XXX TUITION CENTER & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
3 & 17.05.2019 & XXX ESPORT & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
4 & 20.05.2019 & XXXXX Park & & 0 & - & & XX XXX XXX& XXX0000000 & \xmark \\ \hline
5 & 21.05.2019 & XXXX TUITION CENTER & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
6 & 23.05.2019 & XdXmy & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
7 & 25.05.2019 & X\&X & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
8 & 27.05.2019 & XX XXXXXX ELECTRICAL Sdn. Bhd. & & 200 & - & & XX XXX XXX & XXX0000000 & \cmark \\ \hline
9 & 27.05.2019 & XXXXXX NYONYA & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
10 & 28.05.2019 & XXXX MARKETING Sdn. Bhd. & & 0 & - & & XX XXX XXX & XXX0000000 & \xmark \\ \hline
11 & 30.05.2019 & XXXXXXX Coldstorage XXXXXXX Sdn. Bhd. & & - & - & & XX XXX XXX & XXX0000000 & \nmark \\ \hline
12 & 06.06.2019 & XXXXXXXXX & & 0 & - & & XX XXX XXX & XXX0000000 & \nmark \\ \hline
13 & 13.06.2019 & - & WXXX TXXX TXXX & - & Dinner & +6 XXX XXX XXX & XX XXX XXX & XXX0000000 & \cmark \\ \hline
\multicolumn{10}{p{0.99\linewidth}}{\xmark~= Rejected, \nmark~= No Response, \cmark~= Confirmed}
\end{tabularx}
\caption{Time Frame for Event}
\end{table}
\end{landscape}}
\end{document}
6
  • How to make the content in cells centering? \centering seem not working though.
    – weilam06
    Jun 15, 2019 at 10:27
  • @weilam06: The contents of the cells are already horizontally centered. Do you alos want to vertically center the contents?
    – leandriis
    Jun 15, 2019 at 10:31
  • Yes, so the table looks nice to me.
    – weilam06
    Jun 15, 2019 at 10:32
  • @weilam06: Add \renewcommand\tabularxcolumn[1]{m{#1}} to your preamble to alos vertically center the contents.
    – leandriis
    Jun 15, 2019 at 10:33
  • For the column that fill in the company name, how do I adjust the column width and height such that I can fill the table with whole page?
    – weilam06
    Jun 15, 2019 at 10:57

You must log in to answer this question.

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