6

With Texmaker, is it possible to automatically save .tex files currently opened every 5 minutes?

I have found this related post, but the question is about saving automatically whenever compilation occurs. I sometimes write for a long time without compiling, so I don't find that safe enough. I would like the .tex file to save automatically every 5 minutes, regardless of how long ago it was last compiled.


I am using Texmaker 4.1 on Ubuntu 14.04 trusty.

15
  • What is your precise question? Do you want to shorten the auto-save time intervall? – user31729 Jun 22 '14 at 21:49
  • 2
    In Preferences > Editor, there is a checkbox that reads "Backup document every 10 min"; it doesn't allow you to set a custom time. That's a dangerous feature, though: what if you experiment by removing a large part of the code and texmaker saves your file automatically? Better to save when you actually want to capture the state of your document, or, even better, use some version-control tool. – jub0bs Jun 22 '14 at 22:09
  • 1
    @Jubobs It is dangerous only if you don't also use version control. But version control alone isn't enough if, for example, your editor sometimes crashes or freezes or if your entire machine has a habit of simply switching itself off for no reason. (For historical reasons, my autosave is set to 1min intervals for just this reason. I'm not going to commit to the repo every 1min else I'd never actually write anything!) But a good editor will autosave while maintaining the ability to undo changes so you have a further safety net. (svn revert is for when all of that fails!) – cfr Jun 22 '14 at 22:36
  • 2
    It's Options -> Configure Texmaker -> Editor. – Torbjørn T. Jun 23 '14 at 10:50
  • 1
    I'm a Mac user, so I don't know what Texmaker looks like on Linux. However, this suggests that you should follow, Options, Configure Texmaker, Editor. – jub0bs Jun 23 '14 at 10:52
6

Accessing Texmaker's autosave feature

Texmaker (at least 4.1 and newer) has an autosave feature. How you access it depends on your platform.

  • On Linux (and Windows?), you need to follow Options > Configure Texmaker > Editor.
  • On Mac OS X, you need to follow Texmaker > Preferences > Editor.

You should then see a checkbox that reads "Backup [sic] documents every 10 min". As of Texmaker 4.2, the time interval between two autosaves is 10 minutes and cannot be adjusted by the user.

enter image description here


Compiling often is good

In my opinion, you should compile relatively often. The benefits of compiling often are discussed in the answers to this Programmers.SX question, and apply to TeX & friends as well.

In a nutshell, you can think of compilation as a form of feedback. Compiling often means a short feedback loop: if you make a mistake, you'll find out about it more rapidly and you'll be able to correct it right away. By compiling comparatively less often, you expose yourself to the risk of getting into tricky situtations that you may have trouble extricating yourself from.

Autosave is (mostly) evil

Autosave features such as that offered by Texmaker are dangerous. Imagine the following sequence of events.

  1. Your document is a state that you're not happy with (perhaps you're making wild experiments with it, but you're not yet sure that you're happy with the results).
  2. Texmaker's autosave feature saves your document.
  3. You inadvertently close Texmaker.

The last "good" version of your file is now irremediably gone! You could launch Texmaker again, reopen your file, but you wouldn't be able to undo any of the "bad" changes, because Texmaker's undo list was cleared when the app was closed. This horror story, which isn't that farfetched, is scary enough to keep me away from using any form of autosave.

Use a Version Control System (but not as an autosave!)

You should use some Version Control System instead of using Texmaker autosave feature. A VCS such as Git encourages you to take a snapshot of your project every time you feel that recording the current state might be useful. You can then move back and forth between versions, compare versions to see what changed, etc.

However, emulating some autosave feature with a VCS is wrong, IMO. For instance, using cron to automatically commit every n minutes is completely at odds with Git's philosophy. Each snapshot should instead be taken in a conscious manner and have some meaning attached to it, instead of being created in a rather arbitrary fashion, when n minutes happen to have elapsed since the last one.

1
  • 2
    Automatic backup is NOT autosave. Texmaker backup option creates a *.tex.bak file without erasing or modifying the original *.tex (so your dangerous exemple cannot happen here). It's a perfectly fine and safe feature to use (typically a lifesaver against losing all your edits if your computer crashes before you could save). – Yann May 19 '16 at 23:07
0

Honest answer is Texmaker does not have auto save feature.

Solution for me was to install TeXstudio.

TeXstudio builds on Texmaker and has many additional features including auto save enabled by default.

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.