emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: gerard.vermeulen@posteo.net
To: Emacs orgmode <emacs-orgmode@gnu.org>,
	Ihor Radchenko <yantar92@posteo.net>
Subject: [PATCH] lisp/ox-latex.el: improve org-latex-toc-command docstring
Date: Wed, 31 Jan 2024 17:57:29 +0000	[thread overview]
Message-ID: <5aea82a3f1b242f574578baefce57fcc@posteo.net> (raw)

[-- 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


             reply	other threads:[~2024-01-31 17:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 17:57 gerard.vermeulen [this message]
2024-02-01 11:46 ` [PATCH] lisp/ox-latex.el: improve org-latex-toc-command docstring Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5aea82a3f1b242f574578baefce57fcc@posteo.net \
    --to=gerard.vermeulen@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).