2

I'm working on a document in LyX and I'm trying to create a frame around some verbatim text. I've tried a number of different things including ERT \begin{frame}[fragile] and \end{frame} around the block and also using beamer-fragile module. However this simply doesn't do what I need to - the PDF, instead of the frame around the block, contains two small rectangles and text fragile] before the verbatim block. Here's what I've got in lyx:

enter image description here

And here's what I am getting in PDF:

enter image description here

Exactly the same result is produced if I use beamer-fragile module instead of ERT. I'm using LyX 2.0.7.1 (updated from 1.6 today) on OS X 10.9 if that matters. How can I get the frame around the block?

  • Is this a document in beamer, or just a plain article-style document? – Werner Mar 1 '14 at 0:42
  • Note that there is an example in examples/beamerlyxexample.lyx – scottkosty Mar 1 '14 at 2:18
  • Also note that this is much easier in LyX 2.1. Since you just upgraded to 2.0.7.1 you might want to consider just skipping to 2.1 beta 2. – scottkosty Mar 1 '14 at 2:20
  • @scottkosty Upgrading to 2.1 is definitely an option. How do I do this with 2.1 then? I don't seem to find the right option. – Aleks G Mar 1 '14 at 12:30
  • I added an answer. Check out Help > Specific Manuals > Beamer Presentations. It's new in 2.1 and describes how much easier things are in 2.1 over 2.0.x – scottkosty Mar 1 '14 at 15:50
0

In 2.1 there is an easier way. I really recommend reading the (brand new) Beamer LyX manual. Go to Help > Specific Manuals > Beamer Presentations

To change a normal frame to a fragile frame, put the cursor at the beginning of the frame (in the following screenshot, this means after the red text "Frame" and before the "Default Overlay Specifications"). enter image description here

Then change the environment from Frame to Frame (fragile) by going up the top left as shown here:

enter image description here

And clicking on FragileFrame

enter image description here

You should end up with

enter image description here

  • Thanks, it does do the trick! I had to change the document class to "beamer presentation" - which in turn changed all my section titles to include words "section" and "subsection" - I'll need to get rid of them - and renumbered all my figures using a three-part notation - I'll need to fix these too - but at least I managed to get verbatim text inside a frame! – Aleks G Mar 1 '14 at 21:28
  • @AleksG Note that this new beamer implementation is, well, new. So if you find any bugs or have ideas to make it better please let us know at lyx.org/trac – scottkosty Mar 2 '14 at 2:38
2

the syntax

\begin{frame}[fragile]

comes from beamer and it does not make a visible frame box around the content, a "frame" in beamer is one slide of the presentation.

But it seems you are not using beamer (you should always post a complete small document so we don;t have to guess) in which case you are using the standard latex \frame command which is intended to be used with a different syntax \frame{foo} does put a tight visible box around its argument foo' so

\begin{frame}[fragile]

is equivalent to

{\frame{[}fragile]

so \begin starts the group the \frame takes just the [ as its argument and draws a box around it and then fragile] is typeset as text.

You can not put verbatim material in the argument of any command so you can not directly use \frame or \fbox but there arepackages to make framed environments which you can use to wrap verbatim, eg the framed or mdframed packages or fancyvrb.

  • Or tcolorbox. – Gonzalo Medina Mar 1 '14 at 1:12
  • Oh, ok, that makes sens now. – Aleks G Mar 1 '14 at 12:31
  • Where can I read what the property fragile means? – Royi Jun 4 '17 at 20:14
  • it's beamer terminology so the beamer package documentation (texdoc beamer) (It's only vaguely related to the use of "fragile" for latex fragile commands) – David Carlisle Jun 4 '17 at 20:18

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.