emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: [RFC] New "kbd" macro?
Date: Thu, 14 Sep 2017 10:07:26 +0200	[thread overview]
Message-ID: <87a81xn1oh.fsf@gmx.us> (raw)
In-Reply-To: 87377qpwc7.fsf@nicolasgoaziou.fr

Hi Nicolas,

Thanks for looking into this.

Nicolas Goaziou <mail@nicolasgoaziou.fr> 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

  parent reply	other threads:[~2017-09-14  8:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 13:22 [RFC] New "kbd" macro? Nicolas Goaziou
2017-09-13 14:03 ` Kaushal Modi
2017-09-13 14:05   ` Kaushal Modi
2017-09-13 19:25   ` Nicolas Goaziou
2017-09-14  4:45   ` Marcin Borkowski
2017-09-14 13:49   ` Oleh Krehel
2017-09-13 19:24 ` Eric S Fraga
2017-09-14  8:07 ` Rasmus [this message]
2017-09-14 22:02   ` Nicolas Goaziou
2017-09-15  7:36     ` Rasmus
2017-09-15 10:16       ` Nicolas Goaziou
2017-09-15 11:20         ` Rasmus
2017-09-15 11:52           ` Nicolas Goaziou
2017-09-15 12:54     ` Kaushal Modi
2017-09-15 13:08       ` Kaushal Modi
2017-09-15 15:53         ` Nicolas Goaziou
2017-09-17  7:20           ` Nicolas Goaziou

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=87a81xn1oh.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /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).