Graphics, Figures & TablesHow to make an all bold column in tabular

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

How to make an all bold column in tabular

Post by Singularity »

I would like to make an all bold tabular column, following the examples in the array documentation. But it is not working right. I suspect the problem is caused by the open and close braces necessary for the \textbf{} command. See the "B" column in my MWE. Can this be fixed?

Code: Select all

\documentclass{article}

\usepackage{array}					% Provides for a more flexible array and tabular environment, like the column defs below
\usepackage{booktabs}				% For fancy stuff in arrays and tables
\usepackage{multicol,multirow}
\newcolumntype{L}{>{\begin{math}}l<{\end{math}}}%
\newcolumntype{C}{>{\begin{math}}c<{\end{math}}}%
\newcolumntype{R}{>{\begin{math}}r<{\end{math}}}%
\newcolumntype{B}{>{\textbf{}r<{}}}%

\begin{document}
\title{Conic Sections}

\begin{tabular}{|B|L|L|}
	\toprule
	\multicolumn{3}{c}{\large\textbf{Parabola}\normalsize} \\
	\toprule
		& \text{Vertical Axis} & \text{Horizontal Axis} \\
	\midrule
	Equation & \left(x-h\right)^2 = 4p \left(y-k\right) & \left(y-k\right)^2 = 4p \left(x-h\right) \\
	\midrule
	Axis of symmetry & x=h & y=k \\
	\midrule
	Vertex & \left(h,k\right) & \left(h,k\right) \\
	\midrule
	Focus & \left(h,k+p\right) & \left(h+p,k\right) \\
	\midrule
	Directrix & y=k-p & x=h-p \\
	\midrule
	Direction of opening	& p>0 \Rightarrow up 		&  p>0 \Rightarrow right \\
		& p<0 \Rightarrow down	&  p<0 \Rightarrow left 	\\
	\bottomrule
	\multicolumn{3}{l}{Note: $d_1=d_2$, dist. to directrix=dist. to focus} \\
	\bottomrule
\end{tabular}

\end{document}

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

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

How to make an all bold column in tabular

Post by Johannes_B »

Hi, can't test right now, but \textbf takes an argument, which it does not in your case (it does, but it is empty). Try \bfseries instead.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

How to make an all bold column in tabular

Post by Singularity »

I did have the open brace and close brace, which was supposed to wrap around the parameter, but I don't think LaTeX understood what I wanted.

Anyway, \bfseries worked. TY
Post Reply