emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: No mathematics in Texinfo exports


From: Ihor Radchenko
Subject: Re: [PATCH] Re: No mathematics in Texinfo exports
Date: Fri, 19 Aug 2022 12:48:26 +0800

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 via email to

[Prev in Thread] Current Thread [Next in Thread]