LyX 本地布局,适用于自定义环境

LyX 本地布局,适用于自定义环境

我在 LyX 中有以下本地布局。

Format 66
Preamble
  \usepackage{xcolor}
  \newcounter{YourTurn}
  \newenvironment{YourTurn}[1][]{\refstepcounter{YourTurn}\par\medskip
  \noindent \color{green}\textbf{Your Turn ~\theYourTurn. #1} \rmfamily\color{black}}{\medskip}
EndPreamble

Counter YourTurn
 LabelString          "\arabic{YourTurn}"
End

Style YourTurn
    LeftMargin            "   MMMMMM"
    LaTeXName YourTurn
  ParSkip       0.4
  Align     Left
  LabelFont
      Family              Roman
      Series              Medium
      Size                Normal
      Color               Magenta
  EndFont
  LaTeXType Item_Environment
  LabelType Static
  LabelCounter YourTurn
  ItemCommand YourTurn
  LabelString "Your Turn \theYourTurn. "
End

我在 LyX 中的 MWE 代码如下所示:

\documentclass[12pt,a4paper,twoside,english]{article}
\renewcommand{\familydefault}{\rmdefault}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{xcolor}
\newcounter{YourTurn}
\newenvironment{YourTurn}[1][]{\refstepcounter{YourTurn}\par\medskip
     \noindent \color{green}\textbf{Your Turn ~\theYourTurn. #1} 
     \rmfamily\color{black}}{\medskip}

\makeatother

\begin{document}
  \begin{YourTurn}
   \YourTurn This should be Your Turn 1
   \YourTurn This should be Your Turn 2
  \end{YourTurn}

Standard text 1

Standard Text 2
  \begin{YourTurn}
   \YourTurn This should be Your Turn 3
  \end{YourTurn}

\end{document}

LyX 截图如下:

在此处输入图片描述

输出如下所示:

在此处输入图片描述

我不确定为什么 YourTurn 环境会插入到我意想不到的地方。

有任何想法吗?

相关内容