# LyX | Automatic Wrap by Preview?

I haven't found a question post about this exact thing - please link me to one if you do:

Is it possible in LyX to set-up Wrap By Preview for TeX code (written in those TeX code boxes)? I want to set-up something that similar to Instant Preview, only for TeX.

Right now, the only way that I know of to see inside a LyX document the generated is by right-clicking on a TeX box, and clicking on `Wrap by Preview`. I want to automate that with maybe some script that can be written for LyX (or something simpler, if it's possible).

It is on purpose that there is no automatic way of doing this. ERT boxes are often incomplete by themselves. For example, I might have the ERT box:

``````\textbf{
``````

then I have some text, then in another ERT box:

``````}
``````

For more information, see this enhancement request.

Note that you can create a shortcut that opens a TeX box and wraps it in preview. That way one shortcut can do both of those things.