Graphics, Figures & TablesTable formatting

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Table formatting

Post by Lusavia »

Hello. I'm just learning tables and have two questions I can't find answers to searching the forum:

1) Is there a vertical equivalent to the partial horizontal line command (\cline{ })? I only need vertical borders on certain cells in my table but setting them with "|" affects all rows in a column (also merged cells lose the right border, another reason I have to do borders by cell).

2. Can I specify row height for individual rows instead of \renewcommand{\arraystretch}{ } which affects all rows?

Thanks.

Whoops, third question - why doesn't \textbf { } work in tables? I can underline no problem but bolding doesn't work...

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Table formatting

Post by Ijon Tichy »

You can use \multicolumn to change the column specification inclusive the following vertical line specification of a certain column, e.g., \multicolumn{1}{c|}{…} to add a vertical rule or \multicolumn{1}{c}{…} to remove it. Package hhline provides extra features for lines between columns, rows and cells. See the package manual for more information and examples.

Extra spaces between rows can be added by the optional argument of \\, e.g., \\[5cm] or with package booktabs (which is not recommended to be used with vertical lines). Or you can add an invisible rule, e.g., \rule[-\baselineskip]{0pt}{3\baselineskip}.

All the commands used in this answers should be documented in (more or less complete) introductions or beginner guided to LaTeX.

\textbf does work in tabulars:

Code: Select all

\documentclass{article}
\begin{document}
\begin{table}
\centering
\begin{tabular}{lr}
left & \textbf{right} \\
\end{tabular}
\caption{Example}
\end{table}
\end{document}
BTW: If you have multiple questions please use multiple topics and always add a suitable Infominimal working example to each question.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Table formatting

Post by Lusavia »

Great, thanks very much. I'll get to work on both. Re \textbf in tables, that and italics still aren't working, so probably something to do with Overleaf which I'm using.
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Table formatting

Post by Ijon Tichy »

My examples works on Overleaf too. And \textit (or \emph) instead of \textbf also works. So I doubt that anybody can help you, unless you'll show us a Infominimal working example.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Table formatting

Post by Lusavia »

If this is an acceptable minimal working example, the words "Canonical Verbs:" should be bold and "remember" in italics; neither comes through correctly in Overleaf's compilation (image attached).

\begin{tabular}{ r c | r r | r r | m{.5cm} | l l | l l | }
\textbf{Canonical Verbs:} & \multicolumn {1} {c}\ & \multicolumn{4} {c} {stem - \textit{remember}} & \multicolumn {1} {c}\ & \multicolumn{4} {c} {lɛv-} \\
& \multicolumn {1} {c}\ & & \multicolumn {1} {c}\ & & \multicolumn {1} {c}\ & \multicolumn {1} {c}\ & & \multicolumn {1} {c}\ & & \multicolumn {1} {c}\ \\
\cline{3-6} \cline{8-11}
Attachments
Capture.JPG
Capture.JPG (28.61 KiB) Viewed 6735 times
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Table formatting

Post by Ijon Tichy »

Lusavia wrote:If this is an acceptable minimal working example
As the name says and the linked page explains, a Infominimal working example is working (without changing or adding anything). This is not the case for your code. So no. From your screenshot I can see, that you've changed the font. But you've not shown how. So, because this again is not a Infominimal working example, I do not know, whether changing the font is part of your problem.

Sorry, I cannot help you.

PS: And please mark your code as code.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Table formatting

Post by Lusavia »

I identified myself as a beginner in the first post. So if my questions or the format of my questions frustrate you, how about recommending a forum that helps beginners? What we don't need is the same link on minimal examples repeated four times, no one in our office can make heads or tails of what you actually want in a post, wordy as it was.

In fact we've spent a good deal of time going thru help guides and other online resources to see if latex could be a good option in some of our work. So when a simple thing like specifying row height in a table isn't mentioned or doesn't seem possible in latex, it's natural to pose the question to the forum that "loves good questions". Getting smarmy comments back pretty much tells us not to waste our time.
Post Reply