Home > r > Forcing roman font in LaTeX

Forcing roman font in LaTeX

September 18Hits:4
Advertisement

I am using a LaTeX template from my university to typeset my thesis. I am making references to R and I have defined a new command with:

\newcommand{\R}{R} 

in order to get the roman "R". The formatting of the thesis means that chapter titles are written in a sans serif font. When I type a chapter title e.g. "\R{} source code" it does not appear in serif, rather in the same sans serif font at the rest of the title.

Is there a way to force the "base" font to be used, regardless of which font is in use at that time?

Sorry for no minimal working example - I'm just not sure which part of the preamble causes the chapter titles to be sans serif!

Answers

In addition to suggestions from @bdh_dtu and @egreg you might want to also add in the xspace package:

\usepackage{xspace}
% combine suggestions from @bdh_dtu and @egreg with xspace
\newcommand{\R}{\textup{\textrm{R}}\xspace}

\xspace tries to be clever about inserting a space after the macro if there would normally be one but not if there shouldn't be one, such as when writing \R. (i.e. ending the line with \R followed by a full stop.

Found it! Courtesy of Stefaan Lippens. Use:

\textnormal{} % to use the LaTeX font of the main body text (usually serif)
\textrm{}     % to force Roman font (serif)
\textsf{}     % to force sans serif font

Stefaan explains why in detail, and also gives a working example.

To complete my answer, the new command should be changed to:

\newcommand{\R}{\textrm{R}}

Tags:fonts

Related Articles

  • Forcing roman font in LaTeXSeptember 18

    I am using a LaTeX template from my university to typeset my thesis. I am making references to R and I have defined a new command with: \newcommand{\R}{R} in order to get the roman "R". The formatting of the thesis means that chapter titles are

  • TimesNewRoman font in Latex March 7

    This question already has an answer here: How do I make my document use the Times font, both for the text and the math? 6 answers I'm trying to use Times New Roman Font in Latex - MiKTeX 2.9 with command \usepackage{times} but it said pdfTex error (p

  • Using utopia and another roman font in (pdf)LaTeXJanuary 23

    I need to create a document with Utopia (Fourier package) as the default font. However, at a certain point I need to change the default roman font to say for e.g. CM-Roman. At this point reverting back to utopia makes the text seem thicker and broade

  • Migration from Computer Modern to Times New Roman fontsJuly 23

    I had typed my LaTeX article using Computer Modern fonts. Now I want Times New Roman and double spacing. I'm getting so many errors regarding font packages. Please help. \documentclass[11pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[utf8]

  • Use downloaded font in LaTeX

    Use downloaded font in LaTeX August 8

    The standard font packages make global changes to the fonts in my document. What if I want to use a particular font for just a portion of my text? How do I find the right name of the font? How do I select the font? How do I restrict the scope of the

  • Installing Times New Roman fontNovember 1

    How can I install the Times New Roman font? This video illustrates what I want to do, but I do not have the same options - I'm running Ubuntu 12.10. I have also tried running the following from the terminal: sudo apt-get install msttcorefonts sudo ap

  • Mathtype Euclid Font in Latex

    Mathtype Euclid Font in LatexJune 9

    Is there anyway that I can use Mathtype's Euclid font in typing texts in LaTeX? Just for the text, not the math mode. Some used to suggest that it's the same as the default Computer Modern font in LaTeX, but I strongly disagree with that, and I'm sti

  • LyX, How to use more than the thirteen Roman fonts listed under Document Settings Fonts?December 13

    I noticed that LyX 2.0.6 has a very limited selection of Roman (Serif) fonts listed under the Document Settings Fonts dropdown menu. I'd like to be able to use any of the LaTeX fonts that come with my TeXLive or MIKTeX installation, that came bundled

  • Times New Roman font with TeXnicCenter

    Times New Roman font with TeXnicCenterJune 9

    I'm new to LaTeX and trying to write my rapport with TeXnicCenter. I want to use the times new roman font, but i don't know why it does not works with me. This the beginning of my code : \documentclass[12pt,french]{report} \usepackage{times} \usepack

  • What is the default font in latex beamer?November 13

    What is the default font in LaTeX beamer. I want to use it in an ooffice master layout. --------------Solutions------------- Just compile a minimal document to PDF and check the fonts in the document properties in your PDF viewer. \documentclass{beam

  • Force cleartype fonts in Google ChromeJanuary 29

    Firefox allows you to force webpages to use the fonts you specify by unchecking "Allow pages to choose their own fonts instead of my selection above" in the advanced fonts settings. I use this to force cleartype fonts in Firefox. Is there a way

  • using hobby MF font with LaTeX, adding accented characters

    using hobby MF font with LaTeX, adding accented charactersNovember 12

    I created a hobby font with metafont. I would like to include some accents in the font, but I am not sure what is the standard way for accomplishing that (gogle was not very helpful), so that the font works with LaTeX (pdflatex, if needs be). How can

  • polyglossia and minted - The current roman font does not contain the Hebrew script!December 24

    Trying to use minted with Hebrew as the default language with polyglossia: \documentclass{article} \usepackage{minted} \usepackage{polyglossia} \setdefaultlanguage[calendar=hebrew, numerals=arabic]{hebrew} \setotherlanguage{english} \newfontfamily\he

  • Hand written fonts in LaTeX/XeTeX/LuaTeX

    Hand written fonts in LaTeX/XeTeX/LuaTeXMarch 14

    Recently my struggle to find out some handwritten fonts for some document led me to this question. What are the various packages that give nice looking handwritten and / or calligraphic fonts? I know that the experts here will come out with all possi

  • How use Mathematica fonts with LaTeX - which method?April 11

    I want to be able to use Mathematica fonts with LaTeX. I find two sets of instructions for this: Robert's post there Kuska's instructions in mysymdoc.pdf, a file in the Mathematica 8 folder SystemFiles/IncludeFiles/TeX/texmf/doc. Method (1) explicitl

  • Help Installing a Font for Latex on Mac (map file, directory structure, font naming)August 14

    I'm sure this sort of thing has been asked again and again, but I cannot find a guide or post anywhere that has been able to get me what need. All the online help seems to be aimed at a higher level than I can cope with (no big surprise). So any help

  • How do I use freeserif font in latex August 17

    Possible Duplicate: Install OpenType fonts in Texlive I am looking to create some documents in LibreOffice and LaTeX. To maintain consistency I want to use the same font FreeSerif in both set of documents. Is there a way to use FreeSerif fonts in LaT

  • Times new roman font?

    Times new roman font?August 19

    I want this font: But everything I've tried makes ugly pseudo-times new roman font in comparison. What I've tried based on the research I've done so far; \usepackage{mathptmx} \usepackage{times} I use Windows 7. --------------Solutions------------- C

  • \setbeamerfont for customizing content font in LaTeX beamer November 23

    I have a problem in which I am not sure how to modify the content (normal text) of beamer font. I only know how to modify the frametitle In which \setbeamerfont{structure}{family=\fontUbuntu} \setbeamerfont{frametitle}{family=\fontUbuntuLight} done f

  • XeTex - Times New Roman font for Romanian characters ș, ț, Ș and ȚDecember 13

    I have downloaded the Times New Roman font and put it into .local/fonts where it should be (my OS is Fedora 17 and I use TexLive 2012). It is recognized by LibreOffice and LyX. LibreOffice displays correctly the Romanian characters ș,ț,Ș,Ț and even c

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.353 s.