Graphics, Figures & TablesSerif font in TikZ-Node, beamer class

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
guest75

Serif font in TikZ-Node, beamer class

Post by guest75 »

Hello,

if I use beamer class with this code

Code: Select all

\documentclass{beamer} 

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{lmodern} 
\usepackage{newtxtext,newtxmath} 
\usepackage{tikz} 

\usefonttheme[onlymath]{serif} 

\begin{document} 
\begin{frame} 

    \begin{tikzpicture} 
      \node {$g(f(x))$}; 
    \end{tikzpicture} 

\end{frame} 

\end{document}
there is the following problem: the first bracket after the "g" overlaps the following "f".

When I use the same code with article class like this:

Code: Select all

\documentclass{article} 

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{lmodern} 
\usepackage{newtxtext,newtxmath} 
\usepackage{tikz} 

\begin{document} 

    \begin{tikzpicture} 
      \node {$g(f(x))$}; 
    \end{tikzpicture} 


\end{document}
there's no such problem.

Does anyone have an idea about this?

Regards
Tom

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

Serif font in TikZ-Node, beamer class

Post by Johannes_B »

Crosspost to GoLaTeX.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Serif font in TikZ-Node, beamer class

Post by Stefan Kottwitz »

Hi Tom,

welcome to the forum!

You are also invited to our German partner forum TeXwelt.de if you like to talk in German about TeX and TikZ.

As I'm a bit allergic now to flickering commercial advertising on goLaTeX, I prefer to post my answer here instead. 8-) It's a font issue, independent of TikZ. You can verify it with the same node directly in a frame.

And try using instead of the serif theme:

\usefonttheme{professionalfonts}

to not let beamer change the font, you will see that in that case there's no overlap. Perhaps see you on TeXwelt too? It's a new engine with quality sorting and fine topic sorting and there are great TeX connoisseurs who are friendly and welcoming.

Stefan
LaTeX.org admin
guest75

Serif font in TikZ-Node, beamer class

Post by guest75 »

Hello Stefan,

thank you very much for your help. I changed to \usefonttheme{professionalfonts} and it works fine.

I do still not understand what is \usefonttheme[onlymath]{serif} for and why it works perfectly with article but not with beamer.
Stefan_K wrote:Perhaps see you on TeXwelt too? It's a new engine with quality sorting and fine topic sorting and there are great TeX connoisseurs who are friendly and welcoming.
Stefan
I'll take a look on it, thanks for your hint. ;)

Tom
Post Reply