On Fri, 01 Jun 2007 11:35:45 +0200
Georg Baum <[EMAIL PROTECTED]> wrote:

> Jean-Marc Lasgouttes wrote:
> 
> >>>>>> "Micha" == Micha Feigin
> >>>>>> <[EMAIL PROTECTED]> writes:
> > 
> > Micha> As far as I'm concerned, right now (preferably rc2). It's very
> > Micha> unobtrusive and in an external program. (we are talking about
> > Micha> the fix the tex2lyx, right?)
> > 
> > Micha> The last one fixes tex2lyx to work with the way that lyx seems
> > Micha> to chose to work at the moment (height = 1\totalheight). It
> > Micha> does what it's supposed to do under the current implementation
> > Micha> when importing files with text boxes with no height (I'm
> > Micha> guessing that it is the common case)
> > 
> > Micha> I believe that this thing actually fixes a real bug. about the
> > Micha> previous issue of being able to leave the height empty, I ran
> > Micha> into a brick wall, found a work around and I don't have the
> > Micha> time to dig further. I think fixing tex2lyx will solve 99% of
> > Micha> the issues since inserting a new box sets it's heignt to
> > Micha> 1\totalheight
> > 
> > 
> > I really feel that what this is trying to fix is a bug in the qt
> > dialog. I have never seen people feeling forced to add [1\totalheight]
> > to their boxes.
> 
> Exactly. tex2lyx is 100% correct for parbox and minipage arguments. If you

That is not true, there are two real bugs here, one in tex2lyx and one in the
qt dialog/box code

in tex2lyx, if you look at the patch:

Index: src/tex2lyx/text.cpp
===================================================================
--- src/tex2lyx/text.cpp        (revision 18502)
+++ src/tex2lyx/text.cpp        (working copy)
@@ -591,9 +591,9 @@
 {
        string position;
        string inner_pos;
-       string height_value = "0";
-       string height_unit = "pt";
-       string height_special = "none";
+       string height_value = "1";
+       string height_unit = "in";
+       string height_special = "totalheight";
        string latex_height;
        if (p.next_token().asInput() == "[") {
                position = p.getArg('[', ']');

If there is no height for the box it sets it in the lyx file to 0pt and then
exports it as 0pt for. Thats how I found the original, by importing a tex file.
Fo example, the following simple case:

input:
----------------------------------
\documentclass[english]{article}
\begin{document}
\parbox{1\columnwidth}{
sample
}
\end{document}
----------------------------------

tex -> lyx -> tex: (cropping empty lines)
----------------------------------
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\makeatletter
\usepackage{babel}
\makeatother
\begin{document}
\parbox[c][0pt]{1\columnwidth}{%
 sample %
}%
\end{document}
----------------------------------

which would produce the wrong output if there was more text there.

The second bug is that there is no way to insert an empty height in the dialog.
The default is 1\totalheight which works if you insert new boxes from within
lyx but not if you import a tex file. The height element has the option for no
height (IIRC it's the length class), but there is no check for an empty height
and no way to insert it.

The patch above solves the import issue to match the lyx default state when
inserting a new parbox/minipage. I don't know at the moment how to fix the qt
dialog part (I managed to add a none height option to the list but not to make
it actually be used, when I select it lyx still changes the selection back to
0pt)

> don't believe that try to find one example where the tex->lyx->tex
> roundtrip produces different output than the original. This is not possible
> with 1.4. If it is possible with 1.5 then somebody introduced a bug.

I don't currently have lyx 1.4 to check, I may be able to run the above example
when I'm back home on Thursday.

> The only problem the LaTeX export from LyX suffers is that it writes
> optional arguments even if they are the LaTeX default (these are the only
> changes you may see in the roundtrip above), but that is purely cosmetical.
> 

It's far from cosmetical since the latex default is 1\totalheight and it writes
0pt which produces a drastically different result.

> Every other problem is a dialog issue.
> 
> 
> Georg
> 

Reply via email to