%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ELXPAPER.STY -- LaTeX2e package for composing pages of journals published      %%
%% by the Geophysical Center of the Russian Academy of Sciences.                  %%
%%                                                                                %%
%% This package supports two-column journal style, heavy hyperlinking inside and  %%
%% outside article, graphics, possibility to generate DVI, PS, and PDF output     %%
%% files, as well as generation of the XML metadata files under the current       %%
%% CrossRef XML Schema 4.3.3. and under the current eLibrary XML Schema           %%
%% CE 7.1.4.1284.  These enhancements work "behind the screen" and also control   %%
%% the consistency of "anchor-target" pairs, prevent "dubbing" targets, etc.      %%
%% The basic structure and number of definitions used in ELXPAPER package         %%
%% were compiled from RUSPAGE (ver. Jun. 1994), AGUPAPER (ver. Jan. 2000), GCRAS  %%
%% (ver. Mar. 2004),  GIPAPER (ver. Jan. 2007) and GAMSBOOK (ver. Dec. 2008) and  %%
%% SIMPLETEXML (ver. Apr. 2013) packages written by V. Nechitailenko, GC RAS.     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                                %%
%% This version is 1.2,  3 October 2014;  updated January 2015                    %%
%%                                                                                %%
%% Written by Vitaly Nechitailenko,                                               %%
%% Geophysical Center RAS, e-mail: vitaly@wdcb.ru ;  vnechita@gmail.com           %%
%%                                                                                %%
%% TO MAKE A PROPER REFERENCE IN CASE OF POSSIBLE ERRORS AND BUGS,                %%
%% PLEASE KEEP THIS FILE UNCHANGED. IN CASE OF ENTERING ANY                       %%
%% MODIFICATIONS PLEASE USE ANOTHER FILE NAME FOR MODIFIED VERSION.               %%
%% THE PACKAGE IS IN THE PUBLIC DOMAIN AND MAY BE USED AND REPRODUCED WITHOUT     %%
%% SPECIAL PERMISSION. HOWEVER, ANYONE USING PACKAGE IS REQUESTED TO CITE AND     %%
%% ACKNOWLEDGE PROPERLY THE SOURCE.                                               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{elxpaper}[2014/10/03  v1.0 GCRAS page style]
\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{multicol}
\RequirePackage{longtable}
%\RequirePackage{supertabular}
\RequirePackage{makeidx}
\RequirePackage{graphicx}
\RequirePackage{epsf}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{tabularx}
\RequirePackage[figuresright]{rotating}
\RequirePackage{cmap}
\RequirePackage[russian,english]{babel}
\def\pdfout{dvi}        %%  default value
\DeclareOption{dvi}{\def\pdfout{dvi}}
\DeclareOption{pdf}{\def\pdfout{pdf}}
\def\xml@out{xml}        %%  default value
\DeclareOption{xml}{\gdef\xml@out{xml}}
\DeclareOption{noxml}{\gdef\xml@out{noxml}}
\def\html@out{html}        %%  default value
\DeclareOption{html}{\gdef\html@out{html}}
\DeclareOption{nohtml}{\gdef\html@out{nohtml}}
\def\warnmes{verbose}        %%  default value
\DeclareOption{verbose}{\def\warnmes{verbose}}
\DeclareOption{silent}{\def\warnmes{silent}}
\def\@lang{eng}        %%  default value
\DeclareOption{eng}{\def\@lang{eng}\input{english.ldf}}
\DeclareOption{rus}{\def\@lang{rus}\input{russianb.ldf}}
\def\parnumber{nopar}        %%  default value
\DeclareOption{nopar}{\def\parnumber{nopar}}
\DeclareOption{par}{\def\parnumber{par}}
\def\hyptest{hyper}        %%  default value
\DeclareOption{hyper}{\def\hyptest{hyper}}
\DeclareOption{nohyp}{\def\hyptest{nohyp}}
\ProcessOptions
\ExecuteOptions{a4paper,twoside}


% Package and version identifiers

\def\elxpaper@ver{1.0}
\def\elxpaper@date{3 October 2014}
\def\elxpaper@org{GCRAS}
\def\elxpaper@jnl{ELXPAPER}
\def\elxpaper@genre{page}

% Display identifying message on screen and in logfile

\typeout{\elxpaper@org's\space \elxpaper@jnl\space
\elxpaper@genre\space style, v\elxpaper@ver\space <\elxpaper@date>.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                          PREAMBLE                                   %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%    The following macro have to be put into the preamble:
%    \journalid{<journal_code>}{<volume>}{<citation_number>}{<date_of_publishing>}
%    \subident{<first_line, e.g. 'International Conference'>}
%    {<second_line, e.g. 'Electronic Geophysical Year: State of the Art and Results'>}
%    {<third_line, e.g. '3--6 June 2009 $\bullet$ Pereslavl-Zalessky, Russia'>}
%    \citnumber{S-label_of_special_section | placeholder}{two-digit_number_of_paper}
%    \paperid{<GEMS_code_of_paper>}
%    \cpright{<copyright_owner>}{<copyright_year>}
%    \lefthead{<running_head_left_(author_name(s))>}
%    \righthead{<running_head_right_(short_paper_title)>}
%    \received{<day>}{<month>}{<year_of_receiving>}
%    \revised{<day>}{<month>}{<year_of_revision>}
%    \accepted{<day>}{<month>}{<year_of_acceptance>}
%    \published{<day>}{<month>}{<year_of_paper_publishing>}
%    \siterooturl{<URL_address_of_root_page, e.g. 'http://elpub.wdcb.ru'>}
%    \xmldepositor{<depositor_to_CrossRef_name>}{<email_address>}
%    \xmlregistrant{<registering_organisation, e.g. 'GCRAS'>}
%    \gcmdterms{<list_of_GCMD_index_terms separated with semicolons>}
%    \aguterms{<list_of_AGU_index_terms separated with semicolons>}
%    \keywords{<list_of_arbitrary_keywords>}
%    NOTE:
%    \subident -  is an optional parameter, it may be skipped or left blank.
%    At least one line should be non-empty to appear in the final composed version
%    \revised  -  is an optional parameter, it may be skipped or left blank.
%    \xmldepositor - if this command is skipped or left blank the default values are used, as defined in this package
%    \xmlregistrant - if this command is skipped or left blank the default value is used, as defined in this package
%    \originated - the content of footnote reference to originated meeting

% <journal_code> is an abbreviation of the journal name, i.e.
% BS  for  GEOINFORMATICS RESEARCH PAPERS SERIES
% ES  for  RUSSIAN JOURNAL OF EARTH SCIENCES
% RE  for  Russian version of RJES
% NZ  for  VESTNIK ONZ PAN
% PO  for  GEOPHYSICAL PAPERS ONLINE -- PREPRINTS
% MS  for  MANUSCRIPTS
% Warning is issued if entered journal_code does not match above list

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%  Start of CROSSREF  section  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\gdef\respage{%
\ifthenelse{\equal{\html@out}{html}}{%%
%%  Two lines below creates and opens the file \jobname.html to collect response page for CrossRef
%%  if SECTEXML package's  option 'xml' is selected
\newwrite\@htmlout
\immediate\openout\@htmlout\jobname.html
\@bsphack\protected@write\@htmlout{}{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"}\@esphack%%
\@bsphack\protected@write\@htmlout{}{    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<html xmlns="http://www.w3.org/1999/xhtml">}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<head>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<title>\@@title</title>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<script type="text/javascript" language="javascript" src="http://elpub.wdcb.ru/journals/scripts/getCssByOs.js"></script>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<script type="text/javascript" language="javascript" src="http://elpub.wdcb.ru/journals/scripts/popUp.js"></script>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="title" content="\@@title" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="authors" content="\authmeta" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="first-author" content="\authfirst" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="journal" content="\jour@fut" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="doi" content="\doi@prefix/\paper@num" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="paper-number" content="\paper@num" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="paper-type" content="Article" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="publisher" content="\cpr@holder" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="citation" content="\authcit\space   (\cpr@year), \@@title, \jour@abbrev, \jour@vol,  \cin@number, doi:\doi@prefix/\paper@num." />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="copyright" content="Copyright 2011 \cpr@holder" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="published-online" content="\pub@day\space\pub@month\space\pub@year" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="abstract-url" content="http://elpub.wdcb.ru/journals/rjes/abstract/v\jour@vol/\paper@num-abs.html" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="pdf-url" content="http://elpub.wdcb.ru/journals/rjes/v\jour@vol/\paper@num/\paper@num.pdf" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<meta name="keywords" content="\@keys" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{</head>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<body bgcolor="white">}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<table nowrap border=0 width=650 align=center><tr><td align=left colspan=2>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<img src="/journals/rjesCitationLogo.gif" border="0" align="top" alt="RJES"/>&nbsp;&nbsp;&nbsp;&nbsp;}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<input type="button" value="FULL  PAPER" onClick="window.open('/journals/rjes/v\jour@vol/\paper@num/\paper@num.pdf', '_new')"> &nbsp;&nbsp;&nbsp;&nbsp;}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<hr />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<p><font face="Verdana" size=-1>RUSSIAN JOURNAL OF EARTH SCIENCES,  VOL. \jour@vol, \cin@number, doi:\doi@prefix/\paper@num, \cpr@year</font></p>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<p><!--End of header-->}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<h2><font color='green' face='Arial'>\@@title</font></h2> </p>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<b><i>\authmain</i></b>  <p />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<font size=-1><b>\affilmain</b></font><p />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<!--end-of-contents-->}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<a name="chap00">  </a>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<hr /><h3><font color='green' face='Arial'>Abstract</font></h3>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<!--start-of-abstract-->}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<p id="para01">}\@esphack%%
\@bsphack\protected@write\@htmlout{}{\@abstract}\@esphack%%
\@bsphack\protected@write\@htmlout{}{</p>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<p><i>Received \recv@day\space\recv@month\space\recv@year; accepted  \acpt@day\space\acpt@month\space\acpt@year; published \pub@day\space\pub@month\space\pub@year.</i></p>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<p><font size=-1><b>Keywords:</b> \@keys</font></p>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<hr noshade="noshade" width="300" />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<a href="http://elpub.wdcb.ru/journals/rjes"><img src="http://elpub.wdcb.ru/journals/rjesCitationLogo.gif" border="0" align="top" alt="RJES"/></a><br />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<p id="citation"><span class="bold">Citation:</span> <span id="authors"><span id="first-author">\authcit</span></span> (\cpr@year), \@@title, \jour@abbrev, \jour@vol,  \cin@number, doi:\doi@prefix/\paper@num.</p>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{<a href="http://elpub.wdcb.ru/journals/cpt_rjes.html" target="_new">Copyright 2011 by the Geophysical Center RAS</a><hr />}\@esphack%%
\@bsphack\protected@write\@htmlout{}{</td></tr></table>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{</body>}\@esphack%%
\@bsphack\protected@write\@htmlout{}{</html>}\@esphack%%
}{}}

\newcommand{\tab}{\space\space\space}
%
%   The first XML fragment should be formed before author list
%
\gdef\xmlblockone{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname.xml to collect metadata for CrossRef
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlout
\immediate\openout\@xmlout\jobname.xml
\@bsphack\protected@write\@xmlout{}{<?xml version="1.0" encoding="UTF-8"?>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{<doi_batch version="4.3.0" xmlns="http://www.crossref.org/schema/4.3.0"}\@esphack%%
\@bsphack\protected@write\@xmlout{}{xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"}\@esphack%%
\@bsphack\protected@write\@xmlout{}{xsi:schemaLocation="http://www.crossref.org/schema/4.3.0 http://www.crossref.org/schema/deposit/crossref4.3.0.xsd">}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab<head>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab<doi_batch_id>\cin@number</doi_batch_id>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab<timestamp>\print@time</timestamp>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab<depositor>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab<name>\dep@name</name>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab<email_address>\dep@email</email_address>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab</depositor>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab<registrant>\regist@name</registrant>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab</head>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab<body>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab<journal>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab<journal_metadata language="\xml@lang">}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<full_title>\jour@fut</full_title>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<abbrev_title>\jour@abbrev</abbrev_title>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<issn media_type="electronic">\xml@issn</issn>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab</journal_metadata>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab<journal_issue>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<publication_date media_type="online">}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<year>20\jour@date</year>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</publication_date>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<journal_volume>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<volume>\jour@vol</volume>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</journal_volume>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<issue>\jour@num</issue>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab</journal_issue>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab<journal_article publication_type="full_text">}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<titles>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<title>\@@title</title>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</titles>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<contributors>}\@esphack%%
}{}}%
%
%   The second XML fragment is forming  author list
%
\gdef\xmlblocktwo{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
\ifnum\value{atot}=1
    \@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<person_name sequence="first" contributor_role="author">}\@esphack%%
\else
    \@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<person_name sequence="additional" contributor_role="author">}\@esphack%%
\fi
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<given_name>\au@fname</given_name>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<surname>\aut@surname</surname>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab</person_name>}\@esphack%%
}{}}%
%
%   The third XML fragment should be formed before References list
%
\gdef\xmlblockthr{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</contributors>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<publication_date media_type="online">}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<month>\pub@mon</month>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<day>\pub@day</day>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<year>\pub@year</year>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</publication_date>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<pages>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<first_page>1</first_page>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<last_page>\thelstp</last_page>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</pages>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<publisher_item>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<identifier id_type="pii">\pref@pii-\jour@vol-\paper@num</identifier>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</publisher_item>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<doi_data>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<doi>\doi@prefix/\paper@num</doi>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<timestamp>\print@time</timestamp>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<resource>\response@page@dir\response@page@file.html</resource> <!-- DOI's prime URL -->}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<collection property="list-based" multi-resolution="unlock" />}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</doi_data>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab<citation_list>}\@esphack%%
}{}}%
%
%   The fourth XML fragment completes reference list. It is called  from \reference and \endreferences commands
%
\gdef\xmlblockfour{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Writing citation identifier to XML file
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab<citation key="\doi@prefix/\paper@num-\ini@target">}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<author>\ref@surnamef</author>}\@esphack%%
\ifthenelse{\equal{\ref@title}{\@empty}}{}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<article_title>\ref@title</article_title>}%%
}%
\ifthenelse{\ref@type < 3}{%      printing journal title
\ifthenelse{\equal{\ini@jour}{\@empty}}
{%
{\bfseries ERROR!!! Journal title field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Journal title field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<journal_title>\ref@jour</journal_title>}\@esphack%%
}}{}%
\ifthenelse{\(\ref@type = 3\) \or \(\ref@type = 4\)}{%      printing book title
\ifthenelse{\equal{\ini@book}{\@empty}}{%
{\bfseries ERROR!!! Book title field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Book title field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}}{%
}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<volume_title>\ref@book</volume_title>}\@esphack%%
}}{}%
%
\ifthenelse{\equal{\ref@vol}{\@empty}}{}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<volume>\ref@vol</volume>}\@esphack%%
}%
\ifthenelse{\equal{\ref@numb}{\@empty}}{}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<issue>\ref@numb</issue>}\@esphack%%
}%
\ifthenelse{\equal{\ref@page}{\@empty}}{}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<first_page>\ref@page</first_page>}\@esphack%%
}%
\ifthenelse{\equal{\ref@year}{\@empty}}{}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<cYear>\ref@year</cYear>}\@esphack%%
}%
\ifthenelse{\equal{\ref@doi}{\@empty}}{}{%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab\tab<doi>\ref@doi</doi>}\@esphack%%
}%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab\tab</citation>}\@esphack%%
}{}}%
%
%   The fifth XML fragment is called from  \endreferences  command
%
\gdef\xmlblockfive{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab\tab</citation_list>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab\tab</journal_article>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab\tab</journal>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{\tab</body>}\@esphack%%
\@bsphack\protected@write\@xmlout{}{</doi_batch>}\@esphack%%
}{}}%

%%%%%%%%%%%%%%%%%%%%%%%%%%  End of CROSSREF  section  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%  Start of NEB (eLibrary)  section  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%   The ancillary XML file accumulating affiliations used in NEB XML
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\renewcommand{\"}[1]{\gdef\dia@cri{#1} \&\#xF6\&\#x3B\;}

\gdef\au@affil{\relax}

\gdef\xmlautfile{%         Opening initial authors file
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname aut.tex to collect authors' metadata for NEB
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlautlist
\immediate\openout\@xmlautlist\jobname aut.tex
%%\@bsphack\protected@write\@xmlautlist{}{\%  List of authors extracted on first translation}\@esphack%%
}{}}%

\gdef\xmlaffile{%          Opening initial affils file
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname org.tex to collect affiliations' metadata for NEB
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlorglist
\immediate\openout\@xmlorglist\jobname org.tex
%%\@bsphack\protected@write\@xmlorglist{}{\%  List of organizations extracted on first translation}\@esphack%%
}{}}%

\gdef\xmlkeyfile{%         Opening keyword file
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname key.tex to collect keywords metadata for NEB
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlkeylist
\immediate\openout\@xmlkeylist\jobname keys.tex
%%\@bsphack\protected@write\@xmlkeylist{}{ List of authors extracted on first translation}\@esphack%%
}{}}%

\gdef\dointauthor{%        Opening bufferred authors file
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname saveaut.tex to collect authors' metadata for NEB
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlautsave
\immediate\openout\@xmlautsave\jobname saveaut.tex
%%\@bsphack\protected@write\@xmlautsave{}{\%  List of authors extracted on first translation}\@esphack%%
}{}}%

\gdef\dointaffil{%           Opening  bufferred affils file
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname saveorg.tex to collect affiliations' metadata for NEB
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlorgsave
\immediate\openout\@xmlorgsave\jobname saveorg.tex
%%\@bsphack\protected@write\@xmlorgsave{}{\%  List of organizations extracted on first translation}\@esphack%%
}{}}%

\gdef\dointkeys{%           Opening  bufferred keys file
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname savekey.tex to collect keywords metadata for NEB
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlkeysave
\immediate\openout\@xmlkeysave\jobname savekey.tex
%\@bsphack\protected@write\@xmlkeysave{}{List of organizations extracted on first translation}\@esphack%%
}{}}%
%
%   The first NEB XML fragment should be formed before author list
%
\gdef\org@value{\relax}
\gdef\xmlfragone{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
%%  Two lines below creates and opens the file \jobname.xml to collect metadata for CrossRef
%%  if ELXPAPER package's  option 'xml' is selected
\newwrite\@xmlnebout
\immediate\openout\@xmlnebout\jobname-neb.xml
\@bsphack\protected@write\@xmlnebout{}{<?xml version='1.0' standalone='no' ?>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{<journal xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="JournalArticulus.xsd">}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab<operCard>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<operator>RJESconvert</operator>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<date>\neb@time</date>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<cntArticle>\cit@num</cntArticle>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab</operCard>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab<titleid>\neb@titleid</titleid>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab<issn>\xml@issn</issn>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab<codeNEB>\neb@issn</codeNEB>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab<journalInfo lang="\neb@lang">}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<title>\jour@fut</title>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab</journalInfo>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab<issue>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<volume>\jour@vol</volume>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<number>\jour@num</number>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<dateUni>20\jour@date</dateUni>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab<articles>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{<!--   Start of article metadata -->}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab<article>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<pages>1-\thelstp</pages>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<artType>\paper@type</artType>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<authors>}\@esphack%%
}{}}%
%
%   The second NEB XML fragment is forming  author list
%
\gdef\xmlfragtwo{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<author num="\neb@atot">}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab<individInfo lang="\neb@lang">}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<surname>\aut@surname</surname>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<initials>\au@fname</initials>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<orgName>\au@affil</orgName>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<orgName>\org@value</orgName>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab</individInfo>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab</author>}\@esphack%%
}{}}%
%
%     NEB XML final fragment
%
\gdef\xmlfragthree{%
\ifthenelse{\equal{\xml@out}{xml}}{%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab</references>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<files>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<file>\jobname .pdf</file>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<furl>http://dx.doi.org/10.2205/\jobname</furl>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab</files>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab</article>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{<!--   End of article metadata -->}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab</articles>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab</issue>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{</journal>}\@esphack%%
}{}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End of NEB  section  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newdimen\@fmwidth \@fmwidth=17cm
%%%%%%%%%%%%%%%\newdimen\@headwidth \@headwidth=14cm
\newdimen\@headwidth
\newdimen\newheadwidth \newheadwidth=17cm           %%  14cm
\let\@headwidth\newheadwidth
%%  @headwidth is redefined to make it possible to correct header width to produce
%%  descending length of header lines. If necessary put just after \begin{document}
%%  \newheadwidth=XX.Xcm

\newdimen\@fmabwidth \@fmabwidth=8.4cm
\newdimen\@bodywidth \@bodywidth=20pc
\newdimen\textwidth   \textwidth=41pc
\newdimen\textheight  \textheight=9.12in
\newdimen\ancil@width  \ancil@width=\@bodywidth
\newdimen\bottomblockheight
\newlength\float@width
\topmargin=-2pc
%%%\topmargin=0in
\headheight=9pt
\headsep=12pt
%%%\oddsidemargin=0in
%%%\evensidemargin=0in
\oddsidemargin=-1pc
\evensidemargin=-1pc
\parindent=0.38cm
\parskip=0ex
\def\@tolerant{400}
\def\@verytolerant{10000}
\tolerance\@tolerant
\renewcommand{\normalsize}{\fontsize{9}{11}\selectfont}
\renewcommand{\footnotesize}{\fontsize{8}{9}\selectfont}
\newcommand{\font@reference}{\fontsize{8}{9}\selectfont}
\newcommand{\font@author}{\fontsize{11}{14}\selectfont}
\newcommand{\font@affil}{\fontsize{8}{9}\selectfont}
\newcommand{\section@font}{\normalfont\fontsize{11}{12}\selectfont\bfseries}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                          FRONT MATTER                               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Journal identifier___________________________________________

\newcommand{\jrn@BS}{GEOINFORMATICS  RESEARCH  PAPERS}
%%%\newcommand{\jrn@BS}{������������ �� ��������������: ����� �������������� ������ ���}
%%%\newcommand{\jrn@BS}{\ifthenelse{\equal{\@lang}{rus}}{RUS}{ENG}%
%%{������������ �� ��������������: ����� �������������� ������ ���}%
%%{GEOINFORMATICS  RESEARCH  PAPERS: Proceedings of Geophysical Center RAS}%
%%}


%%%%\ifthenelse{\equal{\@lang}{rus}}{�������������}{Acknowledgment}
\newcommand{\jrn@ES}{RUSSIAN JOURNAL OF EARTH SCIENCES}
\newcommand{\jrn@RE}{���������� ������ ���� � �����}
\newcommand{\jrn@NZ}{������� ��� ���}
\newcommand{\jrn@PO}{GEOPHYSICAL PAPERS ONLINE -- PREPRINTS}
\newcommand{\jrn@MS}{MANUSCRIPT}
\newcommand{\jour@name}{\relax}
\newcommand{\jour@fut}{\relax}
\newcommand{\paper@pref}{\relax}
\newcommand{\paper@suff}{\relax}
\newcommand{\@issn}{\relax}
\newcommand{\url@pref}{http://eos.wdcb.ru}
\newcommand{\absheader}{\ifthenelse{\equal{\@lang}{rus}}{���������}{Abstract}}
\newcommand{\acknowtit}{\ifthenelse{\equal{\@lang}{rus}}{�������������}{Acknowledgment}}
\newcommand{\acknowstit}{\ifthenelse{\equal{\@lang}{rus}}{�������������}{Acknowledgments}}
\newcommand{\gpopreprint}[1]{\gdef\gpo@preprint{#1}} \gpopreprint{\@empty}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\newcommand{\paper@language}{\ifthenelse{\equal{\@lang}{rus}}{"RUS"}{"ENG"}}

\newcommand{\ofiz}{\ifthenelse{\equal{\@lang}{rus}}{��}{of}}

\newboolean{id@test}
\setboolean{id@test}{true}
\newboolean{merge@parts}
\setboolean{merge@parts}{false}
\newboolean{abs@label}
\setboolean{abs@label}{false}   %  abstract label shows if \abstract command included
\newboolean{au@test}
\setboolean{au@test}{true}
\newboolean{au@first}
\setboolean{au@first}{true}
%%%\newboolean{start@label}
%%%\setboolean{start@label}{false}
%%%\newboolean{ref@label}
%%%\setboolean{ref@label}{false}
\newcommand{\pref@number}{\relax}

\newcommand{\journalid}[4]{
\gdef\jour@code{#1}\gdef\jour@vol{#2}\gdef\jour@num{#3}\gdef\jour@date{#4}%

% Identifying manuscript file
\ifthenelse{\equal{\jour@vol}{\@empty} \and \equal{\jour@num}{\@empty} \and \equal{\jour@date}{\@empty}}
{\setboolean{id@test}{false}\let\jour@name\jrn@MS
\renewcommand{\font@reference}{\normalfont\fontsize{12}{24}\selectfont}%
\renewcommand{\normalsize}{\fontsize{12}{24}\selectfont}%
\renewcommand{\footnotesize}{\fontsize{12}{24}\selectfont}
\renewcommand{\font@author}{\fontsize{12}{24}\selectfont}
\renewcommand{\font@affil}{\fontsize{12}{24}\selectfont}
\renewcommand{\section@font}{\normalfont\fontsize{14}{24}\selectfont\bfseries}
\parindent=2pc
\textwidth=38pc\textheight=8.5in\@bodywidth=33pc
\gdef\jour@fut{\@empty}
\ifthenelse{\equal{\jour@code}{BS}}{\gdef\jour@fut{Geoinformatics Research Papers}}{%
%\ifthenelse{\equal{\jour@code}{RS}}{\gdef\jour@fut{������������ �� ��������������}}{%
\ifthenelse{\equal{\jour@code}{ES}}{\gdef\jour@fut{Russian Journal of Earth Sciences}}{%
\ifthenelse{\equal{\jour@code}{PO}}{\gdef\jour@fut{Geophysical Papers Online -- Preprints}}{%
\ifthenelse{\equal{\jour@code}{RE}}{\gdef\jour@fut{���������� ������ ���� � �����}}{%
\ifthenelse{\equal{\jour@code}{NZ}}{\gdef\jour@fut{������� ��������� ���� � ����� ���}}{}%
}}}}}{}

\ifthenelse{\boolean{id@test} \and \equal{\jour@code}{BS}}{\setboolean{id@test}{false}
\let\jour@name\jrn@BS\gdef\@issn{2308--5983}\gdef\xml@issn{2308-5983}\gdef\neb@issn{23085983}%
\gdef\@price{\$00.00}\gdef\neb@titleid{00000}%
\gdef\jour@lc@code{bs}\gdef\jour@abbrev{Geoinf. Res. Papers}\gdef\cfg@file{bsformat.cfg}%
\gdef\doi@prefix{10.2205}\gdef\paper@pref{\jour@code\cpr@year}\gdef\pref@pii{GRPS}
\gdef\response@page@dir{http://ebooks.wdcb.ru/doi/}
\gdef\response@page@file{\jobname-res}
\gdef\cpr@holder{\ifthenelse{\equal{\@lang}{rus}}{������������� ����� ���}{Geophysical Center RAS}}}{}

\ifthenelse{\boolean{id@test} \and \equal{\jour@code}{ES}}{\setboolean{id@test}{false}
\let\jour@name\jrn@ES\gdef\@issn{1681--1208}\gdef\xml@issn{1681-1208}\gdef\neb@issn{16811208}%
\gdef\@price{\$18.00}\gdef\neb@titleid{31854}%
\gdef\jour@lc@code{es}\gdef\jour@abbrev{Russ. J. Earth Sci.}\gdef\cfg@file{esformat.cfg}%
\gdef\doi@prefix{10.2205}\gdef\paper@pref{\jour@code\cpr@year}\gdef\pref@pii{RJES}
\gdef\response@page@dir{http://elpub.wdcb.ru/journals/rjes/doi/}
\gdef\response@page@file{\jobname-res}
\gdef\cpr@holder{Geophysical Center RAS}}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifthenelse{\boolean{id@test} \and \equal{\jour@code}{NZ}}{\setboolean{id@test}{false}
\let\jour@name\jrn@NZ\gdef\@issn{1819--6586}\gdef\xml@issn{1819--6586}\gdef\neb@issn{18196586}%
\gdef\@price{\$00.00}\gdef\neb@titleid{31854}%
\gdef\jour@lc@code{nz}\gdef\jour@abbrev{Vestn. Otd. nauk Zemle}\gdef\cfg@file{onzformat.cfg}%
\gdef\doi@prefix{10.2205}\gdef\paper@pref{\jour@code\cpr@year}\gdef\pref@pii{ONZ}
\gdef\response@page@dir{http://onznews.wdcb.ru/doi/}
\gdef\response@page@file{\jobname-res}
\gdef\cpr@holder{������������� ����� ���}}{}

\ifthenelse{\boolean{id@test} \and \equal{\jour@code}{PO}}{\setboolean{id@test}{false}
\let\jour@name\jrn@PO\gdef\@issn{0000--0000}\gdef\xml@issn{0000-0000}\gdef\neb@issn{00000000}%
\gdef\@price{\$00.00}\gdef\neb@titleid{00000}%
\gdef\jour@lc@code{po}\gdef\jour@abbrev{Geoph. Pap. Online}\gdef\cfg@file{poformat.cfg}%
\gdef\doi@prefix{10.2205}\gdef\paper@pref{\jour@code\cpr@year}\gdef\pref@pii{GPO}
\gdef\response@page@dir{http://elpub.wdcb.ru/journals/gpo/doi/}
\gdef\cpr@holder{Geophysical Center RAS}}{}

\ifthenelse{\boolean{id@test} \and \equal{\jour@code}{RE}}{\setboolean{id@test}{false}
\let\jour@name\jrn@RE\gdef\@issn{1681--1194}\gdef\xml@issn{1681-1194}\gdef\neb@issn{16811194}%
\gdef\@price{\$00.00}\gdef\neb@titleid{00000}%
\gdef\jour@lc@code{re}\gdef\jour@abbrev{����. �. ���� � �����}\gdef\cfg@file{resformat.cfg}%
\gdef\doi@prefix{10.2205}\gdef\paper@pref{\jour@code\cpr@year}\gdef\pref@pii{RES}
\gdef\response@page@dir{http://elpub.wdcb.ru/journals/rjes/doi/}
\gdef\cpr@holder{������������� ����� ���}}{}

%\ifthenelse{\boolean{id@test} \and \equal{\jour@code}{NZ}}{\setboolean{id@test}{false}
%\let\jour@name\jrn@NZ\gdef\@issn{1819--6586}\gdef\xml@issn{1819-6586}\gdef\neb@issn{18196586}%
%\gdef\@price{\$00.00}\gdef\neb@titleid{00000}%
%\gdef\jour@lc@code{nz}\gdef\jour@abbrev{Vestn. Otd. nauk Zemle}\gdef\cfg@file{onzformat.cfg}%
%\gdef\doi@prefix{10.2205}\gdef\paper@pref{\jour@code\cpr@year}\gdef\pref@pii{ONZ}
%\gdef\response@page@dir{http://onznews.wdcb.ru/doi/}
%\gdef\cpr@holder{������������� ����� ���}}{}

\ifthenelse{\boolean{id@test}}{%
\typeout{}
\typeout{ELXPAPER ERROR!!! Unrecognized journal code in the 'journalid' macro! (\jour@code)}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}
\let\jour@name\jour@code\gdef\@issn{0000--0000}\gdef\xml@issn{0000-0000}\gdef\neb@issn{00000000}\gdef\@price{\$00.00}}{}
}%

\newcommand{\subident}[3]{%
\gdef\one@subid{#1}\gdef\two@subid{#2}\gdef\three@subid{#3}}
\subident{\@empty}{\@empty}{\@empty}

\newcommand{\originated}[1]{%
\gdef\@originated{#1}}
\originated{\@empty}

% Copyright definitions_____________________________________________
\newcommand{\cpright}[2]{\gdef\cpr@logo{#1}\gdef\cpr@year{#2}%
\ifthenelse{\equal{\cpr@year}{\@empty}}
{\typeout{}\typeout{ELXPAPER ERROR!!! Copyright year is not defined.}%
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein[\cpr@year]{Enter copyright year.}}}{}
\ifthenelse{\equal{\cpr@logo}{\@empty}}{}%
{\gdef\cpr@holder{#1}}
}

% Paper identifier defines paper's unique number (suffix in DOI)
\newcommand{\paperid}[1]{\gdef\paper@num{#1}
%%  Checking if \papernum and \jobname are matching
\ifthenelse{\equal{\paper@num}{\jobname}}{}{%       not matching
\typeout{^^JELXPAPER WARNING! The name of translated TeX file (\jobname) and paper code (\paper@num) are not matching. ^^J }
\ifthenelse{\equal{\warnmes}{silent}}{}{\typein{}}
}}%

%%%%%%%%%%% C I T A T I O N   N U M B E R   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Citation number defines issue number at the time of publication and reflects the order
% in which an article is published online
\newcommand{\citnumber}[2]{\gdef\cit@label{#1}\gdef\cit@num{#2}
\ifthenelse{\equal{\cit@label}{S}}
{\gdef\cin@ser{S}}
{\gdef\cin@ser{0}}
\ifnum\cit@num<10
   \gdef\cin@num{0\cit@num}
\else
   \gdef\cin@num{\cit@num}
\fi
\gdef\cin@number{\jour@code\jour@num\cin@ser\cin@num}%
\let\cit@number\cin@number
%   Defining parameters for timestamp
\setcounter{years}{\year}
\gdef\yr@stamp{\theyears}
\setcounter{months}{\month}%
\ifnum\value{months}<10
    \gdef\mo@stamp{0\themonths}
\else
    \gdef\mo@stamp{\themonths}
\fi
\setcounter{days}{\day}%
\ifnum\value{days}<10
    \gdef\da@stamp{0\thedays}
\else
    \gdef\da@stamp{\thedays}
\fi
\setcounter{hours}{\time/60}%
\ifnum\value{hours}<10
    \gdef\hr@stamp{0\thehours}
\else
    \gdef\hr@stamp{\thehours}
\fi
\setcounter{minutes}{\time-\value{hours}*60}%
\ifnum\value{minutes}<10
    \gdef\mi@stamp{0\theminutes}
\else
    \gdef\mi@stamp{\theminutes}
\fi
\gdef\print@time{\yr@stamp\mo@stamp\da@stamp\hr@stamp\mi@stamp 00}
\gdef\neb@time{\yr@stamp-\mo@stamp-\da@stamp\space\hr@stamp:\mi@stamp:00}
\ifthenelse{\equal{\@lang}{rus}}{\gdef\xml@lang{ru}}{\gdef\xml@lang{en}}%
\ifthenelse{\equal{\@lang}{rus}}{\gdef\neb@lang{RUS}}{\gdef\neb@lang{ENG}}%
}

% Input values for running head and dates
\newcommand{\lefthead}[1]{\gdef\@lefthead{#1}}
\newcommand{\righthead}[1]{\gdef\@righthead{#1}}
\newcommand{\received}[3]{\gdef\recv@day{#1}\gdef\recv@month{#2}\gdef\recv@year{#3}}
\received{\@empty}{\@empty}{\@empty}
\newcommand{\revised}[3]{\gdef\revis@day{#1}\gdef\revis@month{#2}\gdef\revis@year{#3}}
\revised{\@empty}{\@empty}{\@empty}
\newcommand{\accepted}[3]{\gdef\acpt@day{#1}\gdef\acpt@month{#2}\gdef\acpt@year{#3}}
\accepted{\@empty}{\@empty}{\@empty}
\newcommand{\published}[3]{\gdef\pub@day{#1}\gdef\pub@month{#2}\gdef\pub@year{#3}
\ifthenelse{\(\equal{\pub@month}{January}\) \or \(\equal{\pub@month}{������}\)}{\gdef\pub@mon{1}}{%
\ifthenelse{\(\equal{\pub@month}{February}\) \or \(\equal{\pub@month}{�������}\)}{\gdef\pub@mon{2}}{%
\ifthenelse{\(\equal{\pub@month}{March}\) \or \(\equal{\pub@month}{�����}\)}{\gdef\pub@mon{3}}{%
\ifthenelse{\(\equal{\pub@month}{April}\) \or \(\equal{\pub@month}{������}\)}{\gdef\pub@mon{4}}{%
\ifthenelse{\(\equal{\pub@month}{May}\) \or \(\equal{\pub@month}{���}\)}{\gdef\pub@mon{5}}{%
\ifthenelse{\(\equal{\pub@month}{June}\) \or \(\equal{\pub@month}{����}\)}{\gdef\pub@mon{6}}{%
\ifthenelse{\(\equal{\pub@month}{July}\) \or \(\equal{\pub@month}{����}\)}{\gdef\pub@mon{7}}{%
\ifthenelse{\(\equal{\pub@month}{August}\) \or \(\equal{\pub@month}{�������}\)}{\gdef\pub@mon{8}}{%
\ifthenelse{\(\equal{\pub@month}{September}\) \or \(\equal{\pub@month}{��������}\)}{\gdef\pub@mon{9}}{%
\ifthenelse{\(\equal{\pub@month}{October}\) \or \(\equal{\pub@month}{�������}\)}{\gdef\pub@mon{10}}{%
\ifthenelse{\(\equal{\pub@month}{November}\) \or \(\equal{\pub@month}{������}\)}{\gdef\pub@mon{11}}{%
\ifthenelse{\(\equal{\pub@month}{December}\) \or \(\equal{\pub@month}{�������}\)}{\gdef\pub@mon{12}}{\gdef\pub@mon{N/A
%%\typeout{^^JSECTEXML ERROR! The value of publishing month (\pub@month) is out of range. ^^J }%
%%\ifthenelse{\equal{\warnmes}{silent}}{}{\typein{Press ENTER to continue...}}%
}}}}}}}}}}}}}%
\ifthenelse{\(\equal{\pub@mon}{N/A}\)}{
\typeout{^^JSECTEXML ERROR! The value of publishing month (\pub@month) is out of range. ^^J }%
\ifthenelse{\equal{\warnmes}{silent}}{}{\typein{Press ENTER to continue...}}}{}%
}%    Closing \published
\published{\@empty}{\@empty}{\@empty}

\newcommand{\gcmdterms}[1]{\gdef\gcmd@terms{#1}}       \gcmdterms{\@empty}
\newcommand{\aguterms}[1]{\gdef\index@terms{#1}}       \aguterms{\@empty}
\newcommand{\runheadings}{\hfill {\sc \lowercase{\@lefthead : \@righthead}} \hfill}
%%\newcommand{\runheadings}{\cit@@number\hfill {\sc \@lefthead : \@righthead} \hfill\cit@@number}
%%  The command  \gdef\root@url below contains \hyperbaseurl for 'hyper' option
\newcommand{\siterooturl}[1]{\gdef\root@url{\ifthenelse{\equal{\hyptest}{nohyp}}{}{#1}}}
\siterooturl{\@empty}
%   Predefined values for the first XML block
\newcommand{\xmldepositor}[2]{\gdef\dep@name{#1}\gdef\dep@email{#2}}
\xmldepositor{\@empty}{\@empty}
\newcommand{\xmlregistrant}[1]{\gdef\regist@name{#1}}
\xmlregistrant{\@empty}

% Data for header block_______________________________________________
\newcommand{\ident@skip}{36pt}      %  between ident line and title
\newcommand{\title@skip}{12pt}      %  between title and author
\newcommand{\auth@skip}{8pt}       %  between author and affiliation
\newcommand{\auth@skipex}{8pt}     %  extra space if author is followed by abstract
\newcommand{\affil@skip}{10pt}      %  between affiliation and next author
\newcommand{\affil@skipex}{5pt}     %  extra space if affiliation is followed by abstract
\newcommand{\abs@skip}{10pt}        %  space after abstract
\newcommand{\cit@skip}{10pt}        %  space after citation
\newlength{\ltheight}%
\newlength{\ltwidth}%
\newlength{\ltshift}%


\newcounter{appendix}      %  counter of appendices
\setcounter{appendix}{0}

\newcounter{chdr}          %  marker of items in the header:
                           %  1 - ident line, 2 - title, 3 - author, 4 - affil
\setcounter{chdr}{0}
\newcounter{anum}          %  number of author/affiliation groups
\setcounter{anum}{1}
\newcounter{agrnum}        %  number of authors in current group
\setcounter{agrnum}{0}
\newcounter{atot}          %  number of authors counted in run mode
\setcounter{atot}{0}
\newcounter{lastauth}       %  number of authors initially defined
\setcounter{lastauth}{1}
\newcounter{preauth}       %  number of authors prceeding the last one, i.e. \value{lastauth}
\setcounter{preauth}{\value{lastauth}-1}
\newcounter{olof}          %  label of online output
\setcounter{olof}{0}
\newcounter{altaff}        %  counter of altaffil
\setcounter{altaff}{0}
\newcounter{ancil}         %  counter of ancillary items
\setcounter{ancil}{0}
\newcounter{lstp}          %  counter for last page
\setcounter{lstp}{0}
\newcounter{lastref}       %  number of total references
\setcounter{lastref}{0}
\newcounter{curref}        %  marker for references
\setcounter{curref}{0}
\newcounter{parnum}        %  marker for paragraphs
\setcounter{parnum}{0}

\newcounter{affcur}        %  current number of entered affiliation
\setcounter{affcur}{0}
\newcounter{afprev}        %  previous number of entered affiliation
\setcounter{afprev}{0}
\newcounter{afftmp}        %  temporary counter for entered affiliation
\setcounter{afftmp}{0}

\newcounter{affilcur}      %  current number of entered affiliation (in affil block)
\setcounter{affilcur}{0}
\newcounter{affiltmp}      %  temporary counter for entered affiliation (in affil block)
\setcounter{affiltmp}{0}

\newcounter{flbl}           % counter/marker for floatsection
\setcounter{flbl}{0}

\newcounter{flblfin}           % counter/marker for floatsection
\setcounter{flblfin}{0}

\newcounter{keynum}        % counter for keywords (used for NEB XML)
\setcounter{keynum}{0}
\newcounter{lastkey}       % number of keywords (used for NEB XML)
\setcounter{lastkey}{0}

\newcounter{nebtot}            % author counter for NEB
\setcounter{nebtot}{0}

%%--------------------------------------- NEB --------------------------------------------------
\newcounter{steps}            %  counter/marker for translation steps
\setcounter{steps}{1}
%%--------------------------------------- NEB --------------------------------------------------

\newcounter{years}
\newcounter{months}
\newcounter{days}
\newcounter{hours}
\newcounter{minutes}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{flotmp}      %  temporary counter for float anchors     %%%%
\setcounter{flotmp}{0}                                              %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%   Converting text strings to integers
\newcounter{integ}         %  temporary counter for conversion to integer
\setcounter{integ}{0}
\newcommand{\convinteg}[1]{\setcounter{integ}{#1}}%

\newcommand\mpar{\addtocounter{parnum}{1}\vspace*{.5\baselineskip}\hspace*{-1em}%%
\ifthenelse{\equal{\parnumber}{par}}%
{{\footnotesize[\theparnum]}\hspace*{1em}}{\hspace*{1em}}}

\newcommand\parabs{\addtocounter{parnum}{1}%% for Abstract par number
\ifthenelse{\equal{\parnumber}{par}}%
{{\footnotesize[\theparnum]}\hspace*{1em}}{}}

%%\newcommand\mpar{\addtocounter{parnum}{1}%
%%\ifthenelse{\equal{\parnumber}{par}}%
%%{\par{\footnotesize[\theparnum]}}{\par}}

%%\setbox22=\hbox{}
%%\setbox33=\hbox{}

\setbox3=\vbox{}                    %  for accumulating author/affil
\setbox4=\vbox{}                    %  for accumulating altaffil data
\setbox5=\vbox{}                    %  for accumulating author addresses
\setbox6=\hbox{}                    %  for running head
\setbox7=\hbox{}                    %  for accumulating authors line
\setbox8=\hbox{}                    %  buffer for current author
\setbox9=\hbox{}                    %  buffer for affiliation
\setbox13=\hbox{}                   %  for accumulating authors in reference string
\setbox18=\hbox{}
\setbox19=\vbox{}
\setbox20=\hbox{}

\setbox100=\hbox{}                  %  buffer for accumulating \authorcit
\setbox110=\hbox{}                  %  buffer for accumulating \authorcit items
\setbox112=\hbox{}                  %  buffer for accumulating citation number

\setbox200=\hbox{}                  %  buffer for direct author list
\setbox201=\hbox{}                  %  buffer for author list with inverted names of the first author

\newcounter{topnum}%
\newcounter{midnum}%
\newcounter{botnum}%
\newcounter{tmpnum}%

\newlength{\shortcaplen}%
\newlength{\caplen}%
\newlength{\ang@tur}
\newlength{\wdintebox}
\newlength{\hgintebox}
\newsavebox{\horintebox}
\newsavebox{\verintebox}

%  Identification line________________________________________________
\newcommand{\@ident}{%
\vbox{\begin{center}%
\ifthenelse{\equal{\jour@name}{\jrn@MS}}
{\setcounter{page}{1}%
\ifthenelse{\equal{\jour@fut}{\@empty}}
{\small\jour@name\vspace*{-.3pc}\\ \rule{15pc}{.3pt}}
{\ifthenelse{\equal{\cpr@year}{\@empty}}
{\typeout{}\typeout{ELXPAPER ERROR!!! Publication year is not defined.}%
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein[\cpr@year]{Enter publication year.}}}{}
\small\jour@name\vspace*{.4pc}\\ \ifthenelse{\equal{\@lang}{rus}}{������������ � }{Submitted to} {\itshape \jour@fut}, \cpr@year\vspace*{-.3pc}\\
\rule{15pc}{.3pt}}
}{\ifthenelse{\equal{\jour@name}{\jrn@BS}}
  {\small\jour@name \hfill {\selectlanguage{russian} ������������ �� ��������������}\\ Proceedings of Geophysical Center RAS  \hfill \selectlanguage{russian} ����� �������������� ������ ��� \\ \vspace*{\baselineskip} VOL.\space\jour@vol,\space \cit@number,\space doi:\doi@prefix/\paper@num,%
  \space\uppercase\expandafter{20\jour@date}}%
{\ifthenelse{\equal{\jour@name}{\jrn@ES}}
  {\small\jour@name,\space VOL.\space\jour@vol,\space \cit@number,\space doi:\doi@prefix/\paper@num,%
  \space\uppercase\expandafter{20\jour@date}}%
  {\ifthenelse{\equal{\jour@name}{\jrn@PO}}
  {\small\jour@name,\space VOL.\space\jour@vol,\space \cit@number,\space doi:\doi@prefix/\paper@num,%
  \space\uppercase\expandafter{20\jour@date}}%
{\ifthenelse{\equal{\jour@name}{\jrn@RE}}
  {\small\jour@name,\space ���\space\jour@vol,\space \cit@number,\space doi:\doi@prefix/\paper@num,%
  \space\uppercase\expandafter{20\jour@date}}%
{\ifthenelse{\equal{\jour@name}{\jrn@NZ}}
  {\small\jour@name,\space ���\space\jour@vol,\space \cit@number,\space doi:\doi@prefix/\paper@num,%
  \space\uppercase\expandafter{20\jour@date}}%
{}}}}}}

\ifthenelse{\equal{\one@subid}{\@empty} \or  \equal{\two@subid}{\@empty}}{}%
{\vskip7pt
\centerline{\large\sc \one@subid}\vskip4pt
\centerline{\uppercase\expandafter{\bfseries\Large \two@subid}}
\centerline{\three@subid}}
\end{center}}
}

%  Title _______________________________________________________
\def\title#1{%
\ifthenelse{\(\equal{\jour@code}{PO} \and \not\(\equal{\gpo@preprint}{\@empty}\)\)}
{\gdef\@title{\par\noindent\parbox{\@headwidth}%
{\pretolerance=10000\raggedright{\fontsize{14}{18}\selectfont\bfseries #1\altaffilmark{\dag}\hfil}}}
\altaffil{\dag}{Submitted to \gpo@preprint}}
{\gdef\@@title{#1}\gdef\@title{\par\noindent\parbox{\@headwidth}%
{\pretolerance=10000\raggedright{\fontsize{14}{18}\selectfont\bfseries #1\hfil}}}
}

%%  Defining some command for the first XML block
\ifthenelse{\equal{\dep@name}{\@empty} \or \equal{\dep@email}{\@empty}}%
{\gdef\dep@name{Vitaly Nechitailenko}\gdef\dep@email{vitaly@wdcb.ru}}{}
\ifthenelse{\equal{\regist@name}{\@empty}}%
{\gdef\regist@name{GCRAS}}{}

%%  Assigning full title for XML and printing the first XMLblock

\ifthenelse{\equal{\jour@code}{BS}}{\gdef\jour@fut{Geoinformatics Research Papers}}{}%
\ifthenelse{\equal{\jour@code}{ES}}{\gdef\jour@fut{Russian Journal of Earth Sciences}}{}%
\ifthenelse{\equal{\jour@code}{PO}}{\gdef\jour@fut{Geophysical Papers Online -- Preprints}}{}%
\ifthenelse{\equal{\jour@code}{RE}}{\gdef\jour@fut{���������� ������ ���� � �����}}{}%
\ifthenelse{\equal{\jour@code}{NZ}}{\gdef\jour@fut{������� ��������� ���� � ����� ���}}{}%

\xmlblockone
\ifnum\value{steps} = 1
   \xmlautfile
   \xmlaffile
   \xmlkeyfile
\fi
}%

%%  PAPER TYPES: accepted values are RAR|EDI|REV|ABS|REP|COR|MIS
%%  RAR - regular paper; EDI - editorial; REV - review; ABS - abstract; REP - report; COR - corrections; MIS - miscellaneous

\newcommand\papertype[1]{\gdef\paper@type{#1}}      \papertype{\@empty}

%  Author _____________________________________________________
\setboolean{au@test}{true}
\setboolean{au@first}{true}
\def\cur@affil{\@empty}

%% Extracting affiliation text out of elxpaper-org.tex generated on first LaTeX translation

\newcommand{\authorlist}[4]{\gdef\auth@id{#1}\gdef\auth@surname{#2}\gdef\auth@fnames{#3}\gdef\auth@orgname{#4}
%%%\@bsphack\protected@write\@xmlautsave{}{Test string  authors }\@esphack%%
\@bsphack\protected@write\@xmlautsave{}{\string\authorsaved{\auth@id}{\auth@surname}{\auth@fnames}{\auth@orgname}}\@esphack%%   c = \authorsaved
}%

\newcommand{\affillist}[2]{\gdef\saveaf@id{#1}\gdef\saveaf@text{#2}
%%%\@bsphack\protected@write\@xmlorgsave{}{Test string  affiliations }\@esphack%%
\@bsphack\protected@write\@xmlorgsave{}{\string\affilsaved{\saveaf@id}{\saveaf@text}}\@esphack%%
}%
%%    Record of keywords to bufferred file
\newcommand{\fixnebkey}[1]{\gdef\neb@keyout{#1}%
\@bsphack\protected@write\@xmlkeysave{}{\string\keysaved{\neb@keyout}}\@esphack%%
}

%%    The next command process author saved commands  after the list of saved authors is inputed
\newcommand{\authorsaved}[4]{\gdef\saveauth@id{#1}\gdef\saveauth@surname{#2}\gdef\saveauth@fnames{#3}\gdef\saveauth@orgname{#4}
   \setcounter{nebtot}{\saveauth@id}
   \ifnum\value{nebtot}<10
      \gdef\neb@atot{00\thenebtot}
   \else
      ifnum\value{nebtot}<100
         \gdef\neb@atot{0\thenebtot}
      \else
         \gdef\neb@atot{\theanebtot}
   \fi
\input{\jobname saveorg.tex}
}%

%%    The next command scans affiliation list to fine correspondence between author and its primary organization
\newcommand{\affilsaved}[2]{\gdef\saveaffil@id{#1}\gdef\saveaffil@orgname{#2}
%% Affilnum = \saveaffil@id\\
%% Affilname = \saveaffil@orgname\\
   \ifthenelse{\equal{\saveauth@orgname}{\saveaffil@id}}{
%%   TRUE FOR NEB:  \neb@atot\space\space \saveauth@id\space\space \saveauth@surname\space\space \saveaffil@orgname\\}{}%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<author num="\neb@atot">}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab<individInfo lang="\neb@lang">}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<surname>\saveauth@surname</surname>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<initials>\saveauth@fnames</initials>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab\tab<orgName>\saveaffil@orgname</orgName>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab</individInfo>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab</author>}\@esphack%%
}{}%
}%%

\newcommand{\keysaved}[1]{\gdef\key@save{#1}%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab\tab<keyword>\key@save</keyword>}\@esphack%%
}

\renewcommand{\author}[7]{%
\setcounter{preauth}{\value{lastauth}-1}
\gdef\au@surname{\@empty}
\gdef\au@id{#1}\gdef\aut@surname{#2}\gdef\au@fname{#3}\gdef\au@suffix{#4}%
\gdef\au@affil{#5}\gdef\au@altaf{#6}\gdef\au@inits{#7}%

%%--------------------------------------- NEB --------------------------------------------------
\ifnum\value{steps} = 1
   \@bsphack\protected@write\@xmlautlist{}{\string\authorlist{\au@id}{\aut@surname}{\au@fname}{\au@affil}}\@esphack%%
\fi
%%--------------------------------------- NEB --------------------------------------------------

%   Checking correct order for basic affiliation
\ifthenelse{\equal{\au@affil}{\@empty}}%
{{\bf ERROR!!! Affiliation parameter of author \aut@surname\  is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Affiliation parameter of author [\aut@surname]  is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}}%
{\convinteg{#5}%
\setcounter{afftmp}{\theinteg}%
\ifnum\value{integ}>\value{affcur}%
\addtocounter{affcur}{1}%
\fi%
%%%TEST%%%\noindent{\bf AFFTMP (before basic) = \theafftmp \space\space\space AFFCUR = \theaffcur \\}
\ifnum\value{integ}>\value{affcur}
{\bf ERROR!!! Affiliation mark assigned to author \aut@surname\  has wrong order.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Affiliation mark assigned to author [\aut@surname]  has wrong order.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
\fi}%

%   Checking correct order for alternative affiliation
\ifthenelse{\equal{\au@altaf}{\@empty}}{}%
{\convinteg{#6}%
%%%TEST%%%\noindent{\bf AFFTMP (inside alternate) = \theafftmp \space\space\space AFFCUR = \theaffcur \\}
\ifnum\value{integ}>\value{affcur}%
\addtocounter{affcur}{1}%
\fi%
\ifnum\value{integ}>\value{affcur}%
    {\bf ERROR!!! Altaffil mark assigned to author \aut@surname\  has wrong order.}%
    \typeout{}%
    \typeout{ELXPAPER ERROR!!! Altaffil mark assigned to author [\aut@surname]  has wrong order.}%
    \ifthenelse{\equal{\warnmes}{silent}}{}%
    {\typein{Press ENTER to continue...}}%
\else%
    \ifnum\value{integ}<\value{afftmp}%
        {\bf ERROR!!! Affiliation marks assigned to author \aut@surname\  have wrong order.}%
        \typeout{}%
        \typeout{ELXPAPER ERROR!!! Affiliation marks assigned to author [\aut@surname]  have wrong order.}%
        \ifthenelse{\equal{\warnmes}{silent}}{}%
        {\typein{Press ENTER to continue...}}%
    \fi%
    \ifnum\value{integ}>\value{affcur}%
        \addtocounter{affcur}{1}%
    \fi%
\fi}%

\ifthenelse{\equal{\au@altaf}{\@empty}}{\let\au@surname\aut@surname}%
{\def\au@surname{\aut@surname$^{\au@altaf}$}}

%   Define type of author groupping
% The following adds commas to author names depending of position and language
\addtocounter{atot}{1}

\ifnum\value{atot}<10
   \gdef\neb@atot{00\theatot}
\else
   ifnum\value{atot}<100
      \gdef\neb@atot{0\theatot}
   \else
      \gdef\neb@atot{\theatot}
\fi

\ifnum\value{atot}=1
     \setbox8=\hbox{\au@fname\space\aut@surname}%
    \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {}{\setbox8=\hbox{\unhbox8\space\ \au@suffix}}
    \ifthenelse{\equal{\au@altaf}{\@empty}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil}$}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil, \space\au@altaf}$}}
    \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {\setbox110=\hbox{\footnotesize \aut@surname,\space\au@fname}}%
        {\setbox110=\hbox{\footnotesize \aut@surname\space\au@suffix,\space\au@fname}}%
        \setbox7=\hbox{\unhbox8}%
        \setbox100=\hbox{\unhbox110}
\else
    \ifnum\value{atot}<\value{lastauth}
        \setbox8=\hbox{\au@fname\space\aut@surname}%
    \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {}{\setbox8=\hbox{\unhbox8\space\ \au@suffix}}
    \ifthenelse{\equal{\au@altaf}{\@empty}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil}$}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil, \space\au@altaf}$}}
    \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {\setbox110=\hbox{\footnotesize \au@fname\space\aut@surname}}%
        {\setbox110=\hbox{\footnotesize \au@fname\space\aut@surname\space\au@suffix}}%
        \setbox7=\hbox{\unhbox7,\space\unhbox8}%
        \setbox100=\hbox{\unhbox100,\space\unhbox110}
    \else
        \setbox8=\hbox{\au@fname\space\aut@surname}%
        \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {}{\setbox8=\hbox{\unhbox8\space\ \au@suffix}}
        \ifthenelse{\equal{\au@altaf}{\@empty}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil}$}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil, \space\au@altaf}$}}

        \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {\setbox110=\hbox{\footnotesize \au@fname\space\aut@surname}}%
        {\setbox110=\hbox{\footnotesize \au@fname\space\aut@surname\space\au@suffix}}%
    \fi
        \setbox8=\hbox{\au@fname\space\aut@surname}%
        \ifthenelse{\equal{\au@suffix}{\@empty}}%
        {}{\setbox8=\hbox{\unhbox8,\space\au@suffix}}
        \ifthenelse{\equal{\au@altaf}{\@empty}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil}$}}
        {\setbox8=\hbox{\unhbox8$^{\au@affil, \space\au@altaf}$}}
\fi

%%  Writing current contributor's name to XML
\xmlblocktwo      %% Writing authors to CrossRef XML file
}%

%  Affiliation _________________________________________________

\newcommand{\affil}[5]{%
\gdef\af@id{#1}\gdef\af@org{#2}\gdef\af@city{#3}\gdef\af@state{#4}\gdef\af@country{#5}%

\ifthenelse{\equal{\af@id}{\@empty}}%
{{\bf ERROR!!! Affiliation number field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Affiliation number field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}}%
{\convinteg{#1}%
\setcounter{affiltmp}{\theinteg}%

\ifnum\value{integ}>\value{affilcur}%
\addtocounter{affilcur}{1}%      Number of affiliation under processing
\fi%
%   Checking an order of affiliation in footnoted block
\ifnum\value{integ}=\value{affilcur}%
\else%
{\bf ERROR!!! Affiliation numbers should be ordered.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Affiliation numbers should be ordered.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
\fi}%

\ifthenelse{\equal{\af@state}{\@empty}}{
\setbox9=\hbox{\af@org,\space\af@city,\space\af@country}%
\gdef\org@string{\af@org,\space\af@city,\space\af@country}%
}{\setbox9=\hbox{\af@org,\space\af@city,\space\af@state,\space\af@country}%
\gdef\org@string{\af@org,\space\af@city,\space\af@state,\space\af@country}}%

%%--------------------------------------- NEB --------------------------------------------------
\ifnum\value{steps} = 1
   \@bsphack\protected@write\@xmlorglist{}{\string\affillist{\theaffilcur}{\org@string}}\@esphack%%
\fi
%%--------------------------------------- NEB --------------------------------------------------
\gdef\alt@text{\af@org,\space\af@city%
\ifthenelse{\equal{\af@state}{\@empty}}{}{,\space\af@state},\space\af@country}
\ifnum\value{altaff}=0%
%%%%\setbox4=\vbox{\unvbox4\par\noindent\ifthenelse{\equal{\@footnotetext}{\@empty}}{\rule{8pc}{.3pt}}{\rule{8pc}{.0pt}}\vskip2pt}%
\setbox4=\vbox{\unvbox4 \par\noindent\rule{8pc}{.3pt}\vskip2pt}%  8
\addtocounter{altaff}{1}\fi%
\setbox4=\vbox{\unvbox4 \par\noindent\parbox{\@bodywidth}%
{\footnotesize \par\hskip.38cm $^{\af@id}$\alt@text}\vskip1pt}}%

%  Alternative affiliation _____________________________________
\newcommand{\altaffilmark}[1]{\gdef\al@afm{#1}%
$^{\al@afm}$}%
\newcommand{\altaffil}[5]{\gdef\alt@mark{#1}\gdef\alt@org{#2}\gdef\alt@city{#3}\gdef\alt@state{#4}\gdef\alt@country{#5}%
\gdef\alt@text{\alt@org,\space\alt@city%
\ifthenelse{\equal{\alt@state}{\@empty}}{}{,\space\alt@state},\space\alt@country}
\ifnum\value{altaff}=0%
\setbox4=\vbox{\unvbox4 \par\noindent\rule{7pc}{.3pt}\vskip2pt}%
\addtocounter{altaff}{1}\fi%
\setbox4=\vbox{\unvbox4 \par\noindent\parbox{\@bodywidth}%
{\footnotesize \par\hskip.38cm $^{\alt@mark}$ Also at \alt@text}\vskip1pt}
}

%% Keywords _______________________________________

\gdef\neb@keys{\@empty}
\newcommand{\keywd}[1]{\gdef\key@wd{#1} \gdef\neb@wd{#1}%
\addtocounter{keynum}{1}
%  Merging keywords for abstract block  and   writing them to external file
\ifnum\value{keynum}=1
   \setbox18=\hbox{\key@wd}%
\else
   \ifnum\value{keynum}<\value{lastkey}
      \setbox18=\hbox{\unhbox18;\space\key@wd}%
   \else
      \ifnum\value{keynum}=\value{lastkey}
         \setbox18=\hbox{\unhbox18;\space\key@wd}%
      \fi
   \fi
\fi
\gdef\@keys{\unhbox18}
\ifnum\value{steps} = 1
   \@bsphack\protected@write\@xmlkeylist{}{\string\fixnebkey{\neb@wd}}\@esphack%%
\fi
}


%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                             ABSTRACT                                %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\abstract}[1]{%
%   Check matching number of affiliations and links to them
\ifnum\value{affcur}=\value{affilcur}%
\else%
{\bf ERROR!!! Number of affiliations does not match number of links to them.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Number of affiliations does not match number of links to them.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
\fi%
%       Closing authors' citation
\ifnum\value{atot}=1
\setbox100=\hbox{\footnotesize \unhbox100\space\unhbox110}%
\else
    \ifnum\value{atot}=2
\ifthenelse{\equal{\@lang}{rus}}
{\setbox100=\hbox{\footnotesize \unhbox100 \space �\space\unhbox110}}%
{\setbox100=\hbox{\footnotesize \unhbox100 \space and\space\unhbox110}}%
   \else
\ifthenelse{\equal{\@lang}{rus}}
{\setbox100=\hbox{\footnotesize \unhbox100 \space �\space\unhbox110}}%
{\setbox100=\hbox{\footnotesize \unhbox100,\space and\space\unhbox110}}%
    \fi
\fi

\gdef\author@@cit{\copy100}
\gdef\author@cit{\footnotesize \copy100}

%       Closing total author list
\ifnum\value{atot}=1
\setbox7=\hbox{\footnotesize \unhbox7\space\unhbox8}%
\else
    \ifnum\value{atot}=2
\ifthenelse{\equal{\@lang}{rus}}
{\setbox7=\hbox{\footnotesize \unhbox7 \space �\space\unhbox8}}%
{\setbox7=\hbox{\footnotesize \unhbox7 \space and\space\unhbox8}}%
    \else
\ifthenelse{\equal{\@lang}{rus}}
{\setbox7=\hbox{\footnotesize \unhbox7 \space �\space\unhbox8}}%
{\setbox7=\hbox{\footnotesize \unhbox7, \space and\space\unhbox8}}%
    \fi
\fi

\setbox3=\vbox{\unvbox3 \par\noindent\parbox{\@headwidth}%
{\pretolerance=10000\raggedright{\font@author%
\unhbox7}\hfil\vskip\auth@skip}}%
\ifthenelse{%
  \(\equal{\jour@name}{\jrn@BS} \or \equal{\jour@name}{\jrn@ES}
  \or \equal{\jour@name}{\jrn@RE} \or \equal{\jour@name}{\jrn@NZ}  \or \equal{\jour@name}{\jrn@PO}\)}%
{\newcommand{\abstrsize}{\fontsize{10}{12}\selectfont}%
\@fmabwidth=14cm}%
{\newcommand{\abstrsize}{\fontsize{9}{11}\selectfont}%
\@fmabwidth=8.4cm}
\ifthenelse{\equal{\jour@name}{\jrn@MS}}%
{\renewcommand{\abstrsize}{\fontsize{12}{24}\selectfont}
\@fmabwidth=38pc}{}%
\gdef\@abstract{#1}
\ifthenelse{\(\equal{\jour@name}{\jrn@BS} \or \equal{\jour@name}{\jrn@ES} \or \equal{\jour@name}{\jrn@PO} \or \equal{\jour@name}{\jrn@RE} \or \equal{\jour@name}{\jrn@NZ}\)}%
{\twocolumn[%
\@ident
\vskip\ident@skip
\@title\vskip\title@skip\copy3          %%  authors
\noindent {\footnotesize%


\ifthenelse{\(\equal{\recv@day}{\@empty} \or \equal{\recv@month}{\@empty} \or \equal{\recv@year}{\@empty}\)}%
{{\bf ERROR!!! Received date fields are empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Received date fields are empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}}
{\ifthenelse{\equal{\@lang}{rus}}{��������}{Received}\space\recv@day\space\recv@month\space\recv@year\ifthenelse{\equal{\@lang}{rus}}{\space �.}{};}%
\ifthenelse{\(\equal{\revis@day}{\@empty} \or \equal{\revis@month}{\@empty} \or \equal{\revis@year}{\@empty}\)}%
{\typeout{}%
\typeout{ELXPAPER WARNING!!! Revised date fields are empty.}}%
%%{\space revised\space\revis@day\space\revis@month\space\revis@year;}
{\space\ifthenelse{\equal{\@lang}{rus}}{������������}{revised}\space\revis@day\space\revis@month\space\revis@year\ifthenelse{\equal{\@lang}{rus}}{\space �.}{};}
\ifthenelse{\(\equal{\acpt@day}{\@empty} \or \equal{\acpt@month}{\@empty} \or \equal{\acpt@year}{\@empty}\)}%
{\ifthenelse{\equal{\jour@code}{NZ} \or \equal{\jour@code}{RE}}{}{%
{\bf ERROR!!! Accepted date fields are empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Accepted date fields are empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}
}}%
{\space\ifthenelse{\equal{\@lang}{rus}}{�������}{accepted}\space\acpt@day\space\acpt@month\space\acpt@year\ifthenelse{\equal{\@lang}{rus}}{\space �.}{};}
\ifthenelse{\(\equal{\pub@day}{\@empty} \or \equal{\pub@month}{\@empty} \or \equal{\pub@year}{\@empty}\)}%
{{\bf ERROR!!! Published date fields are empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Published date fields are empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}}
{\space \ifthenelse{\equal{\@lang}{rus}}{������������}{published}\space\pub@day\space\pub@month\space\pub@year\ifthenelse{\equal{\@lang}{rus}}{\space �.}{.}}}\\

\newboolean{agu@key}
\setboolean{agu@key}{false}
\newboolean{gcmd@key}
\setboolean{gcmd@key}{false}

%%  Composing and printing abstract and/or index/keywork sets

\ifthenelse{\equal{\@abstract}{\@empty}}{%%                 empty abstract
\par\noindent\parbox[t]{\@fmabwidth}{\pretolerance=100%
\@rightskip=\z@ plus 2em\rightskip\@rightskip%
{\footnotesize%%%%%\scriptsize%
\ifthenelse{\equal{\gcmd@terms}{\@empty}}{}%
{\setboolean{gcmd@key}{true}{\slshape {\footnotesize GCMD T}ERMS:} \gcmd@terms}%
\ifthenelse{\equal{\index@terms}{\@empty}}{}%
{\ifthenelse{\boolean{gcmd@key}}{;\space\space}{}%
\setboolean{agu@key}{true}{\slshape {\footnotesize I}NDEX {\footnotesize T}ERMS:} \index@terms}%
\ifthenelse{\equal{\@keys}{\@empty}}%
{\ifthenelse{\boolean{gcmd@key} \or \boolean{agu@key}}{.}{}}{%      non-empty keys
\ifthenelse{\boolean{gcmd@key} \or \boolean{agu@key}}
{;\space\space}{}%
\ifthenelse{\equal{\@lang}{rus}}{\slshape �������� �����: \@keys.}{\slshape {\footnotesize K}EYWORDS: \@keys.}}%
}}\vskip\abs@skip}
{%%                                                         non-empty abstract
\par\noindent\parbox[t]{\@fmabwidth}{\pretolerance=100%
\@rightskip=\z@ plus 2em\rightskip\@rightskip%
%%\mpar\space\space\abstrsize\@abstract \space\space%
\parabs\space\space\abstrsize\@abstract \space\space%
{\footnotesize%%%%%\scriptsize%
\ifthenelse{\equal{\gcmd@terms}{\@empty}}{}%
{\setboolean{gcmd@key}{true}{\slshape {\footnotesize GCMD T}ERMS:} \gcmd@terms}%
\ifthenelse{\equal{\index@terms}{\@empty}}{}%
{\ifthenelse{\boolean{gcmd@key}}{;\space\space}{}%
\setboolean{agu@key}{true}{\slshape {\footnotesize I}NDEX {\footnotesize T}ERMS:} \index@terms}%
\ifthenelse{\equal{\@keys}{\@empty}}%
{\ifthenelse{\boolean{gcmd@key} \or \boolean{agu@key}}{.}{}}{%     non-empty keys
\ifthenelse{\boolean{gcmd@key} \or \boolean{agu@key}}
{;\space\space}{}%
\ifthenelse{\equal{\@lang}{rus}}{\slshape �������� �����: \@keys.}{\slshape {\footnotesize K}EYWORDS: \@keys.}
%
%%---------------------------------- NEB ---------------------------------------------
%%    Renaming and saving lists of authors and affiliations
%%%{\LARGE STEP = \thesteps}  -->  test  string
\ifnum\value{steps} = 2
   \dointauthor
   \dointaffil
   \input{\jobname aut.tex}
   \input{\jobname org.tex}
\fi
%%---------------------------------- NEB ---------------------------------------------
}
}}\vskip\abs@skip}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbox200 = \hbox{\author@cit}
%%%%\setbox201 = \hbox{\author@cit}
\gdef\main@cit{\copy100}%
\gdef\meta@cit{\copy100}%
\gdef\foot@cit{\copy100}%
\noindent {\footnotesize {\bfseries \ifthenelse{\equal{\@lang}{rus}}{������:}{Citation:}} \author@cit \space\space(\cpr@year),\space
\@@title,\space%
\ifthenelse{\equal{\jour@name}{\jrn@BS}}{{\itshape Geoinf. Res. Papers,\space \jour@vol,}
\space \cit@number,\space doi:\doi@prefix/\paper@num.}{
\ifthenelse{\equal{\jour@name}{\jrn@ES}}{{\itshape Russ. J. Earth. Sci.,\space \jour@vol,}
\space \cit@number,\space doi:\doi@prefix/\paper@num.}{
\ifthenelse{\equal{\jour@name}{\jrn@PO}}{{\itshape Geoph. Papers Online,\space \jour@vol,}
\space \cit@number,\space doi:\doi@prefix/\paper@num.}{
\ifthenelse{\equal{\jour@name}{\jrn@RE}}{{\itshape ����. �. ���� � �����,\space \jour@vol,}
\space \cit@number,\space doi:\doi@prefix/\paper@num.}{
\ifthenelse{\equal{\jour@name}{\jrn@NZ}}{{\itshape ������� ��� ���,\space \jour@vol,}
\space \cit@number,\space doi:\doi@prefix/\paper@num.}{
}}}}}}\vskip\cit@skip

%%---------------------------------- NEB ---------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%{\Large Place to compose authors block   STEP = \thesteps}

\xmlfragone   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifnum\value{steps} = 2
%%   \typein{Inside step \thesteps\space  input keywords   Press ENTER to continue....}
   \dointkeys
   \input{\jobname keys.tex}
\fi
\ifnum\value{steps} > 2
   \input{\jobname saveaut.tex}
%%    Writing title and abstract to xmlnebout
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab</authors>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<artTitles>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<artTitle lang="\neb@lang">\@@title</artTitle>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab</artTitles>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<abstracts>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<abstract lang="\neb@lang">\@abstract</abstract>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab</abstracts>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<keywords>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<kwdGroup lang="ANY">}\@esphack%%
\input{\jobname savekey.tex}
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab</kwdGroup>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab</keywords>}\@esphack%%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab<references>}\@esphack%%
\fi
%%---------------------------------- NEB ---------------------------------------------
%
]}{%
\ifthenelse{\equal{\jour@name}{\jrn@MS}}%                  ADD MS
{\centerline{\@ident}\vskip\ident@skip
\@title\vskip\title@skip\copy3
\ifnum\value{chdr}=3\vskip\auth@skipex
\else\vskip\affil@skipex\fi
\ifnum\value{altaff}=0\else\foot@info{\copy4}\fi
\vfill\noindent Short title: {\sc \@righthead}\vfill
\clearpage\ifthenelse{\equal{\@abstract}{\@empty}}{\@empty}{%
\par\noindent\parbox[t]{\@fmabwidth}{\pretolerance=100%
\abstrsize {\bfseries \absheader.}
\@abstract\vskip\abs@skip}}\clearpage
}{}}

\ifthenelse{\equal{\jour@name}{\jrn@MS}}%
{}{\ifnum\value{altaff}=0\else\foot@info{\copy4}\fi}%
\ifthenelse{\equal{\jour@name}{\jrn@MS}}{}
{\foot@info{\paper@info}}%
\par\vspace*{-3.5\baselineskip}%

\ifthenelse{\equal{\jour@name}{\jrn@MS}}{\pagestyle{plain}}
{\pagestyle{myheadings}\markboth{\runheadings}{\runheadings}
\newlength{\widrhdline}\settowidth{\widrhdline}{\runheadings}
\ifthenelse{\lengthtest{\widrhdline > 13.5cm}}
{\typeout{}\typeout{ELXPAPER WARNING!!!  Running head is too long!}%
\ifthenelse{\equal{\warnmes}{silent}}{} {\typein{Reset 'lefthead'
and 'righthead' values in the preamble.}}}{}
\thispagestyle{plain}\normalsize}\setboolean{abs@label}{true}%
%%

%% Redefining \tablename in Russian with shortening it to ����.
\def\tablename{\ifthenelse{\equal{\@lang}{rus}}{\cyr\CYRT\cyra\cyrb\cyrl.}{Table}}

%%  Redefining commands for linking float anchors to float targets or floatsection
\ifthenelse{\equal{\hyptest}{hyper}}{%      activate hyperlinks defined in this package
    \renewcommand{\tabref}[1]{\gdef\tab@num{##1}%
    \hyperref{}{floats}{tab\tab@num}{\tablename~\tab@num}}%
    \renewcommand{\figref}[1]{\gdef\fig@num{##1}%
    \hyperref{}{floats}{fig\fig@num}{\figurename~\fig@num}}%
    \renewcommand{\plaref}[1]{\gdef\pla@num{##1}%
    \hyperref{}{floats}{pla\pla@num}{\platename~\pla@num}}%
    \ifnum\value{flblfin}=0
        \renewcommand{\tabrefs}[1]{\gdef\tab@nums{##1}{\tablename s~\tab@nums}%
        %%\typeout{}%
        %%\typeout{ELXPAPER WARNING!!! Hyperlink to \tablename s \tab@nums\space  can not be set. Add List of Floats Section.}%
        %%\ifthenelse{\equal{\warnmes}{silent}}{}{\typein{Press ENTER to continue...}}
        }%
        \renewcommand{\figrefs}[1]{\gdef\fig@nums{##1}{\figurename s~\fig@nums}%
        %%\typeout{}%
        %%\typeout{ELXPAPER WARNING!!! Hyperlink to \figurename s \fig@nums\space  can not be set. Add List of Floats Section.}%
        %%\ifthenelse{\equal{\warnmes}{silent}}{}{\typein{Press ENTER to continue...}}
        }%
        \renewcommand{\plarefs}[1]{\gdef\pla@nums{##1}{\platename s~\pla@nums}%
        %%\typeout{}%
        %%\typeout{ELXPAPER WARNING!!! Hyperlink to \platename s \pla@nums\space  can not be set. Add List of Floats Section.}%
        %%\ifthenelse{\equal{\warnmes}{silent}}{}{\typein{Press ENTER to continue...}}
        }%
   \else
        \renewcommand{\tabrefs}[1]{\gdef\tab@nums{##1}
        \hyperref{}{floats}{section}{\tablename s~\tab@nums}}%
        \renewcommand{\figrefs}[1]{\gdef\fig@nums{##1}%
        \hyperref{}{floats}{section}{\figurename s~\fig@nums}}%
        \renewcommand{\plarefs}[1]{\gdef\pla@nums{##1}%
        \hyperref{}{floats}{section}{\platename s~\pla@nums}}%
    \fi
}{%                                        supress hyperlinks defined in hyperref class
    \renewcommand{\href}[2]{\gdef\hr@lnk{##2} \hr@lnk}%
}%
\addcontentsline{toc}{section}{Abstract}%
%% Affiliations are shown in the footnote section, so it is necessary
%% to add to footnote counter accumulated number of affiliations
\addtocounter{footnote}{\au@affil}%
}%       End of ABSTRACT block

%  Footnote-type definitions for paper info block________________
\renewcommand{\footnote}{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn%
  \protected@xdef\@thefnmark{\thempfn}%
  \renewcommand\footnoterule{%
  \kern-3\p@\hrule\@width.4\columnwidth\kern2.6\p@}%
  \@footnotemark\@footnotetext}}
\newcommand{\foot@info}{\@ifnextchar[\@xfootnote{%
  \protected@xdef\@thefnmark{\thempfn}%
  \foot@notetext}}%
\renewcommand{\footnoterule}{\relax}
\newcommand{\foot@notetext}[1]{\insert\footins{%
  \reset@font\footnotesize%
  \interlinepenalty\interfootnotelinepenalty%
  \splittopskip\footnotesep%
  \splitmaxdepth \dp\strutbox \floatingpenalty \@MM%
  \hsize\columnwidth \@parboxrestore%
  \protected@edef\@currentlabel{%
  \csname p@footnote\endcsname\@thefnmark}%
    \color@begingroup%
      \make@fntext{%
      \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
    \color@endgroup}}%
\newcommand{\make@fntext}[1]{\noindent #1}

%  Data for paper info block _______________________________
\newcommand\cpr@string{%
\ifthenelse{\equal{\@originated}{\@empty}}
{}{\vspace*{-1.5\baselineskip}\rule{7pc}{.5pt}\\
\@originated\vspace*{\baselineskip}}\par
\ifthenelse{\equal{\@lang}{rus}}{\copyright\space \cpr@year\space\space \cpr@holder.}
{Copyright \cpr@year\space by the \cpr@holder.}
}
%  CCC code ________________________________________________
\newcommand{\jr@v}{\ifthenelse{\equal{\jour@vol}{\@empty}}%
{00}{\ifnum\jour@vol<10 0\jour@vol \else \jour@vol \fi}}

\newcommand{\jr@n}{
\ifthenelse{\equal{\jour@num}{\@empty}}%
{00}{\ifnum\jour@num<10 0\jour@num \else \jour@num \fi}}

\newcommand{\pr@n}{%
\ifthenelse{\equal{\paper@num}{\@empty}}%
{\typeout{}\typeout{ELXPAPER ERROR!!! Number of paper is not defined.}%
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein[\paper@num]{Enter number of paper.}}}{}%
\ifnum\paper@num<10 0\paper@num \else \paper@num \fi}

\newcommand{\@ccc}{%
\ifthenelse{\equal{\jour@name}{\jrn@BS}}
{\response@page@dir\paper@num.html}
{\ifthenelse{\equal{\jour@name}{\jrn@ES} \or \equal{\jour@name}{\jrn@PO} \or \equal{\jour@name}{\jrn@RE} \or \equal{\jour@name}{\jrn@NZ}}
{\response@page@dir\paper@num-res.html}{}}}%
%
%  Paper information (number, CCC, dates, etc.)____________________
\newcommand{\paper@info}{%
{\vskip2pt{\fontsize{8}{9}\selectfont
\cpr@string\\
\vskip-8pt
\@ccc}
}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                       SECTION  AND  SUBSECTIONS                     %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand\nosection{\vskip24pt plus 4pt minus 2pt%
\ifthenelse{\boolean{abs@label}}{}{%
{\bf\Large\noindent ABSTRACT COMMAND MISSED!\newline
If there is no abstract text put $\backslash$abstract\{\} instead.\vskip2pc}
\typeout{}
\typeout{ELXPAPER ERROR!!! Abstract command missed! Put abstract{} instead.}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}
\setboolean{abs@label}{true}}}

\renewcommand\section{%
\ifthenelse{\boolean{abs@label}}{}{%
{\bf\Large\noindent ABSTRACT COMMAND MISSED!\newline
If there is no abstract text put $\backslash$abstract\{\} instead.\vskip2pc}
\typeout{}
\typeout{ELXPAPER ERROR!!! Abstract command missed! Put abstract{} instead.}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}
\setboolean{abs@label}{true}}
 \ifthenelse{\equal{\jour@name}{\jrn@BS}
 \or \equal{\jour@name}{\jrn@ES} \or \equal{\jour@name}{\jrn@RE}
 \or \equal{\jour@name}{\jrn@MS}}{%
 \setcounter{secnumdepth}{0}}           %%    Temporary  set for fractals
 {\setcounter{secnumdepth}{0}}          %%    Temporary  set for fractals
  \@startsection {section}{1}{\z@}%
  {28pt plus 4pt minus 2pt}{17pt plus 3pt}%
  {\section@font%
  \pretolerance=10000\raggedright}}
\newcommand\floatsection{%
  \setcounter{flbl}{1}
  \hyperdef{floats}{section}{}%
  \@startsection{section}{1}{\z@}%
  {28pt plus 4pt minus 2pt}{17pt plus 3pt}
  {\section@font%
  \pretolerance=10000\raggedright}}
\renewcommand\subsection{%
  \@startsection{subsection}{2}{\z@}%
  {21pt plus 4pt minus 4pt}{16pt plus 3pt}
  {\normalfont\normalsize\bfseries\pretolerance=10000\raggedright}}
\renewcommand\subsubsection{%
  \@startsection{subsubsection}{3}{1em}
  {7pt plus 4pt minus 2pt}{-1em}{\parabs\space\normalfont\normalsize\bfseries}}
\renewcommand\paragraph{%
  \@startsection{paragraph}{4}{1em}
  {7pt plus 4pt minus 2pt}{-1em}{\parabs\space\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{%
  \@startsection{subparagraph}{5}{\parindent}%
  {7pt plus 4pt minus 2pt}{-1em}{\parabs\space\normalfont\footnotesize\bfseries}}
\newcommand\acknowledgments{\@startsection{subparagraph}{5}{1em}
  {10pt plus 4pt minus 2pt}{-1em}
  {\footnotesize \parabs\space{\bfseries \acknowstit.}\footnotesize}}
  \let\acknowledgements=\acknowledgments
\newcommand\acknowledgment{\@startsection{subparagraph}{5}{1em}
  {10pt plus 4pt minus 2pt}{-1em}
  {\footnotesize \parabs\space{\bfseries \acknowtit.}\footnotesize}}
  \let\acknowledgement=\acknowledgment
\newcommand\supplement{%
\@startsection{subsection}{5}{\z@}%
  {21pt plus 4pt minus 4pt}{16pt plus 3pt}
  {\normalfont\normalsize\bfseries\pretolerance=10000\raggedright}%
  {\fontsize{8}{9}\selectfont}\hfill {\normalsize\paper@code}\\%
  \fontsize{8}{9}\selectfont
\ifthenelse{\(\equal{\jour@name}{\jrn@JGRA} \or \equal{\jour@name}{\jrn@JGRB}
  \or \equal{\jour@name}{\jrn@JGRC} \or \equal{\jour@name}{\jrn@JGRD}
  \or \equal{\jour@name}{\jrn@JGRE}\)}
{}
{\typeout{}\typeout{ELXPAPER ERROR!!!  Supplemental abstract is not specified for
selected journale code!}\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                             APPENDICES                              %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\appendix{%
 \ifthenelse{\equal{\jour@name}{\jrn@BS}
 \or \equal{\jour@name}{\jrn@ES} \or \equal{\jour@name}{\jrn@RE}
 \or \equal{\jour@name}{\jrn@MS}}{%
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \setcounter{equation}{0}%
  \gdef\thesection{\@Alph\c@section}
  \renewcommand \theequation {{\@Alph\theappendix}\@arabic\c@equation}
  \addtocounter{appendix}{1}
 \setcounter{secnumdepth}{0}}{%
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \setcounter{equation}{0}%
  \gdef\thesection{\@Alph\c@section}
  \renewcommand \theequation {{\@Alph\theappendix}\@arabic\c@equation}
  \addtocounter{appendix}{1}
 \setcounter{secnumdepth}{0}}          %%  4
  \@startsection {section}{1}{\z@}%
  {28pt plus 4pt minus 2pt}{17pt plus 3pt}%
  {\section@font%
  \pretolerance=10000\raggedright \appendixname~{\@Alph\theappendix}.\space}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                       R E F E R E N C E S                           %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\gdef\ref@accum{\@empty}         %%  String for accumulation reference

%   Initialisation of reference fragments
\newcounter{aref}          %  counter for refauthors
\newcounter{aend}          %  label for author list ending
\setcounter{aref}{0}
\setcounter{aend}{0}             %  1 - means that last author printed by refgroup
\newsavebox{\authbox}
\newsavebox{\authonebox}
\newsavebox{\refnebstring}

%%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
%%        R E F E R E N C E S   S E C T I O N
\def\references{%
\xmlblockthr                    %%  Writing the middle part to XML file
\ifthenelse{\equal{\@lang}{rus}}
{\@startsection{section}{1}{\z@}
{28pt plus 4pt minus 2pt}{17pt plus 3pt}
{\normalfont\fontsize{11}{12}\selectfont\bfseries}{����������}
\bgroup\font@reference\parindent=\z@\parskip=\z@%
\def\refpar{\par\hangindent=1em\hangafter=1}}
{\@startsection{section}{1}{\z@}
{28pt plus 4pt minus 2pt}{17pt plus 3pt}
{\normalfont\fontsize{11}{12}\selectfont\bfseries}{References}
\bgroup\font@reference\parindent=\z@\parskip=\z@%
\def\refpar{\par\hangindent=1em\hangafter=1}}
%   Cleaning of reference fragments
%   The following commands are reserved for CrossRef block
\let\ref@title\@empty
\let\ref@jour\@empty
\let\ref@book\@empty
\let\ref@thesis\@empty
\let\ref@edit\@empty
\let\ref@access\@empty
\let\ref@vol\@empty
\let\ref@numb\@empty
\let\ref@page\@empty
\let\ref@year\@empty
\let\ref@publ\@empty
\let\ref@locat\@empty
\let\red@date\@empty
\setcounter{lastref}{1}    %   Number of references
}%



%   The following macro inserts anchors into the text linked to reference targets
\newcommand{\reflink}[2]{%
\ifthenelse{\equal{\hyptest}{hyper}}{\hyperref{}{reference}{#1}{#2}}{#2}}%

\gdef\auth@string{\@empty}

\def\reference#1{\def\refpar{\par\hangindent=1em\hangafter=1}\relax\refpar%
\ifnum\value{lastref}>1%
\gdef\ref@targetid{#1}  \hyperdef{reference}{\ref@targetid}{}%
\xmlblockfour
\setcounter{aref}{0}%
\setcounter{aend}{0}%
\let\ref@title\@empty
\let\ref@jour\@empty
\let\ref@book\@empty
\let\ref@thesis\@empty
\let\ref@edit\@empty
\let\ref@access\@empty
\let\ref@vol\@empty
\let\ref@numb\@empty
\let\ref@pages\@empty
\let\ref@year\@empty
\let\ref@publ\@empty
\let\ref@locat\@empty
\let\ref@date\@empty
\let\ini@onedoi\@empty
\let\ini@twodoi\@empty
\let\ini@thrdoi\@empty
\let\ini@refer\@empty
\let\ini@target\ref@targetid%%
\else%
\gdef\ref@targetid{#1} \hyperdef{reference}{\ref@targetid}{}%
\let\ini@target\ref@targetid%%
\fi%
\addtocounter{lastref}{1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\immediate\openout\@sumauth\jobname sumauth.tex
}%%

%  Input commands for references
\newcommand{\reftype}[1]{\gdef\ref@type{#1}}

\newcommand{\refauthf}[3]{\gdef\ref@surnamef{#1}\gdef\ref@fnamef{#2}\gdef\ref@suffixf{#3}
\gdef\auth@onestr{\@empty}%
\ifthenelse{\equal{\ref@surnamef}{\@empty}}{%
{\bf ERROR!!! Surname of first author missed!}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Surname of first author missed! Reset reference.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}
%
{%
\setcounter{aref}{1}%
\ifthenelse{\equal{\ref@suffixf}{\@empty}}%
{\ifthenelse{\equal{\ref@fnamef}{\@empty}}%
{\sbox{\authbox}{\ref@surnamef,}%
\sbox{\authonebox}{\ref@surnamef}%
\gdef\auth@split{\ref@surnamef}%
\setbox13=\hbox{\ref@surnamef}%
}{%
\sbox{\authbox}{\ref@surnamef,\space\ref@fnamef,}%
\sbox{\authonebox}{\ref@surnamef,\space\ref@fnamef}%
\gdef\auth@split{\ref@surnamef\space\ref@fnamef}%
\setbox13=\hbox{\ref@surnamef\space\ref@fnamef}%----------------------------------------------------------
}}%
{\sbox{\authbox}{\ref@surnamef,\space\ref@fnamef,\space\ref@suffixf,}%
\sbox{\authonebox}{\ref@surnamef,\space\ref@fnamef,\space\ref@suffixf}%
\gdef\auth@split{\ref@surnamef\space\ref@fnamef\space\ref@suffixf}%
\setbox13=\hbox{\ref@surnamef\space\ref@fnamef,\space\ref@suffixf}%----------------------------------------------------------
}}%
\@bsphack\protected@write\@xmlnebout{}{\tab\tab\tab\tab\tab<reference>\auth@split}\@esphack%%
\relax\refpar}%

\newcommand{\refauth}[3]{\gdef\ref@surname{#1}\gdef\ref@fname{#2}\gdef\ref@suffix{#3}
\ifthenelse{\equal{\ref@surname}{\@empty}}{%
{\bf ERROR!!! Surname of current author missed!}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Surname of current author missed! Reset reference.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{%
\addtocounter{aref}{1}%
\usebox{\authbox}
\ifthenelse{\equal{\ref@suffix}{\@empty}}%
{\sbox{\authbox}{\ref@fname\space\ref@surname,}%
\sbox{\authonebox}{\ref@fname\space\ref@surname}%
\gdef\auth@split{,\space\ref@surname\space\ref@fname}%
}%
{\sbox{\authbox}{\ref@fname\space\ref@surname,\space\ref@suffix,}%
\sbox{\authonebox}{\ref@fname\space\ref@surname,\space\ref@suffix}
\gdef\auth@split{,\space\ref@surname\space\ref@fname\space\ref@suffix}%
}}%
\@bsphack\protected@write\@xmlnebout{}{\auth@split}\@esphack%%
}%

\newcommand{\refgroup}[1]{\gdef\ref@group{#1}%
{\ifthenelse{\equal{\ref@group}{\@empty}}{%
\usebox{\authonebox},\space et al.\space%
\@bsphack\protected@write\@xmlnebout{}{,\space et al.}\@esphack}{%
\usebox{\authonebox},\space \ref@group\space%
\@bsphack\protected@write\@xmlnebout{}{,\space\ref@group}\@esphack}%
\setcounter{aend}{1}%
}}%
%
\newcommand{\refyear}[1]{\gdef\ref@year{#1}
\ifnum\value{aend}=1%
\else%
   {\ifnum\value{aref}=1%
   \usebox{\authonebox}\space%
   \else%
   %%and
   \space\usebox{\authonebox}\space%
   \fi%
\setcounter{aend}{0}}%
\fi%
\space(\ref@year),%
}%

%       Initialisation of reference fragments
\def\ini@title{\@empty}          %     Article  title in journal or book/thesis/database
\newcommand{\reftitle}[1]{\gdef\ref@title{#1}%
\let\ini@title\ref@title}%
\def\ini@jour{\@empty}           %     Journal title
\newcommand{\refjour}[1]{\gdef\ref@jour{#1}%
\let\ini@jour\ref@jour}%
\def\ini@book{\@empty}           %     Book title
\newcommand{\refbook}[1]{\gdef\ref@book{#1}%
\let\ini@book\ref@book}%
\def\ini@edit{\@empty}           %     Editor(s)
\newcommand{\refedit}[1]{\gdef\ref@edit{#1}%
\let\ini@edit\ref@edit}%
\def\ini@thesis{\@empty}         %     Thesis type
\newcommand{\refthesis}[1]{\gdef\ref@thesis{#1}%
\let\ini@thesis\ref@thesis}%
\def\ini@aclink{\@empty}         %     Link to database
\def\ini@actext{\@empty}
\newcommand{\refaccess}[2]{\gdef\ref@aclink{#1}\gdef\ref@actext{#2}%
\let\ini@aclink\ref@aclink%
\let\ini@actext\ref@actext}%
\def\ini@vol{\@empty}            %     Volume number
\newcommand{\refvol}[1]{\gdef\ref@vol{#1}%
\let\ini@vol\ref@vol}%
\def\ini@numb{\@empty}           %     Issue number
\newcommand{\refnumb}[1]{\gdef\ref@numb{#1}%
\let\ini@numb\ref@numb}%
\def\ini@pages{\@empty}          %     Pages
\newcommand{\refpages}[1]{\gdef\ref@pages{#1}}%
%%\let\ini@pages\ref@pages}%
\def\ini@publ{\@empty}           %     Publisher
\newcommand{\refpubl}[1]{\gdef\ref@publ{#1}%
\let\ini@publ\ref@publ}%
\def\ini@locat{\@empty}          %     Location
\newcommand{\reflocat}[1]{\gdef\ref@locat{#1}%
\let\ini@locat\ref@locat}%
\def\ini@date{\@empty}           %     Date of publishing
\newcommand{\refdate}[1]{\gdef\ref@date{#1}%
\let\ini@date\ref@date}%
%     REF
\def\uni@refer{\@empty}          %     Reference string for NEB
%     DOI
\def\ini@onedoi{\@empty}          %     Non-broken DOI
\def\ini@twodoi{\@empty}          %     Broken DOI
\def\ini@thrdoi{\@empty}          %     Combined DOI
\gdef\ref@doi{\@empty}
\newcommand{\nbdoi}[1]{\gdef\one@doi{#1}
\let\ini@onedoi\one@doi}
\newcommand{\brdoi}[2]{\gdef\one@doi{#1}\gdef\two@doi{#2}
\let\ini@onedoi\one@doi \let\ini@twodoi\two@doi}
\newcommand{\tagdoi}[3]{\gdef\one@doi{#1}\gdef\two@doi{#2}\gdef\thr@doi{#3}
\let\ini@onedoi\one@doi \let\ini@twodoi\two@doi \let\ini@thrdoi\thr@doi}
\def\refaut@list{\@empty}

\def\endreference#1{\gdef\anc@text{#1}%
%
\sbox{\refnebstring}{\usebox{\authonebox}\space}
\gdef\refneb@string{\@empty}
%
\ifthenelse{\ref@type = 3}{}{%      printing article/paper title
\ifthenelse{\equal{\ini@title}{\@empty}}{%
{\bf ERROR!!! Article|paper title field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Article|paper title field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{\hskip-1em\ini@title,%
}}%
%
\ifthenelse{\ref@type < 3}{%      printing journal title
\ifthenelse{\equal{\ini@jour}{\@empty}}{%
{\bf ERROR!!! Journal title field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Journal title field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{\space{\itshape \ini@jour},}}{}%
%
\ifthenelse{\(\ref@type = 3\) \or \(\ref@type = 4\)}{%      printing book title
\ifthenelse{\equal{\ini@book}{\@empty}}{%
{\bfseries ERROR!!! Book title field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Book title field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{\ifthenelse{\ref@type = 3}{\space{\itshape \ini@book},}%
{\space%
%%in\space
{\itshape \ini@book}}}}{}%
%
\ifthenelse{\ref@type = 5}{%        printing type of report/thesis/dissertation
\ifthenelse{\equal{\ini@thesis}{\@empty}}{}{%
\space\ini@thesis,}}{}%
%
\ifthenelse{\ref@type = 6}{%        printing access number, code or hyperlink
\ifthenelse{\equal{\ini@aclink}{\@empty}}{}{%
\space{\href{\ini@aclink}{\ini@actext},}}}{}%
%
\ifthenelse{\ref@type < 3}%         Printing volume|number and associated items
{  %%  reftype < 3
    \ifthenelse{\(\equal{\ref@vol}{\@empty}\) \and \(\equal{\ref@numb}{\@empty}\)}{%   %%  Both volume and issue numbers are empty
    {\bf ERROR!!! Journal volume and number fields are empty.}%
    \typeout{}%
    \typeout{ELXPAPER ERROR!!! Journal volume and number fields are empty.}%
        \ifthenelse{\equal{\warnmes}{silent}}{}%
        {\typein{Press ENTER to continue...}}%
    }
    {\ifthenelse{\equal{\ref@vol}{\@empty}}{%       Volume is empty
        \ifthenelse{\equal{\ref@numb}{\@empty}}{}{\space No.\space \ref@numb,}}
        {%  Volume is not empty
        \ifthenelse{\equal{\ref@numb}{\@empty}}{\space{\it \ref@vol,}}{\space{\it \ref@vol,}\space No.\space \ref@numb,}}
    }
}
{%          all other types  -  reftype > 2
\ifthenelse{\equal{\ref@vol}{\@empty}}{%   reftype > 2
}{\space\ref@vol,}%
}%
%
\ifthenelse{\equal{\ref@pages}{\@empty}}{%      Printing pages or |citation number
\ifthenelse{\(\ref@type < 3\) \or \(\ref@type = 4\)}%
{%      pages should present
{\bf ERROR!!! Pages|citation field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Pages|citation field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{}}{%             pages field is not empty
\ifthenelse{\ref@type = 1}{\space\ref@pages.}{%
\ifthenelse{\ref@type = 2}{\space\ref@pages,}{%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\ifthenelse{\ref@type = 3}{\space\ref@pages\space pp.,}{%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\space p.\space\ref@pages,}}%
%%
%%
\ifthenelse{\ref@type = 3}{\space\ref@pages\space \ifthenelse{\equal{\@lang}{rus}}{��.}{pp.},}{%
\space \ifthenelse{\equal{\@lang}{rus}}{�.}{p.}\space\ref@pages,}}%
%%
%%      pp  \ifthenelse{\equal{\@lang}{rus}}{��.}{pp.}
%%      p   \ifthenelse{\equal{\@lang}{rus}}{�.}{p.}
%%
}}%
%
\ifthenelse{\ref@type > 2}{%
\ifthenelse{\equal{\ini@publ}{\@empty}}{%      Printing publisher field
{\bf ERROR!!! Publisher|sponsor|center field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Publisher|sponsor|center field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{\space\ini@publ,}}
{}%
\ifthenelse{\ref@type > 2}{%
\ifthenelse{\equal{\ini@locat}{\@empty}}{%      Printing location field
{\bf ERROR!!! Location field is empty.}%
\typeout{}%
\typeout{ELXPAPER ERROR!!! Location field is empty.}%
\ifthenelse{\equal{\warnmes}{silent}}{}%
{\typein{Press ENTER to continue...}}%
}{\ifthenelse{\equal{\ini@date}{\@empty}}
{\space\ini@locat.}{\space\ini@locat,}}}%
{}%
\ifthenelse{\ref@type > 4}{%
\ifthenelse{\equal{\ini@date}{\@empty}}{}{%      Printing date field
\space\ini@date.}}{}%
\ifthenelse{\equal{\anc@text}{\@empty}}{}{%
\space (\anc@text)}%
%
%        Printing DOIs
\ifthenelse{\(\equal{\ini@onedoi}{\@empty}\) \and \(\equal{\ini@twodoi}{\@empty}\) \and \(\equal{\ini@thrdoi}{\@empty}\)}{}{%
\ifthenelse{\(\not\equal{\ini@onedoi}{\@empty}\) \and \(\equal{\ini@twodoi}{\@empty}\) \and \(\equal{\ini@thrdoi}{\@empty}\)}{%
%%          {\bfseries Put here non-broken DOI}
\ifthenelse{\equal{\hyptest}{hyper}}{%
\space \href{http://dx.doi.org/\ini@onedoi}{doi:\ini@onedoi}}{%
\space\ini@onedoi}
}{%
\ifthenelse{\(\not\equal{\ini@onedoi}{\@empty}\) \and \(\not\equal{\ini@twodoi}{\@empty}\) \and \(\equal{\ini@thrdoi}{\@empty}\)}{%
%%          {\bfseries Put here broken DOI}
\gdef\ref@doi{\ini@onedoi\ini@twodoi}
\ifthenelse{\equal{\hyptest}{hyper}}%
{\href{http://dx.doi.org/\ref@doi}{doi:\ini@onedoi\linebreak\ini@twodoi}}%
{\ini@onedoi\linebreak\ini@twodoi}%
}{%
\ifthenelse{\(\not\equal{\ini@onedoi}{\@empty}\) \and \(\not\equal{\ini@twodoi}{\@empty}\) \and \(\not\equal{\ini@thrdoi}{\@empty}\)}{%
%%          {\bfseries Put here combined DOI}
\gdef\ref@doi{\ini@onedoi}
\def\ref@text{\ini@twodoi\linebreak\ini@thrdoi}%
\ifthenelse{\equal{\hyptest}{hyper}}%
{\href{http://dx.doi.org/\ref@doi}{doi:\ref@text}}%
{\ref@text}
}{}}}}%        End of DOI block


%     Composing string for NEB XML reference list

\ifthenelse{\ref@type < 3}{%        Article in journal
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@numb}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   vol, numb,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space Vol.\space\ini@vol,\space N.\ini@numb,\space p.\ref@pages.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@numb}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   vol, numb, no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space Vol.\space\ini@vol,\space N.\ini@numb,\space p.\ref@pages.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@numb}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   vol, no-numb, doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space Vol.\space\ini@vol,\space p.\ref@pages.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@numb}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   no-vol, numb, doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space  N.\ini@numb,\space p.\ref@pages.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@numb}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   vol, no-numb,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space Vol.\space\ini@vol,\space  p.\ref@pages.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@numb}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   no-vol, no-numb,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space p.\ref@pages.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@numb}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   no-vol, numb,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space // \ini@jour,\space \ref@year.\space  N.\ini@numb,\space p.\ref@pages.}\@esphack%%
}{%
}}}}}}}}{}%
%
\ifthenelse{\ref@type = 3}{%        Book
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   vol, edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space edited by\space\ini@edit,\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   no-vol, edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space edited by\space\ini@edit,\space\ref@year.\space \ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   vol, no-edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   vol, edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space edited by\space\ini@edit,\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   vol, no-edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   no-vol, no-edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space\ref@year.\space\ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   no-vol, edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space edited by\space\ini@edit,\space\ref@year.\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   no-vol, no-edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@book\space,\space\ref@year.\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
}}}}}}}}}{}
%
\ifthenelse{\ref@type = 4}{%        Article in the book
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   vol, edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space edited by\space\ini@edit,\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   no-vol, edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space edited by\space\ini@edit,\space\ref@year.\space \ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   vol, no-edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   vol, edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space edited by\space\ini@edit,\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
\ifthenelse{\(\not\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   vol, no-edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space\ref@year.\space Vol.\space\ini@vol,\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\equal{\ini@edit}{\@empty}\) \and \(\not\equal{\ref@doi}{\@empty}\)}{%   no-vol, no-edit,  doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space\ref@year.\space\ref@pages pp. \space\ini@locat:\space\ini@publ.\space doi:\ref@doi.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   no-vol, edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space edited by\space\ini@edit,\space\ref@year.\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
\ifthenelse{\(\equal{\ini@vol}{\@empty}\) \and \(\not\equal{\ini@edit}{\@empty}\) \and \(\equal{\ref@doi}{\@empty}\)}{%   no-vol, no-edit,  no-doi
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space//\space\ini@book\space,\space\ref@year.\space\ref@pages pp. \space\ini@locat:\space\ini@publ.}\@esphack%%
}{%
}}}}}}}}}{}
%
\ifthenelse{\ref@type = 5}{%        Report/Map/Thesis/Dissertation
\ifthenelse{\not\equal{\ini@locat}{\@empty}}{%   locate
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title:\space\ini@thesis,\space\ini@publ,\space\ini@locat,\space\ref@year.\space \ref@pages pp.}\@esphack%%
}{%
\ifthenelse{\equal{\ini@locat}{\@empty}}{%   no-locate
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title:\space\ini@thesis,\space\ini@publ,\space\ref@year.\space \ref@pages pp.}\@esphack%%
}{%
}}}{}%
%
\ifthenelse{\ref@type = 6}{%        Data sets
\ifthenelse{\not\equal{\ini@date}{\@empty}}{%   date (time coverage)
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space[\ini@date],\space\ref@year,\space\ini@aclink,\space\ini@publ,\space\ini@locat}\@esphack%%
}{%
\ifthenelse{\equal{\ini@date}{\@empty}}{%   no-date
\@bsphack\protected@write\@xmlnebout{}{\space \ini@title\space\ref@year,\space\ini@aclink,\space\ini@publ,\space\ini@locat}\@esphack%%
}{%
}}}{}%

\@bsphack\protected@write\@xmlnebout{}{</reference>}\@esphack%%
}%       End of \endreference  block



\def\endreferences{%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   \respage  -  Generates HTML response page
%%----------------------------------- NEB -----------------------------------
\addtocounter{steps}{1}
%%----------------------------------- NEB -----------------------------------
\xmlblockfour
\xmlblockfive
\xmlfragthree
\ifnum\value{ancil}=0
\else\par\noindent\rule{7pc}{.3pt}\vskip-1pt\fi
\refpar\egroup\vskip 1.5ex%
{\font@reference\author@addresses\vskip5pt%
\lplabel{lastpage}\label{lstpage}
\lalabel{lastauth}\label{lstauth}
\lrlabel{lastref}\label{lstref}
\lflabel{flblfin}\label{flabl}
\cslabel{curstep}\label{curstep}
\keylabel{lstkey}\label{lstkey}
%%%%%%%%%%%%%%%%%%%%%%%%\setcit
\typeout{RUNHEAD: \runheadings}
}}

\def\noreferences{%
%%----------------------------------- NEB -----------------------------------
\addtocounter{steps}{1}
%%----------------------------------- NEB -----------------------------------
\xmlblockfive
\xmlfragthree
\ifnum\value{ancil}=0
\else\par\noindent\rule{7pc}{.3pt}\vskip-1pt\fi\vskip 1.5ex%
{\font@reference\author@addresses\vskip5pt%%%%\par\@dates%
\lplabel{lastpage}\label{lstpage}
\lalabel{lastauth}\label{lstauth}
\lrlabel{lastref}\label{lstref}
\lflabel{flblfin}\label{flabl}
\cslabel{curstep}\label{curstep}
\keylabel{lstkey}\label{lstkey}
}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                         ANCILLARY INFORMATION                       %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Author addresses _________________________________________
\newcommand{\author@addresses}{\@empty}
\newcommand{\join@parts}[2]{%
\xdef\jo@par{#1#2}} \def\jo@par{\@empty}
\newcommand{\authaddr}[1]{\gdef\ancil@data{#1}%
\join@parts{\author@addresses}{\par\ancil@data\vskip1pt}
\let\author@addresses=\jo@par
\addtocounter{ancil}{1}}
\let\authoraddr\authaddr

%  Dates _____________________________________________
\newcommand{\recv@prefix}{%
\ifthenelse{\equal{\@lang}{rus}}{��������}{Received}}
\newcommand{\revis@prefix}{%
\ifthenelse{\equal{\@lang}{rus}}{����� �����������}{revised}}
\newcommand{\accep@prefix}{%
\ifthenelse{\equal{\@lang}{rus}}{�������}{accepted}}
\def\@dates{
\gdef\date@break{%
;\space}
\ifthenelse{\equal{\@recvdate}{\@empty}}{}
{\ifthenelse{\equal{\@revisedate}{\@empty} \and \equal{\@accptdate}{\@empty}}{
\par\noindent(\recv@prefix\space\@recvdate)}
{\ifthenelse{\equal{\@revisedate}{\@empty}}{
\par\noindent(\recv@prefix\space\@recvdate\date@break accepted\space\@accptdate)}
{\ifthenelse{\equal{\@accptdate}{\@empty}}{
\par\noindent(\recv@prefix\space\@recvdate\date@break \revis@prefix\space\@revisedate)}
{\par\noindent(\recv@prefix\space\@recvdate\date@break \revis@prefix\space\@revisedate;\par\noindent
\accep@prefix\space\@accptdate)
}}}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                            RUNNING HEAD                             %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Inserting commas into long numbers (for JGR page numbers)_____________
\newcommand{\modintnumber}[1]{%
\setcounter{integ}{#1}%
\ifnum\value{integ}>999999%
  \setcounter{topnum}{\value{integ}/1000000}%
  \setcounter{tmpnum}{\value{integ}-\value{topnum}*1000000}%
  \setcounter{midnum}{\value{tmpnum}/1000}%
  \setcounter{botnum}{\value{tmpnum}-\value{midnum}*1000}%
  \setbox6=\hbox{\unhbox6 \thetopnum,\themidnum,\thebotnum}%
\else%
  \ifnum\value{integ}>9999%
    \setcounter{midnum}{\value{integ}/1000}%
    \setcounter{botnum}{\value{integ}-\value{midnum}*1000}%
    \setbox6=\hbox{\unhbox6 \themidnum,\thebotnum}%
  \else%
    \setbox6=\hbox{\unhbox6 \theinteg}%
  \fi%
\fi%
\copy6%
}
\renewcommand{\ps@myheadings}{%
  \def\@oddfoot{\reset@font%
%%%%%%%%%%%%%%%%%%%%%%%  test string \hfil\thepage\ \ofiz\ \thelstp\ and  \theflblfin\hfil}
\hfil\thepage\ \ofiz\ \thelstp\hfil}
  \let\@evenfoot\@oddfoot
  \def\@evenhead{%
  {\bfseries \cit@number}\hfil{\slshape\leftmark}{\bfseries \cit@number}}%
  \def\@oddhead{%
    {{\bfseries \cit@number}\slshape\rightmark}\hfil{\bfseries \cit@number}}%
  \let\@mkboth\@gobbletwo
  \let\sectionmark\@gobble
  \let\subsectionmark\@gobble
}
\renewcommand{\ps@plain}{\let\@mkboth\@gobbletwo\let\@oddhead\@empty%
\def\@oddfoot{\reset@font%
\phantom{\thepage\ \ofiz\ \thelstp}\hfil{\bfseries \cit@number}\hfil\thepage\ \ofiz\ \thelstp}
\let\@evenhead\@empty\let\@evenfoot\@oddfoot}

%  The following commands save the last page number and start label in .aux file
%  which after being rerun is interpreted as a value of counter.
%  This is necessary for composing page range for the \ident line and
%  converting page range to comma-separated numbers.
\newcommand{\lastpage}[1]{\setcounter{lstp}{#1}}
\newcommand{\lplabel}[1]{\@bsphack\protected@write\@auxout{}{\string\lastpage{\thepage}}\@esphack}%

\newcommand{\lstkey}[1]{\setcounter{lastkey}{#1}}
\newcommand{\keylabel}[1]{\@bsphack\protected@write\@auxout{}{\string\lstkey{\thekeynum}}\@esphack}%

%  The same for number of references
\newcommand{\lastref}[1]{\setcounter{lastref}{#1}}
\newcommand{\lrlabel}[1]{\@bsphack\protected@write\@auxout{}{\string\lastref{\thecurref}}\@esphack}%

%  The same for number of authors
\newcommand{\lastauth}[1]{\setcounter{lastauth}{#1}}
\newcommand{\lalabel}[1]{\@bsphack\protected@write\@auxout{}{\string\lastauth{\theatot}}\@esphack}%

%  Marker of floatsection
\newcommand{\flblfin}[1]{\setcounter{flblfin}{#1}}
\newcommand{\lflabel}[1]{\@bsphack\protected@write\@auxout{}{\string\flblfin{\theflbl}}\@esphack}%

%  Marker of translation steps
\newcommand{\curstep}[1]{\setcounter{steps}{#1}}
\newcommand{\cslabel}[1]{\@bsphack\protected@write\@auxout{}{\string\curstep{\thesteps}}\@esphack}%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                          FIGURES AND TABLES                         %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newdimen\pt@width
\renewcommand{\@makecaption}[2]{%
  \vskip\abovecaptionskip
  \centerline{\parbox{\pt@width}{{\bfseries #1.} #2}}%
\vskip\belowcaptionskip}

\newdimen\pt@width
\def\tablewidth#1{\pt@width=#1} \pt@width\textwidth
\let\figurewidth=\tablewidth
\let\captionwidth=\tablewidth

\newcommand\tabext{\pt@width}

%  The following fragment modifies some definitions of 'longtable' package
%  to match them with the basic 'table' definitions.
\def\longtable{%
  \par
  \ifx\multicols\@undefined
  \else
     \ifnum\col@number>\@ne
       \@twocolumntrue
     \fi
  \fi
  \if@twocolumn
      \typeout{}\typeout{ELXPAPER WARNING!!!  Longtable not in 1-column mode!}%
      \ifthenelse{\equal{\warnmes}{silent}}{}
    {\typein{Press ENTER to continue...}}
  \fi
  \begingroup
  \@ifnextchar[\LT@array{\LT@array[x]}}
\let\LTcapwidth=\pt@width
\renewcommand\LT@makecaption[3]{%
  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
    \sbox\@tempboxa{#1{{\bfseries #2.} }#3}%
    \ifdim\wd\@tempboxa>\hsize
      #1{{\bfseries #2.} }#3%
    \else
      \hbox to\hsize{\box\@tempboxa\hfil}%
% to center a caption of a longtable use the form below
%      \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
    \fi
    \endgraf\vskip\baselineskip}%
  \hss}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                             SETTING IMAGES                            %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  The next command is the generalized command for image file
%  insertion  which can be convenient for translation input files
%  to .dvi and .pdf output.
%

\newcommand{\setimage}[5]{%
\gdef\h@bias{#1}\gdef\v@bias{#2}%
\gdef\h@imsize{#3}\gdef\v@imsize{#4}\gdef\im@name{#5}%
\addtocounter{figure}{1}{\hyperdef{floats}{fig\thefigure}{}}\addtocounter{figure}{-1}%
\ifthenelse{\equal{\im@name}{\@empty}}%
{\centerline{\parbox{20pc}{\begin{center}IMAGE MISSED\vspace*{1pc}\\
Insert image name with the width and/or height value.\end{center}}}
\typeout{}
\typeout{ELXPAPER ERROR!!! Insert image name with the width and/or height value.}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}}{%
\ifthenelse{\equal{\v@bias}{\@empty}}{}{\vskip\v@bias}%
\ifthenelse{\equal{\pdfout}{pdf}}%
{\IfFileExists{\im@name.png}
{\centerline{\ifthenelse{\equal{\h@bias}{\@empty}}{}{\hskip\h@bias}%
\ifthenelse{\equal{\h@imsize}{\@empty} \and \equal{\v@imsize}{\@empty}}%
{\parbox{20pc}{\begin{center}PNG IMAGE {\bf \im@name.png}\vspace*{1pc}\\
Set width and/or height for PNG image.\end{center}}
\typeout{}
\typeout{ELXPAPER ERROR!!! At least one size (width or height) must be set for PNG image.}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}}%
{\ifthenelse{\equal{\v@imsize}{\@empty}}%
{\pdfimage width \h@imsize {\im@name.png}}%
{\ifthenelse{\equal{\h@imsize}{\@empty}}%
{\pdfimage height \v@imsize {\im@name.png}}%
{\pdfimage width \h@imsize height \v@imsize {\im@name.png}}}}%
\ifthenelse{\equal{\h@bias}{\@empty}}{}{\hskip-\h@bias}}}
{\parbox{20pc}{\begin{center}MISSED PNG IMAGE {\bf {\im@name.png}}\vspace*{1pc}\\
Put requested PNG image  to the current directory.\end{center}}
\typeout{}
\typeout{ELXPAPER ERROR!!! There is no requested \im@name.png file.}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}}}%
{\IfFileExists{\im@name.eps}
{\centerline{\ifthenelse{\equal{\h@bias}{\@empty}}{}{\hskip\h@bias}%
\epsffile{\im@name.eps}%
\ifthenelse{\equal{\h@bias}{\@empty}}{}{\hskip-\h@bias}}}%
{\parbox{20pc}{\begin{center}MISSED EPS IMAGE {\bf {\im@name.eps}}\vspace*{1pc}\\
Put requested EPS image  to the current directory.\end{center}}
\typeout{}
\typeout{ELXPAPER ERROR!!! There is no requested \im@name.eps file.}
\ifthenelse{\equal{\warnmes}{silent}}{}
{\typein{Press ENTER to continue...}}}
\ifthenelse{\equal{\v@bias}{\@empty}}{}{\vskip-\v@bias}}}}

%   Next macro expands the width of table to \tablewidth value
%   Parameter of \fixtabwidth[<parameter>] must be set to the number
%   of columns in the current \tabular.
%   It should be put inside \tabular block somewhere
\newcommand\fixtabwidth[1]{\multicolumn{#1}{@{\hspace{0pt}}c@{\hspace{0pt}}}{\rule{\tabext}{0pt}}}
%   Next macro defines table footnote. First parameter must be set to the
%   number of columns in the current \tabular.
\newcommand\tablefootnote[3]{\multicolumn{#1}{@{\hspace{0pt}}c@{\hspace{0pt}}}{%
\parbox[t]{\tabext}{\baselineskip=8pt\vskip-3pt%
\ifthenelse{\equal{#2}{\@empty}}{\footnotesize #3}
{$^{\rm #2}$\space {\footnotesize #3}}%
}}\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                       LANDSCAPE  FLOATS                               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%  It is recommended to use 'sidewaysfigure' and 'sidewaystable' macros
%  defined in the 'rotating.sty' template by Sebastian Rahtz and Leonor
%  Barroca. The package supports one- and twocolumn floats rotating them
%  to the left page (90 \deg anticlockwise) ot to the right page
%  (90 \deg clockwise)

%  NOTE: The following macros were developed and used for landscape figures
%  with captions rotated 90\deg anticlockwise. They are saved in the current
%  version for compatibility with older versions of the template.
%  Parameter meanings:
%  1 - horizontal displacement "+" to the right, "-" to the left
%  2 - image width  (rotated 90\deg anticlockwise)
%  3 - image height (rotated 90\deg anticlockwise)
%  4 - image file name
%  5 - caption text
%  NOTE:  It is assumed that images are already rotated. The macro rotates
%  only captions. For correct ajusting of rotated captions image width and
%  height in LaTeX units must be set

\newcommand\inslan[5]{%
\newlength{\hpdfone}
\newlength{\hpdftwo}
\newlength{\pdfcaptbias}
\addtocounter{figure}{1}%
\settowidth{\shortcaplen}{{\bf \figurename\space\thefigure.} #5}%
\ifthenelse{\lengthtest{\shortcaplen<\captionwidth}}{\caplen=\shortcaplen}{\caplen=\captionwidth}%
\ifthenelse{\equal{\pdfout}{pdf}}%
{%                                          PNG
\hskip#1\mbox{\pdfimage width #2 height #3 {#4.png}}\vskip-#3%
\setlength{\pdfcaptbias}{((#1+#2)/3)*2}
\rotpspdf[l]{\parbox{#3}{\noindent\rule{0pt}{\pdfcaptbias+\baselineskip}%
\par\centerline{\parbox{\caplen}{{\bf \figurename\space\thefigure.} #5}}}}%
}%
{%                                          EPS
\hskip#1\epsffile{#4.eps}\vskip-#3\hskip#2\hskip#1\hskip2pc%
\rotpspdf[l]{\parbox{#3}{\centerline{\parbox{\caplen}{{\bf \figurename\space\thefigure.} #5}}}}
}}%

%   Landscape table
\newcommand{\lantablebody}[1]{\gdef\lantab{%
\ifthenelse{\equal{\pdfout}{pdf}}%
{%  for PDF branch (.png image file)
\hskip\ltshift
\vbox{\rotpspdf[l]{\vbox{#1}}}%
}{%   for DVI branch (.eps image file)
\centerline{\vbox{\rotpspdf[l]{\vbox{#1}}}}
}}}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                  COMPATIBILITY WITH OLDER VERSIONS                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   The following commands are included for compatibility wiht earlier
%   versions of RUSPAGE/GMAIPAGE/AGUPAGE page styles
%   Extra caption definitions for page composing
%   Table caption containing \reflink
\def\smalltabcaption#1{
\addtocounter{table}{1}\vskip 1ex\normalbaselineskip 10.5pt
\parbox{20pc}{\vspace*{-2\baselineskip}\hyperdef{floats}{tab\thetable}{}\vspace*{2\baselineskip}{\bf \tablename\space\thetable.} #1}}
\def\widetabcaption#1{
\addtocounter{table}{1}\vskip 1ex\normalbaselineskip 10.5pt
\parbox{41pc}{\vspace*{-2\baselineskip}\hyperdef{floats}{tab\thetable}{}\vspace*{2\baselineskip}{\bf \tablename\space\thetable.} #1}}
%   Twocolumn tables put to the page bottom
\def\crosstablecaption#1{
\addtocounter{table}{1}\vskip 1ex\normalbaselineskip 10.5pt
\parbox{41pc}{\vspace*{-2\baselineskip}\hyperdef{floats}{tab\thetable}{}\vspace*{2\baselineskip}{\bf \tablename\space\thetable.} #1}}
%   Twocolumn figures put to the page bottom
\def\crosscaption#1{
\addtocounter{figure}{1}\vskip 1ex\normalbaselineskip 10.5pt
\parbox{41pc}{\centerline{\parbox{35pc}{{\bf \figurename\space\thefigure.} #1}}}}
%   Landscape caption
\def\landscapecaption#1{
\addtocounter{figure}{1}\vskip 1ex\normalbaselineskip 10.5pt
\parbox{54pc}{\centerline{\parbox{41pc}{{\bf \figurename\space\thefigure.} #1}}}}
%   Onecolumn figures put to the page bottom
\def\bottomcaption#1{
\addtocounter{figure}{1}\vskip 2.5ex\normalbaselineskip 10.5pt
\parbox{20pc}{{\bf \figurename\space\thefigure.} #1}\vskip -.5ex}
\def\dblbotcaption#1{
\addtocounter{figure}{1}\vskip 2ex\normalbaselineskip 10.5pt
\centerline{\parbox{35pc}{{\bf \figurename\space\thefigure.} #1}}}
%   Centering short twocolumn captions
\def\shortcaption#1{
\addtocounter{figure}{1}\vskip 2ex\normalbaselineskip 10.5pt
\parbox{41pc}{\centerline{{\bf \figurename\space\thefigure.} #1}}}
%   Centering short onecolumn captions
\def\smallcaption#1{
\addtocounter{figure}{1}\vskip 2ex\normalbaselineskip 10.5pt
\parbox{20pc}{\centerline{{\bf \figurename\space\thefigure.} #1}}}

%   Inserting .pcx and .eps images into float body (old version)
%   First and second parameters (in LaTeX units) provide vertical and
%   horisontal displacement compare to current position. Third parameter
%   is the vertical size of image (in LaTeX units) and fourth parameter is an
%   image file name (PCX or MSP bitmap files for \inspcx and EPS - for \inseps)
\newcommand\inspcx[4]{\vskip#1\relax
  \noindent\hskip#2\relax\special{em:graph #4}\vskip-#1\relax\vskip#3\relax}
\newcommand\inseps[4]{\vskip#1\relax
  \noindent\hskip#2\relax\epsffile{#4}\vskip-#1\relax}

%  The following moves caption up and down inside reserved vertical space
\def\ccaption#1#2{\vskip#1\relax\caption{#2}\vskip-#1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%           SELFCONGFIGURED ROTATION FOR DVI and PDF                  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   The following command \rotpspdf supports rotation of a box and included for
%   the compatibility with older versions of the package.
%   For DVI option it uses an emulation of \rotate[<option>]{<rotated_object>}
%   command as it is defined in rotate.sty package for Postscript output.
%   For PDF option it uses PDF literals (see pdftex.def for more detail)

%   The command is defined so that its first agrument is optional, so setting
%   \rotpspdf{<rotated_object>} assumes that object will be rotated 90\deg
%   counterclockwise (default value)
%   An output of \rotpspdf[<option>]{<rotated_object>} depends on option value, i.e.
%   'l' means rotating 90\deg counterclockwise,
%   'r' means rotating 90\deg clockwise,

\newdimen\d
\newbox\tmpbox
\def\avoidboxdimen#1{%
    \setbox\tmpbox=\hbox{\box#1}%
    \wd\tmpbox=0pt
    \ht\tmpbox=0pt
    \dp\tmpbox=0pt
    \box\tmpbox}
\newcommand\rotpspdf[2][l]{%
    \ifthenelse{\equal{\pdfout}{pdf}}%
    {%                                  PDF branch starts
        \setbox0=\hbox{#2}
        \ifthenelse{\equal{#1}{l}}%
        {%                              90\deg counterclockwise
            % rotation by `t' degrees counterclockwise is specified as
            % `cos(t) sin(t) -sin(t) cos(t) 0 0'.
            \vskip\wd0
            \leftline{\hskip\ht0\hskip\dp0%
            \pdfliteral{q 0 1 -1 0 0 0 cm}%
            \avoidboxdimen 0
            \pdfliteral{Q}}
        }%
        {%
            \ifthenelse{\equal{#1}{r}}%
            {%                          90\deg clockwise
                % rotation by `t' degrees clockwise is specified as
                % `cos(t) sin(t) -sin(t) cos(t) 0 0'.
                \d=\wd0 \advance\d by \dp0
                %%%\vskip\wd0
                \leftline{%%%\hskip\ht0\hskip\dp0%
                \pdfliteral{q 0 -1 1 0 0 0 cm}%
                \avoidboxdimen 0
                \pdfliteral{Q}}
                \vskip\d
            }%
            {%
                \ifthenelse{\equal{#1}{u}}%
                {%                      upside down
                    {\bf Upside down option is not supported!\\}
                }
                {
                    \ifthenelse{\equal{#1}{f}}%
                    {%              flip
                        {\bf Flip option is not supported!\\}
                    }
                    {
                        {\bf Wrong rotating option - #1 !\\}
                    }
                }
            }
        }
    }%                                  PDF branch ends
    {%                                  EPS branch starts
        \ifthenelse{\equal{#1}{r}}{\vskip\baselineskip\begin{turnbox}{-90}{#2}\end{turnbox}}
        {\settowidth{\wdintebox}{#2}\vskip\wdintebox\vskip\baselineskip
        \begin{turnbox}{90}{#2}\end{turnbox}}
    }%                                  EPS branch ends
}

%   The next command rotates cells inside tables
\newcommand\vtcell[2][l]{%
    \ifthenelse{\equal{#1}{r}}{\vskip\baselineskip\centerline{\parbox{0pc}{%
    \begin{turnbox}{-90}{\mbox{#2}}\end{turnbox}}}}
    {\settowidth{\wdintebox}{#2}\vskip\wdintebox\vskip\baselineskip
    \centerline{\parbox{0pc}{\begin{turnbox}{90}{\mbox{#2}}\end{turnbox}}}}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                         LAST PAGE MACRO                             %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\startlastpage#1#2{%
\gdef\break@type{#1}%
\def\split@par{p}%
\def\split@ref{r}%
\def\split@brk{b}%
\ifx\split@par\break@type%          %%  p - last page starts with new paragraph
    \onecolumn\begin{multicols}{2}%
\else%
    \ifx\split@ref\break@type%      %%  r - last page starts after breaking reference item
        \linebreak\vspace*{-\baselineskip}\onecolumn\begin{multicols}{2}\hspace*{.7pc}%
        \parbox[t]{19.3pc}{#2}\vspace*{.5ex}%
    \else%
        \ifx\split@brk\break@type%  %%  b - last page breaks paragraph
            \linebreak\vspace*{-\baselineskip}\onecolumn\begin{multicols}{2}\noindent%
        \else%
            \onecolumn\begin{multicols}{2}%
            \typeout{Error!!  Invalid parameter in 'startlastpage' macro.}%
        \fi%
    \fi%
\fi}%
\def\endlastpage{\end{multicols}\setboolean{merge@parts}{true}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                         MISCELLANEOUS                                 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  The following stretches and shrinks interline spacing
\def\fitopen#1{\renewcommand{\baselinestretch}{#1}\small\normalsize}
\def\fitclose{\renewcommand{\baselinestretch}{1}\small\normalsize}
%  Breaking paragraph in references
\def\refparbreak#1{\linebreak\newpage\hspace*{.7pc}\parbox[t]{19.3pc}{#1}
\vspace*{.5ex}}
\def\ttt{\vspace*{-1.6ex}}
\def\inswin#1#2#3{\relax}       %%  macro for TeXWeb
\let\figurewidth=\tablewidth

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                    SOME USEFUL DEFINITIONS                          %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%------------------ Journal title abbreviations -------------------
\let\jnl@style=\it
\def\ref@jnl#1{{\jnl@style#1}}
\def\aj{\ref@jnl{Astron.~J.}}
\def\apj{\ref@jnl{Astrophys.~J.}}
\def\apjl{\ref@jnl{Astrophys.~J.}}
\def\apjs{\ref@jnl{Astrophys.~J. (Supp.)}}
\def\aap{\ref@jnl{Astron.Astrophys.}}
\def\bams{\ref@jnl{Bull.~Am.~Meteorol.~Soc.}}
\def\bssa{\ref@jnl{Bull.~Seismol.~Soc.~Am.}}
\def\dsr{\ref@jnl{Deep~Sea~Res.}}
\def\eos{\ref@jnl{Eos~Trans.~AGU}}
\def\epsl{\ref@jnl{Earth Planet. Sci. Lett.}}
\def\gca{\ref@jnl{Geochim.~Cosmochim.~Acta}}
\def\gjras{\ref@jnl{Geophys.~J.~R.~Astron.~Soc.}}
\def\grl{\ref@jnl{Geophys. Res. Lett.}}
\def\gsab{\ref@jnl{Geol. Soc. Am. Bull.}}
\def\ijga{\ref@jnl{Int. J. Geomag. and Aeronomy}}
\def\jatp{\ref@jnl{J.~Atmos.~Terr.~Phys.}}
\def\jgr{\ref@jnl{J.~Geophys. Res.}}
\def\jpo{\ref@jnl{J.~Phys.~Oceanogr.}}
\def\mnras{\ref@jnl{Mon.~Not.~R.~Astron.~Soc.}}
\def\mwr{\ref@jnl{Mon.~Weather~Rev.}}
\def\pepi{\ref@jnl{Phys. Earth Planet.~Inter.}}
\def\pra{\ref@jnl{Phys.~Rev.~A}}
\def\prb{\ref@jnl{Phys.~Rev.~B}}
\def\prc{\ref@jnl{Phys.~Rev.~C}}
\def\prd{\ref@jnl{Phys.~Rev.~D}}
\def\prl{\ref@jnl{Phys.~Rev.~Lett}}
\def\pasp{\ref@jnl{Publ.~A.~S.~P.}}
\def\qjrms{\ref@jnl{Q.~J.~R.~Meteorol.~Soc.}}
\def\rg{\ref@jnl{Rev.~Geophys.}}
\def\rs{\ref@jnl{Radio~Sci.}}
\def\rjes{\ref@jnl{Rus. J.~Earth Sci.}}
\def\usgsof{\ref@jnl{U.S.~Geol.~Surv. Open File~Rep.}}
\def\usgspp{\ref@jnl{U.S.~Geol.~Surv.~Prof.~Pap.}}
\def\ang{\ref@jnl{Annales Geophysical}}                        %  annex
\def\ifz{\ref@jnl{Izv. AN SSSR. Fi\-zi\-ka Zem\-li}}           %
\def\gz{\ref@jnl{Ge\-o\-fi\-zi\-che\-s\-kiy Zhur\-nal}}        %
\def\geo{\ref@jnl{Geophysics}}                                 %
\def\dcl{\ref@jnl{Do\-k\-la\-dy AN SSSR}}                      %
\def\pgf{\ref@jnl{Pri\-k\-lad\-naya Ge\-o\-fi\-zi\-ka}}        %
\def\gig{\ref@jnl{Ge\-o\-lo\-gia i Ge\-o\-fi\-zi\-ka}}         %
\def\gtk{\ref@jnl{Geo\-tek\-to\-ni\-ka}}                       %
\def\tph{\ref@jnl{Tec\-to\-no\-phy\-sics}}                     %
\def\mg{\ref@jnl{Marine Geology}}                              %
\def\izvsm{\ref@jnl{Izv. AN SSSR. Ser. matem.}}                %
\def\izvsg{\ref@jnl{Izv. AN SSSR. Ser. geofiz.}}               %
\def\izvsf{\ref@jnl{Izv. AN SSSR. Ser. fiz.}}                  %
\def\jgg{\ref@jnl{JU. Geomagn and Geoelec.}}                   %
\def\jasa{\ref@jnl{J. Acoust. Soc. Amer.}}                     %
\def\akz{\ref@jnl{Akust. Zhurn.}}                              %  end annex
\let\astap=\aap
\let\apjlett=\apjl
\let\apjsupp=\apjs
\def\deg{\hbox{$^\circ$}}
\def\sun{\hbox{$\odot$}}
\def\earth{\hbox{$\oplus$}}
\def\lesssim{\mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$<$}}}}
\def\gtrsim{\mathrel{\hbox{\rlap{\hbox{\lower4pt\hbox{$\sim$}}}\hbox{$>$}}}}
\def\sq{\hbox{\rlap{$\sqcap$}$\sqcup$}}
\def\arcmin{\hbox{$^\prime$}}
\def\arcsec{\hbox{$^{\prime\prime}$}}
\def\fd{\hbox{$.\!\!^{\rm d}$}}
\def\fh{\hbox{$.\!\!^{\rm h}$}}
\def\fm{\hbox{$.\!\!^{\rm m}$}}
\def\fs{\hbox{$.\!\!^{\rm s}$}}
\def\fdg{\hbox{$.\!\!^\circ$}}
\def\farcm{\hbox{$.\mkern-4mu^\prime$}}
\def\farcs{\hbox{$.\!\!^{\prime\prime}$}}
\def\fp{\hbox{$.\!\!^{\scriptscriptstyle\rm p}$}}
\def\micron{\hbox{$\mu$m}}
\let\la=\lesssim
\let\ga=\gtrsim
\def\case#1#2{\hbox{$\frac{#1}{#2}$}}
\def\slantfrac#1#2{\hbox{$\,^#1\!/_#2$}}
\def\onehalf{\slantfrac{1}{2}}
\def\onethird{\slantfrac{1}{3}}
\def\twothirds{\slantfrac{2}{3}}
\def\onequarter{\slantfrac{1}{4}}
\def\threequarters{\slantfrac{3}{4}}
\def\ubvr{\hbox{$U\!BV\!R$}}
\def\ub{\hbox{$U\!-\!B$}}
\def\bv{\hbox{$B\!-\!V$}}
\def\vr{\hbox{$V\!-\!R$}}
\def\ur{\hbox{$U\!-\!R$}}
\def\ion#1#2{#1$\;${\small\rm\@Roman{#2}}\relax}
\def\nodata{\multicolumn{1}{c}{$\cdots$}}
%%---------------- end abbreviations ------------------

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                AMENDMENTS      (October 2007)                               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  The following commands are developed to support in-text hyperlinks to floats
%%  in the article.  \figref{<number_of_figure>} should be used to replace in-text
%%  anchors of the type "Figure 1,  Figure 5, etc." which switch to corresponding
%%  targets placed into bodies of floats.
%%
%%  Anchors \figrefs{<list_of_arbitrary_figures>} does not cause switching fo floats
%%  inside the PDF version of article, they produce switching to tables.shtml file in
%%  the HTML version of the arcticle after filtering source TeX file through the
%%  SemTeXML.pl script.
%%
%%  It is possible to insert the special section (normally before References)
%%  containing lists of all floats referred in the article.  In this case \figrefs
%%  \tabrefs, etc will link to \float supplement section.
%%
%%  \tabref{<number_of_table>}  and  \tabrefs{<list_of_arbitrary_tables>}
%%  should be used to replace in-text anchors of the type "Table 1,  Table 5, etc."
%%
%%  The macros below are defined for the \hyptest option set to 'hyper'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\tabref}[1]{\gdef\tab@num{#1}{\tablename~\tab@num}}
\newcommand{\figref}[1]{\gdef\fig@num{#1}{\figurename~\fig@num}}
\newcommand{\plaref}[1]{\gdef\pla@num{#1}{\platename~\pla@num}}

\newcommand{\extfigref}[1]{\gdef\extfig@num{#1}{\figurename~\extfig@num}}
\newcommand{\exttabref}[1]{\gdef\exttab@num{#1}{\tablename~\exttab@num}}

\newcommand{\tabrefs}[1]{\gdef\tab@nums{#1}{\tablename s~\tab@nums}}
\newcommand{\figrefs}[1]{\gdef\fig@nums{#1}{\figurename s~\fig@nums}}
\newcommand{\plarefs}[1]{\gdef\pla@nums{#1}{\platename s~\pla@nums}}

%%%%%%%%%%%%%%%%%% Modified fragment from ROTATING.STY %%%%%%%%%%%%%%%%%%%%%%%%

\def\sidewaysfigure{\@rotfloat{figure}\ifthenelse{\equal{\hyptest}{hyper}}{%
    \vspace*{-.5\figurewidth}\addtocounter{figure}{1}{\hyperdef{floats}{fig\thefigure}{}}%
    \addtocounter{figure}{-1}\vspace*{.5\figurewidth}}{}}%
\def\sidewaystable{\@rotfloat{table}\ifthenelse{\equal{\hyptest}{hyper}}{%
    \vspace*{-.5\tablewidth}\addtocounter{table}{1}{\hyperdef{floats}{tab\thetable}{}}%
    \addtocounter{table}{-1}\vspace*{.5\tablewidth}}{}}%

\renewenvironment{sidewaysfigure*}
    {\@rotdblfloat{figure}\ifthenelse{\equal{\hyptest}{hyper}}{%
    \vspace*{-.5\figurewidth}\addtocounter{figure}{1}{\hyperdef{floats}{fig\thefigure}{}}%
    \addtocounter{figure}{-1}\vspace*{.5\figurewidth}}{}}%
    {\end@rotdblfloat}
\renewenvironment{sidewaystable*}
    {\@rotdblfloat{table}\ifthenelse{\equal{\hyptest}{hyper}}{%
    \vspace*{-.5\tablewidth}\addtocounter{table}{1}{\hyperdef{floats}{tab\thetable}{}}%
    \addtocounter{table}{-1}\vspace*{.5\tablewidth}}{}}%
    {\end@rotdblfloat}

%%%%%%%%%%%%%%%%%% Modified fragment from ROTATING.STY   END  %%%%%%%%%%%%%%%%%

%%      Modified fragment from article.cls  for plates
\newcounter{plate}
\renewcommand \theplate {\@arabic\c@plate}
\def\fps@plate{tbp}
\def\ftype@plate{1}
\def\ext@plate{lop}
\def\fnum@plate{\platename\nobreakspace\theplate}%
\newenvironment{plate}[3]
    {\@float{plate}\ifthenelse{\equal{\hyptest}{hyper}}{%
    \addtocounter{plate}{1}{\hyperdef{floats}{pla\theplate}{}}\addtocounter{plate}{-1}}{}}%
    {\end@float}
\newenvironment{plate*}[3]
    {\@dblfloat{plate}\ifthenelse{\equal{\hyptest}{hyper}}{%
    \addtocounter{plate}{1}{\hyperdef{floats}{pla\theplate}{}}\addtocounter{plate}{-1}}{}}%
    {\end@dblfloat}
\newcommand\listofplates{%
    \section*{\listplatename}%
      \@mkboth{%
          \MakeUppercase\listplatename}%
         {\MakeUppercase\listplatename}%
    \@starttoc{lop}%
    }
\let\l@plate\l@figure
\newcommand\listplatename{List of Plates}
\newcommand\platename{Plate}

%%  This adds \hyperdef command to captions

\ifthenelse{\equal{\hyptest}{hyper}}{%
%%  Figures and Plates start with image. Though \setimage macro already contains \hyperdef marker
%%  it is also added to the capture to permit usage of figure/plate environments with other
%%  than \setimage macros for insertion of images.
\def\fnum@figure{\hyperdef{floats}{fig\thefigure}{}\figurename\nobreakspace\thefigure}%
\def\fnum@plate{\hyperdef{floats}{pla\theplate}{}\platename\nobreakspace\theplate }%
%%  Tables start with \caption that is why \hyperdef marker was set two lines abobe caption
\def\fnum@table{\vspace*{-2\baselineskip}\hyperdef{floats}{tab\thetable}{}\vspace*{2\baselineskip}\tablename\nobreakspace\thetable}%
}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\latex}{\LaTeX 2$_{\displaystyle\varepsilon}$}
\newcommand{\newtex}{New\TeX\kern-.7em\lower.55ex\hbox{\sl XML}}
\newcommand{\ntex}{New\kern-.3em\hbox{T}\kern-.1667em\lower.5ex\hbox{E}\kern-.125em{\sl XML}}
\newcommand{\stexml}{Sem\kern-.2em\hbox{T}\kern-.1667em\lower.5ex\hbox{E}\kern-.125em{\slshape X}\kern-.11em{\slshape M}\kern-.1em{\slshape L}}
\newcommand{\simtexml}{Simple\kern-.2em\hbox{T}\kern-.1667em\lower.5ex\hbox{E}\kern-.125em{\slshape X}\kern-.11em{\slshape M}\kern-.1em{\slshape L}}
\newcommand{\astexml}{As\kern-.125em\hbox{T}\kern-.1667em\lower.5ex\hbox{E}\kern-.125em{\sl XML}}
\newcommand\permil{\hbox{$^{\rm o}$\kern-.3em/\kern-.2em$_{\rm oo}$}}
\newcommand\pag{P\kern-.75em\lower.18ex\hbox{--}}
\newcommand\kembry{C\kern-.65em\raise.2ex\hbox{\bf --}}
\newcommand{\agupaper}{$\cal AGU^{\mbox{\kern-1.4em\raise-0.2ex\vbox{\sffamily\slshape paper}}}$}
\newcommand{\eastlake}{$\cal EASTLAKE$}
\newcommand{\numero}{${\rm N}^{\underline{\rm o}}$}
\newcommand{\listbreak}{\\ \ldots}      %%  This sets breaks inside \enumerate environment

%%\newcommand{\elxpaper}{$\mathcal{ELX}${\mbox{\kern-1.2em\raise.1ex\vbox{\slshape paper}}}}

\newcommand{\elxpaper}{$\mathcal{ELX}$\kern-.2em{\itshape paper}}


\newcommand{\google}{%
\textcolor{blue}{G}\textcolor{red}{o}\textcolor{yellow}{o}\textcolor{blue}{g}\textcolor{green}{l}\textcolor{red}{e}}
%%\definecolor{brown}{RGB}{157,23,4}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
