Graphics, Figures & TablesTable: force exact same column width

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Mynamedoesntfi
Posts: 2
Joined: Thu Apr 17, 2014 6:46 pm

Table: force exact same column width

Post by Mynamedoesntfi »

Hello,

I'm trieng to make a balans sheet (through table environment) and would like to have two columns with the exact same width. Anyone idea's?

This is my current Latex code and output:

\begin{table}[h!]
\centering
\begin{tabular}{lr|lr}
\multicolumn{4}{c}{Balans te 31/12/20XX} \\
\hline\hline
Revendication & 1 000 & Equity & 1 000 \\
Shares & 500 & Profit & 500 \\
& & & \\
& & Short term liability & 500 \\
\hline
\end{tabular}
\caption{Scenario A: inbreng tegen nominale waarde}
\label{table:ScA_Nom}
\end{table}
Attachments
Result Latex output
Result Latex output
Naamloos.png (18.2 KiB) Viewed 16666 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Table: force exact same column width

Post by Johannes_B »

You can use p-columns and give them a fixed width. There are more, see the arrayy documentaion for details.
I also loaded package siunitx to take care of your number columns. Decimal points will now be aligned.

Code: Select all

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}

\begin{document}
\begin{table}%[h!]%JB: don't do that. It's really bad.
\centering
\begin{tabular}{p{3cm}S|p{3cm}S}
\multicolumn{4}{c}{Balans te 31/12/20XX} \\
\hline\hline
Revendication & 1 000 & Equity & 1 000 \\
Shares & 500 & Profit & 500 \\
& & & \\
& & Short term liability & 500 \\
Something & 5,12 & else &1000000,20 \\
\hline
\end{tabular}
\caption{Scenario A: inbreng tegen nominale waarde}
\label{table:ScA_Nom}
\end{table}
\end{document}
Hint: Click on open in writelatex.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Mynamedoesntfi
Posts: 2
Joined: Thu Apr 17, 2014 6:46 pm

Re: Table: force exact same column width

Post by Mynamedoesntfi »

Okay that did the job. Thank you for your answer.
Post Reply