Hello,

I would like to write a LyX layout file for a LaTeX class file that I wrote. My 
LaTeX class uses standard "article" class. The problem is my custom 
environments are not converted to the corresponding LaTeX code by LyX. Below is 
a MWE:

My Class file (myclassBE.cls) is as follows:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclassBE, article}[2019/03/01 Test LaTeX Class]

\LoadClass[12pt, a4paper]{article}

\newenvironment{keywords}{{\bfseries KEYWORDS:} }{\vspace{1em}}

As can be seen, I have defined a custom environment: keywords. I have installed 
this file to my LaTeX system (Win10, MikTeX) successfully and tested with a 
very simple LaTeX file.

My layout file (myclassBE.layout) is:

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[myclassBE]{My Test Class BE}
#  \DeclareCategory{Articles}

Format 66
Input stdclass.inc
Input numarticle.inc

# Input general definitions
Input article.layout

Style KeywordsBE
    Margin                Dynamic
    Category              FrontMatter
    LabelString           "KEYWORDS: "
    LabelType             Static
    LatexType             Enviroment
    LatexName             keywords
    LabelFont
      Series              Bold
      Size                normalsize
      Color               green
    EndFont
End

LyX recognizes the new layout and the new "KeywordsBE" environment successfully:

[cid:part1.73630636.D0998ABE@hotmail.com]

But it does not generate the LaTeX code for the keywords environment:

% Preview source code

%% LyX 2.3.1-1 created this file. For more info, see http://www.lyx.org/.

%% Do not edit unless you really know what you are doing.

\documentclass[english]{myclassBE}

\usepackage[T1]{fontenc}

\usepackage[latin9]{inputenc}

\usepackage{babel}

\begin{document}

Keyword1, Keyword2

\end{document}

Which should have used the following:

\begin{keywords}
Keyword1, Keyword2
\end{keywords}

What am I missing?

BE

--
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
Please bottom-post. Start your reply here:

Attachment: test-myclassBE.lyx
Description: test-myclassBE.lyx

#% Do not delete the line below; configure depends on this      
#  \DeclareLaTeXClass[myclassBE]{My Test Class BE}
#  \DeclareCategory{Articles}

Format 66
Input stdclass.inc
Input numarticle.inc

# Input general definitions
Input article.layout

Style KeywordsBE
        Margin                Dynamic
        Category              FrontMatter
        LabelString           "KEYWORDS: "
        LabelType             Static
        LatexType             Enviroment
        LatexName             keywords
        LabelFont
          Series              Bold
          Size                normalsize
          Color               green
        EndFont
End
%% LyX 2.3.1-1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{myclassBE}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
Keyword1, Keyword2
\end{document}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclassBE, article}[2019/03/01 Test LaTeX Class]

\LoadClass[12pt, a4paper]{article}

\newenvironment{keywords}{{\bfseries KEYWORDS:} }{\vspace{1em}}

Reply via email to