all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)]
@ 2010-07-23 15:27 Stephen Eglen
  2010-07-25 15:14 ` David Maus
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Eglen @ 2010-07-23 15:27 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Stephen Eglen

With the example file:
----------------------------------------------------------------------
* A 

AAAA

*** B

BBBB


* C

CCCC

** D

DDDD
----------------------------------------------------------------------

If I hit "C-c C-e d" to convert this to PDF and view it, I see something like

1 A
AAAA

2 C
CCCC

2.1 D
DDDD

Neither the heading or text of section 'B' appears due to the incorrect
level of B (three stars rather than two).  If I correct the level for B,
the heading and text appears.

I found this today when working on a document.  It is my fault for
getting the level of heading B wrong, but is it possible to keep the
text in the pdf, or put a heading like '2.0.1 B'?

Stephen

Emacs  : GNU Emacs 23.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.0)
 of 2010-05-24 on maps
Package: Org-mode version 7.01trans (release_6.36.735.g15ca.dirty)

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

* Re: Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)]
  2010-07-23 15:27 Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)] Stephen Eglen
@ 2010-07-25 15:14 ` David Maus
  2010-07-26  9:58   ` Stephen Eglen
  2010-07-27 15:04   ` Stephen Eglen
  0 siblings, 2 replies; 5+ messages in thread
From: David Maus @ 2010-07-25 15:14 UTC (permalink / raw)
  To: Stephen Eglen; +Cc: emacs-orgmode


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

Stephen Eglen wrote:

>Neither the heading or text of section 'B' appears due to the incorrect
>level of B (three stars rather than two).  If I correct the level for B,
>the heading and text appears.

>I found this today when working on a document.  It is my fault for
>getting the level of heading B wrong, but is it possible to keep the
>text in the pdf, or put a heading like '2.0.1 B'?

FYI: This is a know limitation of the LaTeX exporter[1] and the
current state of this issue (dealing with skipped levels) is that
patches for the problem are welcome.  I agree that even if
skipped-level-headlines are not allowed, they shouldn't be silently
droped neither.

Best,
  -- David

[1] http://thread.gmane.org/gmane.emacs.orgmode/26413
--
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] 5+ messages in thread

* Re: Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)]
  2010-07-25 15:14 ` David Maus
@ 2010-07-26  9:58   ` Stephen Eglen
  2010-07-27 15:04   ` Stephen Eglen
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Eglen @ 2010-07-26  9:58 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode, Stephen Eglen

Thanks David, and apologies for not checking the archives.  I'll put
bugfixing it my todo list!

Stephen

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

* Re: Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)]
  2010-07-25 15:14 ` David Maus
  2010-07-26  9:58   ` Stephen Eglen
@ 2010-07-27 15:04   ` Stephen Eglen
  2010-08-15  6:36     ` [Accepted] " Carsten Dominik
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Eglen @ 2010-07-27 15:04 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode, Stephen Eglen

> FYI: This is a know limitation of the LaTeX exporter[1] and the
> current state of this issue (dealing with skipped levels) is that
> patches for the problem are welcome.  I agree that even if
> skipped-level-headlines are not allowed, they shouldn't be silently
> droped neither.
> 
> Best,
>   -- David
> 
> [1] http://thread.gmane.org/gmane.emacs.orgmode/26413

I think I have a patch for this, see below.  I've tested it briefly to
see that it works with both oddeven and odd level headings, but I would
appreciate other people taking a closer look/checking that it doesn't
break other things.  I think I found the problem, in that if you have a
structure like

* A 

*** B

(i.e. a level one and a level 3)

after it has found the level 1 content, it expects to find a level 2
subtree, whereas in fact there could be a level 2+ tree.  See the
comment in the code for the change I made.

Stephen

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 24dd8c1..8530723 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -937,13 +937,28 @@ Return a list reflecting the document structure."
 (defun org-export-latex-parse-subcontent (level odd)
   "Extract the subcontent of a section at LEVEL.
 If ODD Is non-nil, assume subcontent only contains odd sections."
-  (if (not (org-re-search-forward-unprotected
-	    (concat "^\\(\\(?:\\*\\)\\{"
-		    (number-to-string (+ (if odd 4 2) level))
-		    "\\}\\) \\(.*\\)$")
-	    nil t))
-      nil ; subcontent is nil
-    (org-export-latex-parse-global (+ (if odd 2 1) level) odd)))
+
+  (let (nstars new-level)
+    ;; In the search, we should not assume there will be exactly
+    ;; LEVEL+1 stars in the next heading, as there may be more than
+    ;; that number of stars.  hence the regexp should be \\*{N,}
+    ;; rather than just \\*{N} (i.e. no upper bound, but N is minimum
+    ;; number of stars to expect.)
+    ;; We then have to check how many stars were found, rather than
+    ;; assuming there were exactly N.
+    (when (org-re-search-forward-unprotected
+	   (concat "^\\(\\(?:\\*\\)\\{"
+		   (number-to-string (+ (if odd 4 2) level))
+		   ",\\}\\) \\(.*\\)$")
+	   nil t)
+      (setq nstars (1- (- (match-end 1) (match-beginning 1))))
+      (setq new-level (if odd 
+			  (/ (+ 3 nstars) 2);; not entirely sure why +3!
+			nstars)))
+    (if nstars
+	(org-export-latex-parse-global new-level odd)
+      nil)				; subcontent is nil
+      ))
 
 ;;; Rendering functions:
 (defun org-export-latex-global (content)

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

* [Accepted] Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)]
  2010-07-27 15:04   ` Stephen Eglen
@ 2010-08-15  6:36     ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-08-15  6:36 UTC (permalink / raw)
  To: emacs-orgmode

Patch 175 (http://patchwork.newartisans.com/patch/175/) is now "Accepted".

Maintainer comment: No comment

This relates to the following submission:

http://mid.gmane.org/%3C22496.1280243082%40maps%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] Bug: possible bug in latex export [7.01trans
> 	(release_6.36.735.g15ca.dirty)]
> Date: Tue, 27 Jul 2010 20:04:42 -0000
> From: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
> X-Patchwork-Id: 175
> Message-Id: <22496.1280243082@maps>
> To: David Maus <dmaus@ictsoc.de>
> Cc: emacs-orgmode@gnu.org, Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
> 
> > FYI: This is a know limitation of the LaTeX exporter[1] and the
> > current state of this issue (dealing with skipped levels) is that
> > patches for the problem are welcome.  I agree that even if
> > skipped-level-headlines are not allowed, they shouldn't be silently
> > droped neither.
> > 
> > Best,
> >   -- David
> > 
> > [1] http://thread.gmane.org/gmane.emacs.orgmode/26413
> 
> I think I have a patch for this, see below.  I've tested it briefly to
> see that it works with both oddeven and odd level headings, but I would
> appreciate other people taking a closer look/checking that it doesn't
> break other things.  I think I found the problem, in that if you have a
> structure like
> 
> * A 
> 
> *** B
> 
> (i.e. a level one and a level 3)
> 
> after it has found the level 1 content, it expects to find a level 2
> subtree, whereas in fact there could be a level 2+ tree.  See the
> comment in the code for the change I made.
> 
> Stephen
> 
> 
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index 24dd8c1..8530723 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -937,13 +937,28 @@ Return a list reflecting the document structure."
>  (defun org-export-latex-parse-subcontent (level odd)
>    "Extract the subcontent of a section at LEVEL.
>  If ODD Is non-nil, assume subcontent only contains odd sections."
> -  (if (not (org-re-search-forward-unprotected
> -	    (concat "^\\(\\(?:\\*\\)\\{"
> -		    (number-to-string (+ (if odd 4 2) level))
> -		    "\\}\\) \\(.*\\)$")
> -	    nil t))
> -      nil ; subcontent is nil
> -    (org-export-latex-parse-global (+ (if odd 2 1) level) odd)))
> +
> +  (let (nstars new-level)
> +    ;; In the search, we should not assume there will be exactly
> +    ;; LEVEL+1 stars in the next heading, as there may be more than
> +    ;; that number of stars.  hence the regexp should be \\*{N,}
> +    ;; rather than just \\*{N} (i.e. no upper bound, but N is minimum
> +    ;; number of stars to expect.)
> +    ;; We then have to check how many stars were found, rather than
> +    ;; assuming there were exactly N.
> +    (when (org-re-search-forward-unprotected
> +	   (concat "^\\(\\(?:\\*\\)\\{"
> +		   (number-to-string (+ (if odd 4 2) level))
> +		   ",\\}\\) \\(.*\\)$")
> +	   nil t)
> +      (setq nstars (1- (- (match-end 1) (match-beginning 1))))
> +      (setq new-level (if odd 
> +			  (/ (+ 3 nstars) 2);; not entirely sure why +3!
> +			nstars)))
> +    (if nstars
> +	(org-export-latex-parse-global new-level odd)
> +      nil)				; subcontent is nil
> +      ))
>  
>  ;;; Rendering functions:
>  (defun org-export-latex-global (content)
> 

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

end of thread, other threads:[~2010-08-16 10:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23 15:27 Bug: possible bug in latex export [7.01trans (release_6.36.735.g15ca.dirty)] Stephen Eglen
2010-07-25 15:14 ` David Maus
2010-07-26  9:58   ` Stephen Eglen
2010-07-27 15:04   ` Stephen Eglen
2010-08-15  6:36     ` [Accepted] " Carsten Dominik

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.