<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Dear Aleks,<br>
      <br>
      thanks for the info.<br>
      <br>
      On 02.04.19 04:28, Aleks Kleyn wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:007d01d4e8fb$ce1958f0$6a4c0ad0$@org">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Cambria;
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;
        color:black;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:56.7pt 42.5pt 56.7pt 85.05pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1"><span style="color:#1F497D">Files I
          prepare separate editor which allow me organize all context.</span></div>
    </blockquote>
    <br>
    Do I understand correctly that you do not use TeXworks for preparing
    the sources and for running pdflatex?<br>
    <br>
    <blockquote type="cite"
      cite="mid:007d01d4e8fb$ce1958f0$6a4c0ad0$@org">
      <div class="WordSection1"><span style="color:#1F497D"><o:p></o:p></span>
        <p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p>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, </span><span
            style="font-size:9.5pt;font-family:Consolas">fontenc,
            inputenc and babel. </span></p>
      </div>
    </blockquote>
    <br>
    So it only happens for some documents? Does it maybe happen mostly
    for large documents?<br>
    <br>
    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.<br>
    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:<br>
    * 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...<br>
    * 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)<br>
    <br>
    One thing that might be worthwhile to check is the following:<br>
    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:<br>
    <span class="code">COPY</span> /B file.pdf+,,file.pdf<br>
    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).<br>
    <br>
    HTH,<br>
    Stefan<br>
  </body>
</html>