From 46eedaf8c71446c2d12f5484ecced491ae7ae760 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" Date: Tue, 28 Jan 2025 10:59:12 +0100 Subject: [PATCH 2/2] Test last patch and announce it in ORG-NEWS --- etc/ORG-NEWS: Announce fix for :with-title and :with-author testing/lisp/test-ox-latex.el: Add to tests for fixed behaviour * etc/ORG-NEWS: Announce fix for :with-title and :with-author * testing/lisp/test-ox-latex.el: (test-ox-latex/with-title-nil) Make sure the title is not included in the generated LaTeX if :with-title is nil (test-ox-latex/with-author-nil) Make sure the author is not included in the generated LaTeX if :with-author is nil etc/ORG-NEWS | 7 ++++++ testing/lisp/test-ox-latex.el | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) Reported-by: "Antero Mejr" Link: https://lists.gnu.org/archive/html/emacs-orgmode/2025-01/msg00313.html diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index cb2c16da8..7fa30223f 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -527,6 +527,13 @@ were tangled into a file named =NAME.bibtex=. Now, they are tangled into a file named =FILE.bib=, using the standard extension =.bib=, matching the rest of the ecosystem, including BibTeX and LaTeX. +*** =ox-latex=: fixed =:with-title= and =:with-author= handling + +The LaTeX exporter will not include the author in the resulting +document if the =:with-author= property is ~nil~; the same will happen +for =:with-title=. These properties are set with the +~org-export-with-author~ and ~org-export-with-title~ global variables. + * Version 9.7 ** Important announcements and breaking changes diff --git a/testing/lisp/test-ox-latex.el b/testing/lisp/test-ox-latex.el index 892ac4437..be107f510 100644 --- a/testing/lisp/test-ox-latex.el +++ b/testing/lisp/test-ox-latex.el @@ -127,5 +127,49 @@ Column & Column \\\\ (search-forward "\\href{https://orgmode.org/worg/images/orgmode/org-mode-unicorn.svg}{\\includegraphics[width=.9\\linewidth]{/wallpaper.png}}")))) +(ert-deftest test-ox-latex/with-title-nil () + "Test suppressing title in exported LaTeX" + (let ((org-export-with-title nil)) + (org-test-with-exported-text + 'latex + "#+AUTHOR: me +#+TITLE: Supressed + +* A test +A wonderful text" + (goto-char (point-min)) + (should-not + (search-forward "\\maketitle" nil t)) + (goto-char (point-min)) + (should-not + (search-forward "\\title{Suppressed}" nil t)) + (goto-char (point-min)) + (should-not + (search-forward "pdftitle={Suppressed}," nil t)) + (goto-char (point-min)) + (should + (search-forward "pdftitle={},")) + ))) + +(ert-deftest test-ox-latex/with-author-nil () + "Test suppressing author in exported LaTeX" + (let ((org-export-with-author nil)) + (org-test-with-exported-text + 'latex + "#+AUTHOR: me +#+TITLE: Supressed + +* A test +A wonderful text" + (goto-char (point-min)) + (should-not + (search-forward "\\author{me}" nil t)) + (goto-char (point-min)) + (should-not + (search-forward "pdftitle={me}," nil t)) + (goto-char (point-min)) + (should + (search-forward "pdfauthor={},")) + ))) (provide 'test-ox-latex) ;;; test-ox-latex.el ends here -- 2.34.1