From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [proof of concept] inline language blocks
Date: Thu, 29 Feb 2024 12:50:57 +0000 [thread overview]
Message-ID: <87jzmncu32.fsf@posteo.net> (raw)
In-Reply-To: <urprtl$ro3$1@ciao.gmane.io> (Max Nikulin's message of "Thu, 29 Feb 2024 19:05:07 +0700")
Max Nikulin writes:
>> Anyway, I think your example only makes sense in HTML, or at least I
>> can't make sense of it in LaTeX. Why would anyone want &foo{text} to be
>> passed to LaTeX as \bar{text}, instead of just &bar{text}? In HTML it
>> does seem sensible to me that someone would want to change the tags.
>> Maybe with a :html-tag, or something like that.
>
> Consider a document aimed to be exported to different formats. It is
> unlikely that names of commands, elements, classes, etc. match for all
> of them.
It makes sense, although I have never encountered a case like this.
Usually (and returning to the example of the large special blocks), if
in org I put something like:
#+begin_foo
...
#+end_foo
I try to ensure that there is a "foo" environment in LaTeX, a "foo" class
in html or a "foo" style in odt (now I don't remember if the odt exporter
produces paragraph styles from special blocks. I don't think so).
In any case, on second thought, maybe someone wants to reuse a LaTeX
preamble, css style sheets or any odt templates. I see no problem, then,
in there being attributes like :latex-command, :html-tag, :odt-style :html-attribute,
etc., which override the default values.
>> As for :latex-command, if I understand it correctly, I don't quite see
>> how useful this could be:
>> &foo[:latex-command bar]{text} == LaTeX ==> \bar{text}
>> when it is simpler to put:
>> &bar{text}
>
> Command may require additional arguments and it should be convenient
> to define shortcuts to the same command with different arguments:
>
> &la{text} => \foreignlanguage{latin}{text}
> &es{text} => \foreinglanguage{spanish}{text}
With the current implementation:
#+options: inline-special-block-aliases:(("bar" :prelatex [bar]) ("baz" :prelatex [baz]))
&foo[@bar@]{lorem ipsum} ==> \foo[bar]{lorem ipsum}
&foo[@baz@]{lorem ipsum} ==> \foo[baz]{lorem ipsum}
Your example is less verbose, but with this implementation you can do combinations, it's
more granular, I think:
&foo[@bar@ :smallcaps t]{lorem ipsum} ==> {\scshape\foo[bar]{lorem ipsum}}
&foo[@baz@ :lang it]{lorem ipsum} ==> \foo[baz]{\foreignlanguage{italian}{lorem ipsum}}
I think this is quite flexible and leaves a great deal of freedom to the user.
>> The same thing happens with the anonymous variant:
>> &_[:latex-command foo]{text} == LaTeX ==> \foo{text}
>> which is identical to putting &foo{text}
>> The anonymous variant would be equivalent in LaTeX to a
>> \begingroup...\endgroup, or rather to {...}. One could add all the
>> commands one wants within the group simply with :prelatex:
>> &_[:prelatex \foo\bar\vaz\blah{}]{text}
>> ==> {\foo\bar\vaz\blah{}text}
>
> The idea is to not add \begingroup and \endgroup if LaTeX command is
> specified (or to control it by a dedicated attribute). Again, consider
> a document suitable for multiple export formats.
Indeed, if the :latex-command attr is implemented should work in both
variants. In such a way, perhaps:
&_[:latex-command foo]{lorem} ==> \foo{lorem}
> I think, flexibility in respect to underlying
> commands/classes/elements allows to minimize changes in documents
> later. Sometimes it is necessary to switch to another LaTeX package,
> CSS framework, etc. It allows usage semantic names within Org
> documents despite they may be exported to the same command.
>
>> In any case, I think that my implementation leaves open the possibility
>> of extending it with everything you mentioned, or anything else.
>
> The question is proper balance of built-in features, flexibility,
> implementation complexity. It would be unfortunate if most of users
> will have to create custom backends even for basic documents.
We can continue the discussion when I publish my experimental branch and
share the link. I'm a little late because I want to make some
corrections to the code first.
--
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño editorial y ortotipografía
next prev parent reply other threads:[~2024-02-29 12:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 20:35 [proof of concept] inline language blocks Juan Manuel Macías
2024-02-21 8:42 ` Ihor Radchenko
2024-02-21 10:57 ` Juan Manuel Macías
2024-02-21 12:00 ` Ihor Radchenko
2024-02-21 12:53 ` Juan Manuel Macías
2024-02-21 13:10 ` Ihor Radchenko
2024-02-21 14:13 ` Juan Manuel Macías
2024-02-21 20:32 ` [proof of concept] inline-special-block (was: [proof of concept] inline language blocks) Juan Manuel Macías
2024-02-21 23:29 ` [proof of concept] inline-special-block Juan Manuel Macías
2024-02-22 22:03 ` Juan Manuel Macías
2024-02-21 22:11 ` [proof of concept] inline language blocks Samuel Wales
2024-02-21 22:28 ` Juan Manuel Macías
2024-02-21 22:55 ` Samuel Wales
2024-02-21 23:02 ` Juan Manuel Macías
2024-02-28 10:29 ` Max Nikulin
2024-02-28 13:15 ` Juan Manuel Macías
2024-02-28 17:21 ` Max Nikulin
2024-02-28 23:42 ` Juan Manuel Macías
2024-02-29 7:05 ` Max Nikulin
2024-02-29 10:41 ` Juan Manuel Macías
2024-02-29 12:05 ` Max Nikulin
2024-02-29 12:50 ` Juan Manuel Macías [this message]
2024-02-21 23:33 ` Suhail Singh
2024-03-31 14:56 ` Daniel Clemente
2024-03-31 15:20 ` 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=87jzmncu32.fsf@posteo.net \
--to=maciaschain@posteo.net \
--cc=emacs-orgmode@gnu.org \
--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).