emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* TOC and latex memoir class
@ 2022-04-01 23:22 Steve Downey
  2022-04-02  7:21 ` Juan Manuel Macías
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Downey @ 2022-04-01 23:22 UTC (permalink / raw)
  To: org mode

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

In order to place the table of contents without a section name "Contents"
the memoir class uses \tableofcontents* rather than \tableofcontents.
However, `org-latex-toc-command` is documented as:
  "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."
Which is confusing in two ways, first that toc:nil doesn't generate a table
of contents, and that it doesn't seem to provide any way of getting the
string to be used?

As a workaround, I could use the latex command directly, but that means not
having it available in, for example, an html export.

Is there a workaround I'm missing?

[-- Attachment #2: Type: text/html, Size: 816 bytes --]

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

* Re: TOC and latex memoir class
  2022-04-01 23:22 TOC and latex memoir class Steve Downey
@ 2022-04-02  7:21 ` Juan Manuel Macías
  0 siblings, 0 replies; 2+ messages in thread
From: Juan Manuel Macías @ 2022-04-02  7:21 UTC (permalink / raw)
  To: Steve Downey; +Cc: orgmode

Hi Steve,

Steve Downey writes:

> In order to place the table of contents without a section name
> "Contents" the memoir class uses \tableofcontents* rather than
> \tableofcontents.
> However, `org-latex-toc-command` is documented as:
>   "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."
> Which is confusing in two ways, first that toc:nil doesn't generate a
> table of contents, and that it doesn't seem to provide any way of
> getting the string to be used? 
>
> As a workaround, I could use the latex command directly, but that
> means not having it available in, for example, an html export. 
>
> Is there a workaround I'm missing? 

One possible workaround would be to define a macro with a conditional:
if exporting to LaTeX, returns the string 'toc:nil'; otherwise, returns
'toc:t'. And the LaTeX command can be added via a export snippet.
Something like this:

#+MACRO: mytoc (eval (if (eq org-export-current-backend 'latex) "#+OPTIONS: toc:nil" "#+OPTIONS: toc:t"))

{{{mytoc}}}

@@latex:\tableofcontents*@@

* Heading 1

lorem ipsum dolor

* Heading 2

lorem ipsum dolor

------------

Best regards,

Juan Manuel 


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

end of thread, other threads:[~2022-04-02  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 23:22 TOC and latex memoir class Steve Downey
2022-04-02  7:21 ` Juan Manuel Macías

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).