LaTeX forum ⇒ Graphics, Figures & TablesTable formatting

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

Table formatting

Postby Lusavia » Wed Oct 14, 2020 10:48 pm

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...

User avatar
Ijon Tichy
Posts: 332
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Thu Oct 15, 2020 9:15 am

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] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass{article}
  2. \begin{document}
  3. \begin{table}
  4. \centering
  5. \begin{tabular}{lr}
  6. left & \textbf{right} \\
  7. \end{tabular}
  8. \caption{Example}
  9. \end{table}
  10. \end{document}


BTW: If you have multiple questions please use multiple topics and always add a suitable Infominimal working example to each question.

Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Postby Lusavia » Thu Oct 15, 2020 6:49 pm

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: 332
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Thu Oct 15, 2020 7:13 pm

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.

Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Postby Lusavia » Thu Oct 15, 2020 9:46 pm

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 187 times

User avatar
Ijon Tichy
Posts: 332
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Fri Oct 16, 2020 7:43 am

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.

Lusavia
Posts: 6
Joined: Mon May 11, 2020 1:44 am

Postby Lusavia » Fri Oct 16, 2020 2:48 pm

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.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Baidu [Spider] and 8 guests