emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: "Rudolf Adamkovič" <salutis@me.com>
Cc: Nicolas Goaziou <mail@nicolasgoaziou.fr>,  emacs-orgmode@gnu.org
Subject: Re: [PATCH] Re: No mathematics in Texinfo exports
Date: Fri, 19 Aug 2022 12:48:26 +0800	[thread overview]
Message-ID: <87pmgwq1np.fsf@localhost> (raw)
In-Reply-To: <m2y1vqpqu2.fsf@me.com>

Rudolf Adamkovič <salutis@me.com> writes:

>> First of all, checking version should probably be controlled by some
>> customization. Especially when we export to .texi (which does not
>> involve calling makeinfo), not to .info.
>
> I could not figure out how to tell between the two kinds of export.
>
> My attempt, in 'org-texinfo-latex-environment':
>
> (message "filename1: %s" (plist-get info :output-file))
> (message "filename2: %s" (plist-get info :texinfo-filename))
>
> I always got the following, not matter what:
>
> filename1: test.texi
> filename2: nil

I did not mean that the behaviour should necessarily be different. In any
case, you cannot really distinguish this easily. The difference between
info and texinfo exports is simply in the arguments to
org-export-to-file. When exporting to info, the normal texinfo export is
post-processed using org-texinfo-compile. See org-texinfo-export-to-info
and org-texinfo-export-to-texinfo.

>> This customization might be set to 'auto by default, making ox-texinfo
>> check makeinfo version.
>
> We now set the customization to 'detect.  If you think 'auto makes for a
> better name, for consistency or some other reason, please let me know.

'detect is OK.

> --- a/etc/ORG-NEWS
> +++ b/etc/ORG-NEWS
> @@ -270,6 +270,7 @@ example,
>  
>  prints a sub-bibliography containing the book entries with =ai= among
>  their keywords.
> +*** Support for LaTeX mathematics in Texinfo exports

Please provide a bit mode info here. At least, mention the new
customization and its default value.

> +(defcustom org-texinfo-with-latex (and org-export-with-latex 'auto)

I guess that you meant (and org-export-with-latex 'detect).

> +  "If non-nil, the Texinfo exporter attempts to process LaTeX math.
> +
> +When set to t, the exporter always processes LaTeX environments
> +and fragments as Texinfo \"@displaymath\" and \"@math\" commands
> +respectively.  Alternatively, when set to 'detect, the exporter

'detect will trigger unescaped quote warning in Emacs 29. Use `detect'.

> +(defun org-texinfo-latex-environment (environment _contents info)
> +  "Transcode a LaTeX ENVIRONMENT from Org to Texinfo.  CONTENTS is
> +nil.  INFO is a plist holding contextual information."

> +(defun org-texinfo-latex-fragment (fragment _contents info)
> +  "Transcode a LaTeX FRAGMENT from Org to Texinfo.  CONTENTS is
> +nil.  INFO is a plist holding contextual information."

Please Use a single sentence at the first line of the docstring.
"CONTENTS is nil" is misleading. If you want to mention CONTENTS
argument at all, just say that it is ignored.

> +(defun org-texinfo-supports-math-p ()
> +  "Return t if the installed version of Texinfo supports \"@math\"."

This function may be called frequently. Its value should better be
cached. We really only need to calculate it once per Emacs session and
store in some variable.

> +  ;; inline TeX fragment

Please use full sentences in comments. Start sentences with capitalized
words and end with ".".

> +  (should
> +   (equal "@math{a^2 = b}"
> +          (org-texinfo-latex-fragment
> +           (org-element-create 'latex-fragment
> +                               '(:value "$a^2 = b$"))
> +           nil
> +           '(:with-latex t))))

Please note that the test results may depend on the installed texinfo
version. Please guard the tests with (let ((org-texinfo-with-latex t)) ...)

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


  reply	other threads:[~2022-08-19  4:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25  7:45 No mathematics in Texinfo exports Rudolf Adamkovič
2022-03-26 16:07 ` [PATCH] " Rudolf Adamkovič
2022-04-20 20:14   ` Rudolf Adamkovič
2022-04-21  6:11     ` Ihor Radchenko
2022-04-21  7:31       ` Nicolas Goaziou
2022-04-21  9:59         ` Ihor Radchenko
2022-04-21 11:20           ` Nicolas Goaziou
2022-04-21 13:36             ` Ihor Radchenko
2022-05-15 19:37               ` Rudolf Adamkovič
2022-05-16  2:17                 ` Ihor Radchenko
2022-05-20 12:52                   ` Rudolf Adamkovič
2022-05-23 11:30                     ` Rudolf Adamkovič
2022-05-23 11:37                       ` Ihor Radchenko
2022-05-27  7:04                         ` Rudolf Adamkovič
2022-05-28  2:42                           ` Ihor Radchenko
2022-06-05  9:08                             ` Rudolf Adamkovič
2022-06-05 12:22                               ` Ihor Radchenko
2022-06-15 20:26                                 ` Rudolf Adamkovič
2022-06-19  8:23                                   ` Ihor Radchenko
2022-06-24 19:33                                     ` Rudolf Adamkovič
2022-06-25  5:51                                       ` Ihor Radchenko
2022-08-14 19:28                                     ` Rudolf Adamkovič
2022-08-19  4:48                                       ` Ihor Radchenko [this message]
2022-09-16 21:50                                         ` Rudolf Adamkovič
2022-09-21  7:33                                           ` Ihor Radchenko
2022-09-21 20:36                                             ` Rudolf Adamkovič

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=87pmgwq1np.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=salutis@me.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).