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.



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:

  1. Comments associated with changed text, ideally over arbitrary extents of text or particular edits;
  2. A UI that allows changes to be worked through one at a time, and accepted, rejected, or the text modified;
  3. 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.

  • Wouldn't the best solution be to use TeXworks or some other editor?
    – Seamus
    Jan 11, 2011 at 11:51
  • @Seamus: Solution to what? I need change tracking. Jan 11, 2011 at 11:52
  • 4
    Well, the problem seems to be that you're using LyX. The solution is to stop doing so.
    – Seamus
    Jan 11, 2011 at 13:13
  • @Seamus: I've added a postscript explaining why I find this worthwhile. Jan 17, 2011 at 17:02
  • Which documentclass is it? It is not too complicated to write an own layout file for LyX, which makes live much more easier than using tex2lyx
    – user2478
    May 6, 2011 at 12:43

1 Answer 1


This is not the "more principled" solution you have asked for, but another workaround that has been working pretty well for me when editing foreign articles:

  1. I technically do create an own layout file, but do not put any effort into it. I just take a copy of article.layout (or one of its descendants) and edit the class file inside the copy and that's all.
  2. I do live with ERT boxes for everything that is nonstandard

The issue with ERT boxes is that changes inside them are not tracked by LyX's change tracking system. However, in my experience (with classes for scientific articles) most, if not all, incompatibilities to the standard classes affect only the front matter, that is, macros such as \title, \author, \thanks and so on. So I usually end up with one big ERT box at the beginning that contains a verbatim copy of the front matter from the LaTeX source and use tex2lyx to convert only the body of the article. As edits to the front matter are relatively rare, this is an acceptable low-effort workaround.

  • I'd much rather edit the highlighted source in Word than do this. There are journals that use custom macros for such things as scientific units, natbib-like citations, and figure text, all of which are sensitive texts often in need of change tracking. But its worth documenting this, so I'll upvote. May 27, 2011 at 7:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .