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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
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 9472 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: 10348
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