"onf" <o...@disroot.org> writes: >> 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 > > To understand #2, let's assume that C is defined and CR is not. Then: > \fC -> set font to C > \f[CR] -> ignored > \fP -> restore previous font, set previous font to C > \fP -> restore previous font (back to C) > > 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 > > ...which actually gives you: > Normal bold italic bold italic
Yikes! We currently implicitly rely on the assumption that things are working differently: normal *bold /italic/ bold* normal is exported as .TH "" "1" .PP normal \fBbold \fIitalic\fP bold\fP normal and the last "normal" is indeed rendered as italic. > 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'm afraid that I'll need to rethink that export algo for ox-man to account for this nuance. Probably, the simplest way implementation-wise will be applying faces to each "plain text" segment individually: \fRnormal \fR\fBbold \fR\f[BI]italic\fR\fB bold\fR\fR normal\fR -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>