emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH]: ox-latex: omit empty date
@ 2022-07-29 12:49 emacs--- via General discussions about Org-mode.
  2022-07-29 13:31 ` Ihor Radchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: emacs--- via General discussions about Org-mode. @ 2022-07-29 12:49 UTC (permalink / raw)
  To: Emacs Orgmode


[-- Attachment #1.1: Type: text/plain, Size: 282 bytes --]

 Dear list, 

In the attachment you can find a patch which omits an empty \date{} line in
a latex document when the option to include the date is set to nil or when 
no date is provided. This empty date line can cause problems is certain 
use cases. 
Kind regads,
Bob 

[-- Attachment #1.2: Type: text/html, Size: 652 bytes --]

[-- Attachment #2: 0001-lisp-ox-latex-Omit-empty-date.patch --]
[-- Type: application/octet-stream, Size: 1431 bytes --]

From 120e4ca11f021fa2d7e7abf57187c2db71942302 Mon Sep 17 00:00:00 2001
From: Bob Vergauwen <emacs@vergauwen.me>
Date: Fri, 29 Jul 2022 14:28:21 +0200
Subject: [PATCH] lisp/ox-latex: Omit empty date

* lisp/ox-latex.el: (org-latex-template): When no date is provided or
the export option date is nil, the empty '\date{}' string is no
longer included in the exported latex document.

The default behaviour for ox-latex was to include an empty date line as
'\date{}'.  This empty date line can affect more complex latex templates
when the date is for example set by the template on compilation, or when
the date command is overwritten entirely.  In this new patch, the date
line is omitted from the exported document.

TINYCHANGE
---
 lisp/ox-latex.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 1ed988917..129b2dbf0 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1977,7 +1977,8 @@ holding export options."
 	     ((or author email) (format "\\author{%s}\n" (or author email)))))
      ;; Date.
      (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
-       (format "\\date{%s}\n" (org-export-data date info)))
+       (cond date
+             (format "\\date{%s}\n" (org-export-data date info))))
      ;; Title and subtitle.
      (let* ((subtitle (plist-get info :subtitle))
 	    (formatted-subtitle
--
2.30.1 (Apple Git-130)

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

end of thread, other threads:[~2022-08-05 12:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 12:49 [PATCH]: ox-latex: omit empty date emacs--- via General discussions about Org-mode.
2022-07-29 13:31 ` Ihor Radchenko
     [not found] ` <87sfmkkptc.fsf@localhost-N898uXC--3-2>
2022-07-29 18:49   ` emacs--- via General discussions about Org-mode.
2022-07-30  5:49     ` Ihor Radchenko
2022-07-30 16:13 ` Max Nikulin
2022-07-31  0:53   ` Ihor Radchenko
2022-07-31  2:27     ` Max Nikulin
2022-07-31  2:38       ` Ihor Radchenko
2022-07-31  7:14         ` Max Nikulin
     [not found]         ` <eed45238-7cad-1752-9e98-688bd0ead08a@gmail.com-N8I60z3----2>
2022-08-01 10:09           ` emacs--- via General discussions about Org-mode.
2022-08-01 10:28             ` Daniel Fleischer
2022-08-01 10:55               ` emacs--- via General discussions about Org-mode.
2022-08-01 16:47                 ` Max Nikulin
2022-07-31 15:25 ` Daniel Fleischer
2022-07-31 15:40   ` Daniel Fleischer
2022-08-01  1:07     ` Ihor Radchenko
2022-08-05 12:42       ` Ihor Radchenko

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