emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Help with new exporter
@ 2013-07-10 16:32 John Rakestraw
  2013-07-10 16:58 ` Robert Klein
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: John Rakestraw @ 2013-07-10 16:32 UTC (permalink / raw)
  To: emacs-orgmode

Greetings, list --

I've been using Philip Hirschhorn's exam documentclass 
(http://www-math.mit.edu/~psh/#ExamCls) for several years to produce my 
exams. I've been writing the exams in org-mode and using the exporter to
produce the pdf.

I've recently moved to org 8.0. (I like it!) I've successfully 
converted all of my other export class definitions, but I can't figure 
out how to define the exam class so that I can export my exams. I've 
pasted below the class definition that worked with the previous exporter 
(I know it's clumsy, but it worked) and also a sample version of what I 
need in the tex file.

(I know I could just write the tex file directly, but it's nice to have 
all of the course materials included in human-readable form in the 
course org file.)

My problem is that I can't get the exporter to produce chunks like 
this:

\begin{questions}
\question
A paragraph describing how the students should answer the following 
questions.
\begin{parts}
\part
A multi-line question
\part
Another multi-line question
\end{parts}
\end{questions}

Thanks for whatever advice anyone can offer.

--John


Old template:
--8<---------------cut here---------------start------------->8---
       (setq org-export-latex-classes (cons '("exam"
     ### I know that in the new exporter I need to change this variable 
to
     "org-latex-classes" ###
       "% BEGIN exam Defaults
       [NO-DEFAULT-PACKAGES]
       [PACKAGES]
       \\documentclass[12pt]{exam}
       \\usepackage{palatino}
       \\extrawidth{.5in}
       \\extraheadheight{-.75in}
       \\extrafootheight[-3in]{-.75in}
       \\pagestyle{headandfoot}
       \\NoKey
       \\NumberOfVersions{1}
       \\renewcommand\\thequestion{\\Roman{question}}
       \\renewcommand\\thepartno{\\arabic{partno}}
       \\renewcommand\\partlabel{\\thepartno.}


       % END exam Defaults

       "
              ("\\begin{questions}" "\\end{questions}" 
"\\begin{questions}" "\\end{questions}")
              ("\\question" . "\\question*")
              ("\\begin{parts}" "\\end{parts}" "\\begin{parts}" 
"\\end{parts}")
              ("\\part" . "\\part*"))

       org-export-latex-classes))

--8<---------------cut here---------------end--------------->8---

An example of what I need the exporter to produce:

--8<---------------cut here---------------start------------->8---
\documentclass[letterpaper]{exam}
\extrawidth{.5in}
\extraheadheight[.3in]{-.75in}
\extrafootheight{-.25in}
\raggedright
\renewcommand\thequestion{\Roman{question}}
\renewcommand\thepartno{\arabic{partno}}
\renewcommand\partlabel{\thepartno.}
\firstpageheader{Name: \enspace\makebox[3in]{\hrulefill}\\Exam 
1\\}{}{Introductory Class \\May 7, 2013\\}
\begin{document}

\begin{coverpages}
text describing how the exam should be printed and prepared for 
distribution.
\end{coverpages}



\begin{questions}
\question
A paragraph here describes this section and tells students how many 
terms to
identify.
\begin{parts}
\part
term 1
\vspace*{\fill}
\part
term 2
\vspace*{\fill}
\part
term 3
\vspace*{\fill}
\part
term 4
\vspace*{\fill}
\part
term 5
\vspace*{\fill}
\part
term 6
\vspace*{\fill}
\part
term 7
\vspace*{\fill}
\part
term 7
\vspace*{\fill}
\part
term 8
\end{parts}
\end{questions}
\newpage
\fillwithdottedlines{\fill}
\newpage
\begin{questions}
\question
Short Answer. A paragraph describing how I want students to respond to 
the
following questions. I want to leave vertical space filled with dotted 
lines
between the questions, and I want two questions on each page.
\begin{parts}
\part
This is the first question. It will be several lines long, so I'm 
writing enough
filler here to add at least a second line.
\fillwithdottedlines{\fill}
\part
This is the second question. It will also be several lines long, so I 
need
filler enough to get to the second line for this example.
\fillwithdottedlines{\fill}

\newpage
\fillwithdottedlines{\fill}
\newpage
\part
This is the 3d question.
\fillwithdottedlines{\fill}
\end{parts}
\end{questions}
\newpage
\fillwithdottedlines{\fill}
\newpage
\begin{questions}
\question
Essay Question. This is a section of essay questions. Students will 
answer only
one of these questions, so I don't need to leave space between the two 
questions.
\begin{parts}
\part
The first of the essay questions goes here. It will be several lines 
long, so I
want enough text in the example to provide a line break.
\part
The second essay question. It is also several lines long, so I'll add 
some
rambling text here for the second line.
\end{parts}
\end{questions}
\fillwithdottedlines{\fill}
\newpage
\fillwithdottedlines{\fill}
\end{document}

--8<---------------cut here---------------end--------------->8---


-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 16:32 John Rakestraw
@ 2013-07-10 16:58 ` Robert Klein
  2013-07-10 17:27   ` John Rakestraw
  2013-07-10 19:37 ` Robert Klein
  2013-07-10 19:56 ` Rasmus
  2 siblings, 1 reply; 22+ messages in thread
From: Robert Klein @ 2013-07-10 16:58 UTC (permalink / raw)
  To: emacs-orgmode

Hi John,

would you mind posting an example of the org file, too?  It would be
easier for me to wrap my thoughts about this..  (The gurus probably
don't it...)

Thanks a lot
Robert


On 07/10/2013 06:32 PM, John Rakestraw wrote:
> Greetings, list --
> 
> I've been using Philip Hirschhorn's exam documentclass
> (http://www-math.mit.edu/~psh/#ExamCls) for several years to produce my
> exams. I've been writing the exams in org-mode and using the exporter to
> produce the pdf.
> 
> I've recently moved to org 8.0. (I like it!) I've successfully converted
> all of my other export class definitions, but I can't figure out how to
> define the exam class so that I can export my exams. I've pasted below
> the class definition that worked with the previous exporter (I know it's
> clumsy, but it worked) and also a sample version of what I need in the
> tex file.
> 
> (I know I could just write the tex file directly, but it's nice to have
> all of the course materials included in human-readable form in the
> course org file.)
> 
> My problem is that I can't get the exporter to produce chunks like this:
> 
> \begin{questions}
> \question
> A paragraph describing how the students should answer the following
> questions.
> \begin{parts}
> \part
> A multi-line question
> \part
> Another multi-line question
> \end{parts}
> \end{questions}
> 
> Thanks for whatever advice anyone can offer.
> 
> --John
> 
> 
> Old template:
> --8<---------------cut here---------------start------------->8---
>       (setq org-export-latex-classes (cons '("exam"
>     ### I know that in the new exporter I need to change this variable to
>     "org-latex-classes" ###
>       "% BEGIN exam Defaults
>       [NO-DEFAULT-PACKAGES]
>       [PACKAGES]
>       \\documentclass[12pt]{exam}
>       \\usepackage{palatino}
>       \\extrawidth{.5in}
>       \\extraheadheight{-.75in}
>       \\extrafootheight[-3in]{-.75in}
>       \\pagestyle{headandfoot}
>       \\NoKey
>       \\NumberOfVersions{1}
>       \\renewcommand\\thequestion{\\Roman{question}}
>       \\renewcommand\\thepartno{\\arabic{partno}}
>       \\renewcommand\\partlabel{\\thepartno.}
> 
> 
>       % END exam Defaults
> 
>       "
>              ("\\begin{questions}" "\\end{questions}"
> "\\begin{questions}" "\\end{questions}")
>              ("\\question" . "\\question*")
>              ("\\begin{parts}" "\\end{parts}" "\\begin{parts}"
> "\\end{parts}")
>              ("\\part" . "\\part*"))
> 
>       org-export-latex-classes))
> 
> --8<---------------cut here---------------end--------------->8---
> 
> An example of what I need the exporter to produce:
> 
> --8<---------------cut here---------------start------------->8---
> \documentclass[letterpaper]{exam}
> \extrawidth{.5in}
> \extraheadheight[.3in]{-.75in}
> \extrafootheight{-.25in}
> \raggedright
> \renewcommand\thequestion{\Roman{question}}
> \renewcommand\thepartno{\arabic{partno}}
> \renewcommand\partlabel{\thepartno.}
> \firstpageheader{Name: \enspace\makebox[3in]{\hrulefill}\\Exam
> 1\\}{}{Introductory Class \\May 7, 2013\\}
> \begin{document}
> 
> \begin{coverpages}
> text describing how the exam should be printed and prepared for
> distribution.
> \end{coverpages}
> 
> 
> 
> \begin{questions}
> \question
> A paragraph here describes this section and tells students how many
> terms to
> identify.
> \begin{parts}
> \part
> term 1
> \vspace*{\fill}
> \part
> term 2
> \vspace*{\fill}
> \part
> term 3
> \vspace*{\fill}
> \part
> term 4
> \vspace*{\fill}
> \part
> term 5
> \vspace*{\fill}
> \part
> term 6
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 8
> \end{parts}
> \end{questions}
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \begin{questions}
> \question
> Short Answer. A paragraph describing how I want students to respond to the
> following questions. I want to leave vertical space filled with dotted
> lines
> between the questions, and I want two questions on each page.
> \begin{parts}
> \part
> This is the first question. It will be several lines long, so I'm
> writing enough
> filler here to add at least a second line.
> \fillwithdottedlines{\fill}
> \part
> This is the second question. It will also be several lines long, so I need
> filler enough to get to the second line for this example.
> \fillwithdottedlines{\fill}
> 
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \part
> This is the 3d question.
> \fillwithdottedlines{\fill}
> \end{parts}
> \end{questions}
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \begin{questions}
> \question
> Essay Question. This is a section of essay questions. Students will
> answer only
> one of these questions, so I don't need to leave space between the two
> questions.
> \begin{parts}
> \part
> The first of the essay questions goes here. It will be several lines
> long, so I
> want enough text in the example to provide a line break.
> \part
> The second essay question. It is also several lines long, so I'll add some
> rambling text here for the second line.
> \end{parts}
> \end{questions}
> \fillwithdottedlines{\fill}
> \newpage
> \fillwithdottedlines{\fill}
> \end{document}
> 
> --8<---------------cut here---------------end--------------->8---
> 
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 16:58 ` Robert Klein
@ 2013-07-10 17:27   ` John Rakestraw
  0 siblings, 0 replies; 22+ messages in thread
From: John Rakestraw @ 2013-07-10 17:27 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Robert --

> would you mind posting an example of the org file, too?  It would be
> easier for me to wrap my thoughts about this..  (The gurus probably
> don't it...)

Sure. (I should have included it earlier; I was worried that my message 
was already too long.) Here's one that worked with the old exporter. 
(Note that I had to leave many of the actual header lines blank -- or, 
rather, with only an empty space.)

--John

--8<---------------cut here---------------start------------->8---
#+LaTeX_CLASS: exam
#+LaTeX_CLASS_OPTIONS: [10pt]
#+LATEX_HEADER: \extrawidth{.5in}
#+LATEX_HEADER: \extraheadheight[.3in]{-.75in}
#+LATEX_HEADER: \extrafootheight{-.25in}
#+LATEX_HEADER: \raggedright
#+LaTeX: \renewcommand\thequestion{\Roman{question}}
#+LaTeX: \renewcommand\thepartno{\arabic{partno}}
#+LaTeX: \renewcommand\partlabel{\thepartno.}
#+OPTIONS: toc:nil num:y timestamp:nil creator:nil H:4
#+TITLE:
#+LaTeX: \firstpageheader{Name:\enspace\makebox[3in]{\hrulefill}\\Exam 
1\\}{}{Theo 001 -- Rakestraw\\February 14, 2013\\}
#+LaTeX: \begin{coverpages}
this is just some text
#+LaTeX: \end{coverpages}

* Meaningless header
**
*Identification of Terms*. Identify/define and give the significance
of *six* of the following. If you identify/define more than six
without indicating clearly which six you want me to grade, I will
grade your first six answers (18 points).
*** Terms
****
term 1
#+LaTeX: \vspace*{\fill}
****
term 2
#+LaTeX: \vspace*{\fill}
****
term 3
#+LaTeX: \vspace*{\fill}
****
term 4
#+LaTeX: \vspace*{\fill}
****
term 5
#+LaTeX: \vspace*{\fill}
****
term 6
#+LaTeX: \vspace*{\fill}
****
term 7
#+LaTeX: \vspace*{\fill}
****
term 8
#+LaTeX: \vspace*{\fill}
****
term 9
#+LaTeX: \newpage
#+LaTeX: \fillwithdottedlines{\fill}
#+LaTeX: \newpage

**
*Short Answer*. Answer *two* of the following in a paragraph. If you
attempt to answer more than two without indicating clearly which two 
you
intend me to grade I will grade your first two answers (36 points).
*** Questions
****
Question one goes on for more than one line. (I mention that because I 
want to
be clear that I can't put a question in a heading.)

#+LaTeX: \fillwithdottedlines{\fill}

****
Question 2 goes here.
#+LaTeX: \fillwithdottedlines{\fill}

#+LaTeX: \newpage
#+LaTeX: \fillwithdottedlines{\fill}
#+LaTeX: \newpage

****
Question 3 goes here.
#+LaTeX: \fillwithdottedlines{\fill}

****
Question 4 goes here.
#+LaTeX: \fillwithdottedlines{\fill}

#+LaTeX: \newpage
#+LaTeX: \fillwithdottedlines{\fill}
#+LaTeX: \newpage

**
*Essay Question*. Answer *one* of the following as fully as you are 
able.
If you attempt to answer more than one without indicating clearly which 
one
you intend me to grade I will grade your first answer (40 points).
*** Questions

****
here's the first essay question.
****
here's the second essay question.
#+LaTeX: \fillwithdottedlines{\fill}

#+LaTeX: \newpage
#+LaTeX: \fillwithdottedlines{\fill}
--8<---------------cut here---------------end--------------->8---


-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 16:32 John Rakestraw
  2013-07-10 16:58 ` Robert Klein
@ 2013-07-10 19:37 ` Robert Klein
  2013-07-10 20:46   ` John Rakestraw
  2013-07-10 19:56 ` Rasmus
  2 siblings, 1 reply; 22+ messages in thread
From: Robert Klein @ 2013-07-10 19:37 UTC (permalink / raw)
  To: emacs-orgmode

Hi John.

thank you for the example org file.

I made two kinds of changes, one in the org-latex-classes definition and
one in the .org-file itself:


I changed the class definition for org-latex-classes to

#+begin_src emacs-lisp
        ("exam"
         "\\documentclass[12pt]{exam}
% BEGIN exam Defaults
[NO-DEFAULT-PACKAGES]
[PACKAGES]

\\usepackage{palatino}
\\extrawidth{.5in}
\\extraheadheight{-.75in}
\\extrafootheight[-3in]{-.75in}
\\pagestyle{headandfoot}
\\NoKey
\\NumberOfVersions{1}
\\renewcommand\\thequestion{\\Roman{question}}
\\renewcommand\\thepartno{\\arabic{partno}}
\\renewcommand\\partlabel{\\thepartno.}

% END exam Defaults
"
         ("\\begin{questions}{%s}" "\\end{questions}")
         ("\\question{%s}" . "\\question*{%s}")
         ("\\begin{parts}{%s}" "\\end{parts}")
         ("\\part{%s}" . "\\part*{%s}"))
#+end_src


Note the {%s} after the each opening clause.  I left the unnumbered part
of questions and parts out in my version, as I didn't see a difference
(no "unnumbered" \begin{questions} / \begin{parts} in the exam class?).

The documentation of org-latex-classes in ox-latex.el seems to be
confusing; at one place it says "A %s formatter is mandatory in each
section string and will be replaced by the title of the section." an at
another "The opening clause should have a %s to represent the section
title.".  Probably the "should have" in the second place ought to be a
"must have".


Anyway, in the .org file I added a space character to all empty
headings, e.g.

****

Without the space I first for a log of "\textbf{**}" in the output.


After both changes the resulting document looks like something you might
have wanted in the first place.


I got some weird numberings throughout the document, but this may be a
result of my setup.  Could you please check this, and describe anything
weird in your results?

Best regards
Robert





On 07/10/2013 06:32 PM, John Rakestraw wrote:
> Greetings, list --
> 
> I've been using Philip Hirschhorn's exam documentclass
> (http://www-math.mit.edu/~psh/#ExamCls) for several years to produce my
> exams. I've been writing the exams in org-mode and using the exporter to
> produce the pdf.
> 
> I've recently moved to org 8.0. (I like it!) I've successfully converted
> all of my other export class definitions, but I can't figure out how to
> define the exam class so that I can export my exams. I've pasted below
> the class definition that worked with the previous exporter (I know it's
> clumsy, but it worked) and also a sample version of what I need in the
> tex file.
> 
> (I know I could just write the tex file directly, but it's nice to have
> all of the course materials included in human-readable form in the
> course org file.)
> 
> My problem is that I can't get the exporter to produce chunks like this:
> 
> \begin{questions}
> \question
> A paragraph describing how the students should answer the following
> questions.
> \begin{parts}
> \part
> A multi-line question
> \part
> Another multi-line question
> \end{parts}
> \end{questions}
> 
> Thanks for whatever advice anyone can offer.
> 
> --John
> 
> 
> Old template:
> --8<---------------cut here---------------start------------->8---
>       (setq org-export-latex-classes (cons '("exam"
>     ### I know that in the new exporter I need to change this variable to
>     "org-latex-classes" ###
>       "% BEGIN exam Defaults
>       [NO-DEFAULT-PACKAGES]
>       [PACKAGES]
>       \\documentclass[12pt]{exam}
>       \\usepackage{palatino}
>       \\extrawidth{.5in}
>       \\extraheadheight{-.75in}
>       \\extrafootheight[-3in]{-.75in}
>       \\pagestyle{headandfoot}
>       \\NoKey
>       \\NumberOfVersions{1}
>       \\renewcommand\\thequestion{\\Roman{question}}
>       \\renewcommand\\thepartno{\\arabic{partno}}
>       \\renewcommand\\partlabel{\\thepartno.}
> 
> 
>       % END exam Defaults
> 
>       "
>              ("\\begin{questions}" "\\end{questions}"
> "\\begin{questions}" "\\end{questions}")
>              ("\\question" . "\\question*")
>              ("\\begin{parts}" "\\end{parts}" "\\begin{parts}"
> "\\end{parts}")
>              ("\\part" . "\\part*"))
> 
>       org-export-latex-classes))
> 
> --8<---------------cut here---------------end--------------->8---
> 
> An example of what I need the exporter to produce:
> 
> --8<---------------cut here---------------start------------->8---
> \documentclass[letterpaper]{exam}
> \extrawidth{.5in}
> \extraheadheight[.3in]{-.75in}
> \extrafootheight{-.25in}
> \raggedright
> \renewcommand\thequestion{\Roman{question}}
> \renewcommand\thepartno{\arabic{partno}}
> \renewcommand\partlabel{\thepartno.}
> \firstpageheader{Name: \enspace\makebox[3in]{\hrulefill}\\Exam
> 1\\}{}{Introductory Class \\May 7, 2013\\}
> \begin{document}
> 
> \begin{coverpages}
> text describing how the exam should be printed and prepared for
> distribution.
> \end{coverpages}
> 
> 
> 
> \begin{questions}
> \question
> A paragraph here describes this section and tells students how many
> terms to
> identify.
> \begin{parts}
> \part
> term 1
> \vspace*{\fill}
> \part
> term 2
> \vspace*{\fill}
> \part
> term 3
> \vspace*{\fill}
> \part
> term 4
> \vspace*{\fill}
> \part
> term 5
> \vspace*{\fill}
> \part
> term 6
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 8
> \end{parts}
> \end{questions}
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \begin{questions}
> \question
> Short Answer. A paragraph describing how I want students to respond to the
> following questions. I want to leave vertical space filled with dotted
> lines
> between the questions, and I want two questions on each page.
> \begin{parts}
> \part
> This is the first question. It will be several lines long, so I'm
> writing enough
> filler here to add at least a second line.
> \fillwithdottedlines{\fill}
> \part
> This is the second question. It will also be several lines long, so I need
> filler enough to get to the second line for this example.
> \fillwithdottedlines{\fill}
> 
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \part
> This is the 3d question.
> \fillwithdottedlines{\fill}
> \end{parts}
> \end{questions}
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \begin{questions}
> \question
> Essay Question. This is a section of essay questions. Students will
> answer only
> one of these questions, so I don't need to leave space between the two
> questions.
> \begin{parts}
> \part
> The first of the essay questions goes here. It will be several lines
> long, so I
> want enough text in the example to provide a line break.
> \part
> The second essay question. It is also several lines long, so I'll add some
> rambling text here for the second line.
> \end{parts}
> \end{questions}
> \fillwithdottedlines{\fill}
> \newpage
> \fillwithdottedlines{\fill}
> \end{document}
> 
> --8<---------------cut here---------------end--------------->8---
> 
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 16:32 John Rakestraw
  2013-07-10 16:58 ` Robert Klein
  2013-07-10 19:37 ` Robert Klein
@ 2013-07-10 19:56 ` Rasmus
  2 siblings, 0 replies; 22+ messages in thread
From: Rasmus @ 2013-07-10 19:56 UTC (permalink / raw)
  To: emacs-orgmode


Hi John,

Sorry, I meant to email this to the list . . .

> My problem is that I can't get the exporter to produce chunks like 
> this:
>
> \begin{questions}
> \question
> A paragraph describing how the students should answer the following 
> questions.
> \begin{parts}
> \part
> A multi-line question
> \part
> Another multi-line question
> \end{parts}
> \end{questions}

1. You could let * SOMETHING become a section.  See "The sectioning
structure" (it seems you already tried, though).  This would allow you
to get around your problem using usual org latex classes.
Cf. Robert's solution.

2. Presumably, the best way way to do this is to make a derived back-end,
see 

    http://orgmode.org/worg/dev/org-export-reference.html

What you first need to think about is how you want your Org files to
look.

E.g.:

* question 1
  A paragraph describing how the students should answer the following 
  questions.
  1. A multi-line question
  2. Another multi-line question?

Then you have to define the appropriate functions for your backend.
It won't be many since it inherits everything from the LaTeX class.

Of ocurse whether this is necessary depends on how much you want to
'specialize' the org layout compared to the 'usual' LaTeX org-layout.

–Rasmus

-- 
May the Force be with you

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 19:37 ` Robert Klein
@ 2013-07-10 20:46   ` John Rakestraw
  2013-07-10 21:04     ` John Rakestraw
  2013-07-11  5:22     ` Robert Klein
  0 siblings, 2 replies; 22+ messages in thread
From: John Rakestraw @ 2013-07-10 20:46 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Robert --

Thanks very much for your work on this. I'm now *much* closer than I 
was. However, I'm not there yet.

Here's a snippet of the tex file that I need:

--8<---------------cut here---------------start------------->8---
\begin{questions}
\question
A paragraph here describes this section and tells students how many 
terms to
identify.
\begin{parts}
\part
term 1
\vspace*{\fill}
\part
term 2
\vspace*{\fill}
\part
term 3
\vspace*{\fill}
\part
term 4
\vspace*{\fill}
\part
term 5
\vspace*{\fill}
\part
term 6
\vspace*{\fill}
\part
term 7
\vspace*{\fill}
\part
term 7
\vspace*{\fill}
\part
term 8
\end{parts}
\end{questions}
--8<---------------cut here---------------end--------------->8---

However, if I use the org-latex-class definition that you suggested, 
this is what I get:

--8<---------------cut here---------------start------------->8---
\begin[]{questions}{}
\label{sec-1}
\question[]{}
\label{sec-1-1}
A paragraph here describes this section and tells students how many 
terms to
identify.
\begin[]{parts}{}
\label{sec-1-1-1}
\part[]{}
\label{sec-1-1-1-1}
term 1
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-2}
term 2
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-3}
term 3
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-4}
term 4
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-5}
term 5
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-6}
term 6
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-7}
term 7
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-8}
term 8
\vspace*{\fill}

\part[]{}
\label{sec-1-1-1-9}
term 9
\newpage
\fillwithdottedlines{\fill}
\newpage
\end{parts}

--8<---------------cut here---------------end--------------->8---


The additional lines in the tex file add numbers and oddly formatted 
text to the pdf. The numbering scheme is also off -- these lines in the 
class definition:

\renewcommand\thequestion{\Roman{question}}
\renewcommand\thepartno{\arabic{partno}}
\renewcommand\partlabel{\thepartno.}

are supposed to have to have the question-level headings numbered with 
Roman numerals and the part-level headings numbered with Arabic numbers. 
But for some reason that numbering scheme isn't imposed.

Perhaps I need either just to write in latex or to work with what 
Rasmus is suggesting; I've not had time yet to digest his suggestions. 
I'm floating on the edge of my knowledge here....

Thanks again.

--John

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 20:46   ` John Rakestraw
@ 2013-07-10 21:04     ` John Rakestraw
  2013-07-11  4:04       ` Charles Berry
  2013-07-11  5:22     ` Robert Klein
  1 sibling, 1 reply; 22+ messages in thread
From: John Rakestraw @ 2013-07-10 21:04 UTC (permalink / raw)
  To: emacs-orgmode

Apologies for responding to myself, but I realized after writing the 
message below that if I use sed to remove the lines with the word 
"label" and all of the empty brackets (i.e., =[]= and ={}= ) in the tex 
file, then I'm very, very close to what I need. I assume I could write a 
function and then call it in the publishing routine?

--John

On 10.07.2013 16:46, John Rakestraw wrote:
> Hi, Robert --
>
> Thanks very much for your work on this. I'm now *much* closer than I
> was. However, I'm not there yet.
>
> Here's a snippet of the tex file that I need:
>
> --8<---------------cut here---------------start------------->8---
> \begin{questions}
> \question
> A paragraph here describes this section and tells students how many 
> terms to
> identify.
> \begin{parts}
> \part
> term 1
> \vspace*{\fill}
> \part
> term 2
> \vspace*{\fill}
> \part
> term 3
> \vspace*{\fill}
> \part
> term 4
> \vspace*{\fill}
> \part
> term 5
> \vspace*{\fill}
> \part
> term 6
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 8
> \end{parts}
> \end{questions}
> --8<---------------cut here---------------end--------------->8---
>
> However, if I use the org-latex-class definition that you suggested,
> this is what I get:
>
> --8<---------------cut here---------------start------------->8---
> \begin[]{questions}{}
> \label{sec-1}
> \question[]{}
> \label{sec-1-1}
> A paragraph here describes this section and tells students how many 
> terms to
> identify.
> \begin[]{parts}{}
> \label{sec-1-1-1}
> \part[]{}
> \label{sec-1-1-1-1}
> term 1
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-2}
> term 2
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-3}
> term 3
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-4}
> term 4
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-5}
> term 5
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-6}
> term 6
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-7}
> term 7
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-8}
> term 8
> \vspace*{\fill}
>
> \part[]{}
> \label{sec-1-1-1-9}
> term 9
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \end{parts}
>
> --8<---------------cut here---------------end--------------->8---
>
>
> The additional lines in the tex file add numbers and oddly formatted
> text to the pdf. The numbering scheme is also off -- these lines in
> the class definition:
>
> \renewcommand\thequestion{\Roman{question}}
> \renewcommand\thepartno{\arabic{partno}}
> \renewcommand\partlabel{\thepartno.}
>
> are supposed to have to have the question-level headings numbered
> with Roman numerals and the part-level headings numbered with Arabic
> numbers. But for some reason that numbering scheme isn't imposed.
>
> Perhaps I need either just to write in latex or to work with what
> Rasmus is suggesting; I've not had time yet to digest his 
> suggestions.
> I'm floating on the edge of my knowledge here....
>
> Thanks again.
>
> --John

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 21:04     ` John Rakestraw
@ 2013-07-11  4:04       ` Charles Berry
  0 siblings, 0 replies; 22+ messages in thread
From: Charles Berry @ 2013-07-11  4:04 UTC (permalink / raw)
  To: emacs-orgmode

John Rakestraw <lists <at> johnrakestraw.com> writes:

> 
> Apologies for responding to myself, but I realized after writing the 
> message below that if I use sed to remove the lines with the word 
> "label" and all of the empty brackets (i.e., =[]= and ={}= ) in the tex 
> file, then I'm very, very close to what I need. I assume I could write a 
> function and then call it in the publishing routine?
> 
> --John

One way to implement this is to define one or more filters.

:filter-final-output might do it for the unwanted brackets.
Maybe :filter-special-block is what you want for the unwanted label lines,
which I guess are created in special block handling

See 

http://orgmode.org/worg/exporters/filter-markup.html 

for some tips as well as the section headed

;;; The Filter System

in ox.el.

[rest deleted]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-10 20:46   ` John Rakestraw
  2013-07-10 21:04     ` John Rakestraw
@ 2013-07-11  5:22     ` Robert Klein
  2013-07-11 15:15       ` John Rakestraw
  1 sibling, 1 reply; 22+ messages in thread
From: Robert Klein @ 2013-07-11  5:22 UTC (permalink / raw)
  To: emacs-orgmode

Hi John,

I don't think I had those square brackets, yesterday, but see at the end
about them.


Anyway, I thought of something which gives me a result I'd say is Ok for me:

1. Change the .org files as follows
   - add a space to empty headings (as written yesterday)
   - add "texht:nil" to the #+OPTIONS: line (without the quotes)

2. Use the following class definition:

#+begin_src emacs-lisp
(setq org-latex-classes
      '(("exam"
         "\\documentclass[12pt]{exam}
% BEGIN exam Defaults
[NO-DEFAULT-PACKAGES]
[PACKAGES]

\\usepackage{palatino}
\\extrawidth{.5in}
\\extraheadheight{-.75in}
\\extrafootheight[-3in]{-.75in}
\\pagestyle{headandfoot}
\\NoKey
\\NumberOfVersions{1}
\\renewcommand\\thequestion{\\Roman{question}}
\\renewcommand\\thepartno{\\arabic{partno}}
\\renewcommand\\partlabel{\\thepartno.}

% END exam Defaults
"
         ("\\begin{questions} %% %s" "\\end{questions}")
         ("\\question %% %s" . "\\question* %% %s")
         ("\\begin{parts} %% %s" "\\end{parts}")
         ("\\part %% %s" . "\\part* %% %s"))))
#+end_src

As you can see, I still have the %s (now without the curly braces) but
as a LaTeX comment after %...

About the labels, well, I'd just leave them; as long as you don't
reference them they shouldn't disturb anything.


If you still get those square brackets; I use org-mode from the git
repository, as of yesterday or the day before.  Are you using org-mode
8.0.2 or earlier?  I think this gets fixed by Aaron Ecay's patch from
May 02/03.  If you don't want to use the git version, download version
8.0.5 from orgmode.org.


Does this work for you?


Best regards
Robert




On 07/10/2013 10:46 PM, John Rakestraw wrote:
> Hi, Robert --
> 
> Thanks very much for your work on this. I'm now *much* closer than I
> was. However, I'm not there yet.
> 
> Here's a snippet of the tex file that I need:
> 
> --8<---------------cut here---------------start------------->8---
> \begin{questions}
> \question
> A paragraph here describes this section and tells students how many
> terms to
> identify.
> \begin{parts}
> \part
> term 1
> \vspace*{\fill}
> \part
> term 2
> \vspace*{\fill}
> \part
> term 3
> \vspace*{\fill}
> \part
> term 4
> \vspace*{\fill}
> \part
> term 5
> \vspace*{\fill}
> \part
> term 6
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 7
> \vspace*{\fill}
> \part
> term 8
> \end{parts}
> \end{questions}
> --8<---------------cut here---------------end--------------->8---
> 
> However, if I use the org-latex-class definition that you suggested,
> this is what I get:
> 
> --8<---------------cut here---------------start------------->8---
> \begin[]{questions}{}
> \label{sec-1}
> \question[]{}
> \label{sec-1-1}
> A paragraph here describes this section and tells students how many
> terms to
> identify.
> \begin[]{parts}{}
> \label{sec-1-1-1}
> \part[]{}
> \label{sec-1-1-1-1}
> term 1
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-2}
> term 2
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-3}
> term 3
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-4}
> term 4
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-5}
> term 5
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-6}
> term 6
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-7}
> term 7
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-8}
> term 8
> \vspace*{\fill}
> 
> \part[]{}
> \label{sec-1-1-1-9}
> term 9
> \newpage
> \fillwithdottedlines{\fill}
> \newpage
> \end{parts}
> 
> --8<---------------cut here---------------end--------------->8---
> 
> 
> The additional lines in the tex file add numbers and oddly formatted
> text to the pdf. The numbering scheme is also off -- these lines in the
> class definition:
> 
> \renewcommand\thequestion{\Roman{question}}
> \renewcommand\thepartno{\arabic{partno}}
> \renewcommand\partlabel{\thepartno.}
> 
> are supposed to have to have the question-level headings numbered with
> Roman numerals and the part-level headings numbered with Arabic numbers.
> But for some reason that numbering scheme isn't imposed.
> 
> Perhaps I need either just to write in latex or to work with what Rasmus
> is suggesting; I've not had time yet to digest his suggestions. I'm
> floating on the edge of my knowledge here....
> 
> Thanks again.
> 
> --John
> 


-- 
Robert Klein - Max Planck-Institut für Polymerforschung
Ackermannweg 10
55128 Mainz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-11  5:22     ` Robert Klein
@ 2013-07-11 15:15       ` John Rakestraw
  2013-07-11 23:05         ` John Rakestraw
  0 siblings, 1 reply; 22+ messages in thread
From: John Rakestraw @ 2013-07-11 15:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Robert --

This gets me still closer. Using the revised class definition, I get 
exactly what I need except that I'm still left with square brackets in 
tex file. That is, I want this:

\begin{questions} or \begin{parts}

but instead I get this:

\begin[]{questions} or \begin[]{parts}

(Those two places are now the only places where the empty square 
brackets show up, and I don't have any of the empty curly brackets.)

If I remove those square brackets and run latex on the changed file, 
then I get what I want in the pdf.

I was using a fairly recent version (8.0.3) from git; I've now upgraded 
to 8.0.5 from git and get the same result.

I see Charles's suggestion to define a filter to take out the brackets 
(thanks for that) -- I'm afraid I'm on the edge of my knowledge so I'll 
need more time to sort that one out.

Thanks for your help.

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-11 15:15       ` John Rakestraw
@ 2013-07-11 23:05         ` John Rakestraw
  2013-07-12  3:00           ` Thomas S. Dye
  0 siblings, 1 reply; 22+ messages in thread
From: John Rakestraw @ 2013-07-11 23:05 UTC (permalink / raw)
  To: emacs-orgmode

Hi, list --

I understand the value of working on this myself -- what better way to 
learn? -- but after a few hours of reading the docs and scouring the 
list, I've reached the point of seeking at least a hint for where to go. 
(There's much more information higher in this thread, but I'm trying to 
focus rather narrowly on the problem here to keep the email relatively 
short.)

I'm trying to export to a pdf, using Phil Hirschhorn's exam.cls. The 
document class definition I have (thanks, Robert!) gets me almost to 
where I need to be. However, it leaves me with square brackets at 
several points in the tex file. I need to delete those brackets.

That is, I need to change "\begin[]{questions}" to 
"{\begin{questions}".

Following Charles's advice, I'm trying to define and use a filter. 
However, I know little enough about LaTeX and lisp that I can't figure 
out why what I have isn't working. At the risk of making it very clear I 
know even less than nothing, here's what I've worked up:

--8<---------------cut here---------------start------------->8---
   (defun jr-org-delete-brackets-from-tex-file
      (text backend info)
      (while (re-search-forward "\\[]" nil t)
      (replace-match ""))
      text)

    (add-to-list 'org-export-filter-final-output-functions
              'jr-org-delete-brackets-from-tex-file)
--8<---------------cut here---------------end--------------->8---

This doesn't work.

Can someone at least give me a hint on what I need to do differently?

Thanks very much.

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-11 23:05         ` John Rakestraw
@ 2013-07-12  3:00           ` Thomas S. Dye
  0 siblings, 0 replies; 22+ messages in thread
From: Thomas S. Dye @ 2013-07-12  3:00 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode

Hi John,

I think your search string might better be "\[\]", or something along
those lines (perhaps it needs to be "\\[\\]").   

hth,
Tom

John Rakestraw <lists@johnrakestraw.com> writes:

> Hi, list --
>
> I understand the value of working on this myself -- what better way to 
> learn? -- but after a few hours of reading the docs and scouring the 
> list, I've reached the point of seeking at least a hint for where to go. 
> (There's much more information higher in this thread, but I'm trying to 
> focus rather narrowly on the problem here to keep the email relatively 
> short.)
>
> I'm trying to export to a pdf, using Phil Hirschhorn's exam.cls. The 
> document class definition I have (thanks, Robert!) gets me almost to 
> where I need to be. However, it leaves me with square brackets at 
> several points in the tex file. I need to delete those brackets.
>
> That is, I need to change "\begin[]{questions}" to 
> "{\begin{questions}".
>
> Following Charles's advice, I'm trying to define and use a filter. 
> However, I know little enough about LaTeX and lisp that I can't figure 
> out why what I have isn't working. At the risk of making it very clear I 
> know even less than nothing, here's what I've worked up:
>
>    (defun jr-org-delete-brackets-from-tex-file
>       (text backend info)
>       (while (re-search-forward "\\[]" nil t)
>       (replace-match ""))
>       text)
>
>     (add-to-list 'org-export-filter-final-output-functions
>               'jr-org-delete-brackets-from-tex-file)
>
> This doesn't work.
>
> Can someone at least give me a hint on what I need to do differently?
>
> Thanks very much.

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
       [not found] <51DFEC7B.7050504@mpip-mainz.mpg.de>
@ 2013-07-12 11:47 ` Robert Klein
  2013-07-12 13:41   ` Nick Dokos
  0 siblings, 1 reply; 22+ messages in thread
From: Robert Klein @ 2013-07-12 11:47 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2663 bytes --]

(sorry, this should've gone to the list the first time)

Hi John,

sorry, I can't help you with the filters.

On the other hand, I don't see any reason why you gt whose square brackets.

I tried different versions of org-mode, and never got *empty* square
brackets.

E.g. I tried with org-mode 8.0.5 release installed in ~/org-8.0.5  (I
did a "make" and "make autoloads" in this directory) and used the
exam.org file as attached and the attached exam.el for configuration.

I started emacs with from the directory exam.org and exam.el are, using
the following command:

emacs -Q -l exam.el exam.org

Exporting to LaTeX file results in the attached exam.tex.

I tried emacs version 23.1 and 24.2.

(For sure, my latex installation doesn't like the \NoKey and
\NumberOfVersions ...)


You could try, if you get can get the same results I do and then work
through your emacs configuration.

I've got no other idea at the moment.

Best regards
Robert



On 07/12/2013 01:05 AM, John Rakestraw wrote:
> Hi, list --
> 
> I understand the value of working on this myself -- what better way to
> learn? -- but after a few hours of reading the docs and scouring the
> list, I've reached the point of seeking at least a hint for where to go.
> (There's much more information higher in this thread, but I'm trying to
> focus rather narrowly on the problem here to keep the email relatively
> short.)
> 
> I'm trying to export to a pdf, using Phil Hirschhorn's exam.cls. The
> document class definition I have (thanks, Robert!) gets me almost to
> where I need to be. However, it leaves me with square brackets at
> several points in the tex file. I need to delete those brackets.
> 
> That is, I need to change "\begin[]{questions}" to "{\begin{questions}".
> 
> Following Charles's advice, I'm trying to define and use a filter.
> However, I know little enough about LaTeX and lisp that I can't figure
> out why what I have isn't working. At the risk of making it very clear I
> know even less than nothing, here's what I've worked up:
> 
> --8<---------------cut here---------------start------------->8---
>   (defun jr-org-delete-brackets-from-tex-file
>      (text backend info)
>      (while (re-search-forward "\\[]" nil t)
>      (replace-match ""))
>      text)
> 
>    (add-to-list 'org-export-filter-final-output-functions
>              'jr-org-delete-brackets-from-tex-file)
> --8<---------------cut here---------------end--------------->8---
> 
> This doesn't work.
> 
> Can someone at least give me a hint on what I need to do differently?
> 
> Thanks very much.
> 


-- 
Robert Klein - Max Planck-Institut für Polymerforschung
Ackermannweg 10
55128 Mainz




[-- Attachment #2: exam.el --]
[-- Type: text/x-emacs-lisp, Size: 733 bytes --]

(setq load-path (cons "~/org-8.0.5/lisp" load-path))
(require 'org)
(require 'ox)

(setq org-latex-classes
      '(("exam"
         "\\documentclass[12pt]{exam}
% BEGIN exam Defaults
[NO-DEFAULT-PACKAGES]
[PACKAGES]

\\usepackage{palatino}
\\extrawidth{.5in}
\\extraheadheight{-.75in}
\\extrafootheight[-3in]{-.75in}
\\pagestyle{headandfoot}
\\NoKey
\\NumberOfVersions{1}
\\renewcommand\\thequestion{\\Roman{question}}
\\renewcommand\\thepartno{\\arabic{partno}}
\\renewcommand\\partlabel{\\thepartno.}

% END exam Defaults
"
         ("\\begin{questions} %% %s" "\\end{questions}")
         ("\\question %% %s" . "\\question* %% %s")
         ("\\begin{parts} %% %s" "\\end{parts}")
         ("\\part %% %s" . "\\part* %% %s"))))



[-- Attachment #3: exam.org --]
[-- Type: application/vnd.lotus-organizer, Size: 2450 bytes --]

[-- Attachment #4: exam.tex --]
[-- Type: text/x-tex, Size: 3053 bytes --]

\documentclass[10pt]{exam}
% BEGIN exam Defaults

\usepackage{palatino}
\extrawidth{.5in}
\extraheadheight{-.75in}
\extrafootheight[-3in]{-.75in}
\pagestyle{headandfoot}
\NoKey
\NumberOfVersions{1}
\renewcommand\thequestion{\Roman{question}}
\renewcommand\thepartno{\arabic{partno}}
\renewcommand\partlabel{\thepartno.}

% END exam Defaults


\extrawidth{.5in}
\extraheadheight[.3in]{-.75in}
\extrafootheight{-.25in}
\raggedright
\author{Robert Klein}
\date{\today}
\title{}
\begin{document}

\renewcommand\thequestion{\Roman{question}}
\renewcommand\thepartno{\arabic{partno}}
\renewcommand\partlabel{\thepartno.}
\firstpageheader{Name:\enspace\makebox[3in]{\hrulefill}\\Exam 1\\}{}{Theo 001 -- Rakestraw\\February 14, 2013\\}
\begin{coverpages}
this is just some text
\end{coverpages}

\begin{questions} % Meaningless header
\label{sec-1}
\question % 
\label{sec-1-1}
\textbf{Identification of Terms}. Identify/define and give the significance
of \textbf{six} of the following. If you identify/define more than six
without indicating clearly which six you want me to grade, I will
grade your first six answers (18 points).
\begin{parts} % Terms
\label{sec-1-1-1}
\part % 
\label{sec-1-1-1-1}
term 1
\vspace*{\fill}

\part % 
\label{sec-1-1-1-2}
term 2
\vspace*{\fill}

\part % 
\label{sec-1-1-1-3}
term 3
\vspace*{\fill}

\part % 
\label{sec-1-1-1-4}
term 4
\vspace*{\fill}

\part % 
\label{sec-1-1-1-5}
term 5
\vspace*{\fill}

\part % 
\label{sec-1-1-1-6}
term 6
\vspace*{\fill}

\part % 
\label{sec-1-1-1-7}
term 7
\vspace*{\fill}

\part % 
\label{sec-1-1-1-8}
term 8
\vspace*{\fill}

\part % 
\label{sec-1-1-1-9}
term 9
\newpage
\fillwithdottedlines{\fill}
\newpage
\end{parts}
\question % 
\label{sec-1-2}
\textbf{Short Answer}. Answer \textbf{two} of the following in a paragraph. If you
attempt to answer more than two without indicating clearly which two you
intend me to grade I will grade your first two answers (36 points).
\begin{parts} % Questions
\label{sec-1-2-1}
\part % 
\label{sec-1-2-1-1}
Question one goes on for more than one line. (I mention that because I want to
be clear that I can't put a question in a heading.)

\fillwithdottedlines{\fill}
\part % 
\label{sec-1-2-1-2}
Question 2 goes here.
\fillwithdottedlines{\fill}

\newpage
\fillwithdottedlines{\fill}
\newpage
\part % 
\label{sec-1-2-1-3}
Question 3 goes here.
\fillwithdottedlines{\fill}
\part % 
\label{sec-1-2-1-4}
Question 4 goes here.
\fillwithdottedlines{\fill}

\newpage
\fillwithdottedlines{\fill}
\newpage
\end{parts}
\question % 
\label{sec-1-3}
\textbf{Essay Question}. Answer \textbf{one} of the following as fully as you are able.
If you attempt to answer more than one without indicating clearly which one
you intend me to grade I will grade your first answer (40 points).
\begin{parts} % Questions
\label{sec-1-3-1}

\part % 
\label{sec-1-3-1-1}
here's the first essay question.

\part % 
\label{sec-1-3-1-2}
here's the second essay question.
\fillwithdottedlines{\fill}

\newpage
\fillwithdottedlines{\fill}
\end{parts}
\end{questions}
\end{document}


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 11:47 ` Help with new exporter Robert Klein
@ 2013-07-12 13:41   ` Nick Dokos
  2013-07-12 14:12     ` Rasmus
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Dokos @ 2013-07-12 13:41 UTC (permalink / raw)
  To: emacs-orgmode

Robert Klein <kleinrob@mpip-mainz.mpg.de> writes:

> (sorry, this should've gone to the list the first time)
>
> Hi John,
>
> sorry, I can't help you with the filters.
>
> On the other hand, I don't see any reason why you gt whose square brackets.
>
> I tried different versions of org-mode, and never got *empty* square
> brackets.

That was my experience as well...

>
> E.g. I tried with org-mode 8.0.5 release installed in ~/org-8.0.5  (I
> did a "make" and "make autoloads" in this directory) and used the
> exam.org file as attached and the attached exam.el for configuration.
>
> I started emacs with from the directory exam.org and exam.el are, using
> the following command:
>
> emacs -Q -l exam.el exam.org
>
> Exporting to LaTeX file results in the attached exam.tex.
>
> I tried emacs version 23.1 and 24.2.
>
> (For sure, my latex installation doesn't like the \NoKey and
> \NumberOfVersions ...)
>

... and here too.

>
> You could try, if you get can get the same results I do and then work
> through your emacs configuration.
>
> I've got no other idea at the moment.
>

I may be too pessimistic but it seems to me that the exam class just
does not map to the latex export model cleanly (to be honest, the fact
that it worked in some fashion with the old exporter boggles my mind - I
would not have expected it to, which goes to show that I may be too
pessimistic :-) ).

Rasmus's derived backend idea might work perhaps - I for one wouldn't
know how to implement it at this point. But trying to edit artifacts out
after the backend is more or less finished seems to me to be a fruitless
approach.

Nick

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 13:41   ` Nick Dokos
@ 2013-07-12 14:12     ` Rasmus
  2013-07-12 14:59       ` Nick Dokos
  0 siblings, 1 reply; 22+ messages in thread
From: Rasmus @ 2013-07-12 14:12 UTC (permalink / raw)
  To: emacs-orgmode

Nick. Robert, 

Disclaimer: I didn't follow this thread closely. . . 

Nick Dokos <ndokos@gmail.com> writes:

>> (sorry, this should've gone to the list the first time)
>>
>> Hi John,
>>
>> sorry, I can't help you with the filters.
>>
>> On the other hand, I don't see any reason why you gt whose square brackets.
>>
>> I tried different versions of org-mode, and never got *empty* square
>> brackets.
>
> That was my experience as well...

If one desires empty squares why not use [\mbox{}]?  In LaTeX terms I
think [\mbox{}] is equivalent or almost equivalent o [], and to Org
they are different. . .

Otherwise add a (regexp) filter to
org-export-filter-final-output-functions inserting the missing []s.

Here's an example of a filer I use.  Notice that ox keeps everything
in a string and in property lists (← just an indexed dictionary).

#+BEGIN_SRC emacs-lisp
(defun org-latex-filter-nobreaks-double-space (text backend info)
  "Tries to export \"S1. S2\" as \"S1.~S2\",
   while letting \"S1.  S2\" be exported without tilde"
  (when (org-export-derived-backend-p backend 'latex)
    (replace-regexp-in-string "\\(\\. \\)\\{1\\}\\([^ ]\\)" ".~\\2" text)))

(add-to-list 'org-export-filter-final-output-functions
             'org-latex-filter-nobreaks-double-space)
#+END_SRC

(This may not be a great example as one probably should implement it
 at org-export-before-processing-hook and insert NO-BREAK SPACEs and
 tell LaTeX how to handle these).

> Rasmus's derived backend idea might work perhaps - I for one wouldn't
> know how to implement it at this point. But trying to edit artifacts out
> after the backend is more or less finished seems to me to be a fruitless
> approach.

I'm not claiming it's easy (Lisp can be pretty daunting, yes?), but
it's definitely doable.

 1. You start by thinking about how you want your layout to be.  This
    is particularly the case if you don't want to (mis)use the *s for
    everything.  For instance the Org file Robert posted had a lot of
    repeated things that might as well be handeled by the computer.
 2. Then you write functions that translate the elements that you want
    to work differently into LaTeX code and put 'em into
    the :translate-alist.  All functions that you're not adding will
    come from the LaTeX class.

Here's some documentations (somewhat heavy)

     http://orgmode.org/manual/Adding-export-back_002dends.html
     http://orgmode.org/worg/dev/org-export-reference.html

and an not-so-enlightening example

     http://orgmode.org/worg/exporters/filter-markup.html


Further: I'm working on a section for the manual on ways of adding new
backends, but alas I must spend my time on other activities at the
moment. Of course, the present discussion of implementing an exam
class is a much more interesting example than the cookbook I'm working
on at the moment :)  

–Rasmus

-- 
Send from my Emacs

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 14:12     ` Rasmus
@ 2013-07-12 14:59       ` Nick Dokos
  2013-07-12 15:05         ` John Rakestraw
  0 siblings, 1 reply; 22+ messages in thread
From: Nick Dokos @ 2013-07-12 14:59 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Nick. Robert, 
>
> Disclaimer: I didn't follow this thread closely. . . 
>
> Nick Dokos <ndokos@gmail.com> writes:
>
>>> (sorry, this should've gone to the list the first time)
>>>
>>> Hi John,
>>>
>>> sorry, I can't help you with the filters.
>>>
>>> On the other hand, I don't see any reason why you gt whose square brackets.
>>>
>>> I tried different versions of org-mode, and never got *empty* square
>>> brackets.
>>
>> That was my experience as well...
>
> If one desires empty squares why not use [\mbox{}]?  In LaTeX terms I
> think [\mbox{}] is equivalent or almost equivalent o [], and to Org
> they are different. . .
>

I think you misunderstood here: John Rakestraw seems to get empty sets
of square brackets in the latex file that he produces from his org file.
What Robert pointed out (and what I concurred with) was that when he
runs John's org file through the exporter, he does not get these empty
square brackets. The question is why John on one hand and Robert (and I)
on the other hand see such different behavior from the exporter.

> Otherwise add a (regexp) filter to
> org-export-filter-final-output-functions inserting the missing []s.
>
> Here's an example of a filer I use.  Notice that ox keeps everything
> in a string and in property lists (← just an indexed dictionary).
>
> #+BEGIN_SRC emacs-lisp
> (defun org-latex-filter-nobreaks-double-space (text backend info)
>   "Tries to export \"S1. S2\" as \"S1.~S2\",
>    while letting \"S1.  S2\" be exported without tilde"
>   (when (org-export-derived-backend-p backend 'latex)
>     (replace-regexp-in-string "\\(\\. \\)\\{1\\}\\([^ ]\\)" ".~\\2" text)))
>
> (add-to-list 'org-export-filter-final-output-functions
>              'org-latex-filter-nobreaks-double-space)
> #+END_SRC
>
> (This may not be a great example as one probably should implement it
>  at org-export-before-processing-hook and insert NO-BREAK SPACEs and
>  tell LaTeX how to handle these).
>
>> Rasmus's derived backend idea might work perhaps - I for one wouldn't
>> know how to implement it at this point. But trying to edit artifacts out
>> after the backend is more or less finished seems to me to be a fruitless
>> approach.
>
> I'm not claiming it's easy (Lisp can be pretty daunting, yes?), but
> it's definitely doable.
>

The "fruitless" label was *not* meant for your derived-backend idea: au
contraire.

John is trying to write filters to edit out all the artifacts that he is
getting. That's what I thought was the fruitless approach. The derived
backend approach seems to me to be the *only* (or at least the best)
one for mapping org files to the exam class.

I'm sure it is doable: knowing *how* to do it is another matter though -
and it's not so much the Lisp, it's figuring out how everything has to
go together, given the framework (and all the supporting infrastructure)
that Nicolas has provided. I can deal with the Lisp but I just don't
know enough about the new exporter framework to even do a trivial
backend at this point.

>  1. You start by thinking about how you want your layout to be.  This
>     is particularly the case if you don't want to (mis)use the *s for
>     everything.  For instance the Org file Robert posted had a lot of
>     repeated things that might as well be handeled by the computer.
>  2. Then you write functions that translate the elements that you want
>     to work differently into LaTeX code and put 'em into
>     the :translate-alist.  All functions that you're not adding will
>     come from the LaTeX class.
>
> Here's some documentations (somewhat heavy)
>
>      http://orgmode.org/manual/Adding-export-back_002dends.html
>      http://orgmode.org/worg/dev/org-export-reference.html
>
> and an not-so-enlightening example
>
>      http://orgmode.org/worg/exporters/filter-markup.html
>
>
> Further: I'm working on a section for the manual on ways of adding new
> backends, but alas I must spend my time on other activities at the
> moment. Of course, the present discussion of implementing an exam
> class is a much more interesting example than the cookbook I'm working
> on at the moment :)  
>

More tutorials is exactly what's needed, so thanks for the pointers
- and any future tutorials you provide as well :-)

> –Rasmus

-- 
Nick

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 14:59       ` Nick Dokos
@ 2013-07-12 15:05         ` John Rakestraw
  2013-07-12 15:27           ` Rasmus
  2013-07-12 15:28           ` Nick Dokos
  0 siblings, 2 replies; 22+ messages in thread
From: John Rakestraw @ 2013-07-12 15:05 UTC (permalink / raw)
  To: emacs-orgmode

Success!

Thanks to all for your help. I really do appreciate your time.

I cannot figure out why I'm getting the brackets that no one else is
getting (Rasmus -- my problem is that they're there and I don't want
them), but I now have a filter that will take them out:

--8<---------------cut here---------------start------------->8---
      (defun jr-org-delete-brackets-from-tex-file
        (text backend info)
        (replace-regexp-in-string "\\[\\]" "" text))

      (add-to-list 'org-export-filter-final-output-functions
                   'jr-org-delete-brackets-from-tex-file)
--8<---------------cut here---------------end--------------->8---

Now to explore how to implement this only when I'm using the exam 
document
class, perhaps by using a derived backend. (It may be that it won't 
cause
any problems with other classes, but it seems sloppy to have it working
all the time, no?)

Thanks to Robert for the detailed and careful responses, to Charles for
suggesting the filters, and to Rasmus for the example that helped me
straighten me out at the end.

And I can't resist an aside to Nick -- I've really appreciated both the
tone and the content of your detailed contributions to this list over 
the
years. I find it difficult to believe that you're more pessimistic than 
I
am, but I take some odd pleasure in making something work that you 
thought
wouldn't work. ;-)

--John

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 15:05         ` John Rakestraw
@ 2013-07-12 15:27           ` Rasmus
  2013-07-12 15:47             ` John Rakestraw
  2013-07-12 15:28           ` Nick Dokos
  1 sibling, 1 reply; 22+ messages in thread
From: Rasmus @ 2013-07-12 15:27 UTC (permalink / raw)
  To: emacs-orgmode

John Rakestraw <lists@johnrakestraw.com> writes:

> I cannot figure out why I'm getting the brackets that no one else is
> getting (Rasmus -- my problem is that they're there and I don't want
> them), but I now have a filter that will take them out:

My apology. 


>       (defun jr-org-delete-brackets-from-tex-file
>         (text backend info)
>         (replace-regexp-in-string "\\[\\]" "" text))
>
>       (add-to-list 'org-export-filter-final-output-functions
>                    'jr-org-delete-brackets-from-tex-file)
>
> Now to explore how to implement this only when I'm using the exam 
> document
> class, perhaps by using a derived backend. (It may be that it won't 
> cause
> any problems with other classes, but it seems sloppy to have it working
> all the time, no?)

 1. You'd want to check for the backend.
 2. To add a two tests use and and check that the correct document
    class is being used with string-match.  

    Untested:
 
     (when (and ;; check that it's a LaTeX backend
                (org-export-derived-backend-p backend 'latex)
                (string-match "\\documentclass?[.*?]{exam}" (downcase string)))
       (replace-match "" nil nil headline))
 
Most document will fail the second test and those that don't are
probably the ones you want to target.

–Rasmus

-- 
A page of history is worth a volume of logic

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 15:05         ` John Rakestraw
  2013-07-12 15:27           ` Rasmus
@ 2013-07-12 15:28           ` Nick Dokos
  2013-07-12 15:49             ` John Rakestraw
  1 sibling, 1 reply; 22+ messages in thread
From: Nick Dokos @ 2013-07-12 15:28 UTC (permalink / raw)
  To: emacs-orgmode

John Rakestraw <lists@johnrakestraw.com> writes:

> Success!
>
> Thanks to all for your help. I really do appreciate your time.
>
> I cannot figure out why I'm getting the brackets that no one else is
> getting (Rasmus -- my problem is that they're there and I don't want
> them), but I now have a filter that will take them out:
>
>       (defun jr-org-delete-brackets-from-tex-file
>         (text backend info)
>         (replace-regexp-in-string "\\[\\]" "" text))
>
>       (add-to-list 'org-export-filter-final-output-functions
>                    'jr-org-delete-brackets-from-tex-file)
>
> Now to explore how to implement this only when I'm using the exam 
> document
> class, perhaps by using a derived backend. (It may be that it won't 
> cause
> any problems with other classes, but it seems sloppy to have it working
> all the time, no?)
>
> Thanks to Robert for the detailed and careful responses, to Charles for
> suggesting the filters, and to Rasmus for the example that helped me
> straighten me out at the end.
>
> And I can't resist an aside to Nick -- I've really appreciated both
> the tone and the content of your detailed contributions to this list
> over the years. I find it difficult to believe that you're more
> pessimistic than I am, but I take some odd pleasure in making
> something work that you thought wouldn't work. ;-)
>

You underestimate my pessimism :-) I had no doubt that you can get rid
of specific artifacts using specific filters like this - you could after
all, run a sed script on the latex output and get rid of this stuff - it
wouldn't be an org-only solution, but that's OK in my book.

I hope you are ultimately successful in producing exams that look
exactly like you want them, using these mechanisms. But I have my doubts
- you have won a battle, but the war is still raging afaict. OTOH, if
you prove me wrong, I would be delighted!

-- 
Nick

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 15:27           ` Rasmus
@ 2013-07-12 15:47             ` John Rakestraw
  0 siblings, 0 replies; 22+ messages in thread
From: John Rakestraw @ 2013-07-12 15:47 UTC (permalink / raw)
  To: emacs-orgmode

On 12.07.2013 11:27, Rasmus wrote:
>  1. You'd want to check for the backend.
>  2. To add a two tests use and and check that the correct document
>     class is being used with string-match.
>
>     Untested:
>
>      (when (and ;; check that it's a LaTeX backend
>                 (org-export-derived-backend-p backend 'latex)
>                 (string-match "\\documentclass?[.*?]{exam}" (downcase 
> string)))
>        (replace-match "" nil nil headline))
>
> Most document will fail the second test and those that don't are
> probably the ones you want to target.
>
> –Rasmus

Thanks for this.

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 15:28           ` Nick Dokos
@ 2013-07-12 15:49             ` John Rakestraw
  2013-07-12 16:20               ` Nick Dokos
  0 siblings, 1 reply; 22+ messages in thread
From: John Rakestraw @ 2013-07-12 15:49 UTC (permalink / raw)
  To: emacs-orgmode

On Fri, 12 Jul 2013, Nick Dokos wrote:

> You underestimate my pessimism :-) I had no doubt that you can get 
> rid
> of specific artifacts using specific filters like this - you could 
> after
> all, run a sed script on the latex output and get rid of this stuff - 
> it
> wouldn't be an org-only solution, but that's OK in my book.

Yes, I already had a sed script that would work -- just doggedly trying 
to do it all in one org step.

> I hope you are ultimately successful in producing exams that look
> exactly like you want them, using these mechanisms. But I have my 
> doubts
> - you have won a battle, but the war is still raging afaict. OTOH, if
> you prove me wrong, I would be delighted!

Perhaps I'm misunderstanding something (if so, please leave me alone in 
my ignorance at least for a bit), but I'm thinking I've won this 
particular war -- at least, I'm now able to use the exam document class 
to produce an exam formatted to match my expectations.

--John

-- 
John Rakestraw

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Help with new exporter
  2013-07-12 15:49             ` John Rakestraw
@ 2013-07-12 16:20               ` Nick Dokos
  0 siblings, 0 replies; 22+ messages in thread
From: Nick Dokos @ 2013-07-12 16:20 UTC (permalink / raw)
  To: emacs-orgmode

John Rakestraw <lists@johnrakestraw.com> writes:

> On Fri, 12 Jul 2013, Nick Dokos wrote:
>> I hope you are ultimately successful in producing exams that look
>> exactly like you want them, using these mechanisms. But I have my
>> doubts
>> - you have won a battle, but the war is still raging afaict. OTOH, if
>> you prove me wrong, I would be delighted!
>
> Perhaps I'm misunderstanding something (if so, please leave me alone
> in my ignorance at least for a bit), but I'm thinking I've won this
> particular war -- at least, I'm now able to use the exam document
> class to produce an exam formatted to match my expectations.
>

Oh, I thought that was only the first step. At least, the experiments
I was doing last night were *much* less successful, so I projected my
problems onto you. In any case, I'm glad you can do that - and if
I ever need to produce exams, I know who to contact :-)
-- 
Nick

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-07-12 16:20 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <51DFEC7B.7050504@mpip-mainz.mpg.de>
2013-07-12 11:47 ` Help with new exporter Robert Klein
2013-07-12 13:41   ` Nick Dokos
2013-07-12 14:12     ` Rasmus
2013-07-12 14:59       ` Nick Dokos
2013-07-12 15:05         ` John Rakestraw
2013-07-12 15:27           ` Rasmus
2013-07-12 15:47             ` John Rakestraw
2013-07-12 15:28           ` Nick Dokos
2013-07-12 15:49             ` John Rakestraw
2013-07-12 16:20               ` Nick Dokos
2013-07-10 16:32 John Rakestraw
2013-07-10 16:58 ` Robert Klein
2013-07-10 17:27   ` John Rakestraw
2013-07-10 19:37 ` Robert Klein
2013-07-10 20:46   ` John Rakestraw
2013-07-10 21:04     ` John Rakestraw
2013-07-11  4:04       ` Charles Berry
2013-07-11  5:22     ` Robert Klein
2013-07-11 15:15       ` John Rakestraw
2013-07-11 23:05         ` John Rakestraw
2013-07-12  3:00           ` Thomas S. Dye
2013-07-10 19:56 ` Rasmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).