TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes it is useful to open a document as read-only (e.g. when copy/pasting from an old document to a newer one, and wanting to avoid any accidental modifications to the old document). This functionality resembles the one in LibreOffice, specifically the 'Edit File' button which is toggled on by default, and can be toggled off to disable editing.

How can I open a document in LyX and disable editing?

share|improve this question

The easiest way to disable editing in LyX is to View > Toolbars > Command buffer (or simply alt+x, and in the command buffer executing


To make the document editable again you need to redo the above.

If you do this often, then it would be easier to define a new menu entry (see related bug report). Proceed as follows (on Linux):

  • Copy /usr/share/lyx/ui/stdmenus.inc to ~/.lyx/ui/
  • In ~/.lyx/ui/stdmenus.inc find the line containing Menu "document"
  • Right after that line insert:

    Item "Disable Editing|E" "buffer-toggle-read-only"
  • Save config file and restart LyX

This adds a Document > Disable Editing menu item, toggled off by default, which can be toggled on to disable the editing of the current file.

As pointed out in the comments, alternatively one can add a keyboard shortcut. It's easier to set up because you can do it in LyX. In Tools > Prefs > Editing > Shortcuts click on New and put buffer-toggle-read-only in Function field and for the shortcut you could choose, say, F8. Now you can use F8 to toggle on/off the read-only status of the currently edited file.

NOTE: This read-only status of the currently edited file applies only to the current buffer within LyX. It does NOT affect the file-system properties of the file (i.e. you can still rm the file even if you toggled it as read-only while editing it in LyX).

share|improve this answer
An alternative to adding a menu shortcut is adding a keyboard shortcut. Although this is not quite as easy to use (you have to remember what key combination you chose!) it's easier to set up because you can do it in LyX. In the preferences under editing->shortcuts, click new and put buffer-toggle-read-only in the function field. – Jim Oldfield Aug 31 '14 at 13:59
Good point, thanks. I included this in the answer. – landroni Aug 31 '14 at 14:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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