Force table column to be zero width

Mikael Fremling 08/25/2017. 1 answers, 109 views
tables columns

I would like to force the column width in a table to be zero even if there is text in the column.

I'm after something like this:

Zero width collumn

So I try the code

\begin{tabular}{|c|>{\centering}p{0.cm}|c|}
\hline  1 &  &  \tabularnewline
\hline   & 2 &  \tabularnewline
\hline   &  & 3 \tabularnewline
\hline  \end{tabular} 

which produces

non-zero width collumn

I can use the @{} trick from Removing or changing table border spacing to remove the padding before the 2, but that does not help me that much.

Any ideas?

I'm guessing it's possible to play the game using negative spaces, or maybe draw it with tikz... but it feels a bit cumbersome.

PS: In reality, I just want to be able to put symbols on the borders of the table, so if anyone knows how to do that instead, I'm equally happy.

1 Answers


AboAmmar 08/25/2017.

You have to use a box of 0pt width for this cell with 2. Also, you need to add @{\hspace{-.5\arrayrulewidth}} and @{\hspace{-.5\arrayrulewidth}} around this column specification. The reason for the negative space is to shift the second pipe | to the position of the first one, so that they become a single pipe, and the text will be centered around the pipe.

\documentclass[12pt]{article}   
\usepackage{array} 
\begin{document}

\begin{tabular}{|c|@{\hspace{-.5\arrayrulewidth}}c@{\hspace{-.5\arrayrulewidth}}|c|}
\hline 1 &                  &   \tabularnewline
\hline   & \makebox[0pt]{2} &   \tabularnewline
\hline   &                  & 3 \tabularnewline
\hline  \end{tabular} 

\end{document}

enter image description here


HighResolutionMusic.com - Download Hi-Res Songs

1 Alan Walker

Diamond Heart flac

Alan Walker. 2018. Writer: Alan Walker;Sophia Somajo;Mood Melodies;James Njie;Thomas Troelsen;Kristoffer Haugan;Edvard Normann;Anders Froen;Gunnar Greve;Yann Bargain;Victor Verpillat;Fredrik Borch Olsen.
2 Sia

I'm Still Here flac

Sia. 2018. Writer: Sia.
3 Cardi B

Taki Taki flac

Cardi B. 2018. Writer: Bava;Juan Vasquez;Vicente Saavedra;Jordan Thorpe;DJ Snake;Ozuna;Cardi B;Selena Gomez.
4 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
5 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
6 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.
7 Bradley Cooper

Shallow flac

Bradley Cooper. 2018. Writer: Andrew Wyatt;Anthony Rossomando;Mark Ronson;Lady Gaga.
8 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
9 Kelsea Ballerini

This Feeling flac

Kelsea Ballerini. 2018. Writer: Andrew Taggart;Alex Pall;Emily Warren.
10 Mako

Rise flac

Mako. 2018. Writer: Riot Music Team;Mako;Justin Tranter.
11 Dewain Whitmore

Burn Out flac

Dewain Whitmore. 2018. Writer: Dewain Whitmore;Ilsey Juber;Emilio Behr;Martijn Garritsen.
12 Avril Lavigne

Head Above Water flac

Avril Lavigne. 2018. Writer: Stephan Moccio;Travis Clark;Avril Lavigne.
13 Khalid

Better flac

Khalid. 2018. Writer: Charlie Handsome;Jamil Chammas;Denis Kosiak;Tor Erik Hermansen;Mikkel Stoleer Eriksen;Khalid.
14 Lady Gaga

Look What I Found flac

Lady Gaga. 2018. Writer: DJ White Shadow;Nick Monson;Mark Nilan Jr;Lady Gaga.
15 Deep Chills

Run Free flac

Deep Chills. 2018.
16 Dynoro

In My Mind flac

Dynoro. 2018. Writer: Georgi Kay;Feenixpawl;Ivan Gough.
17 Charli XCX

1999 flac

Charli XCX. 2018. Writer: Charli XCX;Troye Sivan;Leland;Oscar Holter;Noonie Bao.
18 NCT 127

Regular (English Version) flac

NCT 127. 2018.
19 Lukas Graham

Love Someone flac

Lukas Graham. 2018. Writer: Don Stefano;Morten "Rissi" Ristorp;Morten "Pilo" Pilegaard;Jaramye Daniels;James Alan;David LaBrel;Lukas Forchhammer Graham.
20 Rita Ora

Let You Love Me flac

Rita Ora. 2018. Writer: Rita Ora.

Related questions

Hot questions

Language

Popular Tags