# How to write raw text verbatim in LyX?

I want to write PlantUML diagrams from within LyX, and I want to put the result right into the document itself. To do so, I attempted to create a comment environment, in which I put the diagram description.

Basically, PlantUML scans a directory for a bunch of text like the following:

@startuml foo.png
(A) --> (B) : x
(B) --> (C) : y
@enduml


...converts it on the fly to something GraphViz understands, then writes the output in foo.png.

To do this, I tried to put the PlantUML source in a comment block. However, this results in the following output in the LyX file:

\begin_inset Note Note
status open

\begin_layout Plain Layout
@startuml foo.png
\end_layout

<snip/>

\end_inset


I tried to work around this by putting the source in an ERT block, but this simply adds a \begin_inset ERT, without removing the \begin_layout lines. How can I work around this?

-
Why not use Tex code blocks? – Charles Stewart Mar 14 '11 at 9:50
@Charles That's what I meant by "ERT" (Evil Red Text), which is supposed to allow raw TeX to be inserted. – badp Mar 14 '11 at 9:53
@Seamus Because with others editors I can't keep up with the lesson while taking notes :) – badp Mar 14 '11 at 11:35
Lyx 2rc1 is marked Please do not use these for any serious work! They are only provided for testing and development purposes. - if you don't actually need any of the features of Lyx 2, I recommend "downgrading" to 1.6.9, which I guess will behave as I've seen. – Charles Stewart Mar 14 '11 at 13:14
A release candidate which you're not supposed to use except for development purposes? Now that's a novel idea… :D – hheimbuerger Mar 18 '11 at 8:54

## 1 Answer

I don't have the same problem, but to document fully what I see: your Plant UML lines when placed in a Tex code block in my Lyx 1.6.8 are represented in the .lyx file so:

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout

@startuml foo.png
\end_layout

\begin_layout Plain Layout

(A) --> (B) : x
\end_layout

\begin_layout Plain Layout

(B) --> (C) : y
\end_layout

\begin_layout Plain Layout

@enduml
\end_layout

\end_inset

\end_layout


Using Lyx's export to Latex gives the original three lines back in the exported .tex file.

I count this as "works for me" - do you see or want a different behaviour?

-
That's what I see, and that's bad, because I don't want to export to Latex to update the images :) – badp Mar 14 '11 at 14:05
@badp: Now I understand the problem. You could put Latex code to create an external file using filecontents and run Plant UML on that. Do you want some example code, or is that clear? – Charles Stewart Mar 14 '11 at 16:03
+1 because I don't think an earnest and competent attempt at help should ever result in -1. – denilw Mar 30 '11 at 23:15