[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro: exporting roman numerals formatted as small-caps
From: |
Christian Moe |
Subject: |
Re: Macro: exporting roman numerals formatted as small-caps |
Date: |
Fri, 09 Dec 2022 09:22:37 +0100 |
User-agent: |
mu4e 1.2.0; emacs 27.2 |
Max Nikulin writes:
> 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
Indeed. Carlos, I'm guessing that you formatted a Roman numeral in ODT
as you wanted it to look, saved the document, opened content.xml and
used the resulting XML.
However, what happens then is that the formatting gets saved as an
automatically numbered text style "T1", which isn't going to mean the
same thing the next time you export a document.
See if this works:
- In the document you are using as your ODT_STYLES_FILE, type a Roman
numeral and format it the way you like.
- Then make it a named character style. In LibreOffice, open the "Styles
and formatting" sidebar and select the "Character styles" tab. Select
the formatted Roman numeral in the text. From the "Styles actions"
dropdown (top right in "Styles and formatting"), choose "New style
from selection". Give it a name, e.g. "Roman numeral".
- Save the styles file.
- In your macro: replace "T1" with "Roman numeral".
- In all your Org documents where you want this to work: make sure that
(1) the macro is defined and (2) that ODT_STYLES_FILE points to the
file you have saved with the style definition for "Roman numeral".
There isn't any simpler way to do it, due to the way LibreOffice stores
all local formatting as generated styles.
Yours,
Christian