SCM

Forum: support

Monitor Forum | Start New Thread Start New Thread
RE: support for chemistry [ Reply ]
By: Achim Zeileis on 2024-11-04 08:06
[forum:49999]
Enrico, thanks for your interest. The individual exercises cannot pass on any information to the LaTeX template into which they are being inserted. Their YAML headers (if any) are ignored.

If you want to use additional packages in exams2pdf(), then the idea is that you set up your LaTeX template as needed. See Section 3 in
vignette("exams", package = "exams") for example.

Also, you can

- run exams_skeleton()
- copy the plain.tex file to, say, mhchem.tex
- add \usepackage{mhchem} in mhchem.tex
- call exams2pdf(..., template = "mhchem.tex")

Then you can also make further modifications of the template to adapt it to the desired layout.

If you want to use such exercises in NOPS exams, then you can add the LaTeX package on the fly via: exams2nops(..., usepackage = "mhchem")

support for chemistry [ Reply ]
By: Enrico Spinielli on 2024-11-01 14:24
[forum:49998]
Hi,
I would like to generate exams for chemistry classes.
For PDF output I can get an Rmd using mhchem LaTeX package as follows:
---
format:
html: default
pdf:
include-in-header:
text: |
\usepackage{mhchem}
---

Question
========
How many atoms of hydrogen, sulfur and oxygen are there in sulfuric acid,
formula $\ce{H2SO4}$?

Solution
========
ciao


Meta-information
================
exname: Bilanciamento (numeric)
extype: num
exsolution: 1
extol: 0

But when processd by exams2pdf() I get the following error:
tlmgr search --file --global '/l3backend-pdftex.def'
! Undefined control sequence.
l.4 formula \(\ce
{H2SO4}\)?

Error: LaTeX failed to compile plain1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See plain1.log for more info.


Any hints or suggestions?
Thanks in advance

Thanks to:
Vienna University of Economics and Business Powered By FusionForge