Hi Xianwen,

Xianwen Chen (陈贤文) writes:

> Does someone have experiences with the exam LaTeX class: 
> http://www-math.mit.edu/~psh/exam/examdoc.pdf?

Yes, but I haven't useid it with orgmode.

> The next step I'm trying to do, but don't know how, is to ask LaTeX 
> exporter to create two exports to PDF.

> I guess one way is to modify the org-latex-export-to-pdf function, so 
> that when the document class is exam, the exporter first export without 
> solutions, and then export to an other PDF file (such as 
> foo-with_solutions.pdf).

Here is one way to do the latex part. You could pass a jobname to latex.

I have this

\IfEndWith*{\jobname}{withsolution}{%
  \usepackage{todonotes}
  \printanswers
}{\usepackage[disable]{todonotes}}

in a myexam.sty file to switch between modes (with or without solutions
and todo notes) and use it in the latex file with

\usepackage{myexam}

You could add your own latex class to org-latex-classes and add this
line there.

The jobname has to be passed to latex with something like -jobname
withsolution if you want it to be with solutions. I use a Makefile for
this purpose which calls latexmk

latexmk -pdf -pdflatex="pdflatex --interaction=errorstopmode" -use-make

and adds -jobname=$(basename $@) if asked to create a pdf ending with
withsolution.pdf. I can send you the Makefile if you're interested.

To use the jobname from within orgmode, you'll have to change
org-latex-pdf-process to use the jobname if needed. I think one way to
achieve this is to add a new export backend which is derived from latex
(see org-export-define-derived-backend) and which sets
org-latex-pdf-process accordingly (and resets it afterwards).

Hope this helps.

Best,
Christine

Reply via email to