0

I wish to control the width in a table characterized by different columns per rows. Here is an excerpt of my table.

\begin{table*}[]
\begin{tabular}{| l | c | c | c | r |}

\multicolumn{5}{l}{Hello World}   \\
Ciao & $\textbullet$ & Hello  & $\textbullet& Hola  \\

\multicolumn{5}{l}{Hello World}   \\
Ciao & $\textbullet$ & Hello  & $\textbullet& Hola  \\

\end{tabular}
\end{table*}
  • 1
    Welcome to TeX SX! The width of what do you want to control? – Bernard Jan 23 '18 at 15:22
  • The width of each column separately. In particular where it is written "Ciao", "Hello" and "Hola". – FlyBob Jan 23 '18 at 15:43
  • Well, you have the p{some width} column type. B.t.w., will all cells in columns 2 and 4 have a simple \textbullet and nothing else? – Bernard Jan 23 '18 at 15:50
  • Yes, they only have a \textbullet. The final form of the table will be without separation lines between columns. – FlyBob Jan 23 '18 at 15:55
  • Type $\bullet$ (math mode) or just \textbullet (text mode) but not $\textbullet$ and anyway, whenever you open a math mode, close it ! (note the $\textbullet& ...) You should take a look to the tabularx and tabulary packages documentation for control of the width of the table and booktabs about nice rules in tables. – Fran Jan 23 '18 at 19:23
2

Here are three possibilities: reducing the number of columns to 3 and inserting the bullets at the beginning of the last two columns (fixed width: 2.5 cm) with the array package. Or, always with three columns, and inserting the bullets as separators between columns. Or with five columns,automatically inserting a bullet in columns 2 and 4:

\documentclass{article}
\usepackage{array}

\begin{document}

\begin{table*}
\begin{tabular}{| l >{\textbullet\hskip\labelsep}p{1.5cm}>{\textbullet\hskip\labelsep}p{1.5cm}|}
\multicolumn{3}{|l|}{Hello World} \\
Ciao & Hello & Hola \\
\multicolumn{3}{|l|}{Hello World} \\
Ciao & Hello & Hola \\
\end{tabular}
\bigskip

\begin{tabular}{| l *{2}{>{\textbullet}c p{1cm}}|}
\multicolumn{5}{|l|}{Hello World} \\
Ciao & & Hello & & Hola \\
\multicolumn{5}{|l|}{Hello World} \\
Ciao & & Hello & & Hola \\
\end{tabular}
\bigskip

\begin{tabular}{| l@{\makebox[3em]{\textbullet}}p{1cm}@{\makebox[3em]{\textbullet}}p{1cm}|}
\multicolumn{3}{|l|}{Hello World} \\
Ciao & Hello & Hola \\
\multicolumn{3}{|l|}{Hello World} \\
Ciao & Hello & Hola \\
\end{tabular}
\end{table*}

\end{document} 

enter image description here

|improve this answer|||||
  • It's not exactly what i'm searching, since what i want to obtain is a series of elements separated by aligned bullets, this is the reason why i use a column for the bullet, in fact, in this manner, i can align them easily. – FlyBob Jan 24 '18 at 12:34
  • But in my solution, the bullets are aligned. I've added two other solutions, see if one of them suits you. – Bernard Jan 24 '18 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.