On Sat, 28 May 2011 18:12:13 +0200
Michal <ms-li...@ms.sebdan.com> wrote:

> Recently I've reinstalled both MiKTeX and LyX from scratch
> using official installers for both, and my documents are not
> compilable anymore, instead I get the following messsage:
> 
>     ! LaTeX Error: File `preambles/common.sty' not found.
    I've investigated this further and it turned out that configure.py
incorrectly sets the option

    \tex_expects_windows_paths

to 'false' on my system, which in turn causes the \def\input@path{{...}}
line in temporary .tex files generated by LyX to contain cygwin-specific
path (starting with '/cygdrive/'), which was the reason of LaTeX not
finding external files.

    The reason for this 'misbehavior' is the following line in
configure.py, taken from checkTeXPaths():

latex_out = cmdOutput(r'latex "\nonstopmode\input{%s}"' % inpname)

    Latex executed this way won't work as intended when there are spaces
in inpname (which is a full path to temporary file). It still works most
of the times because inpname for some reason contains the DOS 8+3 path
whenever it is available, for example on test system of mine:

    c:/docume\string~1/ms/ustawi\string~1/temp/tmpyhdnnl.ltx

('\string' is added a few lines earlier before each tilde) but on a
system I'm currently using it contained:
    c:/documents and settings/ms/ustawienia lokalne/temp/tmp_fnkii.ltx

which confused LaTeX and resulted in a problem I've experienced.

    The more correct way of executing LaTeX is for example used in
checkTeXAllowSpaces():

if os.name == 'nt':
    latex_out = cmdOutput(LATEX + r""""\nonstopmode\input{\"a b\"}" """)
else:
    latex_out = cmdOutput(LATEX + r"""'\nonstopmode\input{"a b"}' """)

... and it additionally uses the LATEX variable, so I think
checkTeXPaths() should be corrected similarly. BTW: isn't it another bug
to not to add space after LATEX? Also: shouldn't checkTeXPaths() also
rely on the previously executed checkTeXAllowSpaces() result and try to
avoid spaces when these are unsupported (couldn't test it, because
MikTeX's latex.exe apparently supports spaces)?

    Anyway, the attached patch (wrt LyX 2.0 'official' configure.py)
helped and my problem is now gone.

    Could someone test and apply this patch (I'm not a LyX developer
myself)?

Regards,
MichaƂ Skrzypek

Attachment: configure.patch
Description: Binary data

Reply via email to