Graphics, Figures & TablesTable "headlines"

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
niklasskold
Posts: 6
Joined: Wed Dec 07, 2016 10:47 pm

Table "headlines"

Post by niklasskold »

Hey all!

So I am trying to make a table in Latex for categorizing different types of something (in my example I have debt). But I want to have 4 "headlines" and I currently can only make 2. I will post a sample for clarity. Basically I want the line under the "private debts" to be equally long as for the above ones.

Code: Select all

\begin{table}[h]
\begin{tabularx}{\linewidth}{>{\parskip1ex}X@{\kern4\tabcolsep}>{\parskip1ex}X}
\toprule
\hfil\bfseries Short-term public debt
&
\hfil\bfseries Long-term public debt
\\\cmidrule(r{3\tabcolsep}){1-1}\cmidrule(l{-\tabcolsep}){2-2}

%% PROS, seperated by empty line or \par
\begin{itemize}

\item Commercial paper

\end{itemize}

\begin{center}
\underline{\textbf{Short-term private debt}}
\begin{itemize}
\item Commercial bank loans
\item Trade credit
\item Nånting
\end{itemize}
\end{center}
&

%% CONS, seperated by empty line or \par
\begin{itemize}

\item Public bonds and notes
\end{itemize}
\begin{center}
\underline{\textbf{Long-term private debt}}
\begin{itemize}
\item Commercial bank loans
\item Private bonds and notes
\end{itemize}
\end{center}
\\\bottomrule
\end{tabularx}
\caption{Pros and cons of an IPO}
\end{table}
TABLE.png
TABLE.png (26.75 KiB) Viewed 2643 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Table "headlines"

Post by Johannes_B »

The code you posted is oerly complicated and confusing. Why aren't you sticking with the table?
niklasskoldTableDebt.png
niklasskoldTableDebt.png (30.35 KiB) Viewed 2642 times

Code: Select all

\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{showframe}
\usepackage{ragged2e}
\newcommand{\tabitem}{\par\RaggedRight\textbullet~}
\newcolumntype{C}{>{\centering\arraybackslash\parskip1ex}X}
\begin{document}

\begin{table}
	\begin{tabularx}{\linewidth}{C@{\quad}C}
		\toprule
		\bfseries Short-term public debt & \bfseries Long-term public debt
		\\\cmidrule(r{3\tabcolsep}){1-1}\cmidrule(l{-\tabcolsep}){2-2}

			\tabitem Commercial paper & \tabitem Public bonds and notes\\\addlinespace

			\textbf{Short-term private debt} &\textbf{Long-term private debt} \\
		\cmidrule(r{3\tabcolsep}){1-1}\cmidrule(l{-\tabcolsep}){2-2}
				\tabitem Commercial bank loans 
				\tabitem Trade credit 
				\tabitem N\r{a}nting 
		&
				\tabitem Commercial bank loans 
				\tabitem Private bonds and notes \\
%% CONS, seperated by empty line or 
		\bottomrule
	\end{tabularx}
	\caption{Pros and cons of an IPO}
\end{table}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply