all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: "Carlos Martínez" <martinez.carlos.93@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Macro: exporting roman numerals formatted as small-caps
Date: Thu, 8 Dec 2022 21:07:40 +0700	[thread overview]
Message-ID: <79cf9afe-5d86-9ee3-0e99-27164ea0f740@gmail.com> (raw)
In-Reply-To: <CAFiHh6HcAPOGtP7fGCREs9YEFv+vM1J+58Nc=W2b2y65+srXwg@mail.gmail.com>

On 08/12/2022 19:38, Carlos Martínez wrote:
> 
> #+MACRO: sc (eval (if (org-export-derived-backend-p
> org-export-current-backend 'latex) (concat "@@latex:\\textsc{@@" $1
> "@@latex:}@@") (concat "@@odt:<text:span
> text:style-name=\"T1\">@@"$1"@@odt:</text:span>@@")))

                            ^  ^
Your missed spaces around $1, but it is unlikely a problem.

Disclaimer: I know almost nothing about odt. Have you customized ODT 
styles? I do not see "T1" in etc/styles/OrgOdtStyles.xml

info "(org) Advanced topics in ODT export"
https://orgmode.org/manual/Advanced-topics-in-ODT-export.html

> I want to achieve something like this: "When exporting to LaTeX (o
> derived formats), surround the argument with \textsc{}; if any other
> format [it will always be odt], do the same with the proper odt code.

I recommend fallback to the argument as plain text for other backends:

(cond
  ((org-export-derived-backend-p org-export-current-backend 'latex)
   (concat ; or format
   ))
  ((org-export-derived-backend-p org-export-current-backend 'odt)
   ; ...
   ))
  (t $1))

If you are absolutely sure that you will never export the file to ascii 
or html then no `eval' is necessary

#+MACRO: sc @@latex:\textsc{$1}@@@@odt:<text:span 
text:style-name="T1">$1</text:span>@@

Here I assume that macro argument contains no markup and can be safely 
put inside export snippets. Otherwise a bit longer version closer to 
`concat' arguments in your original variant would be better.

Another point is the name. Small caps as "sc" means direct formatting. A 
name based on "roman number" might be better. If some other objects 
should be formatted as small caps then creating another macro might help 
to change styles independently later.


  reply	other threads:[~2022-12-08 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 12:38 Macro: exporting roman numerals formatted as small-caps Carlos Martínez
2022-12-08 14:07 ` Max Nikulin [this message]
2022-12-09  8:22   ` Christian Moe

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=79cf9afe-5d86-9ee3-0e99-27164ea0f740@gmail.com \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=martinez.carlos.93@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.