The following should work on LyX >= 2.3.1 for all operating systems:
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 pdf2; buffer-export pdf2"
If you want to know more, read the LyX
help guides in the Help
menu for more customization.
I'm not very familiar with beamer
presentations in LyX, but I will quote a passage from the beamer
manual, page 18-19 (emphasis mine):
\usepackage{pdfpages}
Commands like \includepdf
only work outside frames as they produce pages “by themselves.” You may also wish to say
\setbeamercolor{background canvas}{bg=}
when you use such a command since the background (even a white
background) will otherwise be printed over the image you try to
include. Example:
\begin{document}
\begin{frame}
\titlepage
\end{frame}
{
\setbeamercolor{background canvas}{bg=}
\includepdf{somepdfimages.pdf}
}
\begin{frame}
A normal frame.
\end{frame}
\end{document}
LyX doesn't use \begin{frame}
/\end{frame}
, it defines some custom commands instead (\lyxframe
/\lyxframeend
), but the same point applies I would guess: the \includepdf
cannot be inside a frame, so you have to place after a \lyxframeend
(EndFrame from the style menu), before the next \lyxframe
(BeginFrame from the style menu).
The second point requires an ERT. Create one with Ctrl + L (or Insert --> TeX code) just before the inserted PDF, and write
{\setbeamercolor{background canvas}{bg=}
in it. Add a second ERT just after, and add a closing brace, }
, in this. This is probably why the PDF didn't appear, because it is covered by the background colour. The braces are necessary to keep the redefinition of the background colour to that single slide.
Possible alternative, \includegraphics
Depending on what you're after, you can perhaps use the standard Insert --> Graphics to insert the page. In the LaTeX and LyX options you can add page=5
to insert page number 5 of the PDF. As this is inserted as an image, the header, footer etc. of your presentation will be visible.
Best Answer
I would suggest undoing your changes to the preamble and going to
Insert -> File -> External Material
Then under Template change to "PDF pages" then use browse to find your pdf.
I agree with the above statement because I followed it with success, but in order to insert more than one page like you said that you have under the description in the "PDF pages" if you want all of the pages you need to go to the "LaTeX and LYX Options" tab and in the options bar paste "pages=-". You should also remember that whenever you edit the preamble, you need to immediately go to Tools -> Reconfigure then restart the program in order for the changes to apply, otherwise your problems will not go away. After that, while I don't know how you have your line in the Appendix section set-up, but I used the "standard" set-up; I have not experimented further, but I don't see how the other set-ups would make a difference.
I hope this helps, I wish you luck.