Add shortcut for "Export -> PDF(pdflatex)" on LyX's toolbar

Recently I got annoyed by LyX's inconvenient "Export -> PDF(pdflatex)" command.  Thus, I decide to modify my toolbar in LyX. Particularly, since I don't need the Update function (not an Adobe Reader user...), so I just removed it as well.

Today's aim: add an export shortcut for the menu File -> Export -> PDF(pdflatex), both keyboard shortcut and a button on the toolbar.

To modify LyX's toolbar, you need to go to its installation folder and find "stdtoolbars.inc". Mine is under the default path: "C:\Program Files\LyX20\Resources\ui". Then please find

Toolbar "view/update" "View/Update"
Item "View" "buffer-view"
Item "Update" "buffer-update"

After this, if you want to keep the Update button, then add this line after it:

Item "Export" "buffer-export pdflatex"

The result is shown like below

Or you can do it like me, just put the Update line into comment, i.e.

Toolbar "view/update" "View/Update"
Item "View" "buffer-view"
#Item "Update" "buffer-update"
Item "Export" "buffer-export pdflatex"

Moreover, if you love keyboard shortcut better than buttons on the toolbar, then please follow a few steps:

  1. go to "Tools->Preferences->Editing->shorcuts"
  2. under the "function" column, there is "document and window", then find "buffer-update" and remove it.
  3. find "buffer-export-custom", modify it to "buffer-export pdflatex" and configure the keyboard shortcuts as "ctrl+shift+R". (If you want to keep the shortcut for update, please choose another keyboard combination as you like)

Now you are able to use the keyboard shortcut for " File -> Export -> PDF(pdflatex)" as well! Enjoy!

Note: in similar ways, you can modify all the toolbar and shortcut you like!

ctrl+shift+R

8 thoughts on “Add shortcut for "Export -> PDF(pdflatex)" on LyX's toolbar

  1. Maarten Decat

    Hi,

    Very helpful post. One remark though: with me, "buffer-export pdflatex" mapped on exporting to latex, not to pdf. "buffer-export pdf2" did the trick.

    1. Liyun Post author

      thank you for this remark! So LyX does differ from each other on different computers...

  2. Kevin Chen

    Hi Liyun,
    Glad I found your site. I have a question regarding the "update" function of Lyx. I'm using Lyx 2.0 on Win7, with AcrobatX Pro. However, when I press the "Update" button, I'd get an error message from Lyx saying that it cannot write on the same pdf file. However, on my previous WinXP system, I received no such message when using the update button. Do you know how to fix this problem? Sorry for troubling you with this, but I would appreciate your help! Thanks so much!
    Kevin

    1. Liyun Post author

      My pleasure.

      With Acrobat X, usually you will get this warning message.... I think Acrobat has controls over the writing permission of PDF files. One way is to use other PDF viewers....or close the current acrobat window to release the control...I don't know if there is a way to configure acrobat to avoid this problem...

      1. Kevin Chen

        Well, too bad..... But thanks anyway! It's just annoying to have to close the window before previewing the output every time. Is Acrobat X really the trouble maker though? I was also using Acrobat X on my previous XP system, and it worked perfectly fine. Do you use the update function at all? What other PDF viewers would you recommend?

        BTW, your CV is very impressive!!! I'm curious why you didn't go for a PhD in economics. You'd be really good at it.

      2. Kevin Chen

        Hey, just figured it out! So there's this thing called "pdfview.exe" that is design to work around the locked pdf files. It's a routine that automatically closes the opened pdf, and then reopens it with the updated materials. The "pdfview.exe" file should be automatically installed when installing Lyx. But we'd have to configure it in the following manner for it to work properly:

        Edit --> Preferences
        "File Formats" --> PDF (pdflatex) --> Viewer = PDFview

        Some relevant technical details are discussed in this post: https://www.cfa.harvard.edu/~jbattat/computer/lyxConfiguration.html

Comments are closed.