4

Apologies I am new to Latex. Trying to create a table but it is coming as condensed. The whole table is about 3Cm tall. I want the table on portrait layout of A4 sheet to be decently readable. Please help.

\begin{table}[h!]
\caption{MRMC Requested Benchmarking Tests}
\label{BT2}
\resizebox{\textwidth}{!}{%
\begin{tabular}{*{14}{|c}|}%{|l|l|l|l|l|}\hline

\multicolumn{1}{|c|}{\textbf{S No.}} & \multicolumn{1}{c|}{\textbf{Test Description}}                      & \multicolumn{1}{c|}{\textbf{High Level Steps}}                                                                                                                   & \multicolumn{1}{c|}{\textbf{Expected Output}}                                                                                                   & \multicolumn{1}{c|}{\textbf{PQA Status}}                                                                                                              \\ \hline
1                                    & Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR & a)Take the available complete IHC portfolio.b)Obtain the same COB production 10 Day VaRc)Ensure trade population and notional match betweenTCM data and VaR data & 10 Day VaR should be lower and account for the gap risk in CVA Closeout                                                                         & This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\ \hline
2                                    & Same trade Stressed CVA vs CVA Closeout                             & a)Choose a swap with one year maturity. b)Apply both methodologies on the swap. c)Plot the exposure profile on a graph                                           & For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark.                & The same result can be implied from already run test cases.                                                                                           \\ \hline
3                                    & Same trade Stressed CVA vs CVA Closeout                             & a)Choose an option with one year maturity. b)Apply both methodologies on the swap. c)Plot the exposure profile on a graph                                        & For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry. & The same result can be implied from already run test cases.                                                                                           \\ \hline
4                                    & Swap with IM and without IM                                         & a)Take one year swap and run it with IM.b)Take the same swap and run it without IM. Note: Please use CVA closeout model in both cases.                           & With IM graph should start higher, converging into without IM towards expiry.                                                                   & The same result can be implied from already run test cases.                                                                                           \\ \hline
\end{tabular}%
}
\end{table}

Thanks and Regards Varun

2
  • Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Commented Feb 22, 2018 at 16:42
  • 1
    Many of your cells are quite long. Slitting them over multiple lines might help a bit. And I'd rather use an appropriate font size and not use resizebox for something that contains text. Commented Feb 22, 2018 at 16:43

6 Answers 6

5

i would redesign your table:

enter image description here

\documentclass{article}
\usepackage{geometry}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\RaggedRight}X}

\begin{document}
    \begin{table}[htb]
\caption{MRMC Requested Benchmarking Tests}
\label{BT2}
    \footnotesize
    \setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}{@{} l
              >{\hsize=0.8\hsize}L
              >{\hsize=1.2\hsize}L
                            *{2}{L}
                @{}}
    \toprule
\thead[b]{S\\ No.}
    &   \thead{Test Description}
        &   \thead{High Level Steps}
            &   \thead{Expected Output}
                &   \thead{PQA Status}             \\
    \midrule
1  & Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR
        & a) Take the available complete IHC portfolio.\quad
          b) Obtain the same COB production 10 Day VaRc). Ensure trade population and notional match between TCM data and VaR data
            & 10 Day VaR should be lower and account for the gap risk in CVA Closeout
                & This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\
    \addlinespace
2  & Same trade Stressed CVA vs CVA Closeout
        & a) Choose a swap with one year maturity. \quad
          b) Apply both methodologies on the swap. \quad
          c) Plot the exposure profile on a graph.
            & For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark.
                & The same result can be implied from already run test cases.               \\
    \addlinespace
3   & Same trade Stressed CVA vs CVA Closeout
        & a) Choose an option with one year maturity. \quad
          b) Apply both methodologies on the swap. \quad
          c) Plot the exposure profile on a graph
            & For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry.
                & The same result can be implied from already run test cases.               \\
    \addlinespace
4   & Swap with IM and without IM
        & a)Take one year swap and run it with IM. \quad
          b) Take the same swap and run it without IM.
          Note: Please use CVA closeout model in both cases.
            & With IM graph should start higher, converging into without IM towards expiry.
                & The same result can be implied from already run test cases.               \\
    \bottomrule
\end{tabularx}%
    \end{table}
\end{document}

eddit: considering suggestion given leandris answer, but with improved code, the table can be:

\documentclass{article}
\usepackage{geometry}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\RaggedRight}X}

\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{%
\setlist[enumerate]{nosep, % <-- list setup used in all tables
                     topsep = 0pt,
                     partopsep = 0pt,
                     wide,
                     label=\alph*),
                     before = \vspace{-0.6\baselineskip},
                     }
                        }
\begin{document}
    \begin{table}[htb]
\caption{MRMC Requested Benchmarking Tests}
\label{BT2}
    \footnotesize
    \setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}{@{} l
              >{\hsize=0.8\hsize}L
              >{\hsize=1.2\hsize}L
                            *{2}{L}
                @{}}
    \toprule
\thead[b]{S\\ No.}
    &   \thead{Test Description}
        &   \thead{High Level Steps}
            &   \thead{Expected Output}
                &   \thead{PQA Status}             \\
    \midrule
1  & Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR
        & \begin{enumerate} 
            \item   Take the available complete IHC portfolio.
            \item   Obtain the same COB production 10 Day VaRc). 
          \end{enumerate}
          Ensure trade population and notional match between TCM data and VaR data
            & 10 Day VaR should be lower and account for the gap risk in CVA Closeout
                & This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\
    \addlinespace
2  & Same trade Stressed CVA vs CVA Closeout
        & \begin{enumerate}
            \item   Choose a swap with one year maturity. 
            \item   Apply both methodologies on the swap. 
            \item   Plot the exposure profile on a graph.
          \end{enumerate}  
            & For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark.
                & The same result can be implied from already run test cases.               \\
    \addlinespace
3   & Same trade Stressed CVA vs CVA Closeout
        & \begin{enumerate}
            \item   Choose an option with one year maturity.
            \item   Apply both methodologies on the swap. 
            \item   Plot the exposure profile on a graph
          \end{enumerate}  
            & For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry.
                & The same result can be implied from already run test cases.               \\
    \addlinespace
4   & Swap with IM and without IM
        & \begin{enumerate}
            \item   Take one year swap and run it with IM.
            \item   Take the same swap and run it without IM.
          \end{enumerate}  
          Note: Please use CVA closeout model in both cases.
            & With IM graph should start higher, converging into without IM towards expiry.
                & The same result can be implied from already run test cases.               \\
    \bottomrule
\end{tabularx}
    \end{table}
\end{document}

which gives:

enter image description here

5
  • Thanks @zarko ... I have another Table just below this one with three rows..that is moving to another page...any ideas how can I bring that one to the same page? Commented Feb 23, 2018 at 12:21
  • from your explanation i can't figured what is your problem. if the second table is to big, than it should go to the next page.
    – Zarko
    Commented Feb 23, 2018 at 12:29
  • so on this page it should be: some text-->table 1-->table 2, then next page text but I have: some text -->table 1 -->next page text -->table 2! Commented Feb 23, 2018 at 12:45
  • \clearpage worked! Sorted! Commented Feb 23, 2018 at 12:52
  • @VarunYadav, it seem that you not have enough place on page for two tables and some text. if the table has enough space, and you like to keep together in some page, than encapsulate them in the same table environment: \begin{table}[htbp] <table 1> \caption{1}\label{1} <table 2> \caption{2}\label{2}\end{table}. this is better than use \clearpage
    – Zarko
    Commented Feb 23, 2018 at 12:55
5

I made a few small changes.

  • I removed the 14 columns you had. You are using only 4.

  • I fexed the width of the first column to 1cm

  • I made the cell size fixed as (\textwidth-1cm)/4.

  • I removed the \resizebox and changed the font size manually with \footnotesize. Change this at your will.

  • I removed the \multicolumns as you were not actually using them.

enter image description here

\documentclass{article}

\usepackage{graphicx}

\begin{document}
\begin{table}[h!]
\caption{MRMC Requested Benchmarking Tests}
\label{BT2}
\footnotesize
% \resizebox{\textwidth}{!}{%
\begin{tabular}{|p{1cm}*{4}{|p{\dimexpr(\textwidth-1cm)/4\relax}}|}%{|l|l|l|l|l|}
\hline

\textbf{S No.} & \textbf{Test Description}                      & \textbf{High Level Steps}                                                                                                                   & \textbf{Expected Output}                                                                                                   & \textbf{PQA Status}                                                                                                              \\ \hline
1                                    & Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR & a)Take the available complete IHC portfolio.b)Obtain the same COB production 10 Day VaRc)Ensure trade population and notional match betweenTCM data and VaR data & 10 Day VaR should be lower and account for the gap risk in CVA Closeout                                                                         & This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\ \hline
2                                    & Same trade Stressed CVA vs CVA Closeout                             & a)Choose a swap with one year maturity. b)Apply both methodologies on the swap. c)Plot the exposure profile on a graph                                           & For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark.                & The same result can be implied from already run test cases.                                                                                           \\ \hline
3                                    & Same trade Stressed CVA vs CVA Closeout                             & a)Choose an option with one year maturity. b)Apply both methodologies on the swap. c)Plot the exposure profile on a graph                                        & For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry. & The same result can be implied from already run test cases.                                                                                           \\ \hline
4                                    & Swap with IM and without IM                                         & a)Take one year swap and run it with IM.b)Take the same swap and run it without IM. Note: Please use CVA closeout model in both cases.                           & With IM graph should start higher, converging into without IM towards expiry.                                                                   & The same result can be implied from already run test cases.                                                                                           \\ \hline
\end{tabular}%
% }
\end{table}
\end{document}
2
  • Thanks buddy , awesome! Just missing top header line. Any ideas? Commented Feb 22, 2018 at 17:00
  • @VarunYadav Oh, it was commented... I'll edit my answer Commented Feb 22, 2018 at 17:25
4

A different approach using tabularx and the enumerate environment:

\documentclass{article}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{enumerate}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}

\begin{document}

\begin{table}[h!]
\caption{MRMC Requested Benchmarking Tests}
\label{BT2}
\begin{tabularx}{\textwidth}{cYYYY}

\textbf{S No.} & \textbf{Test Description} & \textbf{High Level Steps}                                                                                                           & \textbf{Expected Output}                                                                                                 & \textbf{PQA Status} \\ \midrule
1                                    
& Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR 
& \begin{enumerate}[a)]\vspace*{-1.5\baselineskip}
   \item Take the available complete IHC portfolio.
   \item Obtain the same COB production 10 Day VaR
   \item Ensure trade population and notional match betweenTCM data and VaR data 
   \end{enumerate}
   & 10 Day VaR should be lower and account for the gap risk in CVA Closeout
& This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\  \midrule
\end{tabularx}%
\end{table}
\end{document}
4

You should not used \resizebox for tables, as it leads to inconsistent font sizes, very often unreadable. Instead, you can play with the font size (\footnotesize seems to be the minimal acceptable size if the document size is 10 pt), and also with the value of \tabcolsep, which defaults to 6pt, but you can set it to $ or 4 pt.

I propose a solution based on tabularx, so the total width of the table will \linewidth. Also, as the third column contains enumerations, except the column head, I defined a new column type, named E, based on X, which automatically enters an enumerate environment, with proper layout parameters, so that you only have to type the \items in each cell. Lat note: I loaded caption to have sensible vertical skip between captions above and tables:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{enumitem}
\usepackage{ragged2e}
\usepackage{tabularx}
\usepackage{caption, makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
 \newcolumntype{E}{>{\arraybackslash\RaggedRight\compress\enumerate[label = \alph*), wide=0pt, nosep, after=\vspace{-0.8\baselineskip}]}X <{\endenumerate}}

\begin{document}

\begin{table}[h!]
\setlength{\extrarowheight}{2pt}
\setlength{\tabcolsep}{4pt}
\small
\caption{MRMC Requested Benchmarking Tests}
\label{BT2}
\begin{tabularx}{\textwidth}{l|X|E|*{2}{>{\arraybackslash\RaggedRight}X|}}%{|l|l|l|l|l|}\hline
\multicolumn{1}{c}{\textbf{S No.}} & \multicolumn{1}{c}{\textbf{Test Description}} & \multicolumn{1}{c}{\textbf{High Level Steps}} & \multicolumn{1}{c}{\textbf{Expected Output}} & \multicolumn{1}{c}{\textbf{PQA Status}} \\
\hline
1 & Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR &%\leavevmode\begin{enumerate}
\item Take the available complete IHC portfolio.
\item Obtain the same COB production 10 Day VaR
\item Ensure trade population and notional match between TCM data and VaR data
 & 10 Day VaR should be lower and account for the gap risk in CVA Closeout & This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\
\hline%
2 & Same trade Stressed CVA vs CVA Closeout &
\item Choose a swap with one year maturity.
\item Apply both methodologies on the swap.
\item Plot the exposure profile on a graph. %
& For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark. & The same result can be implied from already run test cases. \\
\hline
3 & Same trade Stressed CVA vs CVA Closeout &
\item Choose an option with one year maturity.
\item Apply both methodologies on the swap.
\item Plot the exposure profile on a graph.
& For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry. & The same result can be implied from already run test cases. \\
\hline
4 & Swap with IM and without IM &
\item Take one year swap and run it with IM.
\item Take the same swap and run it without IM.
\item[Note:] Please use CVA closeout model in both cases.
& With IM graph should start higher, converging into without IM towards expiry. & The same result can be implied from already run test cases. \\
 \hline
\end{tabularx}%
\end{table}

\end{document} 

enter image description here

4

Here's another tabularx-based solution: It uses the l column type for the first column, and modified X columns for the four data columns. It does away with all vertical rules and uses few, but well-spaced, horizontal rules. Observe that whitespace can be every bit as effect as a solid rule for the purpose of creating a visual divider. The material in each cell is set ragged-right rather than fully justified, while allowing hyphenation. Ties (~) are inserted, as needed, to prevent bad line breaks in the second data columns. Finally, I suggest removing the bold-facing from the header row since it's not really needed.

enter image description here

\documentclass{article}
\usepackage[english]{babel}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters suitably
\usepackage{tabularx,booktabs,caption,ragged2e}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}

\begin{document}
\begin{table}[ht!]
\setlength\tabcolsep{4pt} % default is 6pt
\captionsetup{skip=0.333\baselineskip}
\caption{MRMC Requested Benchmarking Tests} \label{BT2}
\begin{tabularx}{\textwidth}{@{} l *{4}{Y} @{}}
\toprule
S No. & Test Description & High-Level Steps & Expected Output & PQA Status\\ 
\midrule
1 & Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR 
  & a) Take the available complete IHC portfolio. b)~Obtain the same COB production 10~Day VaR\@. c)~Ensure trade population and notional match between TCM data and VaR data 
  & 10~Day VaR should be lower and account for the gap risk in CVA Closeout
  & This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. \\ 
\addlinespace
2 & Same trade Stressed CVA vs CVA Closeout
  & a) Choose a swap with one year maturity. b)~Apply both methodologies on the swap. c)~Plot the exposure profile on a graph 
  & For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark. 
  & The same result can be implied from already-run test cases. \\ 
\addlinespace
3 & Same trade Stressed CVA vs CVA Closeout
  & a) Choose an option with one year maturity. b)~Apply both methodologies on the swap. c)~Plot the exposure profile on a graph 
  & For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry. 
  & The same result can be implied from already-run test cases.\\ 
\addlinespace
4 & Swap with IM and without IM 
  & a) Take one year swap and run it with~IM\@. b)~Take the same swap and run it without~IM\@. Note: Please use CVA closeout model in both cases.
  & With IM graph should start higher, converging into without IM towards expiry.
  & The same result can be implied from already-run test cases.\\ 
\bottomrule
\end{tabularx}
\end{table}
\end{document}
1
  • @Mico..thank you very much for your time and your help buddy! Commented Feb 23, 2018 at 12:31
2

mwe

If I were a professional typographer and you were the guy who pays, I would make an arrangement like the MWE bellow with tabulary some other tricks (see the code), although being unable to resist to change some annoying headers or sentences.

If you're a friend that need help, I'd say "get lost! and do not come back until you think in a decent redesign of the table!"

If you're a colleague that send me that table for my own use, I will first clean all the code to follow the above advice, but most probably I will ended making just a scheme with the ordinary LaTeX sectioning levels (\subsubsections, \paragraph, etc.) and/or nested lists. Huge sentences do not fit well into a table. Simple as that.

\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{tabulary,booktabs}
\usepackage[english]{babel}
\usepackage[stretch=40, shrink=40]{microtype}
\begin{document}
% Carlisle fix for use p column
\makeatletter
\def\z#14#2!!{\def\TY@classz{#17#2}}
\expandafter\z\TY@classz!!
\makeatother

\begin{table}
\caption{MRMC Requested Benchmarking Tests}
\footnotesize
\begin{tabulary}{\linewidth}{
C>{\raggedright}p{1.7cm}
>{\parskip.2ex\everypar{\hangindent1.25em}}p{3.99cm}
LL}
\toprule
\bfseries No. &
\bfseries Test &
\bfseries High Level Steps &
\bfseries Expected Output &
\bfseries PQA Status 
\\\midrule
1  &
Comparison of complete IHC portfolio aggregated TCM with 10-Day VaR &
a) Take the available complete IHC portfolio.\par
b) Obtain the same COB production 10 Day VaR.\par 
c) Ensure trade population and notional match betweenTCM data and VaR data &
10 Day VaR should be lower and account for the gap risk in CVA Closeout &
This test was deemed unfit as variance between VaR and CVA Closeout can be because of various reasons like difference in choice of risk factors, etc. 
\\\addlinespace
2  &
Same trade Stressed CVA vs CVA Closeout &
a) Choose a swap with one year maturity.\par
b) Apply both methodologies on the swap.\par
c) Plot the exposure profile on a graph. &
For Swap the profile should be forward declining slope and in case of CVA closeout there should be a spike post the 1 year mark.  &
The same result can be implied from already run test cases.
\\\addlinespace
3  &
Same trade Stressed CVA vs CVA Closeout &
a) Choose an option with one year maturity.\par 
b) Apply both methodologies on the swap.\par 
c) Plot the exposure profile on a graph.\par  &
For option it should be a straight line for both Stressed CVA and CVA Closeout. Just that for CVA closeout there should be a spike post expiry. &
The same result can be implied from already run test cases. 
\\\addlinespace
4  &
Swap with IM and without IM &
a) Take one year swap and run it with IM.\par 
b) Take the same swap and run it without IM.\par\everypar{}
Note: Please use CVA closeout model in both cases. &
With IM graph should start higher, converging into without IM towards expiry. &
The same result can be implied from already run test cases.
\\\bottomrule
\end{tabulary}%
\end{table}
\end{document}
1
  • ....Thanks for your time, fortunately/unfortunately I am neither a typographer, a Phd. student or any thing on similar lines. I am a Project Manager who has been stuck with a task to do some word beyond my skillset! My boss lives in a different universe for some reason! Commented Feb 23, 2018 at 12:30

You must log in to answer this question.

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