Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

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:

  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.

share|improve this question
Wouldn't the best solution be to use TeXworks or some other editor? – Seamus Jan 11 '11 at 11:51
@Seamus: Solution to what? I need change tracking. – Charles Stewart Jan 11 '11 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 '11 at 13:13
@Seamus: I've added a postscript explaining why I find this worthwhile. – Charles Stewart Jan 17 '11 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 – Herbert May 6 '11 at 12:43
show 1 more comment

1 Answer

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.

share|improve this answer
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. – Charles Stewart May 27 '11 at 7:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
http://tex.stackexchange.com/questions/8704/can-lyx-syntax-files-override-document-class-defaults
tex.stackexchange.com
crawl=CC-MAIN-2013-20
49517
application/http; msgtype=response
sha1:K3WB3KWWKHYY2NVNJIUFPDHSPGNZUSQI
<urn:uuid:37c07f34-65e7-4b8e-bbad-0d3316d6aaef>
2013-05-21T16:56:19Z
198.252.206.16
sha1:AM6Y2OGWORNYVXBMSWSX46WBOWTQO3K6
<urn:uuid:4f514e3c-0cf0-4010-ad58-64cb7e6a8e6e>
http://tex.stackexchange.com/questions/8704/can-lyx-syntax-files-override-document-class-defaults
response
<urn:uuid:6e194af8-d0b8-43af-b4ae-cbe63d6d349e>
robots: classic
hostname: ip-10-60-113-184.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2013-20
operator: CommonCrawl Admin
description: Wide crawl of the web with URLs provided by Blekko for Spring 2013
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf