elsart support

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6140 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2003-02-13 17:49:09 +00:00
parent 29ccdc34aa
commit 102266cf92
10 changed files with 759 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2003-02-11 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* templates/elsart.lyx:
* layouts/elsart.layout: new class, adapted from work of Herbert
Voss and Rod Pinna
2003-02-12 Tomasz Luczak <tlu@technodat.com.pl>
* layouts/mwart.cls:

View File

@ -693,6 +693,27 @@ egs
can be used to write articles for the European Geophysical Society.
\layout Subsection
elsart
\layout Description
Found: @chk_elsart@
\layout Description
CTAN:
\family typewriter
macros/latex/contrib/supported/elsevier/
\layout Description
WWW:
\family typewriter
http://authors.elsevier.com/
\layout Description
Notes: This package is intended for producing journal articles for publication
by Elsevier Science.
\layout Subsection
entcs
\layout Description
@ -743,7 +764,7 @@ extletter
CTAN:
\family typewriter
tex-archive/macros/latex/contrib/other/extsizes/
macros/latex/contrib/other/extsizes/
\layout Description
Notes: These document classes are equivalent to the corresponding standard

475
lib/layouts/elsart.layout Normal file
View File

@ -0,0 +1,475 @@
#% Do not delete the line below; configure depends on this
# \DeclareLaTeXClass[elsart,amssymb.sty]{article (elsevier)}
# Author: Rod Pinna <rpinna@civil.uwa.edu.au>
# The Elsevier doc style also duplicates the theorem
# environments used by the AMS. The definitions here have been
# mainly taken from the amsmath.inc file, from lyx-1.0.2, by
# David L. Johnson and Jean-Marc Lasgouttes. Some modifications
# have been made.
#
# The Elsevier style *does not* implement the starred versions
# of these environments, so they are not supported by this layout.
# There are also a few AMS environments not impletemented by Elsevier,
# so they are not included either.
#
# Version 1.0 19990506 R. Pinna Inital version
# modified 2002-04-02 Herbert Voss <voss@perce.de>
# for use of BeginTitle/EndTitle
# modified 2003-03-11 JMarc for use of TitleLatexType/TitleLatexName
# General textclass parameters
Columns 1
Sides 2
PageStyle headings
MaxCounter Counter_Subsection
ClassOptions
# FontSize "default" # controlled by class
End
# elsart does not use the plain old \maketitle
TitleLatexType Environment
TitleLatexName frontmatter
DefaultFont
Family Roman
Series Medium
Shape Up
Size Normal
Color None
EndFont
Style Standard
LatexName dummy
LatexType Paragraph
Margin Static
ParIndent MM
ParSkip 0.4
ParSep 0.4
TopSep 1.0
BottomSep 1.0
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label
End
Style Keywords
LatexName keyword
LatexType Environment
Margin Static
ParIndent MM
InTitle 1
ParSkip 0.4
ParSep 0.4
TopSep 1.0
BottomSep 1.0
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label
Font
Color blue
EndFont
End
# Load standard defs, as most of the
# Elsevier stuff seems the same.
Input stdsections.inc
Input stdstarsections.inc
Input stdlists.inc
Input stdstruct.inc
Input stdlayouts.inc
Input stdfloats.inc
Input stdcounters.inc
# Title style definition
Style Title
Margin Static
LatexType Command
InTitle 1
LatexName title
NextNoIndent 1
ParSkip 0.4
TopSep 1.3
BottomSep 0.7
ParSep 0.7
Align Center
LabelType No_Label
# standard font definition
Font
Family Sans
Series Bold
Size Largest
EndFont
End
# Author style definition
Style Author
Margin Static
LatexType Command
InTitle 1
LatexName author
NextNoIndent 1
ParSkip 0.4
TopSep 0.7
BottomSep 0.7
ItemSep 0
ParSep 0
Align Center
AlignPossible Center
# standard font definition
Font
Series Bold
EndFont
End
# Author Adress
Style Author_Address
Margin Static
LatexType Command
InTitle 1
LatexName address
Align Center
AlignPossible Center
Labeltype Static
LabelString "Address: "
LabelFont
Shape Italic
EndFont
End
Style Author_Email
Margin Static
LatexType Command
InTitle 1
PassThru 1
LatexName ead
Align Center
AlignPossible Center
Labeltype Static
LabelString "Email: "
TextFont
Family Typewriter
EndFont
LabelFont
Shape Italic
Family Roman
EndFont
End
Style Author_URL
Margin Static
LatexType Command
InTitle 1
PassThru 1
LatexName ead
LatexParam "[url]"
Align Center
AlignPossible Center
Labeltype Static
LabelString "URL: "
TextFont
Family Typewriter
EndFont
LabelFont
Shape Italic
Family Roman
EndFont
End
# thanks is like a footnote
Style Thanks
Margin Static
LatexType Command
LatexName thanks
InTitle 1
Font
Size Small
Family Typewriter
Shape Italic
EndFont
End
# new Abstract style definition
Style Abstract
Margin Static
LatexType Environment
LatexName abstract
NextNoIndent 1
InTitle 1
LeftMargin MMM
RightMargin MMM
ParIndent MM
ItemSep 0
TopSep 0.7
BottomSep 0.7
ParSep 0
Align Block
AlignPossible Block
LabelType Centered_Top_Environment
LabelString Abstract
LabelBottomSep 0.5
# standard font definition
Font
Size Small
EndFont
# label font definition
LabelFont
Series Bold
Size Large
EndFont
End
# Theorm environments have been copied over from
# the amsmaths.inc file. It could not be inputfiled
# as it does some stuff which is incompatible with
# the Elsevier stlye, that is it redefines
# the theorem* environments in the preamble.
# The environments defined are :
# - Theorem
# - Corollary
# - Lemma
# - Proposition
# - Conjecture
# - Criterion
# - Algorithm
# - Definition
# - Example
# - Problem
# - Remark
# - Note
# - Claim
# - Summary
# - Acknowledgement
# - Case
# Theorem-numbered style declaration
Style Theorem
Margin First_Dynamic
LatexType Environment
LatexName thm
NextNoIndent 1
LabelSep xx
ParIndent MMM
ParSkip 0.4
ItemSep 0.2
TopSep 0.7
BottomSep 0.7
ParSep 0.3
Align Block
AlignPossible Block, Left
LabelType Static
LabelString "Theorem #."
# standard font definition
Font
Shape Italic
Size Normal
EndFont
# label font definition
LabelFont
Shape Up
Series Bold
EndFont
End
# Lemma-numbered style declaration
Style Lemma
CopyStyle Theorem
LatexName lem
LabelString "Lemma #."
# Preamble
# \theoremstyle{plain}
# \newtheorem{lem}[thm]{Lemma} %%Delete [thm] to re-start numbering
# EndPreamble
End
# Corollary-numbered style declaration
Style Corollary
CopyStyle Theorem
LatexName cor
LabelString "Corollary #."
# Preamble
# \theoremstyle{plain}
# \newtheorem{cor}[thm]{Corollary} %%Delete [thm] to re-start numbering
# EndPreamble
End
# Proposition-numbered style declaration
Style Proposition
CopyStyle Theorem
LatexName prop
LabelString "Proposition #."
# Preamble
# \theoremstyle{plain}
# \newtheorem{prop}[thm]{Proposition} %%Delete [thm] to re-start numbering
# EndPreamble
End
# Criterion-numbered style declaration
Style Criterion
CopyStyle Theorem
LatexName crit
LabelString "Criterion #."
# Preamble
# \theoremstyle{plain}
# \newtheorem{crit}[thm]{Criterion} %%Delete [thm] to re-start numbering
# EndPreamble
End
# Algorithm-numbered style declaration
Style Algorithm
CopyStyle Theorem
LatexName alg
LabelString "Algorithm #."
# Preamble
# \theoremstyle{plain}
# \newtheorem{alg}[thm]{Algorithm} %%Delete [thm] to re-start numbering
# EndPreamble
End
# Definition-numbered style declaration
Style Definition
CopyStyle Theorem
LatexName defn
LabelString "Definition #."
# standard font definition
Font
Shape Up
EndFont
# label font definition
LabelFont
Shape Up
Series Bold
EndFont
# Preamble
# \theoremstyle{definition}
# \newtheorem{defn}[thm]{Definition}
# EndPreamble
End
# Conjecture-numbered style declaration
Style Conjecture
CopyStyle Theorem
LatexName conj
LabelString "Conjecture #."
# Preamble
# \theoremstyle{plain}
# \newtheorem{conj}[thm]{Conjecture} %%Delete [thm] to re-start numbering
# EndPreamble
End
# Example-numbered style declaration
Style Example
CopyStyle Theorem
LatexName exmp
LabelString "Example #."
# Preamble
# \theoremstyle{definition}
# \newtheorem{exmp}[thm]{Example}
# EndPreamble
End
# Problem-numbered style declaration
Style Problem
CopyStyle Theorem
LatexName prob
LabelString "Problem #."
# Preamble
# \theoremstyle{definition}
# \newtheorem{prob}[thm]{Problem}
# EndPreamble
End
# Remark-numbered style declaration
Style Remark
CopyStyle Theorem
LatexName rem
LabelString "Remark #."
End
# Note-numbered style declaration
Style Note
CopyStyle Theorem
LatexName note
LabelString "Note #."
End
# Claim-numbered style declaration
Style Claim
CopyStyle Theorem
LatexName claim
LabelString "Claim #."
End
# Summary-numbered style declaration
Style Summary
CopyStyle Theorem
LatexName summ
LabelString "Summary #."
End
# Case-numbered style declaration
Style Case
CopyStyle Theorem
LatexName case
LabelString "Case #."
End
# Acknowledgement-numbered style declaration
#Style Acknowledgement
# CopyStyle Theorem
# LatexName ack
# LabelString "Acknowledgement #."
#
#End
# Acknowledgement style definition
# This is not taken from the AMS defs,
# so as to match the output of the
# style file.
Style Acknowledgement
Margin Static
LatexType environment
LatexName ack
Labeltype Top_Environment
LabelBottomsep 1
LabelString "Acknowledgement #."
parsep 0.3
LabelFont
Size large
Series Bold
EndFont
End

142
lib/templates/elsart.lyx Executable file
View File

@ -0,0 +1,142 @@
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass elsart
\begin_preamble
\usepackage{natbib}
\usepackage{amssymb}
\end_preamble
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\layout Title
Insert your Title Here
\layout Author
Author's name
\layout Author Address
Author's address
\layout Author Email
email@address
\layout Author URL
http://www.home.page
\layout Abstract
Text of abstract.
\layout Keywords
keyword1
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sep
\end_inset
keyword2
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sep
\end_inset
keyword3
\layout Keywords
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
PACS
\end_inset
code1
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sep
\end_inset
code2
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
sep
\end_inset
code3
\layout Section
First section
\layout Standard
See style options in the
\family sans
Document\SpecialChar ~
Layout
\family default
popup (accessed from the
\family sans
Layout
\family default
menu).
See the elsart manual for style options, special macros, and the like
\begin_inset LatexCommand \cite{mycitation}
\end_inset
.
\layout Bibliography
\bibitem {mycitation}
Author,
\begin_inset Quotes eld
\end_inset
Title
\begin_inset Quotes erd
\end_inset
, Journal
\series bold
Volume
\series default
, page--numbers (year).
\the_end

View File

@ -1,3 +1,13 @@
2003-02-11 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* paragraph.C (asString): remove two unused variables
* lyxtextclass.C (readTitleType):
(Read):
(LyXTextClass): handle new members titletype_ and titlename_
* buffer.C (latexParagraphs): honor LyXTextClass::titletype
2003-02-13 John Levon <levon@movementarian.org>
* CutAndPaste.C: remove debug

View File

@ -2230,6 +2230,7 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
{
bool was_title = false;
bool already_title = false;
LyXTextClass const & tclass = params.getLyXTextClass();
// if only_body
while (par != endpar) {
@ -2246,10 +2247,24 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
lyxerr <<"Error in latexParagraphs: You"
" should not mix title layouts"
" with normal ones." << endl;
} else
} else if (!was_title) {
was_title = true;
if (tclass.titletype() == TITLE_ENVIRONMENT) {
ofs << "\\begin{"
<< tclass.titlename()
<< "}\n";
texrow.newline();
}
}
} else if (was_title && !already_title) {
ofs << "\\maketitle\n";
if (tclass.titletype() == TITLE_ENVIRONMENT) {
ofs << "\\end{" << tclass.titlename()
<< "}\n";
}
else {
ofs << "\\" << tclass.titlename()
<< "\n";
}
texrow.newline();
already_title = true;
was_title = false;
@ -2268,7 +2283,14 @@ void Buffer::latexParagraphs(ostream & ofs, Paragraph * par,
}
// It might be that we only have a title in this document
if (was_title && !already_title) {
ofs << "\\maketitle\n";
if (tclass.titletype() == TITLE_ENVIRONMENT) {
ofs << "\\end{" << tclass.titlename()
<< "}\n";
}
else {
ofs << "\\" << tclass.titlename()
<< "\n";
}
texrow.newline();
}
}

View File

@ -80,6 +80,15 @@ enum LYX_LATEX_TYPES {
};
/// The different title types
enum LYX_TITLE_LATEX_TYPES {
///
TITLE_COMMAND_AFTER = 1,
///
TITLE_ENVIRONMENT
};
/// The different label types
enum LYX_LABEL_TYPES {
///

View File

@ -60,6 +60,8 @@ LyXTextClass::LyXTextClass(string const & fn, string const & cln,
opt_fontsize_ = "10|11|12";
opt_pagestyle_ = "empty|plain|headings|fancy";
provides_ = nothing;
titletype_ = TITLE_COMMAND_AFTER;
titlename_ = "maketitle";
loaded = false;
}
@ -103,10 +105,11 @@ enum TextClassTags {
TC_RIGHTMARGIN,
TC_FLOAT,
TC_COUNTER,
TC_NOFLOAT
TC_NOFLOAT,
TC_TITLELATEXNAME,
TC_TITLELATEXTYPE
};
// Reads a textclass structure from file.
bool LyXTextClass::Read(string const & filename, bool merge)
{
@ -133,6 +136,8 @@ bool LyXTextClass::Read(string const & filename, bool merge)
{ "secnumdepth", TC_SECNUMDEPTH },
{ "sides", TC_SIDES },
{ "style", TC_STYLE },
{ "titlelatexname", TC_TITLELATEXNAME },
{ "titlelatextype", TC_TITLELATEXTYPE },
{ "tocdepth", TC_TOCDEPTH }
};
@ -145,7 +150,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
<< MakeDisplayPath(filename)
<< endl;
LyXLex lexrc(textClassTags, TC_NOFLOAT);
LyXLex lexrc(textClassTags, TC_TITLELATEXTYPE);
bool error = false;
lexrc.setFile(filename);
@ -323,13 +328,19 @@ bool LyXTextClass::Read(string const & filename, bool merge)
case TC_COUNTER:
readCounter(lexrc);
break;
case TC_TITLELATEXTYPE:
readTitleType(lexrc);
break;
case TC_TITLELATEXNAME:
if (lexrc.next())
titlename_ = lexrc.getString();
break;
case TC_NOFLOAT:
if (lexrc.next()) {
string const nofloat = lexrc.getString();
floatlist_->erase(nofloat);
}
break;
}
}
@ -351,6 +362,33 @@ bool LyXTextClass::Read(string const & filename, bool merge)
}
void LyXTextClass::readTitleType(LyXLex & lexrc)
{
keyword_item titleTypeTags[] = {
{ "commandafter", TITLE_COMMAND_AFTER },
{ "environment", TITLE_ENVIRONMENT }
};
pushpophelper pph(lexrc, titleTypeTags, TITLE_ENVIRONMENT);
int le = lexrc.lex();
switch (le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'");
return;
case TITLE_COMMAND_AFTER:
case TITLE_ENVIRONMENT:
titletype_ = static_cast<LYX_TITLE_LATEX_TYPES>(le);
break;
default:
lyxerr << "Unhandled value " << le
<< " in LyXTextClass::readTitleType." << endl;
break;
}
}
void LyXTextClass::readOutputType(LyXLex & lexrc)
{
keyword_item outputTypeTags[] = {
@ -885,6 +923,21 @@ int LyXTextClass::maxcounter() const
}
LYX_TITLE_LATEX_TYPES LyXTextClass::titletype() const
{
return titletype_;
}
string const & LyXTextClass::titlename() const
{
return titlename_;
}
int LyXTextClass::size() const
{
return layoutlist_.size();

View File

@ -47,6 +47,8 @@ public:
///
void readOutputType(LyXLex &);
///
void readTitleType(LyXLex &);
///
void readMaxCounter(LyXLex &);
///
void readClassOptions(LyXLex &);
@ -135,6 +137,12 @@ public:
string const & rightmargin() const;
///
int maxcounter() const;
/// The type of command used to produce a title
LYX_TITLE_LATEX_TYPES titletype() const;
/// The name of the title command
string const & titlename() const;
///
int size() const;
private:
@ -186,6 +194,11 @@ private:
/// highest header level used in this layout.
int maxcounter_; // add approp. signedness
/// The type of command used to produce a title
LYX_TITLE_LATEX_TYPES titletype_;
/// The name of the title command
string titlename_;
/// Paragraph styles used in this layout
LayoutList layoutlist_;

View File

@ -1760,11 +1760,9 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams)
// Used for building the table of contents
string const Paragraph::asString(Buffer const * buffer, bool label) const
{
BufferParams const & bparams = buffer->params;
string s;
if (label && !params().labelString().empty())
s += params().labelString() + ' ';
string::size_type const len = s.size();
for (pos_type i = 0; i < size(); ++i) {
value_type c = getChar(i);