From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +DQJGsmx52KlsgAAbAwnHQ (envelope-from ) for ; Mon, 01 Aug 2022 12:58:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0GkkGsmx52L/RgEA9RJhRA (envelope-from ) for ; Mon, 01 Aug 2022 12:58:17 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1AE4B1A07F for ; Mon, 1 Aug 2022 12:58:16 +0200 (CEST) Received: from localhost ([::1]:35224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIT7n-0007JD-PS for larch@yhetil.org; Mon, 01 Aug 2022 06:58:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIT59-0007HT-Ns for emacs-orgmode@gnu.org; Mon, 01 Aug 2022 06:55:31 -0400 Received: from w4.tutanota.de ([81.3.6.165]:40052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIT55-0007y3-Md for emacs-orgmode@gnu.org; Mon, 01 Aug 2022 06:55:31 -0400 Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id C4CC51060160; Mon, 1 Aug 2022 10:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1659351325; s=s1; d=vergauwen.me; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=StSFbRZp4T1PowRV06Bt82+LAA/PyBIin73faA9Psno=; b=kI/1SEVqmIJCuoJUcPYkowPpyel6/xbHFWylHzZirLcZhCrOAsniNiP1nASshAfK x+Pj89/fC3neM6Ovf4wB+KwzoFQzXkhrdjmT5917pBr0Dr4ZvcmbzB5cGsDHBPU1juc fHdj9EarsRBXFkHvz4xk//kx+yZsrphjeqcNgEd3jbnxjZUCA8bes9zuLOrZSk8wkNS AR2scX4bBx1s9k3w7xnlNZx477+0BIAnltHseCeOmcOp/7p0uyZ0HCb26X3bgR1gr3j B7o8twRdbYxYMObdHT4hqPVFjQL/9Gyc1FE2PvJ26tIkeZ0DQBwAccJmrBudw23yfwn TqqdRXoG5A== Date: Mon, 1 Aug 2022 12:55:25 +0200 (CEST) To: Daniel Fleischer Cc: "emacs--- viaGeneral discussions about Org-mode." , Max Nikulin Message-ID: In-Reply-To: References: <87wnbuje62.fsf@localhost> <95786e25-53c4-93dd-b77f-0e64fc793b83@gmail.com> <87h72yj9bj.fsf@localhost> Subject: Re: [PATCH]: ox-latex: omit empty date MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_125059_815763316.1659351325783" Received-SPF: pass client-ip=81.3.6.165; envelope-from=emacs@vergauwen.me; helo=w4.tutanota.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" Reply-to: emacs@vergauwen.me From: emacs--- via "General discussions about Org-mode." X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659351497; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=StSFbRZp4T1PowRV06Bt82+LAA/PyBIin73faA9Psno=; b=mV4OttO5nHe+/d+TUHmJGmaAekcQBgNv7ztIMdebn+GDsYSJM2+TFxK/RdlzXqSyFH9g0A mXd9+wojpwUp0SvXfhuWRoZzPIQUp2qMIfebmRBxWw+ZoyAx6JDoDYaB6cvQdeOWX4UR8I PScXVYfuzCuJPcAKIiSQn1JJbd6GypQEwzTtqRjC9yt7pzDB7bChX5GAzuuHhKXF6NBmGF 5nhxJjAtnkfac2zas7COiWEEdkwQeePBoFHWwgylajpU17HmCHl4SX1I8kkX8bfYYOuWA+ S+DibaQjmmVvXhQXOiL0dXgZ4NcwB8GIZ4V7V9bHRjvhI/sZENeVRKavoSxrZA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659351497; a=rsa-sha256; cv=none; b=J5XdnwCX8QXJeXAO7tjxIj8xcg2uWDBcjLsYkDlnuIooPfuAWZPhv2xVUN/weBqcL8pNEG w27jYFkNYqF5OIfev1R6FqrbwTYcphIYz5Vyit+FVT6FSkCknUA/A6oPsiPcGQbRtUofOm Ny11czqQLJjCN1GMbpQt9A4qxVdCx0Wcei3feYMzkSb0DahTrpMOVExG2ZhR+UqMUe2WWo zxmPGRqcUhjM97IUbjjv1HcCQYjqU7hv1uM9DpzG16EnM0ixxluUi+/yBPAta9thMu8xd5 oKha6KWHjv8YQH4ATmhu55425bniZG9plwnaqd1MPkbrhybU1d5lC3OuHO/y1w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=vergauwen.me header.s=s1 header.b="kI/1SEVq"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.72 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=vergauwen.me header.s=s1 header.b="kI/1SEVq"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1AE4B1A07F X-Spam-Score: -1.72 X-Migadu-Scanner: scn0.migadu.com X-TUID: UpbCtZtjEH6S ------=_Part_125059_815763316.1659351325783 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > emacs--- via "General discussions about Org-mode." > writes: > >> My use case is very niche and be solved by changing my custom latex date= =20 >> command by renaming it as for example \mydate. >> >> Adding extra options like with_date:nil seems overkill for this small is= sue. >> > > 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=20 >> #+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.=C2=A0 The following code would "mostly" does the trick (I come back at the mostly= term later in this mail)=C2=A0=C2=A0=C2=A0=C2=A0 ;; Date. =C2=A0=C2=A0=C2=A0=C2=A0 (let ((date (and (plist-get info :with-date) (org-= export-get-date info)))) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (string-match-p "^\{.*\}$" (org-ex= port-data date info)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (format "\\dat= e%s\n" (org-export-data date info)) =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (format "\\date{%s}\n" (or= g-export-data date info)))) Dates can now de set as, and exported to:=C2=A0 #+date: some date=C2=A0 -> \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 behavi= our is=C2=A0 #+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=C2=A0 not escape the special characters. Tips are appreciated.=C2=A0 A general Remark: I feel that passing latex options by their literal value = i.e. including all=C2=A0 latex formatting and brackets, would be a good general addition to the expo= rter. I can=C2=A0 imagine use cases where the author command is also overwritten to format na= mes differently at different locations in the document. As in=C2=A0 #+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=C2=A0 Bob=C2=A0 ------=_Part_125059_815763316.1659351325783 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


emacs--- via "General discussions about Org-mode."
<emac= s-orgmode@gnu.org> writes:
My use case is very= niche and be solved by changing my custom latex date
comman= d by renaming it as for example \mydate.

Addin= g 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 somethin= g many people are interested in and we keep a
backward compat= ibility.
A second option would be is to analyze t= he data format in the org file.
If for example the date is sp= ecified as
#+date: {day}{something}

The thing is \date is a macro with one parameter, a strin= g. That's way
\date{} doesn't do anything and \date{\today} p= rints today's date where
\today return today's date as a stri= ng. 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 t= his mail)
     ;; Date.
<= /div>
     (let ((date (and (plist-get= info :with-date) (org-export-get-date info))))
=        (if (string-match-p "^\{.*\}$" (org-ex= port-data date info))
    &n= bsp;      (format "\\date%s\n" (org-export-data da= te info))
      &n= bsp;  (format "\\date{%s}\n" (org-export-data date info))))
<= div dir=3D"auto">
Dates can now de set as, and e= xported to: 
#+date: some date  -> = \date{some date}
#+date: my {date} -> \date{m= y \{date\}}
#+date: {my}{fancy}{date} -> \dat= e{my}{fancy}{date}
#+date: {} -> \date{}
<= /div>

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 appr= eciated. 

<= u>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 a= lso overwritten to format names differently
at d= ifferent locations in the document. As in 
= #+author: {title}{name}{sir name}
#+author: {nam= e}{thanks}{special thanks}
It gives the end user= way more control over the final document and does not break any
<= div dir=3D"auto">backward compatibility.

Kind regards 
Bob = ;







------=_Part_125059_815763316.1659351325783--