[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro: exporting roman numerals formatted as small-caps
From: |
Max Nikulin |
Subject: |
Re: Macro: exporting roman numerals formatted as small-caps |
Date: |
Thu, 8 Dec 2022 21:07:40 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
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.