admin管理员组文章数量:1355532
I am using R/exams via exams2nops()
to generate PDFs.
The font everywhere is sans serif, which I don't like.
But I know that the front page must be unaltered as much as possible in order not to affect scanning afterwards.
Can I keep the first page unaltered (just change the logo, but stay in sans serif), and then change the font from page 2 onward to use LaTeX's Computer Modern Roman (text and math)? I tried to edit the original code of exams::make_nops_template()
, but the best I managed is to change the font everywhere (including front page).
I am using R/exams via exams2nops()
to generate PDFs.
The font everywhere is sans serif, which I don't like.
But I know that the front page must be unaltered as much as possible in order not to affect scanning afterwards.
Can I keep the first page unaltered (just change the logo, but stay in sans serif), and then change the font from page 2 onward to use LaTeX's Computer Modern Roman (text and math)? I tried to edit the original code of exams::make_nops_template()
, but the best I managed is to change the font everywhere (including front page).
- Does the answer below solve your problem? If so, please accept the answer by clicking the checkmark on the left (so that it is flagged accordingly here on SO). If not, please clarify the remaining problems and then we can continue to help... – Achim Zeileis Commented Apr 2 at 10:59
1 Answer
Reset to default 4Background: You don't need to alter the source code of the package or the template. It is written in such a way that the sans serif font (Helvetica) is enforced for all the elements that need to be scanned (especially exam type and exam ID). Everything else can in principle be changed - and is changed in fact by various of the supported languages.
Update: To further facilitate changing fonts, especially for the math elements, the current development version 2.4-2 of the package on R-Fe gained a new argument exams2nops(..., helvet = TRUE)
. If TRUE
, the default, the template loads
\usepackage{helvet}
\usepackage[helvet]{sfmath}
But by setting helvet = FALSE
, this is suppressed
Answer: For further modifications in the template the arguments exams2nops(..., usepackage = ..., header = ...)
can be used. With usepackage
you can specify a vector of character strings which are then turned into \usepackage{...}
lines in the template. And header
can be a character string with any LaTeX code that should be included in the header.
Example: To switch to a serif font for the exam, you can either just switch off the Helvetica font and use the default LaTeX serif font. Or you can additionally load another font such as Times New Roman via the {times}
LaTeX package.
exams2nops("deriv2.Rmd", helvet = FALSE)
exams2nops("deriv2.Rmd", helvet = FALSE, usepackage = "times")
本文标签: RExams change fontStack Overflow
版权声明:本文标题:RExams change font - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743968407a2570314.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论