# LyX does not display definitions in the LaTeX preamble

I have defined the following preamble in my LyX document:

\setlength{\parindent}{0pt}
\newcommand{\setR}{\mathbb{R}}


The first one is because the language I write in doesn't use indentations in the first line of a paragraph.

After compiling and displaying with pdflatex, I see the behaviour I expected, but in LyX itself, they are ignored. Is there a way to make LyX show them?

• Hi, welcome. For the first: remove the \setlength from your preamble, and instead go to Document --> Settings --> Text layout, and set Indentation to Custom, 0pt. – Torbjørn T. Sep 2 '17 at 16:30
• In general, unless you use the LyX GUI to make settings, LyX will not display something. But as you noticed, it will be shown in the PDF output. This is partly why LyX does not claim to be WYSIWYG. LyX does not in general parse LaTeX that the user enters into ERT or custom preamble (an exception to this is if you import a TeX file via File > Import). – scottkosty Sep 2 '17 at 16:36
• I'm getting an error message, "An error occured while running: tex2lyx -f "mymacros.tex" "mymacros.lyx" When trying to import (I chose import -> Latex (plain)) – Bary12 Sep 2 '17 at 16:45

For the paragraph indentation, don't use \setlength in the preamble, but instead go to Document --> Settings --> Text layout, and define the paragraph separation here:
For \setR, if you define this using Insert --> Math --> Math macro instead, it will display as you'd like it to, while you can still input it with \setR.