[texworks] problem with TeXwork

Stefan Löffler st.loeffler at gmail.com
Tue Apr 2 22:15:17 CEST 2019


Dear Aleks,

thanks for the info.

On 02.04.19 04:28, Aleks Kleyn wrote:
> Files I prepare separate editor which allow me organize all context.

Do I understand correctly that you do not use TeXworks for preparing the
sources and for running pdflatex?

> It happens at least on two documents. Source files of one of them I
> zipped and its size 241 kb. I may think about reducing size before I
> will attach to email. It does not happens for document which uses
> packages cmap, fontenc, inputenc and babel.
>

So it only happens for some documents? Does it maybe happen mostly for
large documents?

Here is some potentially relevant background to this issue. By default,
TeXworks watches .pdf files for changes. When changes are detected, the
file is reloaded (with a bit of delay). A problem can occur, e.g., with
long-running TeX processes. If a process starts writing to a pdf but
hasn't finished by the time TeXworks tries to reload the file, the file
TeXworks attempts to load is incomplete/corrupt. That's presumably why
you see the gray window. Naturally, such problems occur predominantly
with large or complex documents that take a long time to typeset. BTW:
to avoid the gray window, TeXworks temporarily disables watching for
changes when it starts the typeset process itself - hence the question
how you start typesetting - so the problem should not occur when you use
TeXworks for typesetting.
That said, I just performed some tests on my Linux machine, and at least
there it seems that TeXworks does recover from the gray window
eventually. I.e., the last detected change happens when the .pdf file is
completed, upon which TeXworks (again) reloads the now valid document. A
few theoretical possibilities why this might fail are:
* The last (final) change is missed because TeXworks is still in the
process of reloading the previous (incomplete) version. This should
usually not be reproducible, though, because the time between changes
and between reloads is not always precisely the same. One exception to
that would be if loading the pdf takes a relative long time...
* If the underlying file system uses some kind of caching and provides
TeXworks with an old/incomplete version of the pdf during loading
(though this, too, is highly unlikely)

One thing that might be worthwhile to check is the following:
When TeXworks shows a gray window but the pdf file is definitely
finished (i.e. pdflatex has finished), run the following command in a
terminal window in the directory where the pdf is located:
COPY /B file.pdf+,,file.pdf
where file.pdf is the filename. Note the + and , which should be
specified exactly as written here. This command tells Windows that the
file was updated without actually changing its contents. This should
trigger TeXworks to reload the file (thinking it was changed).

HTH,
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texworks/attachments/20190402/22391e8a/attachment.html>


More information about the texworks mailing list