Hello,

First of all, I'm still fairly new to Latex, so please excuse me if this doesn't make sense. I'm using LyX to write a thesis with lots of programming code snippets. I'm using indentation to separate paragraphs and LyX correctly keeps the first paragraph after a title, an enumeration, a figure, etc. not indented. A paragraph after LyX-Code are not indented, and it makes sense because the paragraph can be easily told apart form code.

Program listing insets doesn't follow the same rules. Paragraphs after listing insets are indented even if they are conceptually identical to the LyX-Code environment. My questions are: Why does this happen? And, is there a way to globally prevent the indentation of paragraphs following listing insets?

I've attached an example showing the different behaviours.

Best regards and thanks,
Álvaro M.


This is the output of "lyx -version":
LyX 1.5.5 (Sun, May 11, 2008)
Built on May 28 2008, 15:56:07
Configuration
 Host type:                    i486-pc-linux-gnu
Special build flags: aiksaurus pch warnings use-aspell use-ispell
 C   Compiler:                 gcc
C Compiler LyX flags: C Compiler flags: -Wextra -Wall -g -O2
 C++ Compiler:                 g++ (4.1.2)
C++ Compiler LyX flags: C++ Compiler flags: -Wextra -Wall -g -O2 Linker flags: Linker user flags: -Wl,-z,defs -Wl,--as-needed
 Qt 4 Frontend:
     Qt 4 version:        4.2.1
 Packaging:                    posix
 LyX binary dir:               /usr/bin
 LyX files dir:                /usr/share/lyx

The example file:
#LyX 1.5.5 created this file. For more info see http://www.lyx.org/
\lyxformat 276
\begin_document
\begin_header
\textclass article
\language english
\inputencoding auto
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\paperfontsize default
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\author ""
\author ""
\end_header

\begin_body

\begin_layout Section
LyX-Code vs.
code listing insets
\end_layout

\begin_layout Standard
This is the first paragraph.
It is not indented as it comes after the section title.
\end_layout

\begin_layout Standard
This is the second paragraph.
It is indented so you can distinguish it from the previous one.
\end_layout

\begin_layout LyX-Code
This is LyX-Code.
It stands out from the previous paragraphs.
\end_layout

\begin_layout Standard
A paragraph after LyX-Code is not indented.
It is just the same as it would come after an enumeration (itemize), for
example.
\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Standard


\backslash
begin{lstlisting}[language={C++}]
\end_layout

\begin_layout Standard

This is lstlisting added by hand with an ERT.
\end_layout

\begin_layout Standard

It is just as LyX-Code but better.
\end_layout

\begin_layout Standard


\backslash
end{lstlisting}
\end_layout

\begin_layout Standard

This is how a paragraph after lstlisting would appear if it would have been
dealt with as it is done with LyX-code.
It is not indented, as it stands out from the code (really?).
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset listings
inline false
status open

\begin_layout Standard

This is a lstlisting code added through an inset.
\end_layout

\begin_layout Standard

LyX surrounds this with
\backslash
begingroup and
\backslash
endgroup,
\end_layout

\begin_layout Standard

and creates a new paragraph after this one.
\end_layout

\end_inset


\end_layout

\begin_layout Standard
This is indented.
LyX-Code behaves differently than code listing insets.
Isn't this a contradiction to the User Guide?
\end_layout

\begin_layout Quote
Only a paragraph following another paragraph gets indented.
\end_layout

\end_body
\end_document

Reply via email to