Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-16 Thread Carsten Dominik


On Dec 15, 2009, at 11:55 AM, Nicolas Girard wrote:


2009/12/14 Carsten Dominik carsten.domi...@gmail.com:
Actually,  I cannot reproduce this problem - I do not see the extra  
newline.



Hi Carsten,

you're absolutely right, I performed yet another git pull and couldn't
reproduce this either. Great !

Now, speaking of extra newlines, I'm puzzled about this: at some stage
(which I didn't identify yet, maybe when exporting to LaTeX), Org adds
an ID property to some headings in my document ; that is, for
instance,

* Aa
 * Bb
   Text

becomes

* Aa
 * Bb
   :PROPERTIES:
   :ID: fa489059-d27e-47fb-929d-8ca9c749d079
   :END:

   Text


Notice the extra newline between :END: and Text. It's all good except
when exporting to LaTeX *and* the concerned heading is to be treated
as an item.
I've been thinking a bit about this special case ; and it seems to me
like, on one side, the extra newline should remain, and on the other
side, empty lines following a heading should be ignored by the LaTeX
translator when this heading is translated into an item.
What do you think ?


I do agree and have tried to fix it.  Please verify.

- 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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-15 Thread Nicolas Girard
2009/12/14 Carsten Dominik carsten.domi...@gmail.com:
 Actually,  I cannot reproduce this problem - I do not see the extra newline.

Hi Carsten,

you're absolutely right, I performed yet another git pull and couldn't
reproduce this either. Great !

Now, speaking of extra newlines, I'm puzzled about this: at some stage
(which I didn't identify yet, maybe when exporting to LaTeX), Org adds
an ID property to some headings in my document ; that is, for
instance,

* Aa
  * Bb
Text

becomes

* Aa
  * Bb
:PROPERTIES:
:ID: fa489059-d27e-47fb-929d-8ca9c749d079
:END:

Text


Notice the extra newline between :END: and Text. It's all good except
when exporting to LaTeX *and* the concerned heading is to be treated
as an item.
I've been thinking a bit about this special case ; and it seems to me
like, on one side, the extra newline should remain, and on the other
side, empty lines following a heading should be ignored by the LaTeX
translator when this heading is translated into an item.
What do you think ?

-- 
Nicolas


___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-14 Thread Carsten Dominik
Actually,  I cannot reproduce this problem - I do not see the extra  
newline.


- Carsten

On Dec 10, 2009, at 10:37 PM, Nicolas Girard wrote:


2009/12/9 Nicolas Girard nicolas.gir...@nerim.net:

2009/12/9 Carsten Dominik carsten.domi...@gmail.com:


diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 4c4d540..75ee548 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2423,7 +2423,7 @@ INDENT was the original indentation of the  
block.
(concat (car org-export-latex- 
verbatim-wrap)

rtn (cdr
org-export-latex-verbatim-wrap)))
 '(org-protected t))
- #+END_LaTeX\n))
+ #+END_LaTeX))
((eq backend 'ascii)
 ;; This is not HTML or LaTeX, so just make it an  
example.
 (setq rtn (org-export-number-lines rtn 'ascii 0 0  
num cont

rpllbl fmt))



I have fixed this part, in a different way though.



I'm afraid there are still extra paragraphs resulting from an extra
newline after code blocs.

Consider the following test chunk:

#=
This is a new paragraph
#+begin_src emacs-lisp
(setq ispell-program-name aspell)
#+end_src
continuing after the code bloc.
#=

Using the freshest code, is is translated to

%=
This is a new paragraph
\lstset{language=Lisp}
\begin{lstlisting}
(setq ispell-program-name aspell)
\end{lstlisting}

continuing after the code bloc.
%=





Unfortunately this problem remains: processing

#=
This is a new paragraph
#+begin_src emacs-lisp
(setq ispell-program-name aspell)
#+end_src
continuing after the code bloc.
#=

still inserts an extra newline just before continuing (...).

Cheers,

--
Nicolas


___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-10 Thread Carsten Dominik


On Dec 9, 2009, at 11:50 PM, Nicolas Girard wrote:


2009/12/9 Carsten Dominik carsten.domi...@gmail.com:

Hi Nicolas,

I need additional information with respect to this patch:




diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index ce697a3..18c2183 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -877,7 +877,7 @@ If NUM, export sections as numerical sections.
(delete-region (point-at-bol 0) (point))
  (insert (format \\begin{%s}\n
  (symbol-name org-export-latex-low- 
levels

-(insert (format \n\\item %s\n%s\n
+(insert (format \\item %s\n%s
heading
(if label (format \\label{%s} label)  
)))

(insert (org-export-latex-content content))


Why would you like to remove the \\ as well?  When itemize lists  
are used
to format headlines, I think there should be a line break after the  
end of
the original headline.  Otherwise the text below the headline will  
flow into

the headline.  Or am I missing something here?


I think you're right ; I may have been abused by what Adobe Reader
displayed when performing my tests, as I just discovered that, for
whatever reason, it doesn't always reload the pdf file when using
Ctrl-r

Using this test document

#===
* Level 1

** Level 2

*** Level 3

 Level 4
Text
#===

the current code produces

%==
\begin{itemize}

\item Level 4\\
\label{sec-1.1.1.1}

Text
%==

There's an extra space produced by the \label{} because there's no '%'
at the end of it ; another solution is to move the \label before the
\\


I prefer to write

   \label{...}%

if you can agree to that.



There's also an extra newline before Text.
Please find attached my second proposal to fix this.





@@ -997,7 +997,7 @@ OPT-PLIST is the options plist for current  
buffer.
 (org-export-apply-macros-in-string org-export-latex-append- 
header)

 ;; insert the title
 (format
-  \n\n\\title{%s}\n
+  \n\\title{%s}\n
  ;; convert the title
  (org-export-latex-content
   title '(lists tables fixed-width keywords)))


What is the problem with additional empty lines before \\title  
command.

 Does that really change anything in the output?


It's not really a problem, it just seems to me like, the less extra
'\n' you see in the output of a LaTeX code generator, the more
confident you can be.

--
Nicolas
noextralines.patch___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-10 Thread Carsten Dominik


On Dec 10, 2009, at 12:56 AM, Nicolas Girard wrote:


2009/12/9 Nicolas Girard nicolas.gir...@nerim.net:

2009/12/9 Carsten Dominik carsten.domi...@gmail.com:

Hi Nicolas,

I need additional information with respect to this patch:




diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index ce697a3..18c2183 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -877,7 +877,7 @@ If NUM, export sections as numerical sections.
(delete-region (point-at-bol 0) (point))
  (insert (format \\begin{%s}\n
  (symbol-name org-export-latex-low- 
levels

-(insert (format \n\\item %s\n%s\n
+(insert (format \\item %s\n%s
heading
(if label (format \\label{%s}  
label) )))

(insert (org-export-latex-content content))


Why would you like to remove the \\ as well?  When itemize lists  
are used
to format headlines, I think there should be a line break after  
the end of
the original headline.  Otherwise the text below the headline will  
flow into

the headline.  Or am I missing something here?


I think you're right ; I may have been abused by what Adobe Reader
displayed when performing my tests, as I just discovered that, for
whatever reason, it doesn't always reload the pdf file when using
Ctrl-r



Actually I do remember why I considered removing the '\\' : take  
this document:


#=
Level 1

** Level 2

*** Level 3

 Level 4
- itemized
- list
#=

Since Level 4 is expressed as an item, the only way of getting the
correct output is *not* to have any '\\' between Level 4 and
itemized. That is, in LaTeX, not to have '\\' between
 \item Level 4
and
 \begin{itemize} \item itemized \item list \end{itemize}


OK, I am catching this case now as well.

Let me know if it works all right now.

- 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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-10 Thread Nicolas Girard
2009/12/9 Nicolas Girard nicolas.gir...@nerim.net:
 2009/12/9 Carsten Dominik carsten.domi...@gmail.com:

 diff --git a/lisp/org-exp.el b/lisp/org-exp.el
 index 4c4d540..75ee548 100644
 --- a/lisp/org-exp.el
 +++ b/lisp/org-exp.el
 @@ -2423,7 +2423,7 @@ INDENT was the original indentation of the block.
                             (concat (car org-export-latex-verbatim-wrap)
                                     rtn (cdr
 org-export-latex-verbatim-wrap)))
                          '(org-protected t))
 -                     #+END_LaTeX\n))
 +                     #+END_LaTeX))
             ((eq backend 'ascii)
              ;; This is not HTML or LaTeX, so just make it an example.
              (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont
 rpllbl fmt))


 I have fixed this part, in a different way though.


 I'm afraid there are still extra paragraphs resulting from an extra
 newline after code blocs.

 Consider the following test chunk:

 #=
 This is a new paragraph
 #+begin_src emacs-lisp
 (setq ispell-program-name aspell)
 #+end_src
 continuing after the code bloc.
 #=

 Using the freshest code, is is translated to

 %=
 This is a new paragraph
 \lstset{language=Lisp}
 \begin{lstlisting}
 (setq ispell-program-name aspell)
 \end{lstlisting}

 continuing after the code bloc.
 %=




Unfortunately this problem remains: processing

#=
This is a new paragraph
#+begin_src emacs-lisp
(setq ispell-program-name aspell)
#+end_src
continuing after the code bloc.
#=

still inserts an extra newline just before continuing (...).

Cheers,

-- 
Nicolas


___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-10 Thread Nicolas Girard
2009/12/10 Carsten Dominik carsten.domi...@gmail.com:

 On Dec 10, 2009, at 12:56 AM, Nicolas Girard wrote:

 2009/12/9 Nicolas Girard nicolas.gir...@nerim.net:


 Actually I do remember why I considered removing the '\\' : take this
 document:

 #=
 Level 1

 ** Level 2

 *** Level 3

  Level 4
 - itemized
 - list
 #=

 Since Level 4 is expressed as an item, the only way of getting the
 correct output is *not* to have any '\\' between Level 4 and
 itemized. That is, in LaTeX, not to have '\\' between
  \item Level 4
 and
  \begin{itemize} \item itemized \item list \end{itemize}

 OK, I am catching this case now as well.

 Let me know if it works all right now.


Hi Carsten,
this works fine now, thanks very much !

--
Nicolas


___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-10 Thread Nicolas Girard

 On Dec 9, 2009, at 11:50 PM, Nicolas Girard wrote:

 There's an extra space produced by the \label{} because there's no '%'
 at the end of it ; another solution is to move the \label before the
 \\

 I prefer to write

   \label{...}%

 if you can agree to that.


Sure, no problem !

--
Nicolas


___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-09 Thread Carsten Dominik

Hi Nicolas,

I need additional information with respect to this patch:


diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 4c4d540..75ee548 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2423,7 +2423,7 @@ INDENT was the original indentation of the  
block.
 (concat (car org-export-latex-verbatim- 
wrap)
 rtn (cdr org-export-latex- 
verbatim-wrap)))

  '(org-protected t))
- #+END_LaTeX\n))
+ #+END_LaTeX))
 ((eq backend 'ascii)
  ;; This is not HTML or LaTeX, so just make it an example.
 	  (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont  
rpllbl fmt))



I have fixed this part, in a different way though.


diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index ce697a3..18c2183 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -877,7 +877,7 @@ If NUM, export sections as numerical sections.
 (delete-region (point-at-bol 0) (point))
   (insert (format \\begin{%s}\n
   (symbol-name org-export-latex-low-levels
-(insert (format \n\\item %s\n%s\n
+(insert (format \\item %s\n%s
 heading
 (if label (format \\label{%s} label) )))
 (insert (org-export-latex-content content))


Why would you like to remove the \\ as well?  When itemize lists are  
used to format headlines, I think there should be a line break after  
the end of the original headline.  Otherwise the text below the  
headline will flow into the headline.  Or am I missing something here?



@@ -997,7 +997,7 @@ OPT-PLIST is the options plist for current  
buffer.
  (org-export-apply-macros-in-string org-export-latex-append- 
header)

  ;; insert the title
  (format
-  \n\n\\title{%s}\n
+  \n\\title{%s}\n
   ;; convert the title
   (org-export-latex-content
title '(lists tables fixed-width keywords)))


What is the problem with additional empty lines before \\title  
command.  Does that really change anything in the output?


Thanks.

- Carsten






On Dec 5, 2009, at 12:58 PM, Nicolas Girard wrote:


2009/12/1 Nicolas Girard nicolas.gir...@nerim.net:

Hi,
title says it all.



Hi,

attached is a second patch which suppresses some other extra newlines
in the LaTeX export. Let me know if  you need any explanation.

--
Nicolas
noextralines.patch___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-09 Thread Nicolas Girard
2009/12/9 Carsten Dominik carsten.domi...@gmail.com:
 Hi Nicolas,

 I need additional information with respect to this patch:


 diff --git a/lisp/org-latex.el b/lisp/org-latex.el
 index ce697a3..18c2183 100644
 --- a/lisp/org-latex.el
 +++ b/lisp/org-latex.el
 @@ -877,7 +877,7 @@ If NUM, export sections as numerical sections.
                 (delete-region (point-at-bol 0) (point))
               (insert (format \\begin{%s}\n
                               (symbol-name org-export-latex-low-levels
 -            (insert (format \n\\item %s\n%s\n
 +            (insert (format \\item %s\n%s
                             heading
                             (if label (format \\label{%s} label) )))
             (insert (org-export-latex-content content))

 Why would you like to remove the \\ as well?  When itemize lists are used
 to format headlines, I think there should be a line break after the end of
 the original headline.  Otherwise the text below the headline will flow into
 the headline.  Or am I missing something here?

I think you're right ; I may have been abused by what Adobe Reader
displayed when performing my tests, as I just discovered that, for
whatever reason, it doesn't always reload the pdf file when using
Ctrl-r

Using this test document

#===
* Level 1

** Level 2

*** Level 3

 Level 4
Text
#===

the current code produces

%==
\begin{itemize}

\item Level 4\\
\label{sec-1.1.1.1}

Text
%==

There's an extra space produced by the \label{} because there's no '%'
at the end of it ; another solution is to move the \label before the
\\
There's also an extra newline before Text.
Please find attached my second proposal to fix this.




 @@ -997,7 +997,7 @@ OPT-PLIST is the options plist for current buffer.
      (org-export-apply-macros-in-string org-export-latex-append-header)
      ;; insert the title
      (format
 -      \n\n\\title{%s}\n
 +      \n\\title{%s}\n
       ;; convert the title
       (org-export-latex-content
        title '(lists tables fixed-width keywords)))

 What is the problem with additional empty lines before \\title command.
  Does that really change anything in the output?

It's not really a problem, it just seems to me like, the less extra
'\n' you see in the output of a LaTeX code generator, the more
confident you can be.

-- 
Nicolas
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index ad443aa..1657209 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -864,7 +864,7 @@ If NUM, export sections as numerical sections.
 			   (buffer-substring (point-at-bol 0) (point)))
 		 (delete-region (point-at-bol 0) (point))
 	   (insert \\begin{description}\n))
-	 (insert (format \n\\item[%s]%s~\n\n
+	 (insert (format \n\\item[%s]%s~
 			 heading
 			 (if label (format \\label{%s} label) )))
 	 (insert (org-export-latex-content content))
@@ -877,7 +877,7 @@ If NUM, export sections as numerical sections.
 		 (delete-region (point-at-bol 0) (point))
 	   (insert (format \\begin{%s}\n
 			   (symbol-name org-export-latex-low-levels
-	 (insert (format \n\\item %s\n%s\n
+	 (insert (format \n\\item %s%s~
 			 heading
 			 (if label (format \\label{%s} label) )))
 	 (insert (org-export-latex-content content))
___
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


Re: [Orgmode] Re: [PATCH] Suppress extra newlines around source code in LaTeX export

2009-12-09 Thread Nicolas Girard
2009/12/9 Nicolas Girard nicolas.gir...@nerim.net:
 2009/12/9 Carsten Dominik carsten.domi...@gmail.com:
 Hi Nicolas,

 I need additional information with respect to this patch:


 diff --git a/lisp/org-latex.el b/lisp/org-latex.el
 index ce697a3..18c2183 100644
 --- a/lisp/org-latex.el
 +++ b/lisp/org-latex.el
 @@ -877,7 +877,7 @@ If NUM, export sections as numerical sections.
                 (delete-region (point-at-bol 0) (point))
               (insert (format \\begin{%s}\n
                               (symbol-name org-export-latex-low-levels
 -            (insert (format \n\\item %s\n%s\n
 +            (insert (format \\item %s\n%s
                             heading
                             (if label (format \\label{%s} label) )))
             (insert (org-export-latex-content content))

 Why would you like to remove the \\ as well?  When itemize lists are used
 to format headlines, I think there should be a line break after the end of
 the original headline.  Otherwise the text below the headline will flow into
 the headline.  Or am I missing something here?

 I think you're right ; I may have been abused by what Adobe Reader
 displayed when performing my tests, as I just discovered that, for
 whatever reason, it doesn't always reload the pdf file when using
 Ctrl-r


Actually I do remember why I considered removing the '\\' : take this document:

#=
 Level 1

** Level 2

*** Level 3

 Level 4
- itemized
- list
#=

Since Level 4 is expressed as an item, the only way of getting the
correct output is *not* to have any '\\' between Level 4 and
itemized. That is, in LaTeX, not to have '\\' between
  \item Level 4
and
  \begin{itemize} \item itemized \item list \end{itemize}

-- 
Nicolas


___
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