[-- Attachment #1.1: Type: text/plain, Size: 524 bytes --] Sometimes I encounter such texts: One of the useful features of a basis $B$ in an $n$-dimensional space When entered as-is in Org mode and exported to LaTeX, the string "$n$-dimensional" is exported as plain text, as One of the useful features of a basis \(B\) in an \$n\$-dimensional space However, in cases such as "$n$;" and "$n$.", they are correctly exported as "\(n\);" and "\(n\).". Are there any option to treat hypen the same as semicolon or full stop in LaTeX exports? -- Yuchen Guo [-- Attachment #1.2: yc_pubkey.gpg.asc --] [-- Type: application/pgp-keys, Size: 892 bytes --] [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --]
Sometimes I encounter such texts: One of the useful features of a basis $B$ in an $n$-dimensional space When entered as-is in Org mode and exported to LaTeX, the string "$n$-dimensional" is exported as plain text, as One of the useful features of a basis \(B\) in an \$n\$-dimensional space However, in cases such as "$n$;" and "$n$.", they are correctly exported as "\(n\);" and "\(n\).". Are there any option to treat hypen the same as semicolon or full stop in LaTeX exports? -- Yuchen Guo
[-- Attachment #1: Type: text/plain, Size: 505 bytes --] Sometimes I encounter such texts: One of the useful features of a basis $B$ in an $n$-dimensional space When entered as-is in Org mode and exported to LaTeX, the string "$n$-dimensional" is exported as plain text, as One of the useful features of a basis \(B\) in an \$n\$-dimensional space In cases such as "$n$;" and "$n$.", they are correctly exported as "\(n\);" and "\(n\).". So, are there any option that can be tweaked to export "$MATH$-text" correctly? -- Yuchen Guo [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --]
Hi!
I think we had this discussion quite some times already. Org Mode
supports $...$ syntax wherever possible but not in all places and
encourages the use of \(...\). I switched from using $...$ to \(...\)
everywhere, and have not had any problems since.
Dominik
Yuchen Guo <yuchen@apvc.uk> writes:
> [[PGP Signed Part:Undecided]]
> Sometimes I encounter such texts:
>
> One of the useful features of a basis $B$ in an $n$-dimensional space
>
> When entered as-is in Org mode and exported to LaTeX, the string
> "$n$-dimensional" is exported as plain text, as
>
> One of the useful features of a basis \(B\) in an \$n\$-dimensional space
>
> In cases such as "$n$;" and "$n$.", they are correctly exported as
> "\(n\);" and "\(n\).".
>
> So, are there any option that can be tweaked to export "$MATH$-text"
> correctly?
On 14/03/2023 14:02, Yuchen Guo wrote: > Sometimes I encounter such texts: > > One of the useful features of a basis $B$ in an $n$-dimensional space > > When entered as-is in Org mode and exported to LaTeX, the string > "$n$-dimensional" is exported as plain text, as > > One of the useful features of a basis \(B\) in an \$n\$-dimensional space I assume "\(n\)-dimensional". > In cases such as "$n$;" and "$n$.", they are correctly exported as > "\(n\);" and "\(n\).". > > So, are there any option that can be tweaked to export "$MATH$-text" > correctly? Consider "$M$" as deprecated. Balance of lightweight markup and heuristics to distinguish literal symbols and markup markers is quite subtle. Dash detection is broken for a long time despite the manual still says that it is supported: Max Nikulin to emacs-orgmode. Re: [PATCH] Add support for $…$ latex fragments followed by a dash. Tue, 1 Feb 2022 21:26:50 +0700. https://list.orgmode.org/stbfvc$3rs$1@ciao.gmane.io That thread contains examples what may be false positives, e.g. Max Nikulin to emacs-orgmode. Re: [PATCH] Add support for $…$ latex fragments followed by a dash. Sun, 30 Jan 2022 22:28:38 +0700. https://list.orgmode.org/st6ar8$tjk$1@ciao.gmane.io Another thread: Timothy to emacs-orgmode… Re: Depreciating TeX-style LaTeX fragments (was: Org Syntax Specification) Sun, 16 Jan 2022 00:36:35 +0800. https://list.orgmode.org/87lezgly20.fsf@gmail.com
[-- Attachment #1: Type: text/plain, Size: 645 bytes --] Hi, You can write \(n\)-dimensional space. On Wed, Mar 15, 2023, 02:18 Yuchen Guo <yuchen@apvc.uk> wrote: > Sometimes I encounter such texts: > > One of the useful features of a basis $B$ in an $n$-dimensional space > > When entered as-is in Org mode and exported to LaTeX, the string > "$n$-dimensional" is exported as plain text, as > > One of the useful features of a basis \(B\) in an \$n\$-dimensional space > > However, in cases such as "$n$;" and "$n$.", they are correctly exported > as "\(n\);" and "\(n\).". > > Are there any option to treat hypen the same as semicolon or full stop > in LaTeX exports? > > -- > Yuchen Guo > > [-- Attachment #2: Type: text/html, Size: 1084 bytes --]
iemacs@gmail.com writes:
> You can write \(n\)-dimensional space.
ROFL.
My apologies for the laugh, but this question will keep coming over and
over and over until the end of times. Clearly, there is a need for the
dash, and given the quality and syntactic stability of TeX, the problem
is not going anywhere ... ever.
Rudy
--
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't. That's logic.'"
-- Lewis Carroll, Through the Looking Glass, 1871/1872
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
I like the $...$ syntax, but since it is not fully supported, I rather
use \(...\) consistently; I do not really care.
Maybe the best thing to do is drop support for $...$ completely?
I quote the Org mode manual section about $...$ syntax:
Text within the usual LaTeX math delimiters. To avoid conflicts with
currency specifications, single ‘$’ characters are only recognized
as math delimiters if the enclosed text contains at most two line
breaks, is directly attached to the ‘$’ characters with no
whitespace in between, and if the closing ‘$’ is followed by
whitespace, punctuation or a dash. For the other delimiters, there
is no such restriction, so when in doubt, use ‘\(...\)’ as inline
math delimiters.
I think this is HIGHLY confusing. I think we should write something
along the lines: "Do not use $...$. Only for reasons of backwards
compatibility, $...$ syntax is partly (!) supported."
Dominik
Rudolf Adamkovič <salutis@me.com> writes:
> iemacs@gmail.com writes:
>
>> You can write \(n\)-dimensional space.
>
> ROFL.
>
> My apologies for the laugh, but this question will keep coming over and
> over and over until the end of times. Clearly, there is a need for the
> dash, and given the quality and syntactic stability of TeX, the problem
> is not going anywhere ... ever.
>
> Rudy
[-- Attachment #1: Type: text/plain, Size: 511 bytes --] If it is deprecated in Org mode, maybe we can print a warning message in echo area? > but this question will keep coming over and > over and over until the end of times. Yet I tried searching Org manual, and also here the mailing list archive, before posting my latest lame message here. Maybe I did not use the correct keyword, maybe something else. > Clearly, there is a need for the dash, and given the quality and > syntactic stability of TeX, the problem is not going anywhere > ... ever. Absolutely. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 247 bytes --]
Dominik Schrempf <dominik.schrempf@gmail.com> writes: > Maybe the best thing to do is drop support for $...$ completely? We cannot do it. Otherwise, existing Org documents may be broken. > I quote the Org mode manual section about $...$ syntax: > > Text within the usual LaTeX math delimiters. To avoid conflicts with > currency specifications, single ‘$’ characters are only recognized > as math delimiters if the enclosed text contains at most two line > breaks, is directly attached to the ‘$’ characters with no > whitespace in between, and if the closing ‘$’ is followed by > whitespace, punctuation or a dash. For the other delimiters, there > is no such restriction, so when in doubt, use ‘\(...\)’ as inline > math delimiters. > > I think this is HIGHLY confusing. I think we should write something > along the lines: "Do not use $...$. Only for reasons of backwards > compatibility, $...$ syntax is partly (!) supported." Feel free to provide a patch. -- Ihor Radchenko // yantar92, 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>
Ihor Radchenko <yantar92@posteo.net> writes: > Dominik Schrempf <dominik.schrempf@gmail.com> writes: > >> Maybe the best thing to do is drop support for $...$ completely? > > We cannot do it. Otherwise, existing Org documents may be broken. > Well, and as detailed later in my mail, I meant deprecating support for $...$. But thanks for pointing this out! > >> I quote the Org mode manual section about $...$ syntax: >> >> Text within the usual LaTeX math delimiters. To avoid conflicts with >> currency specifications, single ‘$’ characters are only recognized >> as math delimiters if the enclosed text contains at most two line >> breaks, is directly attached to the ‘$’ characters with no >> whitespace in between, and if the closing ‘$’ is followed by >> whitespace, punctuation or a dash. For the other delimiters, there >> is no such restriction, so when in doubt, use ‘\(...\)’ as inline >> math delimiters. >> >> I think this is HIGHLY confusing. I think we should write something >> along the lines: "Do not use $...$. Only for reasons of backwards >> compatibility, $...$ syntax is partly (!) supported." > > Feel free to provide a patch. I think that a change in the documentation alone is insufficient. We need to make sure that all current and future maintainers of org-latex are aware of the decision to deprecate $...$ (if we make this decision). How do we do that?
[-- Attachment #1: Type: text/plain, Size: 170 bytes --] Yuchen Guo <yuchen@apvc.uk> writes: > If it is deprecated in Org mode, maybe we can print a warning message in > echo area? Not in echo area, but we can add a linter. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-lint-Add-checker-for-.-LaTeX-fragments.patch --] [-- Type: text/x-patch, Size: 1628 bytes --] From 129e3aa03229fd2e5dd6ea9bf627e4d95a061744 Mon Sep 17 00:00:00 2001 Message-Id: <129e3aa03229fd2e5dd6ea9bf627e4d95a061744.1679488572.git.yantar92@posteo.net> From: Ihor Radchenko <yantar92@posteo.net> Date: Wed, 22 Mar 2023 13:35:22 +0100 Subject: [PATCH] org-lint: Add checker for $...$ LaTeX fragments * lisp/org-lint.el (org-lint-LaTeX-$): New checker warning about semi-obsolete $...$ LaTeX fragment syntax. Link: https://orgmode.org/list/86ileukojk.fsf@lan --- lisp/org-lint.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/org-lint.el b/lisp/org-lint.el index 0e2967b6c..8d6d22be7 100644 --- a/lisp/org-lint.el +++ b/lisp/org-lint.el @@ -1227,6 +1227,14 @@ (defun org-lint-incomplete-citation (ast) (org-element-property :parent text)) "Possibly incomplete citation markup"))))) +(defun org-lint-LaTeX-$ (ast) + "Report semi-obsolete $...$ LaTeX fragments." + (org-element-map ast 'latex-fragment + (lambda (fragment) + (and (string-match-p "^[$][^$]" (org-element-property :value fragment)) + (list (org-element-property :begin fragment) + "Potentially confusing LaTeX fragment format. Prefer using more reliable \\(...\\)"))))) + \f ;;; Checkers declaration @@ -1450,6 +1458,11 @@ (org-lint-add-checker 'incomplete-citation #'org-lint-incomplete-citation :categories '(cite) :trust 'low) +(org-lint-add-checker 'LaTeX-$ + "Report potentially confusing $...$ LaTeX markup." + #'org-lint-LaTeX-$ + :categories '(markup)) + (provide 'org-lint) ;; Local variables: -- 2.39.1 [-- Attachment #3: Type: text/plain, Size: 224 bytes --] -- Ihor Radchenko // yantar92, 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>
Dominik Schrempf <dominik.schrempf@gmail.com> writes: >>> I think this is HIGHLY confusing. I think we should write something >>> along the lines: "Do not use $...$. Only for reasons of backwards >>> compatibility, $...$ syntax is partly (!) supported." >> >> Feel free to provide a patch. > > I think that a change in the documentation alone is insufficient. We > need to make sure that all current and future maintainers of org-latex > are aware of the decision to deprecate $...$ (if we make this decision). > How do we do that? $...$ is a part of Org markup spec. We can document the deprecation in https://orgmode.org/worg/org-syntax.html#LaTeX_Fragments and possibly as a comment in source code (org-element.el). This is still under discussion in https://list.orgmode.org/orgmode/87r195nt2g.fsf@localhost/ -- Ihor Radchenko // yantar92, 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>
Ihor Radchenko <yantar92@posteo.net> writes: > Yuchen Guo <yuchen@apvc.uk> writes: > >> If it is deprecated in Org mode, maybe we can print a warning message in >> echo area? > > Not in echo area, but we can add a linter. Applied, onto main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cfe5e01e1 -- Ihor Radchenko // yantar92, 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>
Great, thank you so much!
Ihor Radchenko <yantar92@posteo.net> writes:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Yuchen Guo <yuchen@apvc.uk> writes:
>>
>>> If it is deprecated in Org mode, maybe we can print a warning message in
>>> echo area?
>>
>> Not in echo area, but we can add a linter.
>
> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cfe5e01e1