I'm editing a client's Latex file in Lyx, where the client has used a document class not supported by Lyx.
In these cases, I use tex2lyx
with either -c article
or -c report
to ensure Lyx can import the file, and look at the difference (using wdiff
) between the provided Latex file and that which Lyx exports to assemble a list of misunderstood syntax, which I can create a syntax file from to pass to tex2lyx
using the -s $SYNTAXFILE
option.
All well and good, but if the document classes conflict in their syntax (e.g., passing optional arguments to such commands as \author
or environments such as {enumerate}
) then Lyx ignores what the syntax file says and so misparses the imported Latex file.
I have a workaround for this case, namely putting the definition \let\lyxtexblock=\relax
in the Latex preamble and a line \lyxtexblock{}
in the syntax file, and surrounding any misunderstood Latex with it. But I wonder if there is a more principled solution, something less time-consuming than hacking up a new layout file.
I'm using Lyx 1.6.8, but I'm interested to hear of solutions for Lyx 2.
Resource
- Converting *.tex to *.lyx (lyx.org wiki)
Motivation
While it is possible to edit someone else's Latex manuscript by directly editing the source file, and use wdiff/texdiff/latexdiff
to document the changes made, this tends to be a relatively inefficient way of working when there are many edits (say 1 000 edits on a 9 000 word manuscript). The change tracking features of Word, Open Office Writer and Lyx all offer the following features, among others, which I call the change-tracking minimum:
- Comments associated with changed text, ideally over arbitrary extents of text or particular edits;
- A UI that allows changes to be worked through one at a time, and accepted, rejected, or the text modified;
- A UI that allows all changes in some selected portion of text to either accepted or rejected, and likewise all comments in a slected area be deleted;
Point one is possible with wdiff/texdiff/latexdiff
. Neither points 2 or 3 are, with any software I have seen. Anything less than all three points will cause a big increase in the time it takes for a client of mine to work through the kind of edits I produce. I believe the lack of good editing tools for Latex, such as the above, is the principal reason why many publishers do not want to work within Latex.