* Trivial bug in ox-latex
@ 2018-01-31 20:01 Akater
2018-01-31 20:22 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Akater @ 2018-01-31 20:01 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
The following snippet in ox-latex.el processes negative tocdepths
incorrectly:
#+begin_src emacs-lisp
;; Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth
(concat (when (wholenump depth)
(format "\\setcounter{tocdepth}{%d}\n" depth))
(plist-get info :latex-toc-command))))
#+end_src
When depth is -1, wholenump form evaluates to nil, and setcounter command is not exported at all.
See, e.g.
https://en.wikibooks.org/wiki/LaTeX/Document_Structure#Sectioning_commands
for example of a negative level use.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trivial bug in ox-latex
2018-01-31 20:01 Trivial bug in ox-latex Akater
@ 2018-01-31 20:22 ` Nicolas Goaziou
2018-02-01 14:50 ` Akater
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2018-01-31 20:22 UTC (permalink / raw)
To: Akater; +Cc: emacs-orgmode
Hello,
Akater <nuclearspace@gmail.com> writes:
> The following snippet in ox-latex.el processes negative tocdepths
> incorrectly:
>
> #+begin_src emacs-lisp
> ;; Table of contents.
> (let ((depth (plist-get info :with-toc)))
> (when depth
> (concat (when (wholenump depth)
> (format "\\setcounter{tocdepth}{%d}\n" depth))
> (plist-get info :latex-toc-command))))
> #+end_src
>
> When depth is -1, wholenump form evaluates to nil, and setcounter
> command is not exported at all.
I don't think it's a bug. Org doesn't pretend to support every LaTeX
feature. Setting `org-export-with-toc', which is where DEPTH comes from,
to -1 doesn't make much sense in an Org context, does it?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trivial bug in ox-latex
2018-01-31 20:22 ` Nicolas Goaziou
@ 2018-02-01 14:50 ` Akater
2018-02-03 13:57 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Akater @ 2018-02-01 14:50 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1369 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> When depth is -1, wholenump form evaluates to nil, and setcounter
>> command is not exported at all.
>
> I don't think it's a bug. Org doesn't pretend to support every LaTeX
> feature. Setting `org-export-with-toc', which is where DEPTH comes from,
> to -1 doesn't make much sense in an Org context, does it?
I can't answer this as I do not deal with org-export-with-toc
directly. I was setting tocdepth via
org-export-filter-options-functions, specialized explicitly to latex
backend:
#+begin_src emacs-lisp
(defun my-consistent-toc (plist backend)
(cond
((equal backend 'latex)
(plist-put plist :with-toc -1))
;; other backend-specific settings
)
plist)
(add-to-list 'org-export-filter-options-functions 'my-consistent-toc)
#+end_src
I was able to achieve the desired outcome with
#+LATEX_HEADER: \setcounter{tocdepth}{-1}
If this is not considered a bug, fine then. However, this is confusing
behaviour at best, and given the rich functionality of filter-options
and friends, I don't see why it should silently fail here.
Lots of possible settings don't make sense. In my most humble opinion,
this sort of ad hoc type-checking—preventing valid document to be
produced without any notice—doesn't feel like it fits a dynamic Lisp, or
Org-mode.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trivial bug in ox-latex
2018-02-01 14:50 ` Akater
@ 2018-02-03 13:57 ` Nicolas Goaziou
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2018-02-03 13:57 UTC (permalink / raw)
To: Akater; +Cc: emacs-orgmode
Hello,
Akater <nuclearspace@gmail.com> writes:
> I can't answer this as I do not deal with org-export-with-toc
> directly. I was setting tocdepth via
> org-export-filter-options-functions, specialized explicitly to latex
> backend:
I didn't thought about filters, indeed. Fair enough, then. I changed
`wholenump' to `integerp'.
Thank you.
Regards,
--
Nicolas Goaziou 0x80A93738
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-03 13:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 20:01 Trivial bug in ox-latex Akater
2018-01-31 20:22 ` Nicolas Goaziou
2018-02-01 14:50 ` Akater
2018-02-03 13:57 ` Nicolas Goaziou
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.