Re: exported latex source code
rgheck writes: > > On 09/23/2009 10:19 AM, David Wang wrote: > > I found exported latex source (by File->Export->LaTex(plain)) is not > > terribly clean. Specifically, \begin{equation} and \end{equation} in general > > don't start at the first column and occupy one line each [...] > > > > > This is probably a bug. The exported code is meant to be "clean", in > this sense, and we do our best e.g. to break the lines at 80 characters, > etc, etc. So you should report this on the bug tracker. It's probably an > easy fix. I'm not sure, though, because there is a need here to make > sure we don't out output too many newlines. I.e., this is OK: > blah blah blah > \begin{equation} > ... > but we do not want: > blah blah blah > > \begin{equation} > ... The way this is handled for e.g. \begin{figure} or \begin{table} is to insert a comment mark (%) and a newline before the \begin{environment}. Applying this to your example would produce: blah blah blah% \begin{equation} ... or: blah blah blah % \begin{equation} ... which I think looks very acceptable. The extra newlines would be ignored during latex processing because of the comment mark. I do not know the details of the code producing this latex output but this solution should be easy to implement. Julien
Re: exported latex source code
On 09/23/2009 10:19 AM, David Wang wrote: I found exported latex source (by File->Export->LaTex(plain)) is not terribly clean. Specifically, \begin{equation} and \end{equation} in general don't start at the first column and occupy one line each like, for example, \begin{equation} \mathbf{y} = \mathbf{A} \cdot \mathbf{x} \end{equation} Instead they are embedded in plain text and can appear anywhere within a line. This reduces the code readability when I need to modify latex source directly. So my question is, how to make Lyx export latex source of clearer format? Did I miss anything simple? This is probably a bug. The exported code is meant to be "clean", in this sense, and we do our best e.g. to break the lines at 80 characters, etc, etc. So you should report this on the bug tracker. It's probably an easy fix. I'm not sure, though, because there is a need here to make sure we don't out output too many newlines. I.e., this is OK: blah blah blah \begin{equation} ... but we do not want: blah blah blah \begin{equation} ... At least, we do not want that, unless the user specifically requests it. So it may be that this is a kind of safety valve. Anyway, report it on trac (http://www.lyx.org/trac), and someone can have a look. Until then, you might write use a trivial perl script to clean this up: while (<>) { if (/(.+)(\\begin{equation}.*)/) { print "$1\n$2; } else { print; } } Obviously, sed can work here, too, etc. Perl works for me. Richard
exported latex source code
Hello, I'm fairly new to Lyx. I found exported latex source (by File->Export->LaTex(plain)) is not terribly clean. Specifically, \begin{equation} and \end{equation} in general don't start at the first column and occupy one line each like, for example, \begin{equation} \mathbf{y} = \mathbf{A} \cdot \mathbf{x} \end{equation} Instead they are embedded in plain text and can appear anywhere within a line. This reduces the code readability when I need to modify latex source directly. So my question is, how to make Lyx export latex source of clearer format? Did I miss anything simple? Thanks, David -- turn and live.