Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use LyX 2.0.4 (on Mac OS 10.7) and would like it to do the following:

whenever I hit "View" it should automatically save the pdf output of the lyx file in the same folder the lyx file resides. Whenever I hit "View" again it should overwrite the older version of the pdf. Is that possible?

This is similar to the behavior I know from TeXShop.

share|improve this question

2 Answers 2

up vote 9 down vote accepted

First go to Tools > Preferences > Output and change "Overwrite on export" to "All files". Make sure you know what that means and that you are comfortable with that. Apply that preference change.

Then go to Help > About to find out where your "Library directory" and "User directory" are. For example, mine are

library directory: /usr/share/lyx

and

user directory: ~/.lyx/

Navigate (e.g. in your file browser) to your library directory and go to the ui folder and copy stdtoolbars.inc to the ui folder of your user directory. So in my case I copied /usr/share/lyx/ui/stdtoolbars.inc to ~/.lyx/ui/stdtoolbars.inc

Now edit stdtoolbars.inc in your user directory: You want to edit the line below

Toolbar "view/update" "View/Update"

Change

Item "View" "buffer-view"

to

Item "View" "command-sequence buffer-view; buffer-export pdf2"

If you want to know more, read the LyX help guides in the Help menu for more customization.

share|improve this answer
    
+1 for the cool idea to implement this on the UI level by a simple command sequence –  Daniel Sep 12 '12 at 9:17
    
Thanks a for the detailed instructions. Unfortunately after following the steps and hitting view on a file I get the message "SIGSEGV signal caught! Sorry, you have found a bug in LyX..." and thereafter LyX crashes each time I hit view. But the problem dissapears if I delete the stdtoolbars.inc file and undo the setting. Guess I'll have to send a bug report. –  Michael Sep 13 '12 at 14:43
    
@Michael do you also get that message if you use that command in the mini-buffer? Type alt-x and then paste command-sequence buffer-view; buffer-export pdf2 and press return. –  scottkosty Sep 13 '12 at 16:18
    
Thanks for your continued interest. I just tried what you suggested but it crashed again (this time on a different Mac running OS 10.8 with LyX 2.0.0). Didn't give me the error message though. Might be a Mac related problem? –  Michael Sep 13 '12 at 18:48
    
@Michael yes, it might be. I might be at fault for suggesting you run these commands. LyX allows for a lot of customization and with that freedom sometimes comes a price. If you're up for it, I'd suggest you try one more thing: switch the order, so try running command-sequence buffer-export pdf2; buffer-view –  scottkosty Sep 13 '12 at 19:25

Alternative workaround: map buffer-export pdf2 to a keyboard shortcut in Editing->Shortcuts in Preferences.

How to use it: Preview in OS X (and many other pdf viewers as well) will update open pdf's whenever they are changed, so, if you just run the export command once and then open the pdf and leave it open, every time you run the export command again the pdf will get updated. I usually have my windows arranged such that I can see LyX and Preview at the same time, so this works out almost as well as having LyX actually open the pdf (like it does when you run the "View" command -- which somehow renders and opens the pdf without crashing LyX...).

Why use this method: As was the case for Michael, in OS X LyX randomly crashes when I try to do command-sequence buffer-view; buffer-export pdf2 as suggested by @scottkosty. It seems that some other users are able to use the sequence without crashing, so it might be best try that first. The workaround given here isn't exactly what Michael asked for because LyX does not open the pdf, but it is the closest I have been able to get that works without crashing.

share|improve this answer
    
Thanks I will try that out. –  Michael Jan 29 '13 at 13:43
    
I've talked with LyX developers about this and this is the approach they recommend. –  badp May 10 '13 at 14:31
    
Please don't start answers with "I have the same issue". People might think you don't post a solution but a "me too" post instead. –  Martin Scharrer May 11 '13 at 9:26

Your Answer

 
discard

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.