Hi Ihor, On Wed Jan 1, 2025 at 1:30 PM CET, onf wrote: > On Wed Jan 1, 2025 at 10:38 AM CET, Ihor Radchenko wrote: > > >> Also, what if we leave \fC and add \f[CR]/.EX on top? > > >> AFAIU, the worst case scenario for \fC is that it does nothing. By > > >> leaving it there, we thus retain old working exports working while also > > >> adding appropriate format when \f[CR] is supported. > > > > > > The \f escape sets current font. \fP restores previous font. > > > What this means is that doing \fC\f[CR]Lorem\fP: > > > (1) sets the text Lorem in Courier if font name C or CR exists > > > (2) restores previous font if neither font C nor CR exists > > > (3) sets font to Courier if both font name C and CR exist > > > > What about \fC\f[CR]Lorem\fP\fP? > > (1) if both C and CR exist, sets Lorem in Courier > (2) if only C or CR exists, sets font to Courier > (3) if neither exists, does nothing > > [...] > > It's important to understand that troff commands don't really use > nesting or a stack as one might be used to from HTML and similar > markup languages. That's why it's also not possible to e.g. nest > bold and italic like this: > Normal \fBbold \fIbold-italic\fP bold\fP normal > [...] > One has to do one of these instead: > Normal \fBbold \f[BI]bold-italic\fP bold\fR normal > Normal \fBbold \f[BI]bold-italic\fB bold\fR normal > Normal \fBbold\fP \f[BI]bold-italic\fP \fBbold\fP normal
I don't know why it took me so long, but I think what you're looking for is this: \fC\f(CRLorem\fR \fR sets regular / "roman" font, i.e. what's usually the default. Just as shown in the examples with nested italic within bold, you will likely have to track the style changes desired by Org-mode and map them into the appropriate fonts, since troff knows only fonts, not "text styles", and so these changes cannot be nested. Note that I've used the syntax \f(, not \f[], because older implementations of troff (such as Plan9 troff iirc) don't support it. If you used \f[CR] on those platforms, it would be interpretted like: \f[ -> set font [ (non-existent => ignored) CR] -> text CR] meaning you would get CR] in the text. ~ onf