[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] New "kbd" macro?
From: |
Rasmus |
Subject: |
Re: [O] [RFC] New "kbd" macro? |
Date: |
Thu, 14 Sep 2017 10:07:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Hi Nicolas,
Thanks for looking into this.
Nicolas Goaziou <address@hidden> writes:
> I would like to submit a new minor macro for integration within Org: the
> "kbd" macro.
>
> The "kbd" macro focuses on normalizing keybinding during export. For
> example, during Texinfo export, {{{kbd(v SPC)}}} becomes
>
> @kbd{v @key{SPC}}
>
> whereas in another back-end, it becomes
>
> v <SPC>
>
> More specifically:
>
> Within {{{kbd(...)}}}, the following case-sensitive keys are wrapped
> within angle brackets: SPC, RET, LFD, TAB, BS, ESC, DELETE, SHIFT,
> CTRL, META, up, down, left, right.
(I wish there was a more light-weight syntax for macros... Maybe we
should provide something similar to C-c C-l for inserting them...)
> With an optional argument, it can wrap the key-binding within verbatim
> or code markup:
>
> {{{kbd(v SPC,code)}}} => ~v <SPC>~
>
> {{{kbd(v SPC,verbatim)}}} => =v <SPC>=
>
> Other markup is not implemented because, in that case, you can wrap
> appropriate characters around the macro.
I am not sure where it makes sense to print in "plain" text as opposed to
code or verbatim by default. Anyway, I think it makes sense to add
specific export mechanisms for several backends, which might make it
possible to remove that argument.
- HTML, MD :: as Kaushal points out, please use <kbd>.</kbd>.
- LaTeX :: it’s complicated, as e.g. keys needs to be translated in a specific
way, depending on the package that is being used, e.g. "libertinekey",
"menukeys" or whatnot. We should not add new default packages IMO. We
could always support a couple of different packages, but default to
something like "\fbox{\ttfamily %s}". Adding support for other packages
reduces to mapping specific sequences, like "SPC" to something like
"\LKeySpace".
- ODT :: it should be possible to use something like Biolinium or
Libertinus keyboard fonts if we just have an alist mapping sequences
like CTRL to the right unicode symbol (E.g. U+E173 here), but the place
in the font would probably depend on the font. So unless there’s a
standard it would be risky. Since fonts aren’t (typically?) embedded in
ODT it might be better to add a new odt style that prints the words in
the mono font inside a box, i.e. the equivalent of "\fbox{\ttfamily %s}".
- Texinfo :: already supported.
Rasmus
--
Bang bang
- [O] [RFC] New "kbd" macro?, Nicolas Goaziou, 2017/09/13
- Re: [O] [RFC] New "kbd" macro?, Kaushal Modi, 2017/09/15
- Re: [O] [RFC] New "kbd" macro?, Kaushal Modi, 2017/09/15
- Re: [O] [RFC] New "kbd" macro?, Nicolas Goaziou, 2017/09/15
- Re: [O] [RFC] New "kbd" macro?, Nicolas Goaziou, 2017/09/17