How to change font and point size in bookdown pdf?

浪子不回头ぞ 提交于 2021-01-22 03:15:12

问题


I am writing a document with a strict requirement to use arial 12 point. I have modified my output yml in bookdown like this:

site: bookdown::bookdown_site
fontsize: 12pt
fontfamily: arial
documentclass: book
output: 
  bookdown::pdf_book:
    includes:
      in_header: preamble.tex
    keep_tex: yes
    toc_depth: 3
    toc_appendix: yes
clean: [packages.bib, bookdown.bbl]

but it has no effect on the output other than I was forced to install some extra font packages in MikTex package manager, but even after this was done, there was no change to the actual document output, yet the top of the _main.tex looks like this:

\documentclass[12pt,]{book}
\usepackage[]{arial}
\usepackage{amssymb,amsmath}

Why doesn't it honour my choice of font? I also tried Lato, a similar font, but the document always comes back with the default serif family font.


回答1:


Try adding the following lines to your preamble.tex:

\usepackage{fontspec}
\setmainfont{Arial}



回答2:


The default article documentclass (but even the book one you selected) only supports 10, 11 and 12. If you want more choice you should use the KOMA equivalents.



来源:https://stackoverflow.com/questions/44638337/how-to-change-font-and-point-size-in-bookdown-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!