all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] lisp/ox-latex.el: improve org-latex-toc-command docstring
@ 2024-01-31 17:57 gerard.vermeulen
  2024-02-01 11:46 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: gerard.vermeulen @ 2024-01-31 17:57 UTC (permalink / raw)
  To: Emacs orgmode, Ihor Radchenko

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

Hi,

I have read the docstring of `org-latex-toc-command' too literally
to discover that specifying anything else than "toc:nil" works.

The attached patch contains a proposal for improvement.

Below there is a not so small mwe.

--- begin mwe ---
#+title: Table of Contents Test
#+latex_class: article
#+options: author:nil date:nil toc:1
#+latex_header: \usepackage{listings}
#+latex_header: \usepackage{minted}
* Test ~toc:~ and ~org-latex-toc-command~
Anything else than ~toc:nil~ in ~#+options:~ above exports the TOC.
#+caption: Execute this block before exporting to a LaTeX buffer or 
file.
#+begin_src emacs-lisp :results silent
   (when (require 'ox-latex nil 'noerror)
     (setq-local org-latex-src-block-backend 'listings)
     (setq-local org-latex-toc-command
      (cond
       ((eq org-latex-src-block-backend 'verbatim)
        "\\tableofcontents\n\\vspace{10pt}\n")
       ((eq org-latex-src-block-backend 'listings)
        "\\tableofcontents\n\\lstlistoflistings\n\\vspace{10pt}\n")
       ((memq org-latex-src-block-backend '(minted engraved))
        "\\tableofcontents\n\\listoflistings\n\\vspace{10pt}\n"))))
#+end_src
--- end mwe ---

Regards -- Gerard

[-- Attachment #2: 0001-lisp-ox-latex.el-improve-org-latex-toc-command-docst.patch --]
[-- Type: application/octet-stream, Size: 1161 bytes --]

From df05af7b2a4425067b8a3ee3c3cf8fb3923f1c5b Mon Sep 17 00:00:00 2001
From: Gerard Vermeulen <gerard.vermeulen@posteo.net>
Date: Wed, 31 Jan 2024 18:28:35 +0100
Subject: [PATCH] lisp/ox-latex.el: improve org-latex-toc-command docstring

* lisp/ox-latex.el (org-latex-toc-command): specify clearer which
option settings use `org-latex-toc-command'.  This shows also how
to specify a table of contents depth.
---
 lisp/ox-latex.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index df20345f8..3eb40766e 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -620,8 +620,9 @@ which is replaced with the subtitle."
 
 (defcustom org-latex-toc-command "\\tableofcontents\n\n"
   "LaTeX command to set the table of contents, list of figures, etc.
-This command only applies to the table of contents generated with
-the toc:nil option, not to those generated with #+TOC keyword."
+This command only applies to the table of contents generated with the
+toc:t, toc:1, toc:2, toc:3, ... options, not to those generated with
+the #+TOC keyword."
   :group 'org-export-latex
   :type 'string)
 
-- 
2.42.0


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

end of thread, other threads:[~2024-02-01 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 17:57 [PATCH] lisp/ox-latex.el: improve org-latex-toc-command docstring gerard.vermeulen
2024-02-01 11:46 ` Ihor Radchenko

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.