reddit / emacs

How do I export org to latex without chapter titles?

altad55 · 2022-06-20 15:20
When I'm writing with org mode I would like to have a template that upon latex export does not show the title of the chapters, but does still show Chapter 1, Chapter 2 and so forth. How would I accomplish this? This is my setupfile: #+OPTIONS: toc:nil #+LANGUAGE: sv #+LATEX_CLASS: book #+LATEX_HEADER: \usepackage[swedish]{babel} #+LATEX_HEADER: \usepackage{setspace} #+LATEX_HEADER: \usepackage{titlesec} #+LATEX_HEADER: \usepackage{hyperref} #+LATEX_HEADER: \hypersetup{colorlinks, linkcolor=black} #+LATEX_HEADER: \pagestyle{plain} #+LATEX_HEADER: \renewcommand{\part}[1]{} #+LATEX_HEADER: \setstretch{1.2} Org file: #+TITLE: Some title #+AUTHOR: Jane Doe #+SETUPFILE: ~/.config/doom/latex-templates/book.org * Part 1 (first heading always a part, I ignored this through the renewcommand in setupfile) ** This should not be visible in pdf Upon export above this paragraph should only be Chapter 1. ** This text should not show on export either Another paragraph. Currently upon export, my pdf: Chapter 1 This title should not be visible in pdf Upon export above this paragraph should only be Chapter 1. And so forth.
L-Szos · 2022-06-20 18:13
You could tag the trees with noexport, eg `* non exported tree :noexport:`.
AblatedSprocket · 2022-06-20 21:16
Doesn't that prevent the whole subtree from being exported? I think they just want to not display the chapter title.
danderzei · 2022-06-21 04:12
This is a LaTeX question, not org. You need to add so etching to your header. Try the LaTeX subreddit
altad55 · 2022-06-21 07:46
I tried that first but they told me to check in /r/emacs https://old.reddit.com/r/LaTeX/comments/vgj5ao/no_title_for_chapter_in_compiled_pdf/
danderzei · 2022-06-21 08:35
LaTeX decides what appears in the PDF. It has macros that construct the titles not Org mode. The `titlesec` package lets you control how section headers look. Explained here: https://tex.stackexchange.com/questions/544473/show-only-chapter-number-and-not-name-as-chapter-heading You add the example on this page to your init file as such: (add-to-list 'org-latex-classes '("nochaptitle" "\\documentclass[11pt]{book} \\usepackage{titlesec} \\usepackage{xpatch} \\usepackage{lipsum} \\makeatletter \\xpatchcmd\\ttl@mkchap {\\ttl@mkchap@i{#1}{#2}{#3}{#4}{#5}{#6}{#7}} {\\ttl@mkchap@i{#1}{#2}{#3}{#4}{#5}{#6}{}} {}{\\fail} \\makeatother \\titleformat{\\chapter}[display] {\\normalfont\\huge\\bfseries} {\\thechapter} {20pt} {\\Huge} \\renewcommand\\thechapter{\\Roman{chapter}}" ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) Then add `#+latex_class: nochaptitle` to your Org file. Alternatively, you can use `\chapter[toc and header entry]{}` for each chapter. The bit between square brackets will appear in the Table of Contents and the page headers. But unfortunately that does not work when you write it as an Org heading.
L-Szos · 2022-06-21 15:06
Ah i must have misunderstood their questions. Yes this would prevent the export of the subtree. I dont think theres a way to do that in org then; theyll likely have to fix this in whatever their export medium is (in this case latex).
kaushalmodi · 2022-06-23 12:52
Check out the "ignore headlines" feature in `ox-extra.el`: https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra.el