2

Each time I compile Kile scrolls back to the beginning of the document. I would like to avoid this, it makes it very hard to write text as I need to browse back to the section I am editing each time. Any suggestions ?

5
  • Suggestion: If you're just editing text and aren't fine tuning placement of floats etc., just don't recompile so often. That's a bad habit anyway. – Skillmon Nov 15 '18 at 13:47
  • IF essential this may be possible if you are compiling to PDF (but NOT recommended, as you will see) 1) you will need to have an external pdf viewer outside your compile sequence but include synctex generation. 2) have a viewer that is able to reload itself on command. Now for your requirement, whilst you work you are halfway with some edits, you forward search to same PDF location in viewer & recompile As the link is broken tex goes to start and pdf is exactly as you left it. So you can inverse jump to previous point in tex. BUT tex and pdf are out of sync so you need to reopen pdf, not ideal – user170109 Nov 16 '18 at 1:02
  • Just noticed a similar request here tex.stackexchange.com/questions/309942/… answer was to change call to okular and use F5 – user170109 Nov 16 '18 at 1:31
  • There are no such options in most (La)TeX compiler as I have known so far. However, if it is necessary that you have to compile very often and to keep the output in the same place, I suggest using Overleaf -- it does this very well as default. Anyway, I don't think that compiling too often is good. – user156344 Nov 16 '18 at 7:42
  • Also, if you are just editing text or picture, etc., as @Skillmon say, and not sure if the output is good (so you have to compile so often), I suggest you should make a new .tex file and copy all your text/pictures, which need editing, to the new file. The new file's output is only 1-2 pages long -- and it is very easy to scroll and find text in just 1-2 pages. When you see that the output is good enough, just copy the source code back from the new file to the original file and then just don't care about it anymore :) – user156344 Nov 16 '18 at 7:47
1

When an error is encountered during the compilation, Kile opens the location of the first error. With some kinds of errors, Kile cannot determine where the error is located, and so it jumps to the beginning of the document. For example, this happens frequently with missing closing brackets.

The best thing is to investigate the error output (click on "Output" in the bottom menu and scroll until you find the error). When the output is long and/or you cannot find the error in it, run the compilation on command line (e.g. pdflatex my-document.tex or latex my-document.tex); the compilation will stop with a helpful message explaining where latex came to the conclusion that something is wrong, and if you investigate that spot in your input, you'll usually be able to correct it. (Press x on the command line to stop attempting further compilation after the first message.)

If you do not care to correct the compilation error (e.g., you have a coauthor who is much better than you at finding the problematic spot), then you can switch off the "Jump to first error" option. It's a tickbox in Kile's Settings > Configure Kile > Build > PDFLaTeX (the last part may be different; if you're compiling to DVI, it would be just LaTeX).

5
  • In addition to jumping to the top if it can't find the error, if there are no errors, Kile will jump to the top of the document with this setting checked. Unchecking it fixed this very annoying behavior, thank you! – zaen Nov 26 '19 at 17:32
  • Could it be that the command run by kile to compile the document always ends with an error exit code? If it is a script, it might help to put exit 0 on the last line of the script - but then kile will not know when the compilation fails, it will not highlight failed jobs with red color in the "Log and Messages" pane, and THAT can be very confusing, especially since after a couple of months, you forget that your script always exits gracefully, no matter how serious trouble it encountered during compilation... – Ansa211 Nov 26 '19 at 17:46
  • The behavior is pretty erratic, actually. I just defined a command to be able to type monospaced code as per this question and now the generated PDF jumps back to the top again with QuickBuild. Deleting the \newcommand line and the \code commands restores the functionality of staying on the current page when recompiling. – zaen Nov 26 '19 at 18:00
  • Oh, are you talking about the pdf scrolling back to the beginning? My answer is meant to adress issues with kile EDITOR view jumping to the beginning of the (main) .tex SOURCE file... For the pdf view, I prefer to have the document opened in okular with automatic reloading set on. This means there is no automatic jump to the last edited position (unlike if I were using ForwardPDF at the end of each compilation), but at least the view stays on the same page (in terms of its number). – Ansa211 Nov 27 '19 at 11:22
  • Yes, that's what I ended up having to do, just turned live preview back on. I just set the reload timer to be long enough that I don't get errors when I pause in the middle of typing an equation and have been pleasantly surprised at how well the live preview handles scrolling the PDF to correspond to where you are in the editor. – zaen Nov 28 '19 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.