emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
@ 2010-03-17 12:43 Francesco Pizzolante
  2010-03-17 14:35 ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Francesco Pizzolante @ 2010-03-17 12:43 UTC (permalink / raw)
  To: mailing-list-org-mode

Hi,

When exporting an Org buffer to latex, I can see that Org generates an extra
\newline command just after exporting the timestamps to the heading.

An example.

This Org stuff:
--8<---------------cut here---------------start------------->8---
*** DONE My Task                                                 :Be:
    SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-05 Fri>
    :LOGBOOK:
    - State "STARTED"    from "TODO"       [2010-03-02 Tue 09:30]
    - State "DONE"       from "STARTED"    [2010-03-02 Tue 10:00]
    CLOCK: [2010-03-02 Tue 09:30]--[2010-03-02 Tue 10:00] =>  0:30
    - PWA.
    :END:
    :PROPERTIES:
    :Effort:   4:00
    :END:
--8<---------------cut here---------------end--------------->8---

Is exported to latex this way:
--8<---------------cut here---------------start------------->8---
\subsubsection{\textbf{DONE} My Task \textbf{:Be:}}
\label{sec-2.2.2}

    \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-05 Fri}\newline
--8<---------------cut here---------------end--------------->8---

At the end of the timestamps line, you can see the extra \newline command.

This \newline command should be removed as it adds extra vertical space which
does not respect the document class definition used for the document.

In order to do that, I made the following change to org-latex.el and it works
for me, but I'm not sure my change is completely safe:

--8<---------------cut here---------------start------------->8---
index 03216a8..88bd8c3 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1511,7 +1511,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
       (beginning-of-line 1)
       (unless (looking-at ".*\\\\newline[ \t]*$")
        (end-of-line 1)
-       (insert "\\newline")))))
+       ))))

 (defun org-export-latex-fixed-width (opt)
   "When OPT is non-nil convert fixed-width sections to LaTeX."
--8<---------------cut here---------------end--------------->8---

Is this the right thing to do to avoid this extra \newline command?

Thanks,
Francesco


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

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

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
  2010-03-17 12:43 LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb") Francesco Pizzolante
@ 2010-03-17 14:35 ` Carsten Dominik
  2010-03-17 20:00   ` David Maus
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-03-17 14:35 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode

Hi Francesco,

thanks for this.  The reason why I put this is is to make sure that  
text after that line will start
in a new line, and now flow into the scheduled/deadline line.   For  
example:

*** DONE My Task                                                 :Be:
    SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-05 Fri>
    this should start a new line but does not with your patch

Do you disagree that this is the right thing to do?  Do you know a  
method to achieve the same result without generating extra white space?

- Carsten

On Mar 17, 2010, at 1:43 PM, Francesco Pizzolante wrote:

> Hi,
>
> When exporting an Org buffer to latex, I can see that Org generates  
> an extra
> \newline command just after exporting the timestamps to the heading.
>
> An example.
>
> This Org stuff:
> --8<---------------cut here---------------start------------->8---
> *** DONE My Task                                                 :Be:
>    SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-05 Fri>
>    :LOGBOOK:
>    - State "STARTED"    from "TODO"       [2010-03-02 Tue 09:30]
>    - State "DONE"       from "STARTED"    [2010-03-02 Tue 10:00]
>    CLOCK: [2010-03-02 Tue 09:30]--[2010-03-02 Tue 10:00] =>  0:30
>    - PWA.
>    :END:
>    :PROPERTIES:
>    :Effort:   4:00
>    :END:
> --8<---------------cut here---------------end--------------->8---
>
> Is exported to latex this way:
> --8<---------------cut here---------------start------------->8---
> \subsubsection{\textbf{DONE} My Task \textbf{:Be:}}
> \label{sec-2.2.2}
>
>    \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:}  
> \textit{2010-03-05 Fri}\newline
> --8<---------------cut here---------------end--------------->8---
>
> At the end of the timestamps line, you can see the extra \newline  
> command.
>
> This \newline command should be removed as it adds extra vertical  
> space which
> does not respect the document class definition used for the document.
>
> In order to do that, I made the following change to org-latex.el and  
> it works
> for me, but I'm not sure my change is completely safe:
>
> --8<---------------cut here---------------start------------->8---
> index 03216a8..88bd8c3 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1511,7 +1511,7 @@ The conversion is made depending of STRING- 
> BEFORE and STRING-AFTER."
>       (beginning-of-line 1)
>       (unless (looking-at ".*\\\\newline[ \t]*$")
>        (end-of-line 1)
> -       (insert "\\newline")))))
> +       ))))
>
> (defun org-export-latex-fixed-width (opt)
>   "When OPT is non-nil convert fixed-width sections to LaTeX."
> --8<---------------cut here---------------end--------------->8---
>
> Is this the right thing to do to avoid this extra \newline command?
>
> Thanks,
> Francesco
>
>
> _______________________________________________
> 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] 10+ messages in thread

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
  2010-03-17 14:35 ` Carsten Dominik
@ 2010-03-17 20:00   ` David Maus
  2010-03-18  5:47     ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: David Maus @ 2010-03-17 20:00 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: mailing-list-org-mode


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

Carsten Dominik wrote:
>Hi Francesco,

>thanks for this.  The reason why I put this is is to make sure that
>text after that line will start
>in a new line, and now flow into the scheduled/deadline line.   For
>example:

>*** DONE My Task                                                 :Be:
>    SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-05 Fri>
>    this should start a new line but does not with your patch

>Do you disagree that this is the right thing to do?  Do you know a
>method to achieve the same result without generating extra white
>space?

We could simply insert a blank line (e.g. "\n\n"), couldn't we?  This
would let LaTeX start a new paragraph if there's no space between
scheduled/deadline line and do no harm if there is, because LaTeX
doesn't care about multiple newlines.

HTH
 -- David

--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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 export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
  2010-03-17 20:00   ` David Maus
@ 2010-03-18  5:47     ` Carsten Dominik
       [not found]       ` <F8590385-44EE-4081-81FA-FC10AA364CA0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2010-03-18  5:47 UTC (permalink / raw)
  To: David Maus; +Cc: mailing-list-org-mode


On Mar 17, 2010, at 9:00 PM, David Maus wrote:

> Carsten Dominik wrote:
>> Hi Francesco,
>
>> thanks for this.  The reason why I put this is is to make sure that
>> text after that line will start
>> in a new line, and now flow into the scheduled/deadline line.   For
>> example:
>
>> *** DONE My Task                                                 :Be:
>>   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-05 Fri>
>>   this should start a new line but does not with your patch
>
>> Do you disagree that this is the right thing to do?  Do you know a
>> method to achieve the same result without generating extra white
>> space?
>
> We could simply insert a blank line (e.g. "\n\n"), couldn't we?  This
> would let LaTeX start a new paragraph if there's no space between
> scheduled/deadline line and do no harm if there is, because LaTeX
> doesn't care about multiple newlines.

Yes, we could, but what I tries was to *not* start a new paragraph...

- Carsten

>
> HTH
> -- David
>
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de

- Carsten

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

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
       [not found]       ` <F8590385-44EE-4081-81FA-FC10AA364CA0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2010-03-18  9:07         ` Francesco Pizzolante
  2010-03-18 11:45           ` David Maus
  0 siblings, 1 reply; 10+ messages in thread
From: Francesco Pizzolante @ 2010-03-18  9:07 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: mailing-list-org-mode

Hi,

Thanks for your remarks.

>>> thanks for this.  The reason why I put this is is to make sure that
>>> text after that line will start
>>> in a new line, and now flow into the scheduled/deadline line.   For
>>> example:
>>
>>> *** DONE My Task                                                 :Be:
>>>   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-05 Fri>
>>>   this should start a new line but does not with your patch
>>
>>> Do you disagree that this is the right thing to do?  Do you know a
>>> method to achieve the same result without generating extra white
>>> space?
>>
>> We could simply insert a blank line (e.g. "\n\n"), couldn't we?  This
>> would let LaTeX start a new paragraph if there's no space between
>> scheduled/deadline line and do no harm if there is, because LaTeX
>> doesn't care about multiple newlines.
>
> Yes, we could, but what I tries was to *not* start a new paragraph...

Why not? From my point of view, the timestamps are more technical information
and the text you have after is the "real" text regarding the heading, so why
not put them on separate paragraphs?

After a few more tests, I think that David's suggestion is the best one:
having a simple blank line after the timestamps in the generated LaTex code.

This way, if we have some text in the heading, LaTex will simply start a new
paragraph and we will have the correct spacing. If don't have text in the
heading, LaTeX will simply ignore the blank line and will format the next
heading according to the document class chosen.

The problem with the actual implementation is that it forces a newline in all
cases (both if you have text in the heading or not) which does not respect the
document class formatting that you've chosen.

What do you think?

Thanks a lot,
Francesco


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

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

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
  2010-03-18  9:07         ` Francesco Pizzolante
@ 2010-03-18 11:45           ` David Maus
       [not found]             ` <87y6hpkg4f.wl%dmaus-lYycHbxpNtazQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: David Maus @ 2010-03-18 11:45 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode, Carsten Dominik


[-- Attachment #1.1.1: Type: text/plain, Size: 936 bytes --]

Francesco Pizzolante wrote:
>The problem with the actual implementation is that it forces a newline in all
>cases (both if you have text in the heading or not) which does not respect the
>document class formatting that you've chosen.

Took me a while to realize the problem with current implementation: If
you already have a blank line between scheduled/deadline line and the
content the newline forces extra spacing between scheduled/deadline
and the following paragraph.

This cleary /is/ problem.  Maybe we should catch these two cases
(patch attached):

,----
| (unless (and (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
`----

Insert \newline only if there is no paragraph separator.  As far as I
can see the LaTeX code is already rendered when
`org-export-latex-keywords' is called so this should work out.

HTH
 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.1.2: fix-latex-newline.diff --]
[-- Type: application/octet-stream, Size: 483 bytes --]

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 1f697d5..37ccce3 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1517,7 +1517,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 			   (match-string 0)) t t)
     (save-excursion
       (beginning-of-line 1)
-      (unless (looking-at ".*\\\\newline[ \t]*$")
+      (unless (and (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
 	(end-of-line 1)
 	(insert "\\newline")))))
 

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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 related	[flat|nested] 10+ messages in thread

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
       [not found]             ` <87y6hpkg4f.wl%dmaus-lYycHbxpNtazQB+pC5nmwQ@public.gmane.org>
@ 2010-03-18 13:54               ` Francesco Pizzolante
  2010-03-18 15:41                 ` David Maus
  2010-03-19 17:20                 ` Carsten Dominik
  0 siblings, 2 replies; 10+ messages in thread
From: Francesco Pizzolante @ 2010-03-18 13:54 UTC (permalink / raw)
  To: David Maus; +Cc: mailing-list-org-mode, Carsten Dominik

Hi David,

David Maus wrote:
> Took me a while to realize the problem with current implementation: If
> you already have a blank line between scheduled/deadline line and the
> content the newline forces extra spacing between scheduled/deadline
> and the following paragraph.

I'm sorry if I wasn't clear enough.


> This cleary /is/ problem.  Maybe we should catch these two cases
> (patch attached):
>
> ,----
> | (unless (and (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
> `----
>
> Insert \newline only if there is no paragraph separator.  As far as I
> can see the LaTeX code is already rendered when
> `org-export-latex-keywords' is called so this should work out.

I tried your patch, but I still get extra \newline commands in the generated
LaTeX.

Let's go back to examples, I think it will be easier to understand my problem.

1) Heading with no text

--8<---------------cut here---------------start------------->8---
** STARTED  First
   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
--8<---------------cut here---------------end--------------->8---

Gives the following:

--8<---------------cut here---------------start------------->8---
\subsection{\textbf{STARTED} First}
\label{sec-1.1}

   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}\newline
--8<---------------cut here---------------end--------------->8---

Which gives me an extra vertical space between this heading and the next one.

While I would expect this (with or without the extra blank line in this case,
as there's no text after):

--8<---------------cut here---------------start------------->8---
\subsection{\textbf{STARTED} First}
\label{sec-1.1}

   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}

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


2) Heading with text and no blank line between heading and text

--8<---------------cut here---------------start------------->8---
** STARTED  Second
   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
   This task is split among all services and communication between the
   entities.
--8<---------------cut here---------------end--------------->8---

This gives the following:

--8<---------------cut here---------------start------------->8---
\subsection{\textbf{STARTED} Second}
\label{sec-1.2}

   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}\newline\newline
   This task is split among all services and communication between the
   entities.
--8<---------------cut here---------------end--------------->8---

I also get an extra vertical space between the timestamps and the text which
is on a new paragraph.

Instead, I was expecting this:

--8<---------------cut here---------------start------------->8---
\subsection{\textbf{STARTED} Second}
\label{sec-1.2}

   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}

   This task is split among all services and communication between the
   entities.
--8<---------------cut here---------------end--------------->8---


3) Heading with text and blank line between heading and text

--8<---------------cut here---------------start------------->8---
** DONE Third
   DEADLINE: <2010-03-26 Fri>

   This task is split among all services and communication between the
   entities.
   Second paragraph.

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

This gives the following:

--8<---------------cut here---------------start------------->8---
\subsection{\textbf{DONE} Third}
\label{sec-1.3}

   \texttt{DEADLINE:} \textit{2010-03-26 Fri}\newline

   This task is split among all services and communication between the
   entities.
   Second paragraph.

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

In this case, again, I get an extra vertical space between the timestamps and
the text which is also in a new paragraph.

Instead, I would simply expect this:

--8<---------------cut here---------------start------------->8---
\subsection{\textbf{DONE} Third}
\label{sec-1.3}

   \texttt{DEADLINE:} \textit{2010-03-26 Fri}

   This task is split among all services and communication between the
   entities.
   Second paragraph.

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


As you can see from these 3 examples, it is safer to always generate blank
lines only instead of \newline commands.

Sorry for the length of this message.

I hope, the problem is clearer now.

Please let me know what you think.

Francesco


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

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

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
  2010-03-18 13:54               ` Francesco Pizzolante
@ 2010-03-18 15:41                 ` David Maus
       [not found]                   ` <87wrx9skm4.wl%dmaus-lYycHbxpNtazQB+pC5nmwQ@public.gmane.org>
  2010-03-19 17:20                 ` Carsten Dominik
  1 sibling, 1 reply; 10+ messages in thread
From: David Maus @ 2010-03-18 15:41 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode, Carsten Dominik


[-- Attachment #1.1.1: Type: text/plain, Size: 3140 bytes --]

Francesco Pizzolante wrote:
>Hi David,

>> This cleary /is/ problem.  Maybe we should catch these two cases
>> (patch attached):
>>
>> ,----
>> | (unless (and (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
>> `----
>>
>> Insert \newline only if there is no paragraph separator.  As far as I
>> can see the LaTeX code is already rendered when
>> `org-export-latex-keywords' is called so this should work out.

>I tried your patch, but I still get extra \newline commands in the generated
>LaTeX.

Yes, sorry, my brain's logical unit misfired.  What I meant was

,----
| (unless (or (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
`----

Translating to: insert /no/ \newline, if either (a) there is a empty
line beneath this line or (b) there is already a \newline.  Using this
the examples give:

1) Heading with no text

--8<---------------cut here---------------start------------->8---
** STARTED  First
   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
--8<---------------cut here---------------end--------------->8---

Gives the following:

--8<---------------cut here---------------start------------->8---
\section{STARTED  First}
\label{sec-1}

   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}
--8<---------------cut here---------------end--------------->8---

No extra vertical space between this heading and the next one.

2) Heading with text and no blank line between heading and text

--8<---------------cut here---------------start------------->8---
** STARTED  Second
   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
   This task is split among all services and communication between the
   entities.
--8<---------------cut here---------------end--------------->8---

Gives the following:

--8<---------------cut here---------------start------------->8---
\section{STARTED  Second}
\label{sec-2}

   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}\newline
   This task is split among all services and communication between the
   entities.
--8<---------------cut here---------------end--------------->8---

This would be Carsten's case.

3) Heading with text and blank line between heading and text

--8<---------------cut here---------------start------------->8---
** DONE Third
   DEADLINE: <2010-03-26 Fri>

   This task is split among all services and communication between the
   entities.
   Second paragraph.

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

Gives the following:

--8<---------------cut here---------------start------------->8---
\section{\textbf{DONE} Third}
\label{sec-3}

   \texttt{DEADLINE:} \textit{2010-03-26 Fri}

   This task is split among all services and communication between the
   entities.
   Second paragraph.

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

What you expected.

IMO inserting a \newline after the deadline/scheduled line if text follows
immediately (example 2) makes sense.

HTH
 -- David

--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.1.2: latex-newline-2.diff --]
[-- Type: application/octet-stream, Size: 482 bytes --]

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 1f697d5..d50dc2d 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1517,7 +1517,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 			   (match-string 0)) t t)
     (save-excursion
       (beginning-of-line 1)
-      (unless (looking-at ".*\\\\newline[ \t]*$")
+      (unless (or (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
 	(end-of-line 1)
 	(insert "\\newline")))))
 

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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 related	[flat|nested] 10+ messages in thread

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
       [not found]                   ` <87wrx9skm4.wl%dmaus-lYycHbxpNtazQB+pC5nmwQ@public.gmane.org>
@ 2010-03-18 16:06                     ` Francesco Pizzolante
  0 siblings, 0 replies; 10+ messages in thread
From: Francesco Pizzolante @ 2010-03-18 16:06 UTC (permalink / raw)
  To: David Maus; +Cc: mailing-list-org-mode, Carsten Dominik

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

Hi David,

> Yes, sorry, my brain's logical unit misfired.  What I meant was
>
> ,----
> | (unless (or (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\\newline[ \t]*$"))
> `----
>
> Translating to: insert /no/ \newline, if either (a) there is a empty
> line beneath this line or (b) there is already a \newline.

We're going ahead! ;-)

Your intention is also clearer for me now.

Examples 1 and 3 are OK. I still have a remark for example 2.

> 2) Heading with text and no blank line between heading and text
>
> ** STARTED  Second
>    SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
>    This task is split among all services and communication between the
>    entities.
>
> Gives the following:
>
> \section{STARTED  Second}
> \label{sec-2}
>
>    \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:} \textit{2010-03-19 Fri}\newline
>    This task is split among all services and communication between the
>    entities.
>
> This would be Carsten's case.

Yes, it is. ;-)


> IMO inserting a \newline after the deadline/scheduled line if text follows
> immediately (example 2) makes sense.

I'm just wondering why having a special handling for this case (the second
one). Adding a simple blank line instead of the \newline command would be
cleaner as it you would totally rely on LaTeX for the formatting.

In addition, we keep having 2 different behaviors: in example 2, the text
starts on a newline (but on the same paragraph as what comes before) while on
example 3, the text starts on a new paragraph.

See the attached picture which shows clearly the difference between the text
of section 1.2 and the text of section 1.3: for this example, I simply use the
default article formatting which uses paragraph indentation except for the
first paragraph of sections.

From my point of view, both examples 2 and 3 should be exported the same way:
it should not matter if we have (or not) an empty line in the Org buffer between
the heading and text. While, in the LaTex code, we should always add blank
line instead of \newline commands. LaTeX will thus always put things on
separate paragraphs, which totally makes sens to me.

Does all this make sense to you?

F.

[-- Attachment #2: newline-capture.png --]
[-- Type: image/png, Size: 23303 bytes --]

[-- Attachment #3: Type: text/plain, Size: 222 bytes --]

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

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

* Re: LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb")
  2010-03-18 13:54               ` Francesco Pizzolante
  2010-03-18 15:41                 ` David Maus
@ 2010-03-19 17:20                 ` Carsten Dominik
  1 sibling, 0 replies; 10+ messages in thread
From: Carsten Dominik @ 2010-03-19 17:20 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode


On Mar 18, 2010, at 2:54 PM, Francesco Pizzolante wrote:

> Hi David,
>
> David Maus wrote:
>> Took me a while to realize the problem with current implementation:  
>> If
>> you already have a blank line between scheduled/deadline line and the
>> content the newline forces extra spacing between scheduled/deadline
>> and the following paragraph.
>
> I'm sorry if I wasn't clear enough.
>
>
>> This cleary /is/ problem.  Maybe we should catch these two cases
>> (patch attached):
>>
>> ,----
>> | (unless (and (looking-at ".*\n[ \t]*\n") (looking-at ".*\\\ 
>> \newline[ \t]*$"))
>> `----
>>
>> Insert \newline only if there is no paragraph separator.  As far as I
>> can see the LaTeX code is already rendered when
>> `org-export-latex-keywords' is called so this should work out.
>
> I tried your patch, but I still get extra \newline commands in the  
> generated
> LaTeX.
>
> Let's go back to examples, I think it will be easier to understand  
> my problem.
>
> 1) Heading with no text
>
> --8<---------------cut here---------------start------------->8---
> ** STARTED  First
>   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
> --8<---------------cut here---------------end--------------->8---
>
> Gives the following:
>
> --8<---------------cut here---------------start------------->8---
> \subsection{\textbf{STARTED} First}
> \label{sec-1.1}
>
>   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:}  
> \textit{2010-03-19 Fri}\newline
> --8<---------------cut here---------------end--------------->8---
>
> Which gives me an extra vertical space between this heading and the  
> next one.
>
> While I would expect this (with or without the extra blank line in  
> this case,
> as there's no text after):
>
> --8<---------------cut here---------------start------------->8---
> \subsection{\textbf{STARTED} First}
> \label{sec-1.1}
>
>   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:}  
> \textit{2010-03-19 Fri}
>
> --8<---------------cut here---------------end--------------->8---
>
>
> 2) Heading with text and no blank line between heading and text
>
> --8<---------------cut here---------------start------------->8---
> ** STARTED  Second
>   SCHEDULED: <2010-03-01 Mon> DEADLINE: <2010-03-19 Fri>
>   This task is split among all services and communication between the
>   entities.
> --8<---------------cut here---------------end--------------->8---
>
> This gives the following:
>
> --8<---------------cut here---------------start------------->8---
> \subsection{\textbf{STARTED} Second}
> \label{sec-1.2}
>
>   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:}  
> \textit{2010-03-19 Fri}\newline\newline
>   This task is split among all services and communication between the
>   entities.
> --8<---------------cut here---------------end--------------->8---
>
> I also get an extra vertical space between the timestamps and the  
> text which
> is on a new paragraph.
>
> Instead, I was expecting this:
>
> --8<---------------cut here---------------start------------->8---
> \subsection{\textbf{STARTED} Second}
> \label{sec-1.2}
>
>   \texttt{SCHEDULED:} \textit{2010-03-01 Mon} \texttt{DEADLINE:}  
> \textit{2010-03-19 Fri}
>
>   This task is split among all services and communication between the
>   entities.
> --8<---------------cut here---------------end--------------->8---
>
>
> 3) Heading with text and blank line between heading and text
>
> --8<---------------cut here---------------start------------->8---
> ** DONE Third
>   DEADLINE: <2010-03-26 Fri>
>
>   This task is split among all services and communication between the
>   entities.
>   Second paragraph.
>
>   fdqsfdq
> --8<---------------cut here---------------end--------------->8---
>
> This gives the following:
>
> --8<---------------cut here---------------start------------->8---
> \subsection{\textbf{DONE} Third}
> \label{sec-1.3}
>
>   \texttt{DEADLINE:} \textit{2010-03-26 Fri}\newline
>
>   This task is split among all services and communication between the
>   entities.
>   Second paragraph.
>
>   fdqsfdq
> --8<---------------cut here---------------end--------------->8---
>
> In this case, again, I get an extra vertical space between the  
> timestamps and
> the text which is also in a new paragraph.
>
> Instead, I would simply expect this:
>
> --8<---------------cut here---------------start------------->8---
> \subsection{\textbf{DONE} Third}
> \label{sec-1.3}
>
>   \texttt{DEADLINE:} \textit{2010-03-26 Fri}
>
>   This task is split among all services and communication between the
>   entities.
>   Second paragraph.
>
>   fdqsfdq
> --8<---------------cut here---------------end--------------->8---
>
>
> As you can see from these 3 examples, it is safer to always generate  
> blank
> lines only instead of \newline commands.
>
> Sorry for the length of this message.

On the contrary, thank you for this long message.  This is exactly  
what nails
the discussion and shows the problems.

I agree with what I think is the conclusion of this discussion:  No  
\newline,
only an empty line to star a new paragraph, in all three example cases.

I have made this change now, thank you both.

- Carsten

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

end of thread, other threads:[~2010-03-19 18:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-17 12:43 LaTeX export > Avoid \newline command after timestampsX-Draft-From: ("nnimap+mc:INBOX.sncb") Francesco Pizzolante
2010-03-17 14:35 ` Carsten Dominik
2010-03-17 20:00   ` David Maus
2010-03-18  5:47     ` Carsten Dominik
     [not found]       ` <F8590385-44EE-4081-81FA-FC10AA364CA0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-03-18  9:07         ` Francesco Pizzolante
2010-03-18 11:45           ` David Maus
     [not found]             ` <87y6hpkg4f.wl%dmaus-lYycHbxpNtazQB+pC5nmwQ@public.gmane.org>
2010-03-18 13:54               ` Francesco Pizzolante
2010-03-18 15:41                 ` David Maus
     [not found]                   ` <87wrx9skm4.wl%dmaus-lYycHbxpNtazQB+pC5nmwQ@public.gmane.org>
2010-03-18 16:06                     ` Francesco Pizzolante
2010-03-19 17:20                 ` Carsten Dominik

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