emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex enumeration issue
@ 2010-02-02 22:08 Mark Elston
  2010-02-03 10:34 ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Elston @ 2010-02-02 22:08 UTC (permalink / raw)
  To: org-mode emacs-orgmode

A year ago Flavio de Souza asked a question about latex enumerations
that is similar to a problem I now have.  The answer given then was a
workaround that doesn't apply in my case.

This stems from my project of using a single file to maintain source
for generating my class notes *and* student handouts for my classes.
This allows me to take advantage of the common outline and common
text while specifying text that should go into only one or the other
document.

I manage to do this by something like:

* Common heading

   Some common text

** A common subheading

    More common text

***                                  :handouts:
     Something for handouts only

***                                  :both:
     More common text

***                                  :notes:
     My class notes text

***                                  :both:
     More common text


I have a makefile which creates a temporary .org file by
prepending a specific header on this file for each type of
output (handouts or notes), exporting to a latex file, running
a perl script to remove any (sub)+sections with just the
tags in them, and running pdflatex to generate the output.

So far, so good.

However, I ran into a problem with enumerations.  Sometimes I
have enumerations in my original org file which are separated by
the 'empty' sectioning commands.  This ends the enumeration and
the next enumerated item starts a new one.  The result is a set
of enumerations with a single element in it.  I get something
like:

    1.  Blah

    handout-specific text

    1.  More Blah

etc.  These should really have been 1, 2, etc.

The only workaround I have so far is to make all these items lists
instead of enumerations.  This works OK but they would make much more
sense as enumerations.

Is there anything I can do here?

Mark

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

* Re: latex enumeration issue
  2010-02-02 22:08 latex enumeration issue Mark Elston
@ 2010-02-03 10:34 ` Carsten Dominik
  2010-02-03 20:41   ` Mark Elston
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-02-03 10:34 UTC (permalink / raw)
  To: Mark Elston; +Cc: org-mode emacs-orgmode

Hi Mark,

On Feb 2, 2010, at 11:08 PM, Mark Elston wrote:

> A year ago Flavio de Souza asked a question about latex enumerations
> that is similar to a problem I now have.  The answer given then was a
> workaround that doesn't apply in my case.
>
> This stems from my project of using a single file to maintain source
> for generating my class notes *and* student handouts for my classes.
> This allows me to take advantage of the common outline and common
> text while specifying text that should go into only one or the other
> document.
>
> I manage to do this by something like:
>
> * Common heading
>
>  Some common text
>
> ** A common subheading
>
>   More common text
>
> ***                                  :handouts:
>    Something for handouts only
>
> ***                                  :both:
>    More common text
>
> ***                                  :notes:
>    My class notes text
>
> ***                                  :both:
>    More common text
>
>
> I have a makefile which creates a temporary .org file by
> prepending a specific header on this file for each type of
> output (handouts or notes), exporting to a latex file, running
> a perl script to remove any (sub)+sections with just the
> tags in them, and running pdflatex to generate the output.
>
> So far, so good.
>
> However, I ran into a problem with enumerations.  Sometimes I
> have enumerations in my original org file which are separated by
> the 'empty' sectioning commands.  This ends the enumeration and
> the next enumerated item starts a new one.  The result is a set
> of enumerations with a single element in it.  I get something
> like:
>
>   1.  Blah
>
>   handout-specific text
>
>   1.  More Blah
>
> etc.  These should really have been 1, 2, etc.


I don't understand.  Why is the text "handout-specific text" still  
there?
Do you need it between the items?  Do you want to make it part of the  
item (indentation would solve this).


>
> The only workaround I have so far is to make all these items lists
> instead of enumerations.  This works OK but they would make much more
> sense as enumerations.


How does this help?

- Carsten

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

* Re: latex enumeration issue
  2010-02-03 10:34 ` Carsten Dominik
@ 2010-02-03 20:41   ` Mark Elston
  2010-02-04  2:24     ` Mark Elston
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Elston @ 2010-02-03 20:41 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: org-mode emacs-orgmode

Hi Carsten,

Thanks for the reply.  My responses are below:

On 2/3/2010 2:34 AM, Carsten Dominik wrote:
> Hi Mark,
>
> On Feb 2, 2010, at 11:08 PM, Mark Elston wrote:
>
>> A year ago Flavio de Souza asked a question about latex enumerations
>> that is similar to a problem I now have. The answer given then was a
>> workaround that doesn't apply in my case.
>>
>> This stems from my project of using a single file to maintain source
>> for generating my class notes *and* student handouts for my classes.
>> This allows me to take advantage of the common outline and common
>> text while specifying text that should go into only one or the other
>> document.
>>
>> I manage to do this by something like:
>>
>> * Common heading
>>
>> Some common text
>>
>> ** A common subheading
>>
>> More common text
>>
>> *** :handouts:
>> Something for handouts only
>>
>> *** :both:
>> More common text
>>
>> *** :notes:
>> My class notes text
>>
>> *** :both:
>> More common text
>>
>>
>> I have a makefile which creates a temporary .org file by
>> prepending a specific header on this file for each type of
>> output (handouts or notes), exporting to a latex file, running
>> a perl script to remove any (sub)+sections with just the
>> tags in them, and running pdflatex to generate the output.
>>
>> So far, so good.
>>
>> However, I ran into a problem with enumerations. Sometimes I
>> have enumerations in my original org file which are separated by
>> the 'empty' sectioning commands. This ends the enumeration and
>> the next enumerated item starts a new one. The result is a set
>> of enumerations with a single element in it. I get something
>> like:
>>
>> 1. Blah
>>
>> handout-specific text
>>
>> 1. More Blah
>>
>> etc. These should really have been 1, 2, etc.
>
>
> I don't understand. Why is the text "handout-specific text" still there?
> Do you need it between the items?

Yes (see below).  I have in each of these items something I want as part
of the handouts and some additional info I want to include for myself.

 > Do you want to make it part of the
> item (indentation would solve this).

It will always be a part of the item, otherwise I would have made it a
footnote or left it to after the enumeration.

Unfortunately, indentation doesn't solve this.  My example above was a
little shy on details, sorry.

If I have a file with:

------------------------------------
#+EXPORT_EXCLUDE_TAGS: notes

* Common Heading
   Common Text

   1) Blah

**                                                   :handouts:
      handout-specific text
**                                                      :notes:
      note-specific text
**                                                       :both:

   2) More Blah

**                                                   :handouts:
      handout-specific text
**                                                      :notes:
      note-specific text
**                                                       :both:

   3) Even more...
------------------------------------

After I export to latex and post process with my perl script I
have the following for the body of my document:

------------------------------------

\section{Common Heading}
\label{sec-1}

   Common Text

\begin{enumerate}
\item Blah
\end{enumerate}

      handout-specific text

\begin{enumerate}
\item More Blah
\end{enumerate}

      handout-specific text

\begin{enumerate}
\item Even more\ldots{}
\end{enumerate}
------------------------------------

This is because the 'empty' placeholder headings (tags-only)
interrupt the enumeration processing for each item, effectively
ending it and causing the insertion of the \end{enumeration}.
So each item is in it's own enumeration and the number restarts
from 1 with each item.

>
>>
>> The only workaround I have so far is to make all these items lists
>> instead of enumerations. This works OK but they would make much more
>> sense as enumerations.
>
>
> How does this help?
>

It eliminates the numbers and uses only list marks instead.  That way
I don't have to worry about incorrect numbering of enumerations.
Unfortunately, the text between items is still not indented properly
since it appears outside the list environment.

It is not ideal but it is something I can live with if I have to.

Mark

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

* Re: latex enumeration issue
  2010-02-03 20:41   ` Mark Elston
@ 2010-02-04  2:24     ` Mark Elston
  2010-02-04  3:12       ` Mark Elston
  2010-02-04 10:05       ` Eric S Fraga
  0 siblings, 2 replies; 10+ messages in thread
From: Mark Elston @ 2010-02-04  2:24 UTC (permalink / raw)
  To: emacs-orgmode

Carsten,

Never mind.  I had had problems in the past getting the hook function
to work because I was making it harder than it needed to be.  I just
went back to trying my hand at it and got it working pretty easily.
Sigh.

I added a hook function to org-export-preprocess-hook and removed the
blank headers that way.  That solved the problem before it even starts.
I probably don't have to do any perl post-processing at all, now.

Thanks for all the help.

Mark

P.S.  If anyone is interested here is the embarrassingly simple hook
function I came up with.  I show it not because I think anyone else
will find this thing useful but as an example of how simple it really
is to write this kind of thing.

;;; Export Hooks
(defun mee-delete-empty-org-headers ()
   (while (re-search-forward "^[*]+   [ ]+:[a-zA-Z0-9]+:$" nil t)
     (progn
       (beginning-of-line)
       (kill-line 0))))

(add-hook 'org-export-preprocess-hook
           'mee-delete-empty-org-headers)



On 2/3/2010 12:41 PM, Mark Elston wrote:
> Hi Carsten,
>
> Thanks for the reply. My responses are below:
>
> On 2/3/2010 2:34 AM, Carsten Dominik wrote:
>> Hi Mark,
>>
>> On Feb 2, 2010, at 11:08 PM, Mark Elston wrote:
>>
>>> A year ago Flavio de Souza asked a question about latex enumerations
>>> that is similar to a problem I now have. The answer given then was a
>>> workaround that doesn't apply in my case.
>>>
>>> This stems from my project of using a single file to maintain source
>>> for generating my class notes *and* student handouts for my classes.
>>> This allows me to take advantage of the common outline and common
>>> text while specifying text that should go into only one or the other
>>> document.
>>>
>>> I manage to do this by something like:
>>>
>>> * Common heading
>>>
>>> Some common text
>>>
>>> ** A common subheading
>>>
>>> More common text
>>>
>>> *** :handouts:
>>> Something for handouts only
>>>
>>> *** :both:
>>> More common text
>>>
>>> *** :notes:
>>> My class notes text
>>>
>>> *** :both:
>>> More common text
>>>
>>>
>>> I have a makefile which creates a temporary .org file by
>>> prepending a specific header on this file for each type of
>>> output (handouts or notes), exporting to a latex file, running
>>> a perl script to remove any (sub)+sections with just the
>>> tags in them, and running pdflatex to generate the output.
>>>
>>> So far, so good.
>>>
>>> However, I ran into a problem with enumerations. Sometimes I
>>> have enumerations in my original org file which are separated by
>>> the 'empty' sectioning commands. This ends the enumeration and
>>> the next enumerated item starts a new one. The result is a set
>>> of enumerations with a single element in it. I get something
>>> like:
>>>
>>> 1. Blah
>>>
>>> handout-specific text
>>>
>>> 1. More Blah
>>>
>>> etc. These should really have been 1, 2, etc.
>>
>>
>> I don't understand. Why is the text "handout-specific text" still there?
>> Do you need it between the items?
>
> Yes (see below). I have in each of these items something I want as part
> of the handouts and some additional info I want to include for myself.
>
>  > Do you want to make it part of the
>> item (indentation would solve this).
>
> It will always be a part of the item, otherwise I would have made it a
> footnote or left it to after the enumeration.
>
> Unfortunately, indentation doesn't solve this. My example above was a
> little shy on details, sorry.
>
> If I have a file with:
>
> ------------------------------------
> #+EXPORT_EXCLUDE_TAGS: notes
>
> * Common Heading
> Common Text
>
> 1) Blah
>
> ** :handouts:
> handout-specific text
> ** :notes:
> note-specific text
> ** :both:
>
> 2) More Blah
>
> ** :handouts:
> handout-specific text
> ** :notes:
> note-specific text
> ** :both:
>
> 3) Even more...
> ------------------------------------
>
> After I export to latex and post process with my perl script I
> have the following for the body of my document:
>
> ------------------------------------
>
> \section{Common Heading}
> \label{sec-1}
>
> Common Text
>
> \begin{enumerate}
> \item Blah
> \end{enumerate}
>
> handout-specific text
>
> \begin{enumerate}
> \item More Blah
> \end{enumerate}
>
> handout-specific text
>
> \begin{enumerate}
> \item Even more\ldots{}
> \end{enumerate}
> ------------------------------------
>
> This is because the 'empty' placeholder headings (tags-only)
> interrupt the enumeration processing for each item, effectively
> ending it and causing the insertion of the \end{enumeration}.
> So each item is in it's own enumeration and the number restarts
> from 1 with each item.
>
>>
>>>
>>> The only workaround I have so far is to make all these items lists
>>> instead of enumerations. This works OK but they would make much more
>>> sense as enumerations.
>>
>>
>> How does this help?
>>
>
> It eliminates the numbers and uses only list marks instead. That way
> I don't have to worry about incorrect numbering of enumerations.
> Unfortunately, the text between items is still not indented properly
> since it appears outside the list environment.
>
> It is not ideal but it is something I can live with if I have to.
>
> Mark
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

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

* Re: latex enumeration issue
  2010-02-04  2:24     ` Mark Elston
@ 2010-02-04  3:12       ` Mark Elston
  2010-02-04  4:28         ` Dan Davison
  2010-02-04  7:00         ` Mark Elston
  2010-02-04 10:05       ` Eric S Fraga
  1 sibling, 2 replies; 10+ messages in thread
From: Mark Elston @ 2010-02-04  3:12 UTC (permalink / raw)
  To: emacs-orgmode

OK.  I guess I was wrong.  For some reason this hook doesn't seem
to work.  I masked the issue a different way and it made me *think*
this was working.

Any ideas why this hook function would not remove header lines with
only tags and no header text?

Mark

On 2/3/2010 6:24 PM, Mark Elston wrote:
> ...
>
> ;;; Export Hooks
> (defun mee-delete-empty-org-headers ()
>   (while (re-search-forward "^[*]+ [ ]+:[a-zA-Z0-9]+:$" nil t)
>     (progn
>       (beginning-of-line)
>       (kill-line 0))))
>
> (add-hook 'org-export-preprocess-hook
>           'mee-delete-empty-org-headers)
>
>

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

* Re: latex enumeration issue
  2010-02-04  3:12       ` Mark Elston
@ 2010-02-04  4:28         ` Dan Davison
  2010-02-04  7:00         ` Mark Elston
  1 sibling, 0 replies; 10+ messages in thread
From: Dan Davison @ 2010-02-04  4:28 UTC (permalink / raw)
  To: Mark Elston; +Cc: emacs-orgmode

Mark Elston <m_elston@comcast.net> writes:

> OK.  I guess I was wrong.  For some reason this hook doesn't seem
> to work.  I masked the issue a different way and it made me *think*
> this was working.
>
> Any ideas why this hook function would not remove header lines with
> only tags and no header text?
>
> Mark

Hi Mark,

I haven't tried to understand the use case, but here's a modified
version.

Dan

(defun mee-delete-empty-org-headers ()
  (while (re-search-forward "^\\*+[\t ]+:[a-zA-Z0-9]+:$" nil t)
    (beginning-of-line)
    (kill-line)
    (forward-line)))

>
> On 2/3/2010 6:24 PM, Mark Elston wrote:
>> ...
>>
>> ;;; Export Hooks
>> (defun mee-delete-empty-org-headers ()
>>   (while (re-search-forward "^[*]+ [ ]+:[a-zA-Z0-9]+:$" nil t)
>>     (progn
>>       (beginning-of-line)
>>       (kill-line 0))))
>>
>> (add-hook 'org-export-preprocess-hook
>>           'mee-delete-empty-org-headers)
>>
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: latex enumeration issue
  2010-02-04  3:12       ` Mark Elston
  2010-02-04  4:28         ` Dan Davison
@ 2010-02-04  7:00         ` Mark Elston
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Elston @ 2010-02-04  7:00 UTC (permalink / raw)
  To: emacs-orgmode

Found it.  Apparently org-export-preprocess-hook was the wrong hook.
When I used org-export-preprocess-final-hook instead it works as
expected.

Mark

On 2/3/2010 7:12 PM, Mark Elston wrote:
> OK.  I guess I was wrong.  For some reason this hook doesn't seem
> to work. I masked the issue a different way and it made me *think*
> this was working.
>
> Any ideas why this hook function would not remove header lines with
> only tags and no header text?
>
> Mark
>
> On 2/3/2010 6:24 PM, Mark Elston wrote:
>> ...
>>
>> ;;; Export Hooks
>> (defun mee-delete-empty-org-headers ()
>> (while (re-search-forward "^[*]+ [ ]+:[a-zA-Z0-9]+:$" nil t)
>> (progn
>> (beginning-of-line)
>> (kill-line 0))))
>>
>> (add-hook 'org-export-preprocess-hook
>> 'mee-delete-empty-org-headers)
>>
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

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

* Re: latex enumeration issue
  2010-02-04  2:24     ` Mark Elston
  2010-02-04  3:12       ` Mark Elston
@ 2010-02-04 10:05       ` Eric S Fraga
  2010-02-06  8:18         ` Daniel Martins
  1 sibling, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2010-02-04 10:05 UTC (permalink / raw)
  To: Mark Elston; +Cc: emacs-orgmode

At Wed, 03 Feb 2010 18:24:02 -0800,
Mark Elston wrote:

> P.S.  If anyone is interested here is the embarrassingly simple hook
> function I came up with.  I show it not because I think anyone else
> will find this thing useful but as an example of how simple it
> really is to write this kind of thing.

very useful, actually.  i use org-mode for my cv.  in my enumerated
list of my publications, say, I often want to add some notes that
don't appear in any exported version.  but I also don't want the
enumeration interrupted.  There are other possible solutions but this
simple function could prove quite useful indeed.

thanks,
eric

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

* Re: latex enumeration issue
  2010-02-04 10:05       ` Eric S Fraga
@ 2010-02-06  8:18         ` Daniel Martins
  2010-02-06 19:06           ` Mark Elston
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Martins @ 2010-02-06  8:18 UTC (permalink / raw)
  To: e.fraga; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 987 bytes --]

This behaviour and/or hook could not be the default?

Daniel

2010/2/4 Eric S Fraga <ucecesf@ucl.ac.uk>

> At Wed, 03 Feb 2010 18:24:02 -0800,
> Mark Elston wrote:
>
> > P.S.  If anyone is interested here is the embarrassingly simple hook
> > function I came up with.  I show it not because I think anyone else
> > will find this thing useful but as an example of how simple it
> > really is to write this kind of thing.
>
> very useful, actually.  i use org-mode for my cv.  in my enumerated
> list of my publications, say, I often want to add some notes that
> don't appear in any exported version.  but I also don't want the
> enumeration interrupted.  There are other possible solutions but this
> simple function could prove quite useful indeed.
>
> thanks,
> eric
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

[-- Attachment #1.2: Type: text/html, Size: 1566 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: latex enumeration issue
  2010-02-06  8:18         ` Daniel Martins
@ 2010-02-06 19:06           ` Mark Elston
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Elston @ 2010-02-06 19:06 UTC (permalink / raw)
  To: Daniel Martins; +Cc: emacs-orgmode

Daniel,

I don't know if this would be the best default behavior.  As I
think about it I would rather have a simple default behavior that I
can customize to my heart's content.  Simple, predictable behavior
makes it easier to customize.

My $0.02 worth, anyway.

Mark

On 2/6/2010 12:18 AM, Daniel Martins wrote:
> This behaviour and/or hook could not be the default?
>
> Daniel
>
> 2010/2/4 Eric S Fraga <ucecesf@ucl.ac.uk <mailto:ucecesf@ucl.ac.uk>>
>
>     At Wed, 03 Feb 2010 18:24:02 -0800,
>     Mark Elston wrote:
>
>      > P.S.  If anyone is interested here is the embarrassingly simple hook
>      > function I came up with.  I show it not because I think anyone else
>      > will find this thing useful but as an example of how simple it
>      > really is to write this kind of thing.
>
>     very useful, actually.  i use org-mode for my cv.  in my enumerated
>     list of my publications, say, I often want to add some notes that
>     don't appear in any exported version.  but I also don't want the
>     enumeration interrupted.  There are other possible solutions but this
>     simple function could prove quite useful indeed.
>
>     thanks,
>     eric

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

end of thread, other threads:[~2010-02-06 19:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-02 22:08 latex enumeration issue Mark Elston
2010-02-03 10:34 ` Carsten Dominik
2010-02-03 20:41   ` Mark Elston
2010-02-04  2:24     ` Mark Elston
2010-02-04  3:12       ` Mark Elston
2010-02-04  4:28         ` Dan Davison
2010-02-04  7:00         ` Mark Elston
2010-02-04 10:05       ` Eric S Fraga
2010-02-06  8:18         ` Daniel Martins
2010-02-06 19:06           ` Mark Elston

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).