Hi,

I think I may have found a bug in the way character styles are handled.
See attached sample document and sample styles.

If a character style is used in an "itemize" environment, LyX
genereates LaTeX code like this:

\begin{itemize}
\item item 1
\item item 2
\item item 3 has a \texttt{\begin{itemize}
\item command
\end{itemize}
} and then some more text
...

That's not the intention. There is no reason to repeat "itemize" inside
the "command" character style. It should have been

\begin{itemize}
\item item 1
\item item 2
\item item 3 has a \texttt{command} and then some more text
...

But not only does LyX generate a nested "itemize" structure, it also
displays it like that (no line breaks around "command", but a "-" in
front of it to symbolize the 2nd level of itemize).

Regards,
Markus
#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[article]{MM Article}
# Markus' Article textclass definition file.
# Author : Markus Mayer

Input article.layout
Input mm_charstyles.inc
# Textclass definition file for article.
# Character Styles definition

Format 2

CharStyle filename
        LatexType             Command
        LatexName             textsf
        Font
          Family              Sans
        EndFont
        LabelFont
          Family              Roman
          Color               blue
        EndFont
End

CharStyle variable
        LatexType             Command
        LatexName             textsf
        Font
          Family              Sans
        EndFont
        LabelFont
          Family              Roman
          Color               blue
        EndFont
End

CharStyle command
        LatexType             Command
        LatexName             texttt
        Font
          Family              Typewriter
        EndFont
        LabelFont
          Family              Roman
          Color               blue
        EndFont
End

CharStyle code
        LatexType             Command
        LatexName             texttt
        Font
          Family              Typewriter
        EndFont
        LabelFont
          Family              Roman
          Color               blue
        EndFont
End
#LyX 1.4.0 created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\textclass mm_article
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize default
\use_geometry false
\use_amsmath 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
\end_header

\begin_body

\begin_layout Standard
Enumeration test
\end_layout

\begin_layout Itemize
item 1
\end_layout

\begin_layout Itemize
item 2
\end_layout

\begin_layout Itemize
item 3 has a 
\begin_inset CharStyle command
status inlined

\begin_layout Itemize
command
\end_layout

\end_inset

 and then some more text
\end_layout

\begin_layout Itemize
item 4 has a 
\begin_inset CharStyle filename
status inlined

\begin_layout Itemize
filename
\end_layout

\end_inset

 and then some more text
\end_layout

\begin_layout Itemize
item 5
\end_layout

\begin_layout Standard
That's it.
\end_layout

\end_body
\end_document

Attachment: charstyle-bug.tex
Description: TeX document

Reply via email to