# cas-common.inc
# Shared layout definitions for Elsevier CAS templates (cas-sc / cas-dc).
# Do NOT use this file directly; it is Input'd by cas-sc.layout and cas-dc.layout.
# Authors: Marco Morandini <marco.morandini@polimi.it>, Jürgen Spitzmüller <spitz@lyx.org>
#
# Covers all commands and environments from cas-common.sty v2.4 (2024/05/04):
#   Titles (all modes), Authors (full key-value signature), Affiliations,
#   Abstract, Keywords, Classifications (MSC/JEL/PACS), Date history,
#   Highlights, Graphical Abstract, CRediT contributions, Biography, Bibliography.

Format 111
Input stdclass.inc

Provides hyperref 1
Provides graphicx 1
Provides xparse 1
Provides etoolbox 1
Provides booktabs 1
Provides makecell 1
Provides multirow 1
Provides colortbl 1
Provides dcolumn 1
Provides stfloats 1
Provides xspace 1
Provides xstring 1
Provides footmisc 1
Provides xcolor 1

NoStyle			Chapter
NoCounter		chapter
NoStyle			Chapter*

# ======================================================================
# TITLE
# \title[mode=title|alt|sub|trans|transsub|ascii]{Title text}
# Can also pass: size, shape, weight, color, before, after, align.
# ======================================================================

Style Title
	Margin			Static
	LatexType		Command
	LatexName		title
	Category		FrontMatter
	InTitle			1
	ResetArgs		1
	ParSkip			0.4
	ItemSep			0
	TopSep			0
	BottomSep		1
	ParSep			1
	Align			Left
	LabelType		No_Label
	Argument 1
		LabelString		"Title options"
		Tooltip			"Key-value options, e.g. mode=title (default)|alt|sub|trans|transsub|ascii. Also accepts: size, shape, weight, color, before, after, align."
		Mandatory		0
	EndArgument
	Font
		Size		Largest
	EndFont
	HTMLTitle		true
	DocBookTag		title
	DocBookTagType		paragraph
	DocBookInInfo		maybe
End

# Alternate title — shortcut for \title[mode=alt]{...}
Style "Alt Title"
	CopyStyle		Title
	LatexParam		[mode=alt]
	ResetArgs		1
	Margin			Dynamic
	LabelType		Static
	#LabelSep		xx
	LabelString		"Alt Title:"
	ParSkip			0.4
	Font
		Size		Larger
	EndFont
	LabelFont
		Color		textlabel2
		Size		small
		Series		Bold
	EndFont
End

# Subtitle — shortcut for \title[mode=sub]{...}
Style "Subtitle"
	CopyStyle		"Alt Title"
	LatexParam		[mode=sub]
	LabelString		"Subtitle:"
	Font
		Size		Larger
	EndFont
	LabelFont
		Color		textlabel2
		Size		small
		Series		Bold
	EndFont
End

# Translated title — shortcut for \title[mode=trans]{...}
Style "Translated Title"
	CopyStyle		"Alt Title"
	LatexParam		[mode=trans]
	LabelString		"Trans. Title:"
	Font
		Size		Normal
	EndFont
	LabelFont
		Color		textlabel2
		Size		small
		Series		Bold
	EndFont
End

# Translated subtitle — shortcut for \title[mode=transsub]{...}
Style "Translated Subtitle"
	CopyStyle		"Alt Title"
	LatexParam		[mode=transsub]
	LabelString		"Trans. Subtitle:"
	Font
		Size		Small
	EndFont
	LabelFont
		Color		textlabel2
		Size		small
		Series		Bold
	EndFont
End

# ASCII title (metadata / submission systems) — \title[mode=ascii]{...}
Style "ASCII Title"
	CopyStyle		"Alt Title"
	LatexParam		[mode=ascii]
	LabelString		"ASCII Title:"
	Font
		Family		Typewriter
		Size		Small
	EndFont
	LabelFont
		Color		textlabel2
		Size		small
		Series		Bold
	EndFont
End

# Title note mark — inline inset inside the Title paragraph
# \tnotemark[t1,t2]
InsetLayout "Flex:Title Note Mark"
	LyxType			custom
	LatexType		command
	#ForcePlain		1
	LatexName		tnotemark
	Argument 1
		LabelString		"List of title note marks"
		Tooltip			"Comma-separated integers IDs of Title Notes, e.g. 1,2"
		Mandatory		1
		LeftDelim		"["
		RightDelim		"]"
		AutoInsert		1
	EndArgument
	LabelString		"Title Note Mark"
	Font
		Color		foreground
		Size		Small
		Family		Roman
		Shape		Up
		Series		Medium
		Misc		No_Emph
		Misc		No_Noun
		Misc		No_Bar
	EndFont
	LabelFont
		Color		textlabel2
		Size		Small
	EndFont
End

# Title footnote text — \tnotetext[label]{text}
Style "Title Note"
	Margin			Dynamic
	LatexType		Command
	LatexName		tnotetext
	Category		FrontMatter
	InTitle			1
	Argument 1
		LabelString		"Note Label"
		Tooltip			"Label key for this title footnote (e.g. t1, t2, t3), referenced via the Title Note Mark inset in the title"
		Mandatory		0
	EndArgument
	ParSkip			0.4
	BottomSep		0.5
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Title Note:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# ======================================================================
# AUTHORS
# \author[aff-ref-list]{Full Name}[key=value options]
#
# Affil. refs (Arg 1): comma-separated labels matching \address / \affiliation
# Author options (post-Arg 1): orcid, degree, role, prefix, suffix,
#   style=chinese, deceased=true, collab=true, type=editor|collab|anon,
#   twitter, facebook, linkedin, gplus
# ======================================================================

Style Author
	Margin			Static
	LatexType		Command
	LatexName		author
	Category		FrontMatter
	InTitle			1
	Argument 1
		LabelString		"Affil. ref(s)"
		Tooltip			"Comma-separated label(s) of affiliated address(es) as defined with Address or Affiliation (e.g. a1,a2)"
		Mandatory		0
	EndArgument
	Argument post:1
		LabelString		"Author options"
		Tooltip			"Key-value options (comma-separated):\n  orcid=<id>\n  degree=<title>\n  role=<role>\n  prefix=<prefix>\n  suffix=<suffix>\n  style=chinese\n  deceased=true|false\n  collab=true|false\n  type=editor|collab|anon\n  twitter=handle\n  facebook=id\n  linkedin=id\n  gplus=id"
		Mandatory		0
	EndArgument
	ParSkip			0.4
	TopSep			2.3
	BottomSep		0.7
	Align			Left
	LabelType		No_Label
	Font
		Size		Large
	EndFont
	DocBookTag		personname
	DocBookTagType		paragraph
	DocBookWrapperTag	author
	DocBookWrapperTagType block
	DocBookInInfo		always
End

# Standalone author footnote mark — must be its own paragraph after \author{}
# so LyX emits \fnmark[...] outside \author{...}.
Style "Author Note Mark"
	Margin			Dynamic
	LatexType		Command
	LatexName		fnmark
	Category		FrontMatter
	InTitle			1
	KeepEmpty		1
	Argument 1
		LabelString		"Author note marks"
		Tooltip			"Integers IDs of Author Notes, e.g. 1 or 1,2"
		Mandatory		1
		LeftDelim		"["
		RightDelim		"]"
		AutoInsert		1
	EndArgument
	ParSkip			0.2
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Author Note Mark:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End


# Standalone corresponding author mark — must be its own paragraph after
# \author{} so LyX emits \cormark[...] outside \author{...}.
Style "Corresponding Author Mark"
	Margin			Dynamic
	LatexType		Command
	LatexName		cormark
	Category		FrontMatter
	InTitle			1
	KeepEmpty		1
	Argument 1
		LabelString		"Corresponding author mark"
		Tooltip			"Integer IDs of Corresponding Author, e.g. 1"
		Mandatory		1
		LeftDelim		"["
		RightDelim		"]"
		AutoInsert		1
	EndArgument
	ParSkip			0.2
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Cor. Author Mark:"
	LabelFont
		Color		textlabel1
		Series		Bold
	EndFont
End


# Author footnote text — \fntext[label]{text}
Style "Author Note"
	Margin			Dynamic
	LatexType		Command
	LatexName		fntext
	Category		FrontMatter
	InTitle			1
	Argument 1
		LabelString		"Note Label"
		Tooltip			"Label key for this author footnote (e.g. fn1, fn2); reference it with the Author Note Mark inset inside Author"
		Mandatory		0
	EndArgument
	ParSkip			0.4
	TopSep			2.3
	BottomSep		0.5
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Author Note:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# Corresponding author text — \cortext[label]{Tel/email/address}
Style "Corresponding Author"
	CopyStyle		"Author Note"
	LatexName		cortext
	LabelString		"Corresponding Author:"
	LabelFont
		Color		textlabel1
		Series		Bold
	EndFont
End

# Non-numbered footnote (paper-level notes, e.g. dedicated/research notes)
# \nonumnote{text}
Style "Non-Numbered Note"
	Margin			Dynamic
	LatexType		Command
	LatexName		nonumnote
	Category		FrontMatter
	InTitle			1
	ParSkip			0.4
	BottomSep		0.5
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Note:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# ======================================================================
# AFFILIATION / ADDRESS
# ======================================================================

# Plain text address — \address[label]{Full address text}[type options]
# Post-arg options: type=regular|alt|addl|custom, name=..., foot=true
Style Address
#	Margin			Static
	Margin			Dynamic
	LatexType		Command
	LatexName		address
	Category		FrontMatter
	InTitle			1
	Argument 1
		LabelString		"Address Label"
		Tooltip			"Label key for this address (must match the affil. refs given in Author)"
		Mandatory		0
	EndArgument
	Argument post:1
		LabelString		"Address options"
		Tooltip			"Options:\n  type=regular (default)|alt|addl|custom\n  name=Custom Type Name\n  foot=true (place in page footnote instead of address block)"
		Mandatory		0
	EndArgument
	ParSkip			0.4
	Align			Left
	LabelType		No_Label
	Font
		Shape	Italic
		Size	Small
	EndFont
	DocBookTag		address
	DocBookTagType		paragraph
	DocBookWrapperTag	author
	DocBookWrapperTagType	block
	DocBookWrapperMergeWithPrevious true
	DocBookInInfo		always
End

# Structured affiliation (key-value form)
# \affiliation[label]{organization=X, addressline=Y, city=Z, postcode=W, state=V, country=U}[options]
# Short keys: o/or=organization, a/ad=addressline, c/ci=city, p/pc=postcode, s/st=state, cy/country=country
Style Affiliation
	Margin			Dynamic
	LatexType		Command
	LatexName		affiliation
	LabelType		Static
	Category		FrontMatter
	InTitle			1
	Argument 1
		LabelString		"Affiliation Label"
		Tooltip			"Label key for this affiliation (must match the affil. refs given in Author)"
		Mandatory		1
		LeftDelim		"["
		RightDelim		"]"
		AutoInsert		1
	EndArgument
	Argument 2
		LabelString		"Affiliation options"
		Tooltip			"Key-value options (comma-separated):\n  organization={University}, addressline={Street No.}, postcode={Postcode}, postcodesep={}, city={City}, country={Country}"
		Mandatory		1
		AutoInsert 		1
	EndArgument
	LabelSep		xx
	LabelString		"Affiliation:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# Email address or URL
# \ead{email@domain.com}   or   \ead[url]{https://...}
Style Email
	CopyStyle		Address
	LatexName		ead
	LabelType		Static
	LabelSep		xx
	LabelString		"Email:"
	Argument 1
		LabelString		"Type"
		Tooltip			"Leave empty for an email address, or enter 'url' for a URL"
		Mandatory		0
	EndArgument
	Font
		Shape	Up
	EndFont
	DocBookTag		email
	DocBookTagType		paragraph
	DocBookWrapperTag	author
	DocBookWrapperTagType	block
	DocBookWrapperMergeWithPrevious true
	DocBookInInfo		always
End

# Short authors for running headers — \shortauthors{A. Author et al.}
Style "Short Authors"
	Margin			Dynamic
	LatexType		Command
	LatexName		shortauthors
	Category		FrontMatter
	InTitle			1
	ParSkip			0.4
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Short Authors:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
	Font
		Size	Small
	EndFont
End

# Short title for running headers — \shorttitle{Short version}
Style "Short Title"
	CopyStyle		"Short Authors"
	LatexName		shorttitle
	LabelString		"Short Title:"
End

# ======================================================================
# ABSTRACT AND KEYWORDS
# ======================================================================

Style Abstract
	Margin			Static
	LatexType		Environment
	LatexName		abstract
	Category		FrontMatter
	InTitle			1
	NextNoIndent	1
	LeftMargin		MMM
	RightMargin		MMM
	ParIndent		MM
	ItemSep			0
	TopSep			0.7
	BottomSep		0.7
	ParSep			0
	Align			Block
	AlignPossible		Block
	LabelType		Centered
	LabelString		"Abstract"
	LabelBottomSep	0.5
	Font
		Size	Small
	EndFont
	LabelFont
		Series	Bold
		Size	Large
	EndFont
	DocBookAbstract		true
	DocBookInInfo		always
	DocBookWrapperTag	abstract
	DocBookWrapperMergeWithPrevious true
	DocBookTag		para
End

# Keywords
# \begin{keywords}[Optional header override] kw1 \sep kw2 \sep kw3 \end{keywords}
# Note: separate keywords with \sep (or simply commas in the text)
Style Keywords
	Margin			Dynamic
	LatexType		Environment
	LatexName		keywords
	Category		FrontMatter
	InTitle			1
	NextNoIndent		1
	BottomSep		0.5
	ParSkip			0.4
	Align			Block
	LabelSep		xx
	LabelType		Static
	LabelString		"Keywords:"
	Argument 1
		LabelString		"Keywords header"
		Tooltip			"Override the default 'Keywords' header text (default: Keywords)"
		Mandatory		0
	EndArgument
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
	DocBookTag			keyword
	DocBookTagType		paragraph
	DocBookWrapperTag	keywordset
	DocBookInInfo		always
End

# MSC mathematical subject classification — \MSC[year]{codes}
Style "MSC Codes"
	Margin			Dynamic
	LatexType		Command
	LatexName		MSC
	Category		FrontMatter
	InTitle			1
	ParSkip			0.4
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"MSC:"
	Argument 1
		LabelString		"Year"
		Tooltip			"MSC year edition, e.g. 2010 or 2020"
		Mandatory		0
	EndArgument
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# JEL classification (economics) — \JEL{C10, D81}
Style "JEL Codes"
	CopyStyle		"MSC Codes"
	LatexName		JEL
	LabelString		"JEL:"
	ResetArgs		1
End

# PACS classification (physics) — \PACS{XX.YY.Zz}
Style "PACS Codes"
	CopyStyle		"MSC Codes"
	LatexName		PACS
	LabelString		"PACS:"
	ResetArgs		1
End

# ======================================================================
# DATE HISTORY
# \received{date}  \revised{date}  \accepted{date}
# ======================================================================

Style Received
	Margin			Dynamic
	LatexType		Command
	LatexName		received
	Category		FrontMatter
	InTitle			1
	ParSkip			0.4
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Received:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
	Font
		Size	Small
	EndFont
End

Style Revised
	CopyStyle		Received
	LatexName		revised
	LabelString		"Revised:"
End

Style Accepted
	CopyStyle		Received
	LatexName		accepted
	LabelString		"Accepted:"
End

# ======================================================================
# PRE-PRINT MATTER  (separate page before the article)
# ======================================================================

# Highlights — \begin{highlights}[Heading] followed by \\item entries
# NOTE: The highlights environment auto-wraps content in \begin{itemize},
# so use LyX's Itemize environment inside, or plain \item (via ERT).
Style Highlights
	Margin			Static
	LatexType		Item_Environment
	LatexName		highlights
	Category		FrontMatter
	InTitle			1
	ParagraphGroup		1
	TopSep			0.7
	BottomSep		0.5
	Align			Block
	LabelType		Centered
	LabelString		"Highlights"
	LabelBottomSep	0.5
	Argument 1
		LabelString		"Heading"
		Tooltip			"Override the default 'Highlights' heading"
		Mandatory		0
	EndArgument
	LabelFont
		Series	Bold
		Size	Large
	EndFont
End

# Graphical abstract — \begin{graphicalabstract}[Heading] image + caption \end{graphicalabstract}
Style "Graphical Abstract"
	CopyStyle		Highlights
	LatexType		Environment
	LatexName		graphicalabstract
	LabelString		"Graphical Abstract"
	NextNoIndent          	1
	Argument 1
		LabelString		"Heading"
		Tooltip			"Override the default 'Graphical Abstract' heading"
		Mandatory		0
	EndArgument
End

# ======================================================================
# CRediT AUTHOR CONTRIBUTIONS
# ======================================================================

# Standalone credit role for an author
# \credit{Conceptualization, Methodology, Writing - original draft}
# Place in its own paragraph after the corresponding \author{} block.
Style "CRediT Role"
	Margin			Dynamic
	LatexType		Command
	LatexName		credit
	Category		FrontMatter
	InTitle			1
	ParSkip			0.2
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"CRediT Role:"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# Print CRediT contributions section — \printcredits
# Outputs a "CRediT authorship contribution statement" section.
# Place at the end of the article body, before the bibliography.
Style "Print Credits"
	Margin			Dynamic
	LatexType		Command
	LatexName		printcredits
	Category		BackMatter
	KeepEmpty		1
	Align			Left
	LabelSep		xx
	LabelType		Static
	LabelString		"Print CRediT Contributions"
	LabelFont
		Color		textlabel2
		Series		Bold
	EndFont
End

# ======================================================================
# BIOGRAPHY
# ======================================================================

# Author biography with optional photo
# \begin{biography}[photo.jpg]{Author Name} bio text \end{biography}
# For the wrapped-photo variant, use ERT with \bio[opts]{photo}...\endbio
Style Biography
	Margin			Static
	LatexType		Environment
	LatexName		biography
	Category		BackMatter
	Argument 1
		LabelString		"Photo file"
		Tooltip			"Path to author photo image file (leave empty for text-only biography)"
		Mandatory		0
	EndArgument
	Argument 2
		LabelString		"Author name"
		Tooltip			"Author name printed in bold before the biography text"
		Mandatory		1
	EndArgument
	ParSkip			0.4
	TopSep			0.7
	Align			Left
	LabelType		No_Label
	Font
		Size	Small
	EndFont
End

# ======================================================================
# BIBLIOGRAPHY
# ======================================================================

Style Bibliography
	Margin				First_Dynamic
	LatexType			Bib_Environment
	LatexName			thebibliography
	Category			BackMatter
	NextNoIndent		1
	ToggleIndent		Never
	LeftMargin			MM
	ParSkip				0.4
	ItemSep				0
	TopSep				0.7
	BottomSep			0.7
	ParSep				0.5
	Align				Block
	AlignPossible		Block, Left
	LabelType			Bibliography
	LabelString			"References"
	LabelBottomSep		1.2
	LabelFont
		Series	Bold
		Size	Larger
	EndFont
	TocLevel			1
	IsTocCaption			0
	Argument listpreamble:1
		LabelString		"Bib preamble"
		MenuString		"Bibliography Preamble"
		Tooltip			"LaTeX code to be inserted before the first bibliography item"
		PassThru		1
		Font
			Family		typewriter
			Color		latex
		EndFont
	EndArgument
End

# ======================================================================
# TABLE AND FIGURE OPTIONS
# ======================================================================

InsetLayout "Float:table"
	Argument 1
		LabelString		"Table Options"
		MenuString		"Table Options|O"
		PassThru 		1
		Tooltip			"Additional table options"
	EndArgument
End


# ======================================================================
# ENUMERATE OPTIONS
# ======================================================================
ModifyStyle Enumerate
	Argument 1
    		LabelString    "Mini Template"
    		Tooltip        "Mini template for this list (see CAS manual for details)"
		PassThru     	1
	EndArgument
End

