emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* keep newlines on pdf export
@ 2009-12-13  1:04 ` Eraldo Helal
  2009-12-13 18:21   ` Nick Dokos
  2009-12-14  3:40   ` Nick Dokos
  0 siblings, 2 replies; 16+ messages in thread
From: Eraldo Helal @ 2009-12-13  1:04 UTC (permalink / raw)
  To: Org-Mode

When I export an org file like the following to pdf:
test.org
> line1
> line2
> line3

what I get is:
test.pdf
> line1 line2 line3

however, I would like to get the following in the pdf:
test.pdf
> line1
> line2
> line3

How can I get pdf export to keep my org newlines?
Remark: I do have "\n:t" set in my options line.

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

* keep newlines on pdf export
@ 2009-12-13  2:39 Eraldo Helal
  0 siblings, 0 replies; 16+ messages in thread
From: Eraldo Helal @ 2009-12-13  2:39 UTC (permalink / raw)
  To: emacs-orgmode

When I export an org file like the following to pdf:
test.org
> line1
> line2
> line3

what I get is:
test.pdf
> line1 line2 line3

however, I would like to get the following in the pdf:
test.pdf
> line1
> line2
> line3

How can I get pdf export to keep my org newlines?
Remark: I do have "\n:t" set in my options line.

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

* Re: keep newlines on pdf export
  2009-12-13  1:04 ` keep newlines on pdf export Eraldo Helal
@ 2009-12-13 18:21   ` Nick Dokos
  2009-12-13 20:51     ` Eraldo Helal
  2009-12-14  3:40   ` Nick Dokos
  1 sibling, 1 reply; 16+ messages in thread
From: Nick Dokos @ 2009-12-13 18:21 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode

Eraldo Helal <eraldo@eraldo.org> wrote:

> When I export an org file like the following to pdf:
> test.org
> > line1
> > line2
> > line3
> 
> what I get is:
> test.pdf
> > line1 line2 line3
> 
> however, I would like to get the following in the pdf:
> test.pdf
> > line1
> > line2
> > line3
> 
> How can I get pdf export to keep my org newlines?
> Remark: I do have "\n:t" set in my options line.
> 

org-to-pdf is really org-to-latex-to-pdf, and generally
speaking[1] newlines in latex are not significant. One way
to make them significant is

line1\\
line2\\
line3

Another might be

#+LATEX: \obeylines { %}
line1
line2
line3
#+LATEX: }

The %} might or might not be necessary to prevent the org LaTeX exporter
from complaining, but it's a useful workaround for an area that has had
problems in the past.

HTH,
Nick

[1] with exceptions, e.g. paragraph demarcation.

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

* Re: keep newlines on pdf export
  2009-12-13 18:21   ` Nick Dokos
@ 2009-12-13 20:51     ` Eraldo Helal
  2009-12-13 20:53       ` Eraldo Helal
  0 siblings, 1 reply; 16+ messages in thread
From: Eraldo Helal @ 2009-12-13 20:51 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org-Mode

> org-to-pdf is really org-to-latex-to-pdf, and generally
> speaking[1] newlines in latex are not significant. One way
> to make them significant is
>
> line1\\
> line2\\
> line3

This is what I am doing now as a workaround.
I know that inside latex it does not make sence...
but afaik one of the ideas behind org is that you can write plain text
and the exporter does the markup.
The "\n:t" option should tell the latex exporter to put a "\\" at the
end of each linebreak.
At least that is what I would wish. :)

Greetings from Austria,
Eraldo

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

* Re: keep newlines on pdf export
  2009-12-13 20:51     ` Eraldo Helal
@ 2009-12-13 20:53       ` Eraldo Helal
  2009-12-13 23:42         ` Nick Dokos
                           ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Eraldo Helal @ 2009-12-13 20:53 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org-Mode

One other reason behind this is that I can not export my document to
html anymore after I added "\\" at the end of every line... well I can
but it does not look the way I want it to be. =]

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

* Re: keep newlines on pdf export
  2009-12-13 20:53       ` Eraldo Helal
@ 2009-12-13 23:42         ` Nick Dokos
  2009-12-14 15:18           ` Bill Powell
  2009-12-14 14:58         ` andrea
  2009-12-14 15:35         ` Carsten Dominik
  2 siblings, 1 reply; 16+ messages in thread
From: Nick Dokos @ 2009-12-13 23:42 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode

Eraldo Helal <eraldo@eraldo.org> wrote:

> One other reason behind this is that I can not export my document to
> html anymore after I added "\\" at the end of every line... well I can
> but it does not look the way I want it to be. =]
> 

The \obeylines method should not affect the HTML export.

Nick

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

* Re: keep newlines on pdf export
  2009-12-13  1:04 ` keep newlines on pdf export Eraldo Helal
  2009-12-13 18:21   ` Nick Dokos
@ 2009-12-14  3:40   ` Nick Dokos
  2009-12-14  7:49     ` Carsten Dominik
  1 sibling, 1 reply; 16+ messages in thread
From: Nick Dokos @ 2009-12-14  3:40 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode

Eraldo Helal <eraldo@eraldo.org> wrote:

> When I export an org file like the following to pdf:
> test.org
> > line1
> > line2
> > line3
> 
> what I get is:
> test.pdf
> > line1 line2 line3
> 
> however, I would like to get the following in the pdf:
> test.pdf
> > line1
> > line2
> > line3
> 
> How can I get pdf export to keep my org newlines?
> Remark: I do have "\n:t" set in my options line.
> 

Not sure whether this actually went in or not: see

    http://thread.gmane.org/gmane.emacs.orgmode/18823

Also I messed up the syntax of obeylines before - it should
look like this:

#+LATEX: {\obeylines %}
line1
line2
line3
#+LATEX: }

Nick

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

* Re: keep newlines on pdf export
  2009-12-14  3:40   ` Nick Dokos
@ 2009-12-14  7:49     ` Carsten Dominik
  0 siblings, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-12-14  7:49 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Eraldo Helal, Org-Mode


On Dec 14, 2009, at 4:40 AM, Nick Dokos wrote:

> Eraldo Helal <eraldo@eraldo.org> wrote:
>
>> When I export an org file like the following to pdf:
>> test.org
>>> line1
>>> line2
>>> line3
>>
>> what I get is:
>> test.pdf
>>> line1 line2 line3
>>
>> however, I would like to get the following in the pdf:
>> test.pdf
>>> line1
>>> line2
>>> line3
>>
>> How can I get pdf export to keep my org newlines?
>> Remark: I do have "\n:t" set in my options line.
>>
>
> Not sure whether this actually went in or not: see
>
>    http://thread.gmane.org/gmane.emacs.orgmode/18823

We went in and out of this idea.  For a while, "#+OPTIONS: \n:t"
did enter a \obeylines into the LaTeX output, but that turned
out to be not reliable,

http://thread.gmane.org/gmane.emacs.orgmode/18823/focus=18867

so I removed that again.

But the hack you show below surely will work in that limited sense.

- Carsten

>
> Also I messed up the syntax of obeylines before - it should
> look like this:
>
> #+LATEX: {\obeylines %}
> line1
> line2
> line3
> #+LATEX: }
>
> Nick
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: keep newlines on pdf export
  2009-12-13 20:53       ` Eraldo Helal
  2009-12-13 23:42         ` Nick Dokos
@ 2009-12-14 14:58         ` andrea
  2009-12-14 15:35         ` Carsten Dominik
  2 siblings, 0 replies; 16+ messages in thread
From: andrea @ 2009-12-14 14:58 UTC (permalink / raw)
  To: emacs-orgmode

Eraldo Helal <eraldo@eraldo.org> writes:

> One other reason behind this is that I can not export my document to
> html anymore after I added "\\" at the end of every line... well I can
> but it does not look the way I want it to be. =]

We already discussed about that and \obeylines doens't really work.
If you have lists or arrays or something complicated it will screw up
the structure of your file.

Adding a \\ would be maybe better, but in this case we should skip the
"\\" when exporting to other formats, is that possible?

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

* Re: keep newlines on pdf export
  2009-12-13 23:42         ` Nick Dokos
@ 2009-12-14 15:18           ` Bill Powell
  0 siblings, 0 replies; 16+ messages in thread
From: Bill Powell @ 2009-12-14 15:18 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Eraldo Helal, Org-Mode

At Sun, 13 Dec 2009 18:42:58 -0500,
Nick Dokos wrote:
> 
> Eraldo Helal <eraldo@eraldo.org> wrote:
> 
> > One other reason behind this is that I can not export my document to
> > html anymore after I added "\\" at the end of every line... well I can
> > but it does not look the way I want it to be. =]
> > 
> 
> The \obeylines method should not affect the HTML export.
> 
> Nick

Hi folks,

I also have been using the \obeylines technique. But it seems a bit
crufty. I do lots of work in LaTeX, so I have a sense of the perils
involved in LaTeX linebreaking. Unfortunately, I have zero experience
with elisp, so I can't tackle this (yet).

The problem with the \obeylines hack is that if it's not properly
closed with a final bracket, your file breaks. But how do you keep
this final bracket in place? You can't move headlines around with the
usual reckless abandon, because there's no way (that I know of) to
keep that final bracket locked at the end of your text file. Unless
you want to enter an \obeylines within every headline ...

So I would give a +1 to \n:t giving at least rudimentary linebreak
support for PDF export, rather than silently failing. As someone who
regularly has to export the same file to both HTML and PDF, I would
rather have an option that works 90% of the time and sometimes
requires an arcane LaTeX fix (and is documented as such), than
/always/ have to use an arcane LaTeX fix.

Thanks,
Bill Powell

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

* Re: keep newlines on pdf export
  2009-12-13 20:53       ` Eraldo Helal
  2009-12-13 23:42         ` Nick Dokos
  2009-12-14 14:58         ` andrea
@ 2009-12-14 15:35         ` Carsten Dominik
  2009-12-14 21:56           ` Bill Powell
  2009-12-16  4:05           ` Eraldo Helal
  2 siblings, 2 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-12-14 15:35 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode

Hi Eraldo,

I am always much more interested in thinking about a solution
if I am not just presented with an abstract wish, but rather
with a concrete example where this might be useful.

- Carsten

On Dec 13, 2009, at 9:53 PM, Eraldo Helal wrote:

> One other reason behind this is that I can not export my document to
> html anymore after I added "\\" at the end of every line... well I can
> but it does not look the way I want it to be. =]
>
>
> _______________________________________________
> 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

- Carsten

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

* Re: keep newlines on pdf export
  2009-12-14 15:35         ` Carsten Dominik
@ 2009-12-14 21:56           ` Bill Powell
  2009-12-14 22:20             ` Nick Dokos
  2009-12-16  4:05           ` Eraldo Helal
  1 sibling, 1 reply; 16+ messages in thread
From: Bill Powell @ 2009-12-14 21:56 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Eraldo Helal, Org-Mode

At Mon, 14 Dec 2009 16:35:32 +0100,
Carsten Dominik wrote:
> 
> Hi Eraldo,
> 
> I am always much more interested in thinking about a solution
> if I am not just presented with an abstract wish, but rather
> with a concrete example where this might be useful.
> 
> - Carsten

Carsten,

Thanks for the recent \{ and \} LaTeX fix, btw.

To add to my recent post about the newlines, here's a concrete example
for newlines in both HTML and PDF: flashcards. It's extremely useful
to be able to visually break up text on a flashcard using linebreaks.
And org-mode is ideal for organizing flashcards by topic, subtopic,
etc.

I use org-mode's export to LaTeX to make flashcards for students who
want a printout they can cut into paper flashcards. For those who
prefer to review flashcards with Anki, I use export to HTML. My
post-processor perl scripts will be much happier if org-mode takes
care of the linebreaks. :-) 

Thanks for considering this,
Bill Powell


> 
> On Dec 13, 2009, at 9:53 PM, Eraldo Helal wrote:
> 
> > One other reason behind this is that I can not export my document to
> > html anymore after I added "\\" at the end of every line... well I can
> > but it does not look the way I want it to be. =]
> >
> >
> > _______________________________________________
> > 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
> 
> - Carsten
> 
> 
> 
> 
> 
> _______________________________________________
> 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] 16+ messages in thread

* Re: keep newlines on pdf export
  2009-12-14 21:56           ` Bill Powell
@ 2009-12-14 22:20             ` Nick Dokos
  2009-12-14 23:25               ` Bill Powell
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Dokos @ 2009-12-14 22:20 UTC (permalink / raw)
  To: Bill Powell; +Cc: Eraldo Helal, Org-Mode, Carsten Dominik

Bill Powell <bill@billpowellisalive.com> wrote:

> ...
> 
> I use org-mode's export to LaTeX to make flashcards for students who
> want a printout they can cut into paper flashcards. For those who
> prefer to review flashcards with Anki, I use export to HTML. My
> post-processor perl scripts will be much happier if org-mode takes
> care of the linebreaks. :-) 
> 

Can you post a short example? Both the org file and (a pointer to) the
PDF/HTML files, if possible.

This is off the top of my head, but wouldn't an item list do what you want?
Something like

* topic
** subtopic

   - item
   - item
   - item

Thanks,
Nick

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

* Re: keep newlines on pdf export
  2009-12-14 22:20             ` Nick Dokos
@ 2009-12-14 23:25               ` Bill Powell
  0 siblings, 0 replies; 16+ messages in thread
From: Bill Powell @ 2009-12-14 23:25 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org-Mode, Eraldo Helal, Carsten Dominik

At Mon, 14 Dec 2009 17:20:36 -0500,
Nick Dokos wrote:
> 
> Bill Powell <bill@billpowellisalive.com> wrote:
> 
> > ...
> > 
> > I use org-mode's export to LaTeX to make flashcards for students who
> > want a printout they can cut into paper flashcards. For those who
> > prefer to review flashcards with Anki, I use export to HTML. My
> > post-processor perl scripts will be much happier if org-mode takes
> > care of the linebreaks. :-) 
> > 
> 
> Can you post a short example? Both the org file and (a pointer to) the
> PDF/HTML files, if possible.

Nick,

Well, in this case, it would be kind of tricky to do a minimal working
example, because I use a pretty ugly post-processor script to patch
things up, and the final PDF output also depends on several external
LaTeX classes. I was just offering this as an example use of where
org-mode inserting a "\linebreak" could be helpful.

> This is off the top of my head, but wouldn't an item list do what you want?
> Something like
> 
> * topic
> ** subtopic
> 
>    - item
>    - item
>    - item


Sometimes I do, and that can be handy. But the item list won't always
work because LaTeX and HTML usually spaces item lists, and add
bullets, and do that kind of thing. I guess I could use memoir.cls and
\tightlists.

Thanks,
Bill Powell

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

* Re: keep newlines on pdf export
  2009-12-14 15:35         ` Carsten Dominik
  2009-12-14 21:56           ` Bill Powell
@ 2009-12-16  4:05           ` Eraldo Helal
  2009-12-16  6:24             ` Carsten Dominik
  1 sibling, 1 reply; 16+ messages in thread
From: Eraldo Helal @ 2009-12-16  4:05 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-Mode

Hi Carsten

> I am always much more interested in thinking about a solution
> if I am not just presented with an abstract wish, but rather
> with a concrete example where this might be useful.
First of all I want to thank all of you (again) for this great mailing-list.
I am a great fan of the idea of writing an org file and being able to
export it to differnt formats as desired. (ASCII, html, pdf, etc)
In my case the absence of consistent newlines (as present in html
export) was not that much of a problem because the document
(scientific article on complex numbers) does not need to be exported
to html at all... so I just added "\\" to the end of every line.
Nontheless I took notice of the problem and wanted to get and give
some feedback.

Greetings from Austria,
Eraldo

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

* Re: keep newlines on pdf export
  2009-12-16  4:05           ` Eraldo Helal
@ 2009-12-16  6:24             ` Carsten Dominik
  0 siblings, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2009-12-16  6:24 UTC (permalink / raw)
  To: Eraldo Helal; +Cc: Org-Mode


On Dec 16, 2009, at 5:05 AM, Eraldo Helal wrote:

> Hi Carsten
>
>> I am always much more interested in thinking about a solution
>> if I am not just presented with an abstract wish, but rather
>> with a concrete example where this might be useful.
> First of all I want to thank all of you (again) for this great  
> mailing-list.
> I am a great fan of the idea of writing an org file and being able to
> export it to differnt formats as desired. (ASCII, html, pdf, etc)
> In my case the absence of consistent newlines (as present in html
> export) was not that much of a problem because the document
> (scientific article on complex numbers) does not need to be exported
> to html at all... so I just added "\\" to the end of every line.
> Nontheless I took notice of the problem and wanted to get and give
> some feedback.


Hi Eraldo,

still, an example would have been useful, to generate more ideas.

In the absence of an example, a few more comments/ideas that have
not yet come up (unless I missed them..)

"\\" at the end of a line does also the right thing in HTML
export, i.e. it is converted to <br/>

Other possibilities to preserve line breaks include

1. the #+begin_verse...#+end_verse block
2. A #+begin_example ... #+end_example block
3. Putting the numbers into a table
4. Starting each line with ": " (also makes them end up in an
    example block)

Cheers

- Carsten

>
> Greetings from Austria,
> Eraldo

- Carsten

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

end of thread, other threads:[~2009-12-16  6:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <eraldo@eraldo.org>
2009-12-13  1:04 ` keep newlines on pdf export Eraldo Helal
2009-12-13 18:21   ` Nick Dokos
2009-12-13 20:51     ` Eraldo Helal
2009-12-13 20:53       ` Eraldo Helal
2009-12-13 23:42         ` Nick Dokos
2009-12-14 15:18           ` Bill Powell
2009-12-14 14:58         ` andrea
2009-12-14 15:35         ` Carsten Dominik
2009-12-14 21:56           ` Bill Powell
2009-12-14 22:20             ` Nick Dokos
2009-12-14 23:25               ` Bill Powell
2009-12-16  4:05           ` Eraldo Helal
2009-12-16  6:24             ` Carsten Dominik
2009-12-14  3:40   ` Nick Dokos
2009-12-14  7:49     ` Carsten Dominik
2009-12-13  2:39 Eraldo Helal

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