I recently needed to turn a big LyX document into a number of Word documents (one for each chapter). Because the export to OpenOffice format no longer worked on my system (I couldn't find oolatex in a new install of MiKTeX 2.9), I resorted to pasting from the pdf to Word. Using non-default fonts in LyX this meant that all bolding (section headings) and emphasis (as italic) was preserved. The big problem in pasting from a pdf is that each line in the pdf is treated by Word as a separate paragraph. I worked around that by noting that the final line of most paragraphs was shorter than the lines in the paragraph body, but there were enough exceptions to make the process only semi-automatic. Thinking about this later, it would have helped if the first word of each paragraph was a different colour -- say, red -- and I could have searched for that. Colour, like bolding and emphasis, is preserved on pasting into Word (at least for non-default fonts).

With sectioning commands, you can create a module containing lines like

Style Section
    LatexName    newsection
    Preamble
        \newcommand{\newsection}[1]{{\centering\section{\emph{#1}}}}
    EndPreamble
End

and in the usual classes with bold upright headings, all sections will now be bold and italicised and centred -- or not, depending on whether one adds the module to the document or not.

It would be very nice if a similar thing was possible for Standard style: if the LatexName is dummy, as at present, nothing happens but if a different LatexName is used, as with newsection in the example, LyX passes the command on to Latex, so that a module with

Style Standard
    LatexName    notdummy
    Preamble
        \newcommand{\notdummy}...
    EndPreamble
End

and a suitable definition of \notdummy, would enable the first word of a paragraph to be reddened or whatever other effect one wanted, depending on whether the module is added to the document or not.

It would give LyX something like (La)TeX's \everypar facility. The trouble with \everypar is that it is reset, \everypar={}, with every section command (at least in my experiments) so that it doesn't apply document-wide. The proposed mechanism would. Presumably it would involve something like \everypar={\notdummy}, but it would be set by LyX with every paragraph.

Andrew Parsloe

Reply via email to