emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: emacs--- via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: Daniel Fleischer <danflscr@gmail.com>
Cc: "emacs--- viaGeneral discussions about Org-mode."
	<emacs-orgmode@gnu.org>,  Max Nikulin <manikulin@gmail.com>
Subject: Re: [PATCH]: ox-latex: omit empty date
Date: Mon, 1 Aug 2022 12:55:25 +0200 (CEST)	[thread overview]
Message-ID: <N8O1xep--3-2@vergauwen.me> (raw)
In-Reply-To: <m2o7x41cmw.fsf@gmail.com>

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




> emacs--- via "General discussions about Org-mode."
> <emacs-orgmode@gnu.org> writes:
>
>> My use case is very niche and be solved by changing my custom latex date 
>> command by renaming it as for example \mydate.
>>
>> Adding extra options like with_date:nil seems overkill for this small issue.
>>
>
> I agree; I think we shouldn't change basic behavior for more advanced
> usages unless it's something many people are interested in and we keep a
> backward compatibility.
>
>> A second option would be is to analyze the data format in the org file.
>> If for example the date is specified as 
>> #+date: {day}{something}
>>
>
> The thing is \date is a macro with one parameter, a string. That's way
> \date{} doesn't do anything and \date{\today} prints today's date where
> \today return today's date as a string. Starting to introduce new kinds
> of inputs - e.g. {y}{m}{d} - to the \date macro would just confuse
> people, I think.
>

It is an optional use pattern and the old options wil still work. 
The following code would "mostly" does the trick (I come back at the mostly term
later in this mail)     ;; Date.
     (let ((date (and (plist-get info :with-date) (org-export-get-date info))))
       (if (string-match-p "^\{.*\}$" (org-export-data date info))
           (format "\\date%s\n" (org-export-data date info))
         (format "\\date{%s}\n" (org-export-data date info))))

Dates can now de set as, and exported to: 
#+date: some date  -> \date{some date}
#+date: my {date} -> \date{my \{date\}}
#+date: {my}{fancy}{date} -> \date{my}{fancy}{date}
#+date: {} -> \date{}

Why mostly:
At the moment the code escapes the provided brackets and the current behaviour is 
#+date: {my}{fancy}{date} -> \date\{my\}\{fancy\}\{date\}
#+date: {} -> \date\{\}
which is not correct and I cant seem to find a good way to alter the format command to 
not escape the special characters. Tips are appreciated. 

A general Remark: I feel that passing latex options by their literal value i.e. including all 
latex formatting and brackets, would be a good general addition to the exporter. I can 
imagine use cases where the author command is also overwritten to format names differently
at different locations in the document. As in 
#+author: {title}{name}{sir name}
#+author: {name}{thanks}{special thanks}
It gives the end user way more control over the final document and does not break any
backward compatibility.

Kind regards 
Bob 







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

  reply	other threads:[~2022-08-01 10:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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. [this message]
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

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=N8O1xep--3-2@vergauwen.me \
    --to=emacs-orgmode@gnu.org \
    --cc=danflscr@gmail.com \
    --cc=emacs@vergauwen.me \
    --cc=manikulin@gmail.com \
    /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).