> Problem: > tex2lyx currently cannot handle commands with optional arguments, > because the brackets are translated to normal text. LyX then produces > {[} instead of [. One example where this happens is the userguide. > > Solution 1: > Call something like > > string opts; > string opt = p.getOpt(); > while (opt.size()) { > opts += opt; > opt = p.getOpt(); > } > > after every command and after every closing brace (because we can have > stupid things like \psfrag{tag}[pos][pspos][scale][rot]{text}). This > works well with one exception: If a opening bracket follows a command > that does not take optional arguments like in > > \necommand{\foo}{bar} > \foo [more text > > the parser goes to the end of the file while searching for the matching > closing bracket. Things are only slightly better if there is a > matching closing bracket, because then a false optional argument is > created. > > > Solution 2: > Create a list of commands that take optional arguments and only serach > for them when they are expected. The drawback is of course the > hardcoding of commands. > > > I don't like either solution. Does anybody have a Solution 3 that is > better? If not, which solution do you prefer?
Solution 2 1/2. The #hardcoding' should be done by using an external plain text file which contains the 'known' commands. Does do reLyX something similar? Andre' PS: In case I did not mention that so far: Thanks for cleaning up this tex2lyx mess behind me...