Graphics, Figures & TablesArial font in table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Ross Ahmed
Posts: 15
Joined: Mon Dec 17, 2012 8:56 pm

Arial font in table

Post by Ross Ahmed »

The code below has set arial font throughout file. However, note the table contents is not arial. How can I make even the table content arial font?

Code: Select all

\documentclass[12]{article}

\renewcommand{\rmdefault}{phv}
 % Arial font
\renewcommand{\sfdefault}{phv} 
% Arial font

\begin{document}

\title{test}
\maketitle

This is a test document

% Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Sat, Feb 02, 2013 - 12:41:40
\begin{table}[htb] \centering 
  \caption{} 
  \label{} 
\footnotesize 

\begin{tabular}{@{\extracolsep{5pt}} c c c } 
\\[-1.8ex]\hline 
\hline \\[-1.8ex] 
variable1 & variable2 & variable3 \\ 
\hline \\[-1.8ex] 
$21$ & $6$ & $160$ \\ 
$21$ & $6$ & $160$ \\ 
$22.800$ & $4$ & $108$ \\ 
\hline \\[-1.8ex] 
\normalsize 
\end{tabular} 
\end{table} 

\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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Arial font in table

Post by Stefan Kottwitz »

Hi Ross,

it shows the same font, when I tried it:
font.png
font.png (6.33 KiB) Viewed 9391 times
Click on "Open in writeLaTeX" above your code example to verify. Please check your example again, if it really does what you said.

Stefan
LaTeX.org admin
Ross Ahmed
Posts: 15
Joined: Mon Dec 17, 2012 8:56 pm

Re: Arial font in table

Post by Ross Ahmed »

Note that numbers within the table columns are not Arial.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Arial font in table

Post by Stefan Kottwitz »

Ah, the numbers! Well, they have math font. That's not necessary just for numbers if you would like to use the same font. So, simply remove the $ symbols.

If math mode would really be necessary, it could be achieved by

Code: Select all

\usepackage{sfmath}
Btw. phv means Helvetiva (or the Nimbus Sans clone), not Arial - Arial is kind of a Microsoft copy of the original Helvetica.

Stefan
LaTeX.org admin
Ross Ahmed
Posts: 15
Joined: Mon Dec 17, 2012 8:56 pm

Re: Arial font in table

Post by Ross Ahmed »

Great, many thanks.
Post Reply