public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Adin Klotz <adinklotz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Filter help: apply LaTeX command to words matching pattern
Date: Mon, 28 Nov 2022 14:53:48 -0500	[thread overview]
Message-ID: <CAFy2Trs7g+84uDfLAYOa+FZm7YmXfwCUiFiTbcCwyN56KEv8nQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

Background: I like the look of old-style numerals in text, but they look
bad in acronyms or other all-caps blocks, so I’d like to switch to lining
numerals there. I couldn’t find an all-LaTeX way to do this so simplest way
seemed to be a filter. I want to match words containing and only containing
capital letters and numbers and surround them with \liningnums{}

For example:
NUMBER1 -> \liningnums{NUMBER1}
2022 -> 2022
A1B2C3 -> \liningnums{A1B2C3}
A1b2c3 -> A1b2c3

I’ve played around a bit but don’t know enough Lua or Pandoc internals to
get there. I have patterns to check the words but haven’t managed to
successfully add the latex macro. Can someone point me in the right
direction?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFy2Trs7g%2B84uDfLAYOa%2BFZm7YmXfwCUiFiTbcCwyN56KEv8nQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 1696 bytes --]

             reply	other threads:[~2022-11-28 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 19:53 Adin Klotz [this message]
     [not found] ` <CAFy2Trs7g+84uDfLAYOa+FZm7YmXfwCUiFiTbcCwyN56KEv8nQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-11-28 20:07   ` Bastien DUMONT

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFy2Trs7g+84uDfLAYOa+FZm7YmXfwCUiFiTbcCwyN56KEv8nQ@mail.gmail.com \
    --to=adinklotz-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.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.
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 NNTP newsgroup(s).