6

I am using WinEdt 10 (64 bit). Today, I observed a strange behavior that I cannot understand. I would appreciate if anyone could explain why parts of my text would disappear due to a grammatical error in my text!

When I compile my text that has a grammatical error at the end of the last sentence, parts of my text disappears in the output pdf (the figure below shows a snapshot of my latex file with a duplicate word "to" at the end and its pdf output which is missing parts of its second line): enter image description here

enter image description here

When I fix the grammatical error by deleting the duplicate word "to", the disappeared part shows up! Can anyone understand why winedt/latex behaves this way?

enter image description here

enter image description here

For clarification: Lines in pdf snapshots are end-of-page and header lines, so they are not parts of the text.

Arzigoglu
  • 1,348
Salivan
  • 303
  • 1
    Can you make this happen with only that paragraph in question, plus a few packages? Could you paste that corresponding tex code, instead of giving us screen shots? – Teepeemm Mar 20 '18 at 02:41
  • 1
    When I delete any other parts of the text, this does not happen! So I couldn't produce what you ask. – Salivan Mar 20 '18 at 03:18
  • 1
    What compiler are you using? Can you compile your document using command line, instead of WinEdt? Is the result the same? –  Mar 20 '18 at 03:29
  • What did you do to get wjnedt to underline the grammatical problem? – Ulrike Fischer Mar 20 '18 at 07:19
  • @UlrikeFischer Repetead words are underlined by default. – Arzigoglu Mar 20 '18 at 11:55
  • @Arzigoglu Ah right. Never really realized this. Well we will need the actually code to test this. – Ulrike Fischer Mar 20 '18 at 12:01
  • @RobtAll I am using PDFTeXify. I do not know how to compile the document using the command line. I would appreciate if you could give me a step-by-step instructions. – Salivan Mar 20 '18 at 18:11
  • @UlrikeFischer Unfortunately, I cannot upload the whole paper and when I try to shorten the paper to include only the problematic part, the problem goes away; i.e. when there is a change in the document, the sentence does not disappear. I assume it has something to do with optimizing the length of each line and positioning each paragraph that Latex does in the background. – Salivan Mar 20 '18 at 18:15
  • 1
    Try this: Open a Windows command prompt (some people call it a "DOS box"). Type pdflatex -v and see the result. Assuming it is found: Navigate to the folder containing your tex document. Then type: pdflatex yourfilename.tex modified for your file name. Works better if no spaces in file name. Does that compile as expected? If it does, then the problem is with WinEdit. But if you see the same problem, then the problem is with your TeX code. Note: Use xelatex or lualatex as compiler, if necessary. –  Mar 20 '18 at 18:17
  • @RobtAll Thanks for the instruction. I followed the instruction and produced a pdf file, but the file does not include references---I tried to compile the document several times to make sure that all required files are produced. The produced pdf includes all my sentences; however, I do not think that I can conclude that the problem is with WinEdt, because as the references are not produced, so the whole paper is a bit shorter, and words and paragraphs are not in their original places. – Salivan Mar 20 '18 at 19:20
  • 1
    @amir In a Windows command Prompt, after running pdflatex yourfilename.tex run bibtex yourfilename and then again pdflatex yourfilename.tex twice, so to have your references compiled. – Arzigoglu Mar 20 '18 at 19:48
  • 1
    @Arzigoglu Thank you! Now, I've got my references back. As I guessed, now that everything is back, the sentence disappears again. – Salivan Mar 20 '18 at 20:02
  • 1
    @amir so WinEdt is not the source of the problem, as I guessed. Do you have an up-to-date TeX system (TeX Live or MiKTeX)? If not, try updating it. – Arzigoglu Mar 21 '18 at 04:32
  • 3
    Did you ever find out what's the problem? I got it and can't figure out what is going on. This must be the most ridiculous bug I've seen with LaTeX so far! I'm using MiKTeX 2.9.5700 on Win7 and it's impossible to find a MWE. Only a document that has the same exact spacing causes MiKTeX to fail; it outputs a line with only the first word, and the rest of the line seems to have vanished far to the right beyond the page margin. – user21820 May 12 '18 at 12:28
  • 2
    No, I could not figure out the reason. I had to change the spacing a bit to avoid that. But now, whenever I create a pdf I visually go through that to make sure nothing is left out---very frustrating! – Salivan May 15 '18 at 16:39
  • I got that frustrating problem again, and believe it might be due to the footmisc package with the hang option interacting in some weird way with the hyperref package. Any ideas or work-around that you found in the past 2 years? – user21820 Dec 10 '20 at 20:02
  • I give up; the bug is sensitive to the number of pages (even though there is a manual page-break before the issue, removing earlier pages causes the bug to vanish). – user21820 Dec 10 '20 at 21:35
  • @user21820 Unfortunately, I do not have my latex file that had this reported issue. If you do not mind, you can send your instance to me that I can share it here. If people see an example, they might be able to help us better. – Salivan Dec 10 '20 at 22:19
  • Sorry I can't share my source file. I did something that appears to fix it in my case; I removed the hang option from footmisc and replaced it with my own code: \makeatletter\renewcommand\@makefntext[1]{\setlength{\hangindent}{\footnotemargin}\noindent\rlap{\@makefnmark}\rule[0em]{\footnotemargin}{0em}#1}\makeatother. Do you remember whether you also used \footmisc with hang? If so, then maybe this is the answer. – user21820 Dec 11 '20 at 04:59
  • 1
    I had the exact same problem in my document and a comment to this question contained a "solution" which "solved" the problem for me. Could the question be reopened so that the comment can be added as an answer for future readers? – Rayllum Jun 02 '21 at 13:46
  • Is there any message in the log file? – Andrew Swann Jun 05 '21 at 09:33
  • I have not explored the log file, but I can say that there is no clear sign of this happening unless you read the output. – Salivan Jun 06 '21 at 12:49
  • I just got the bug again, this time despite not using the hang option of footmisc. I am using the article class with font size 11, and found that changing \setlength\footnotemargin{1em} to \setlength\footnotemargin{11pt} resolved the bug, so I am very sure the bug is related to footnotes... – user21820 Jun 18 '21 at 09:33
  • Do you think you could post a MWE, as a code block rather than an image, that reproduces this bug? Without that, it’s impossible to test. – Davislor Oct 22 '21 at 04:09
  • My last comment above was kind of wrong; I got the bug again and found that I can solve the bug by making a change that is supposed to be completely free of side effects! It is possible that footnote packages use some obscure LaTeX internals that triggers an overflow bug under rather rare circumstances, which is somehow tied to the internals of \setlength. Therefore, ironically, we can 'fix' the bug by just adding \newlength{\fixmissingtext}\setlength{\fixmissingtext}{1em} to the preamble!! – user21820 Feb 08 '22 at 12:35
  • In the end, I fixed the problem by completely dropping the footmisc package. After all, I was only using the bottom and hang options. These can be imitated using the etoolbox package via \pretocmd{\footnoterule}{\vfill}{}{} and the code I provided above. Sigh. DIY seems best. – user21820 Mar 23 '22 at 18:50
  • I am sad to say that despite not using footmisc or fancyhdr or any footnote-related package, the bug has returned. This is getting increasingly annoying as I have ≈ 200 pages and it is ridiculous if I have to check every single page every time I make a change... – user21820 Apr 05 '22 at 13:29

1 Answers1

4

I had the same problem in my document (and sadly also cannot upload a MWE) and "solved" it as suggested by Salivan in a comment:

Change the spacing a little

Even though it is not a real solution, but only fights the symptoms, it was the only way I could get a correct PDF.

In my case it was enough to replace : (colon, space) by :\ (colon, backslash, space) in the document, which changes the spacing only very little.

Details

For anyone interested in the problem, I put my preamble here. I removed all lines, where I'm 100% sure, that they're not related to the problem, like \newcommand, \tikzstyle, ... . Since the problem disappears with the slightest change, the preamble is still quite large.

As described in the preamble, commenting out the line \newcounter{unusedCounter} "resolves" the problem. The counter is nowhere else used in the code.

The compilation log-file in the buggy case shows for the last counter of the bibtex-part: \c@cbx@tempcntd=\count512

Maybe someone has an idea, whether this could mean something. I mean, a high powers of 2 that appears at the same time as a problem could very well be related to that problem. Still, I changed some other lines that led to a compilation where also \c@cbx@tempcntd=\count512, but the pdf-output was correct.

The preamble:

\documentclass[11pt, a4paper, twoside, cleardoublepage=plain, openright, hyphens]{scrbook}

\usepackage{etex} \usepackage[utf8]{inputenc} \usepackage[russian, ngerman, main=english, australian]{babel} \usepackage[cmex10]{amsmath} \usepackage{algcompatible} \usepackage{algorithm} \usepackage[noend]{algpseudocode} \usepackage{subcaption} \usepackage{amssymb} \usepackage{blindtext} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{tikz} \usepackage[normalem]{ulem} \usetikzlibrary{shapes,arrows,fit,calc} \usetikzlibrary{arrows.meta} \usetikzlibrary{backgrounds,calc,circuits.logic.US,positioning,intersections} \usetikzlibrary{patterns, patterns.meta} \usetikzlibrary{decorations.pathreplacing,angles,quotes} \usetikzlibrary{shapes.geometric} \usepackage{circuitikz} \usepackage{graphicx} \usepackage{makecell} \usepackage{xspace} \usepackage{arydshln} \usepackage{mathtools} \usepackage[usestackEOL]{stackengine} \usepackage{scalerel} \usepackage{titletoc} \usepackage{enumerate} \usepackage{lmodern} \usepackage{bibentry} \usepackage{multirow} \usepackage{booktabs} \usepackage[official]{eurosym} \usepackage{amsthm} \usepackage{soul} \usepackage[most]{tcolorbox} \usepackage[T1]{fontenc} \usepackage{pifont} \usepackage{pdftexcmds} \usepackage{catchfile} \usepackage{ifluatex} \usepackage{ifplatform} \usepackage{ifthen} \usepackage{cancel} \usepackage{microtype} \usepackage{mathtools} \usepackage{pdflscape} \usepackage{enumitem} \usepackage{filecontents} \usepackage{etoolbox} \usepackage{framed} \usepackage{fancyhdr} \usepackage{xpatch}

\newcommand{\pageeq}[2]{\ifthenelse{\pageref{#1}=\pageref{#2}}{p.~\pageref{#1}}{pp.~\pageref{#1}-\pageref{#2}}} \newcommand{\Pageeq}[2]{\ifthenelse{\pageref{#1}=\pageref{#2}}{Page~\pageref{#1}}{Pages~\pageref{#1}-\pageref{#2}}}

\let\newclassictheorem\newtheorem \let\classicproof\proof

\tcbset{ thmbox/.style={ enhanced, breakable, sharp corners=all, fonttitle=\bfseries\normalsize, fontupper=\normalsize\itshape, top=0mm, bottom=0mm, right=0mm, colback=white, colframe=white, colbacktitle=white, coltitle=black, attach boxed title to top left, boxed title style={empty, size=minimal, bottom=1.5mm}, overlay unbroken ={ \draw (title.south west)--(title.south east); \draw ([xshift=3.5mm]frame.north west)|-% (frame.south east)--(frame.north east);}, overlay first={ \draw (title.south west)--(title.south east); \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west); \draw (frame.north east)--(frame.south east);}, overlay middle={ \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west); \draw (frame.north east)--(frame.south east);}, overlay last={ \draw ([xshift=3.5mm]frame.north west)|-% (frame.south east)--(frame.north east);}, }, L/.style={thmbox, overlay unbroken ={ \draw (title.south west)--(title.south east); \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);}, overlay first={ \draw (title.south west)--(title.south east); \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);}, overlay middle={ \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);}, overlay last={ \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west);}, }, LQ/.style={thmbox, overlay unbroken ={ \draw (title.south west)--(title.south east); \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west); \node[anchor=east] at (frame.south east) {$\square$};}, overlay first={ \draw (title.south west)--(title.south east); \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);}, overlay middle={ \draw ([xshift=3.5mm]frame.north west)--([xshift=3.5mm]frame.south west);}, overlay last={ \draw ([xshift=3.5mm]frame.north west)|-([xshift=15mm]frame.south west); \node[anchor=east] at (frame.south east) {$\square$};}, }, }

\newcommand*\quotefont{\fontfamily{LinuxLibertineT-LF}}

\pagestyle{fancy} \renewcommand{\chaptermark}[1]{\markboth{#1}{}} \fancyhead{} \fancyhead[RO]{\slshape\nouppercase{\rightmark}} \fancyhead[LE]{\slshape\nouppercase{\leftmark}} \fancyfoot{} \fancyfoot[LE,RO]{\thepage}

\newclassictheorem{hypothesis}[]{Hypothesis}

\newtcbtheorem[number within = section]{theobox}{Theorem}{thmbox,L, before skip=1em plus 0.5em, after skip=1em plus 0.5em}{thm} \newtcbtheorem[use counter from=theobox]{defbox}{Definition}{thmbox,L, description delimiters parenthesis, separator sign none, before skip=1em plus 0.5em, after skip=1em plus 0.5em, fontupper=\normalfont}{def} %% Many more \newtcbtheorem[use counter from=theobox] \newtcbtheorem[]{proofbox}{Proof}{thmbox,LQ, before skip=1em plus 0.5em, after skip=1em plus 0.5em}{proof}

\newcommand{\thmCounter}{tcb@cnt@theobox}

\newclassictheorem{algo}[\thmCounter]{Algorithm} \newclassictheorem{algo-sketch}[\thmCounter]{Algorithm Sketch}

\makeatletter \renewcommand\thealgorithm{\thesection.\arabic{\thmCounter}} @addtoreset{algorithm}{\thmCounter} \makeatother

%%%%%%%%%%%%%%%%% % Comment the following line out to dissolve problem \newcounter{unusedCounter} %%%%%%%%%%%%%%%%%

\usepackage[ backend=biber, style=ieee, sorting=nyt, bibencoding=utf8, defernumbers=true, maxnames=10, citestyle=numeric-comp ]{biblatex}

\assignrefcontextkeyws[labelprefix=J]{J} \assignrefcontextkeyws[labelprefix=C]{C} \assignrefcontextkeyws[labelprefix=B]{B} \assignrefcontextkeyws[labelprefix=W]{W}

% Pseudo-Code \makeatletter \def\BState{\State\hskip-\ALG@thistlm} \makeatother

% \hyphenation, \newcommand, \tikzstyle, ... \usepackage[bookmarks=false]{hyperref}

Rayllum
  • 167
  • 9
  • No, please, this isn't a solution and shouldn't be treated as one! Can you confirm whether you are using footmisc or not? – user21820 Jun 18 '21 at 09:14
  • 1
    @user21820 This isn't a great solution, but it does solve the problem. So until someone can reproduce the problem and is willing to share that example with the rest of us, "change the spacing a little" is the best that we'll get. – Teepeemm Jun 21 '21 at 01:40
  • do you still have a sample document that shows this behaviour? – David Carlisle Sep 01 '21 at 15:03
  • @user21820 Sorry for the late reply. As you can see now, I did not use footmisc. – Rayllum Oct 22 '21 at 02:26
  • @DavidCarlisle Yes, I still have the file, also sorry for taking so long to reply. I tried working it down to an MWE, but even removing an unused counter "resolved" the problem. (See the added preamble in m answer). – Rayllum Oct 22 '21 at 02:28
  • @Rayllum I assume that if adjusting the preamble causes the change, then adjusting the text also causes the change. Are you able to add enough text so that something in the source file disappears before reaching the pdf? Ideally, you'd find a working example, even if it's not minimal. – Teepeemm Oct 22 '21 at 02:48
  • Without any MWE that reproduces this bug, I’m afraid there’s not much I can do for either you or the original asker. All I know is that there’s some document that has it. – Davislor Oct 22 '21 at 04:08
  • @Rayllum: Wait so do you have an example (no need to post it) that does not use footmisc but has the bug? – user21820 Oct 22 '21 at 05:54
  • @Rayllum you still have not provided an example of the problem so it's impossible to even guess an answer sorry. You need to provide a test document not a preamble that shoiws no problem. It doesn't have to be long (you can probably delete most of the preamble) but it does need to be an example of the problem. – David Carlisle Oct 22 '21 at 08:03
  • @Teepeemm Your assumption is right. Weirdly enough, for some cases even removing text on a page far before the disappearing text (including many \clearpages inbetween) resolves the problem. Sorry, I don't understand your question; what do you mean by "before reaching the pdf"? – Rayllum Oct 23 '21 at 01:29
  • @user21820 Yes, exactly. I use another footnote-related-package: fancyhdr – Rayllum Oct 23 '21 at 01:30
  • I'd really like to provide a MWE, but I cannot since after only little changes the problem disappears. Thus, I cannot delete enough of the non-publishable text. As a LaTeX-non-expert I still provide the information I have, because maybe there's a way I didn't think of to find the cause of the problem. Like a compilation in some sort of debug-mode. – Rayllum Oct 23 '21 at 01:31
  • Text disappearing between the tex source code and the resulting pdf would be a serious bug, which is why the topic gets such attention. But if the only thing users finding this bug can tell us is "it sometimes happens", then that's not enough for us to even start. – Teepeemm Oct 23 '21 at 01:47
  • @Teepeemm I think I understand you now, you were asking me to add text to the preamble. I'm sure I wouldn't be successful, since I couldn't even work my way from the problematic file to a MWE, sorry. I thought about showing (a limited audience) via ScreenShare what happens, but I don't think any knowledge can be gained from it. – Rayllum Oct 23 '21 at 02:26
  • @Teepeemm: Does it help if I believe that the bug is caused by a really fat box that gets inserted after the first word on the line, which pushes everything else off the page to the right? What I cannot fathom is how a footnote-related package can do that even when there is no footnote on that page. – user21820 Oct 23 '21 at 03:23
  • @Rayllum: I am completely guessing in the dark, but I think that this bug is caused by some deeply embedded overflow bug, because the bug just popped up again for me and I found that merely adding or removing a \setlength of a completely unused length can fix it!! This should not even change the spacing, nor any bit of the layout, but somehow has an effect! – user21820 Feb 08 '22 at 12:21
  • @user21820 I agree. For me, commenting out an unused counter, which also has no impact on the spacing, "resolved" the problem. Moreover, the counter has "number" 512, which is a high power of 2, indicating an overflow problem. If wish there was a way to see intermediate steps of the latex compilation... – Rayllum Feb 09 '22 at 15:24
  • @Rayllum There is a way to see intermediate steps, and lots of people are really interested in seeing this bug. But it requires someone to post (anywhere) a complete example. We've already established that whatever is happening is sensitive to the smallest change, so just the preamble is insufficient. – Teepeemm Feb 09 '22 at 16:03
  • @Teepeemm: I am unable to get a working example that does not have personal identifying information. Even changing the title causes the bug to disappear! One day, when I have nothing to do, I will try to get an anonymous example. But right now, that's kind of impossible. – user21820 Feb 09 '22 at 19:01
  • @Teepeemm What is this way to see intermediate steps? – Rayllum Feb 10 '22 at 09:03
  • @user21820 I have the same problem and I had multiple of such days. But I can only change so little before the bug disappears, that the document still has over 100 pages full of content that I cannot upload. – Rayllum Feb 10 '22 at 09:03
  • @Rayllum you can always see the steps lax is taking add \tracingall at a suitable point – David Carlisle Apr 05 '22 at 13:34
  • After discussion with Ulrike Fischer and David Carlisle and Joseph Wright in chat, I discovered that LyX was somehow the culprit. When I compiled the same LaTeX source file using TeXworks instead of LyX (using the same pdflatex and the same MikTeX installation) and the bug was fixed (everything looks identical except the missing text appears). Are you also using LyX? I'm guessing it's a difference in command-line options but I don't know what command LyX runs. CC @Teepeemm – user21820 Apr 05 '22 at 16:15
  • My comment above is wrong. LyX was not the culprit. It was simply that TeXworks had an extra synctex=1 command-line option. Although the bug vanished upon turning that option on, I can't tell whether it is just luck (since changing almost anything destroys the bug anyway). But showoutput is identical except for the synctex-related magic-markers, down to the claimed resources used by TeX! So something is deliberately adding the ", glue set < -20000.0" (causing the bug) after the output routine. CC @Teepeemm – user21820 Apr 13 '22 at 18:29
  • Also don't have a MWE but I have experienced the same behaviour in two column documents where several multi-line footnotes were being placed on the same page. My workaround has been to use inline links to documents using \href to reduce the use of footnotes. Maybe this can help someone. – quabbage Jun 21 '22 at 16:28