← All templates

International Press journals (ipart, main layout)

International Press's ipart class with its shared main layout, used by several of its mathematics journals; the sample is VTeX's Cambridge Journal of Mathematics sample article with front matter, theorems and numbered references, plus a blank topmatter template.

Create an account to use this
Category
Journal
Document class
ipart (ipart.cls) — ships with TeX Live
Workflow
Journal manuscript — submissions and revision rounds
Author
International Press of Boston
Source
International Press of Boston
Licence
No licence is stated in the files. International Press of Boston distributes them for authors preparing a submission.

These are the publisher’s own files. This project starts from International Press of Boston’s package for this publication — their manuscript, their ipart.cls, their bibliography style — so what compiles here is what they would have given you.

International Press of Boston serves this exact file to Cambridge Journal of Mathematics and 6 other titles. Check International Press of Boston’s author pages for the current instructions.

Where this differs from the publisher’s download.

  • Note: The class option selects the journal: cjm (sample), amsa, cis, cntp, joc, mcgd or gic. Add authoryear for author-year citations. Start a new article from cjm-template.tex.

What you get

  • LICENSE · 19 KB
  • cjm-sample.tex — the file that is compiled · 18 KB
  • cjm-template.tex · 2 KB
  • imsart-nameyear.bst · 38 KB
  • imsart-number.bst · 38 KB
  • ipart-layout-main.sty · 52 KB
  • ipart.cls · 8 KB

These become your files. Editing them afterwards changes your project and nothing else — a project owns its files from the moment it is made.

Journals using this template

All 7 journals →

Source

LICENSE — binary, 19 KB

cjm-sample.tex — the file that is compiled · 18 KB
%%  It's a sample file!
%%  Please use corressponding template

\documentclass[cjm]{ipart}

\RequirePackage{hyperref}

\startlocaldefs
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\def\SM#1#2{\sum_{#1\in #2}}
\def\FL#1{\left\lfloor #1 \right\rfloor}
\def\FR#1#2{{\frac{#1}{#2}}}
\endlocaldefs

%%  Settings
\pubyear{2022}
\volume{0}
\issue{0}
\firstpage{1}
\lastpage{9}
\arxiv{0000.0000}

\begin{document}

\begin{frontmatter}
\title{Your paper}
\runtitle{A sample document}
\thankstext{T1}{Footnote to the title with the `thankstext' command.}

\begin{aug}
    \author{\fnms{First} \snm{Author}\thanksref{t2}\ead[label=e1]{[email protected]}},
    \address{Address of the First Author\\
             Country\\
             \printead{e1}}
    \author{\fnms{Second} \snm{Author}\ead[label=e2]{[email protected]}},
    \address{Address of the Second Author\\
             Country\\
             \printead{e2}}
    \and
    \author{\fnms{Third} \snm{Author}
            \ead[label=e3]{[email protected]}%
            \ead[label=u1,url]{http://www.foo.com}}
    \address{Address of the Third Author\\
             Country\\
             \printead{e3}\\
             \printead{u1}}
    \thankstext{t2}{Footnote to the author with the `thankstext' command.}
\end{aug}
%
\received{\sday{3} \smonth{1} \syear{2022}}

\begin{abstract}
The abstract should summarize the contents of the paper.
It should be clear, descriptive, self-explanatory and not longer
than 200 words. It should also be suitable for publication in
abstracting services. Please avoid using math formulas as much as possible.

This is a sample input file.  Comparing it with the output it
generates can show you how to produce a simple document of
your own.
\end{abstract}

\begin{keyword}[class=MSC]
\kwdgroup[type=primary]{\kwd{00K00}\kwd{00K01}}
\kwdgroup[type=secondary]{\kwd{00K02}}
\end{keyword}

%%  Upper case for every keyword
\begin{keyword}
\kwd{Sample}
\kwd{\LaTeXe}
\end{keyword}

%\tableofcontents
\end{frontmatter}

\section{Ordinary text}

The ends  of words and sentences are marked
  by   spaces. It  doesn't matter how many
spaces    you type; one is as good as 100.  The
end of   a line counts as a space.

One   or more   blank lines denote the  end
of  a paragraph.

Since any number of consecutive spaces are treated like a single
one, the formatting of the input file makes no difference to
      \TeX,
but it makes a difference to you.
When you use
      \LaTeX,
making your input file as easy to read as possible
will be a great help as you write your document and when you
change it.  This sample file shows how you can add comments to
your own input file.

Because printing is different from typewriting, there are a
number of things that you have to do differently when preparing
an input file than if you were just typing the document directly.
Quotation marks like       ``this''
have to be handled specially, as do quotes within quotes:
       ``\,`this'          % \, separates the double and single quote.
    is what I just
    wrote, not  `that'\,''.

Dashes come in three sizes: an
       intra-word
dash, a medium dash for number ranges like
       1--2,
and a punctuation
       dash---like
this.

A sentence-ending space should be larger than the space between words
within a sentence.  You sometimes have to type special commands in
conjunction with punctuation characters to get this right, as in the
following sentence.
       Gnats, gnus, etc.\    % `\ ' makes an inter-word space.
       all begin with G\@.   % \@ marks end-of-sentence punctuation.
You should check the spaces after periods when reading your output to
make sure you haven't forgotten any special cases.
Generating an ellipsis
       \ldots\    % `\ ' needed because TeX ignores spaces after
                  % command names like \ldots made from \ + letters.
%
% Note how a `%' character causes TeX to ignore the
% end of the input line, so these blank lines do not
% start a new paragraph.
with the right spacing around the periods
requires a special  command.

\TeX\ interprets some common characters as commands, so you must type
special commands to generate them.  These characters include the
following:
       \& \% \# \{ and~\}.

In printing, text is emphasized by using an        
{\em italic\/}    % The \/ command produces the tiny extra space that
                  % should be added between a slanted and a following
                  % unslanted letter.
type style.

\begin{em}
   A long segment of text can also be emphasized in this way.  Text within
   such a segment given additional emphasis
      with\/ {\em Roman}
   type.  Italic type loses its ability to emphasize and become simply
   distracting when used excessively.
\end{em}

It is sometimes necessary to prevent \TeX\ from breaking a line where
it might otherwise do so.  This may be at a space, as between the
``Mr.'' and ``Jones'' in
``Mr.~Jones'',    % ~ produces an unbreakable interword space.
or within a word---especially when the word is a symbol like
       \mbox{\em itemnum\/}
that makes little sense when hyphenated across
       lines.

\TeX\ is good at typesetting mathematical formulas like
       \( x-3y = 7 \)
or
       \( a_{1} > x^{2n} / y^{2n} > x' \).
Remember that a letter like
       $x$    % $ ... $  and  \( ... \)  are equivalent
is a formula when it denotes a mathematical symbol, and should
be treated as one.

\begin{table*}
\tabcolsep=0pt
\caption{The spherical case ($I_1=0$, $I_2=0$)}\label{sphericcase}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}crrrrc}
\hline
 Equil. Points & \multicolumn{1}{c}{$x$} & \multicolumn{1}{c}{$y$} & \multicolumn{1}{c}{$z$} & \multicolumn{1}{c}{$C$} &
S \\
\hline
$L_1$ & $-$2.485252241 & 0.000000000 & 0.017100631 & 8.230711648 & U \\
$L_2$ &    0.000000000 & 0.000000000 & 3.068883732 & 0.000000000 & S \\
$L_3$ &    0.009869059 & 0.000000000 & 4.756386544 & $-$0.000057922 & U \\
$L_4$ &    0.210589855 & 0.000000000 & $-$0.007021459 & 9.440510897 & U \\
$L_5$ &    0.455926604 & 0.000000000 & $-$0.212446624 & 7.586126667 & U \\
$L_6$ &    0.667031314 & 0.000000000 & 0.529879957 & 3.497660052 & U \\
$L_7$ &    2.164386674 & 0.000000000 & $-$0.169308438 & 6.866562449 & U \\
$L_8$ &    0.560414471 & 0.421735658 & $-$0.093667445 & 9.241525367 & U \\
$L_9$ &    0.560414471 & $-$0.421735658 & $-$0.093667445 & 9.241525367 & U\\
$L_{10}$ & 1.472523232 & 1.393484549 & $-$0.083801333 & 6.733436505 & U \\
$L_{11}$ & 1.472523232 & $-$1.393484549 & $-$0.083801333 & 6.733436505 & U
\\ \hline
\end{tabular*}
\end{table*}


\section{Notes}
Footnotes\footnote{This is an example of a footnote.}
pose no problem\footnote{And another one.}.

\section{Displayed text}

Text is displayed by indenting it from the left margin.
Quotations are commonly displayed.  There are short quotations
\begin{quote}
   This is a short a quotation.  It consists of a
   single paragraph of text.  There is no paragraph
   indentation.
\end{quote}
and longer ones.
\begin{quotation}
   This is a longer quotation.  It consists of two paragraphs
   of text.  The beginning of each paragraph is indicated
   by an extra indentation.

   This is the second paragraph of the quotation.  It is just
   as dull as the first paragraph.
\end{quotation}
Another frequently-displayed structure is a list.
The following is an example of an {\em itemized} list, four levels deep.
\begin{itemize}
\item  This is the first item of an itemized list.  Each item
      in the list is marked with a ``tick''.  The document
      style determines what kind of tick mark is used.
\item  This is the second item of the list.  It contains another
      list nested inside it.  The three inner lists are an {\em itemized}
      list.
    \begin{itemize}
       \item This is the first item of an enumerated list that
            is nested within the itemized list.
          \item This is the second item of the inner list.  \LaTeX\
            allows you to nest lists deeper than you really should.
      \end{itemize}
      This is the rest of the second item of the outer list.  It
      is no more interesting than any other part of the item.
   \item  This is the third item of the list.
\end{itemize}


The following is an example of an {\em enumerated} list, four levels deep.
\begin{enumerate}
\item  This is the first item of an enumerated list.  Each item
      in the list is marked with a ``tick''.  The document
      style determines what kind of tick mark is used.
\item  This is the second item of the list.  It contains another
      list nested inside it.  The three inner lists are an {\em enumerated}
      list.
    \begin{enumerate}
       \item This is the first item of an enumerated list that
            is nested within the enumerated list.
          \item This is the second item of the inner list.  \LaTeX\
            allows you to nest lists deeper than you really should.
      \end{enumerate}
      This is the rest of the second item of the outer list.  It
      is no more interesting than any other part of the item.
   \item  This is the third item of the list.
\end{enumerate}


The following is an example of a {\em description} list.
\begin{description}
\item[Cow] Highly intelligent animal that can produce milk out of grass.
\item[Horse] Less intelligent animal renowned for its legs.
\item[Human being] Not so intelligent animal that thinks that it can think.
\end{description}

You can even display poetry.
\begin{verse}
   There is an environment for verse \\    % The \\ command separates lines
   Whose features some poets will curse.   % within a stanza.

               % One or more blank lines separate stanzas.

   For instead of making\\
   Them do {\em all\/} line breaking, \\
   It allows them to put too many words on a line when they'd
   rather be forced to be terse.
\end{verse}

Mathematical formulas may also be displayed.  A displayed formula is
one-line long; multiline formulas require special formatting
instructions
   \[  x' + y^{2} = z_{i}^{2}.\]
Don't start a paragraph with a displayed equation, nor make
one a paragraph by itself.

Example of a theorem:


\begin{thm}
All conjectures are interesting, but some conjectures are more
interesting than others.
\end{thm}

\begin{proof}
Obvious.
\end{proof}

\section{Tables and figures}
Cross references to labelled tables you can see in Table~\ref{sphericcase}
and also in Table~\ref{parset}.

A major
point of difference lies in the value of the specific production rate $\pi$ for
large values of the specific growth rate $\mu$.
Already in the early publications \cite{r1,r2,r3}
it appeared that high glucose
concentrations in the production phase are well correlated with a
low penicillin yield (the
`glucose effect'). It has been confirmed recently
\cite{r1,r2,r3,r4}
that
high glucose concentrations inhibit the synthesis of the enzymes of the
penicillin pathway, but not the actual penicillin biosynthesis.
In other words, glucose represses (and not inhibits) the penicillin
biosynthesis.

These findings do not contradict the results of
\cite{r5} and of \cite{r6} which were obtained for
continuous culture fermentations.
Because for high values of the specific
growth rate $\mu$ it is most likely (as shall be discussed below) that
maintenance metabolism occurs, it can be shown that
in steady state continuous culture conditions, and with $\mu$ described by a Monod kinetics
\begin{equation}
    C_{s}  =  K_{M} \frac{\mu/\mu_{x}}{1-\mu/\mu_{x}} \label{cs}
\end{equation}
Pirt and Rhigelato determined $\pi$ for $\mu$ between
$0.023$ and $0.086$ h$^{-1}$.
They also reported a value $\mu_{x} \approx 0.095$
h$^{-1}$, so that for their experiments $\mu/\mu_{x}$ is in the range
of $0.24$ to $0.9$.
Substituting $K _M$ in Eq. (\ref{cs}) by
the value $K_{M}=1$ g/L as used by \cite{r1}, one finds
with the above equation $0.3 < C_{s} < 9$ g/L. This agrees well with
the work of \cite{r7}, who reported that penicillin biosynthesis
repression only occurs at glucose concentrations from $C_{s}=10$ g/L on.
The conclusion is that the glucose concentrations in the experiments of
Pirt and Rhigelato probably were too low for glucose repression to be
detected. The experimental data published by Ryu and Hospodka
are not detailed sufficiently to permit a similar analysis.

\begin{table}
\centering
\caption{Parameter sets used by Bajpai and Reu\ss are not detailed sufficiently to permit a similar analysis}
\label{parset}
\begin{tabular}{lrll}
\hline
\multicolumn{2}{@{}l}{Parameter} & Set 1 & Set 2\\
\hline
$\mu_{x}$           & [h$^{-1}$]  & 0.092       & 0.11          \\
$K_{x}$             & [g/g DM]     & 0.15        & 0.006         \\
$\mu_{p}$           & [g/g DM h]  & 0.005       & 0.004         \\
$K_{p}$             & [g/L]        & 0.0002      & 0.0001        \\
$K_{i}$             & [g/L]        & 0.1         & 0.1           \\
$Y_{x/s}$           & [g DM/g]     & 0.45        & 0.47          \\
$Y_{p/s}$           & [g/g]        & 0.9         & 1.2           \\
$k_{h}$             & [h$^{-1}$]  & 0.04        & 0.01          \\
$m_{s}$             & [g/g DM h]  & 0.014       & 0.029         \\
\hline
\end{tabular}
\end{table}

Bajpai and Reu\ss\ decided to disregard the
differences between time constants for the two regulation mechanisms
(glucose repression or inhibition) because of the
relatively very long fermentation times, and therefore proposed a Haldane
expression for $\pi$.

It is interesting that simulations with the \cite{r4} model for the
initial conditions given by these authors indicate that, when the
remaining substrate is fed at a constant rate, a considerable and
unrealistic amount of penicillin is
produced when the glucose concentration is still very high \cite{r2,r3,r4}.
Simulations with the Bajpai and Reu\ss\ model correctly predict almost
no penicillin production in similar conditions.

\begin{figure}
\centering
\fbox{\makebox[5cm][c]{Picture}\rule[-1.5cm]{0pt}{3cm}}
%\includegraphics{}
\caption{Pathway of the penicillin G biosynthesis.}\label{penG}
\end{figure}

Sample of cross-reference to figure.
Figure~\ref{penG} shows that is not easy to get something on paper.


\section{Headings}

\subsection{Subsection}
Carr-Goldstein based their model on balancing methods and
biochemical know\-ledge. The original model (1980) contained an equation for the
oxygen dynamics which has been omitted in a second paper
(1981). This simplified model shall be discussed here.

\subsubsection{Subsubsection}
Carr-Goldstein
based their model on balancing\break methods and
biochemical know\-ledge. The original model (1980) contained an equation for the
oxygen dynamics which has been omitted in a second paper
(1981). This simplified model shall be discussed here.

\section{Equations and the like}

Two equations:
\begin{equation}
    C_{s}  =  K_{M} \frac{\mu/\mu_{x}}{1-\mu/\mu_{x}} \label{ccs}
\end{equation}
and
\begin{equation}
    G = \frac{P_{\rm opt} - P_{\rm ref}}{P_{\rm ref}} \mbox{\ }100 \mbox{\ }(\%).
\end{equation}

Two equation arrays:
\begin{align}
  \frac{dS}{dt} & =  - \sigma X + s_{F} F\\
  \frac{dX}{dt} & =    \mu    X\\
  \frac{dP}{dt} & =    \pi    X - k_{h} P\\
  \frac{dV}{dt} & =    F
\end{align}
and
\begin{align}
 \mu_{\rm substr} & =  \mu_{x} \frac{C_{s}}{K_{x}C_{x}+C_{s}}  \\
 \mu              & =  \mu_{\rm substr} - Y_{x/s}(1-H(C_{s}))(m_{s}+\pi /Y_{p/s}) \\
 \sigma           & =  \mu_{\rm substr}/Y_{x/s}+ H(C_{s}) (m_{s}+ \pi /Y_{p/s})
\end{align}

Long equation:
\begin{align}
\SM u{C^+}\FL{\FR{w'(u)}m}&\le \FL{\SM u{C^+} \FR{w'(u)}m}\nonumber\\ &\le
\FL{\FR{r(v)+\SM u{C^+} w(u)}m} = \FL{\FR{w(v)-\SM u{C^-} w(u)}m}\nonumber\\
&\le \FL{\FR{w(v)}m}-\SM u{C^-}\FL{\FR{w(u)}m}
= s(v)+\SM u{C^+}\FL{\FR{w(u)}m}
\end{align}
and
\begin{align}
\SM u{C^-}\FL{\FR{w(u)}m}&\le \FL{\SM u{C^-} \FR{w(u)}m}\nonumber\\ & \le
\FL{\FR{r'(v)+\SM u{C^-} w'(u)}m} = \FL{\FR{w'(v)-\SM u{C^+} w'(u)}m}\nonumber\\
&\le \FL{\FR{w'(v)}m}-\SM u{C^+}\FL{\FR{w'(u)}m}
= s'(v)+\SM u{C^-}\FL{\FR{w'(u)}m}.
\end{align}
This time we have
\begin{align*}
f(S)-f(T) =    {}  &  D_k^T(1+C_{\geq k+1}^T)(1 + C) + C_k^T(1+D_{\geq k+1}^T)(1 + D) \\
        {}   &  - C_k^T(1+C_{\geq k+1}^T)(1 + C) - D_k^T(1+D_{\geq k+1}^T)(1 + D)   \\
=     {} &   (D_k^T-C_k^T)[(1+C_{\geq k+1})(1+C)-(1+D_{\geq
k+1}^T)(1+D)]>0.
\end{align*}

\appendix

\section{Appendix section}\label{app}

We consider a sequence of queueing systems
indexed by $n$.  It is assumed that each system
is composed of $J$ stations, indexed by $1$
through $J$, and $K$ customer classes, indexed
by $1$ through $K$.  Each customer class
has a fixed route through the network of
stations.  Customers in class
$k$, $k=1,\ldots,K$, arrive to the
system according to a
renewal process, independently of the arrivals
of the other customer classes.  These customers
move through the network, never visiting a station
more than once, until they eventually exit
the system.

\subsection{Appendix subsection}

However, different customer classes may visit
stations in different orders; the system
is not necessarily ``feed-forward.''
We define the {\em path of class $k$ customers} in
as the sequence of servers
they encounter along their way through the network
and denote it by
\begin{equation}
\mathcal{P}=\bigl(j_{k,1},j_{k,2},\dots,j_{k,m(k)}\bigr). \label{path}
\end{equation}

Sample of cross-reference to the formula \ref{path} in Appendix~\ref{app}.

\section*{Acknowledgements}
And this is an acknowledgements section with a heading that was produced by the
\verb|\section*| command. Thank you all for helping me writing this
\LaTeX\ sample file.

\begin{thebibliography}{9}

\bibitem{r1} C. A. Athanasiadis, On a refinement of the generalized
Catalan numbers for Weyl groups. \textit{Trans. AMS} \textbf{357} (2005), 179--196.
\MR{2098091}

\bibitem{r2} D. Bessis, The dual braid monoid,
\textit{Ann. Sci. \'Ecole Norm. Sup.} S\'er. IV \textbf{36} (2003), 647--683.
\MR{2032983}

\bibitem{r3} N. Bourbaki,
\textit{Groupes et alg\`ebres de Lie}, Chapitres 4, 5 et 6, Hermann,
Paris (1975).
\MR{0453824}

\bibitem{r4} P. Cellini and P. Papi,
ad-nilpotent ideals of a Borel subalgebra. \textit{J.~Algebra} \textbf{225} (2000), 130--141.
\MR{1743654}

\bibitem{r5} P. Cellini and P. Papi,
ad-nilpotent ideals of a Borel subalgebra II. \textit{J.~Algebra} \textbf{258} (2002), 112--121.
\MR{1958899}

\bibitem{r6}
R. P. Dilworth,  Proof of a conjecture on finite modular
lattices.
\textit{Annals Math.} \textbf{60} (1954), 359--364.
\MR{0063348}

\bibitem{r7}
J. E. Humphreys,  \textit{Reflection Groups and Coxeter Groups}.
Cambridge Univ. Press. (1992).
\MR{1066460}

\end{thebibliography}

\end{document}
cjm-template.tex · 2 KB
%%  Template for the submission to:
%%    Cambridge Journal of Mathematics [cjm]
%%
%%  Author: In this template, the places where you need to add information
%%          (or delete line) are indicated by {???}.  Mostly the information
%%          required is obvious, but some explanations are given in lines starting
%%  Author:
%%  All other lines should be ignored.  After editing, there should be
%%  no instances of ??? after this line.

%%  Journal options: cjm
%%  Bibliography options: authoryear,nonatbib
%%  Numbering options: seceqn
\documentclass[cjm]{ipart}

%\RequirePackage{hyperref}

\startlocaldefs
%%  Put your definitions here
\endlocaldefs

%%  Will be filled by editor:
\pubyear{2022}
\volume{0}
\issue{0}
\firstpage{1}
\lastpage{1}
%\arxiv{}

\begin{document}

\begin{frontmatter}

%%  "Title of the Paper"
\title{???\protect\thanksref{T1}}
\thankstext{T1}{???}

\begin{aug}
%%  \author{\fnms{John} \snm{Smith}\thanksref{t2}\ead[label=e1]{[email protected]}\ead[label=e2,url]{www.foo.com}}
%%  \thankstext{t2}{The author is supported by ...}
%%  \address{line 1\\ line 2\\ \printead{e1}\\\printead{e2}}

\author{\fnms{???} \snm{???}\ead[label=e1]{???}}
\address{???\\\printead{e1}}
%\author{\fnms{???} \snm{???}\thanksref{t2}\ead[label=e2]{???}}
%\address{???\\\printead{e2}}
%\and
%\author{\fnms{???} \snm{???}%
%        \ead[label=e3]{???}%
%        \ead[label=u1,url]{???}}
%\address{???\\\printead{e3}\\\printead{u1}}
%\thankstext{t2}{The author is supported by ...}
\end{aug}
%%  History:
%\received{\sday{3} \smonth{1} \syear{2022}}

%\begin{abstract}
%\end{abstract}

%\begin{keyword}[class=MSC]
%\kwdgroup[type=primary]{\kwd{}\kwd{}}
%\kwdgroup[type=secondary]{\kwd{}}
%\end{keyword}

%%  Upper case for every keyword
%\begin{keyword}
%\kwd{}
%\kwd{}
%\end{keyword}

%\tableofcontents

\end{frontmatter}

%%  The body


%%  The bibliography

%\begin{thebibliography}{9}
%%  Use \bibitem{r1} or \bibitem[Surname(2010)]{r1} (for authoryear case)
%
%\bibitem{}
%
%\end{thebibliography}

\end{document}
imsart-nameyear.bst · 38 KB
%% This is file `imsart-nameyear.bst'
%%
%%
%% You are free to use this style file as you see fit, provided 
%% that you do not make changes to the file. 
%% If you DO make changes, you are required to rename this file.
%%
%% It may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% TeX programming: Linas Stonys, VTeX, Lithuania, [email protected] 
%%
%% This bibtex style produces structured bibliography (.bbl) file which could be
%% converted back into the database (.bib) format.
%% bibtex program must be invoked with the maximum allocation of memory (-w switch)
%%
%% This bibtex style could be used only with the imsart package 
%% starting with version from 2009/08/13

%% 2010-02-01 - splited inits "A.D." -> "A. D." and "A.{\,}D." -> "A. D."
%% 2010-03-19 - fixed sorting.
%% 2011-01-07 - inserted options: sort, nameyear, alpha, number.
%% 2013-01-28 - added: arxiv, mrnumber. Changed tags.

ENTRY
  { address
    author
    arxiv
    booktitle
    bpt_note
    bpt_ok
    chapter
    doi
    edition
    editor
    howpublished
    institution
    isbn
    journal
    key
    month
    mrnumber
    note
    number
    organization
    pages   
    publisher
    school
    series
    src
    sortkey
    title
    type
    volume
    year
    url
    id
    options
  }
  {}
   { label extra.label sort.label short.list }

INTEGERS { output.state before.all mid.sentence after.sentence
           after.block between.elements }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #5 'between.elements :=
}

STRINGS { s t tmp1 tmp2 tmp3 tmp4 tmp5}
STRINGS { longest.label last.label list.string temp.str default.list}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}


FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { " " * write$ newline$}
    { output.state after.block =
        { add.period$ write$
          newline$
         % "\newblock " write$
        }
        { output.state between.elements =
            { ", " * write$ newline$ }
            { output.state before.all =
                'write$
                { add.period$ " " * write$ newline$}
              if$
            }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    {output.nonnull}
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    {output.nonnull}
  if$
}



FUNCTION {insert.comma}
{ output.state before.all =
    'skip$
    { between.elements 'output.state := }
  if$
}
FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state :=}
      if$
    }
  if$
}


FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

STRINGS { v l f j b ff}
INTEGERS { nameptr namesleft numnames bother}
INTEGERS {str.length count return save.num1 save.num2 save.num3 save.num4 int done}
FUNCTION {is.in.list}{
	'f :=
	%%%% issisaugoju originalius "s" ir "t"
	s 'j :=
	f 's :=
	t 'f :=  
  list.string text.length$ 'str.length :=
  list.string 't :=
%  s text.length$ 'slen :=
  int   'save.num1 :=
  count 'save.num2 :=
  #1 'int :=
  #1 'count :=
  #0 'return :=
    
    { count str.length = not 
      #0 str.length = not
      and
    }
    {
			count #1 + 'count :=
		  t int #1 substring$ "," =
      	{
      	  t #1 int substring$ s "," * =
      	    {
		  		   #1 'return :=
  			      str.length 'count :=
			   	  }
	    			'skip$
         if$
	        
	        int #1 + 'int :=
   		    t int global.max$ substring$ 't :=
				  #0 'int :=
      	}
      	'skip$
      if$	
      int #1 + 'int :=
%			"count=" count int.to.str$ * " slen=" * str.length int.to.str$ * top$
    }
  while$

  save.num1 'int   :=
  save.num2 'count :=
  
  #0 return =
  	{ s t =
		    {#1 'return :=}
		    'skip$
		  if$
  	}
  	'skip$
  if$
	%%%% grazinu originalius "s" ir "t"
	j 's :=
	f 't :=  
	
	return		
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%% formating bbl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

FUNCTION {make.tag}
{ 't :=
  duplicate$ empty$
    { pop$ "" }
    { bother #0 =
    	{	t "volume" =
    			{"\textbf{"  swap$ * "}" * }
    			'skip$
    		if$
    	}
	    { "\b" t * "{" * swap$ * "}" * }
	  if$
    }
  if$
}

INTEGERS {sk}
FUNCTION {is.num}
{ chr.to.int$
  duplicate$ "0" chr.to.int$ < not
  swap$ "9" chr.to.int$ > not and
}

FUNCTION {byear}
{ duplicate$ empty$
    { pop$ "" }
    {'t :=
     t text.length$ 'sk :=
			#5 sk =
					{t #1 #4 substring$ 's :=
					 t #5 #1 substring$ 'longest.label :=
					 	longest.label is.num not	
							{"\byear{" s * "}" * longest.label * }
							{"\byear{"  t * "}" * }
						if$
					}
					{t "year" make.tag 
  						"type=nameyear" is.in.list						
							{extra.label *}
							'skip$
						if$
					}
			if$
    }
  if$
}



FUNCTION {format.address}
{address empty$
	{ "" }
	{address "address" make.tag }
  if$
}

FUNCTION {format.organization}
{organization empty$
		{ "" }
		{organization "publisher" make.tag}
  if$
}

FUNCTION {format.org}
{organization empty$
	{ "" }
	{organization "organization" make.tag add.period$}
  if$
}




FUNCTION {format.pub.address}
{ publisher empty$
    { "" }
    { publisher "publisher" make.tag
      address empty$
        'skip$
        {", " * format.address * add.period$}
      if$
    }
  if$
}

FUNCTION {mk.tag}
{ 'temp.str :=
  duplicate$ empty$
    { pop$ "" }
    { 
    	b "nothing" =
    		'skip$
			{"\b" temp.str * "{" * swap$ * "}" * }
		if$
	}
  if$
}

FUNCTION {space.after.dot}
{'t :=
	"" 'l :=
	"" 's :=
  { t empty$ not }
  {   t #1 #1 substring$ 's :=
		  l  s * 'l := 
      s "." = 
				{ t #2 #1 substring$ " " =
    	      'skip$
		 			  {
						  l  " " * 'l := 
						  t #2 #4 substring$ "{\,}" =
		 			  		{
						  	  t #5 global.max$ substring$ 't :=
		 			  		}
    	     		  'skip$
      	  		if$ 
		 			  }
      	  if$  
				} 
				'skip$
				
      if$
  	  t #2 global.max$ substring$ 't :=
    }
  while$
  l 
}

FUNCTION {format.author.editor}
{ 	'b :=
  	
  	b "editor" =
  	b "beditor" =
  	b "editor2" =
  	or or
		{editor space.after.dot 's :=}
		{author space.after.dot 's :=}
	if$

  	#1 'nameptr :=
  	s num.names$ 'numnames :=
  	numnames 'namesleft :=
    { namesleft #0 > }
    {	
    	s nameptr "{vv}" format.name$ "particle" mk.tag  'v := 
       	s nameptr "{ll}" format.name$ "snm"      mk.tag  'l :=   
    	s nameptr "{f.}" format.name$ "inits"    mk.tag  'f := 
    	s nameptr "{ff}" format.name$ "fnm"      mk.tag  'ff := 
     	s nameptr "{jj}" format.name$ "suffix"   mk.tag  'j := 
  		
  		j empty$
	   		{"" 'j :=} 		
	   		{" " j * 'j :=} 		
		if$
 		
 		v empty$
	   		{"" 'v :=} 		
	   		{v " " * 'v :=} 		
		if$
 		
 		l  "\bsnm{others}" =
  			{  "et~al." "etal" make.tag * }
  			{
   				b "editor2" =
	 				{"\beditor{" * ff * f * 
						ff "" = f "" = and
		  					'skip$
		  					{"~" * }
		  				if$
	 					v * l * j * "}" * "" 't :=
	 				}
		  			'skip$
				if$

			   	b "author" =
   				b "editor" =
   				or
	 				{"\b" * b * "{" * v * l * 
						ff "" = f "" = and
		  					'skip$
		  					{",~" * }
		  				if$
	 					ff * f * j * "}" * "" 't :=}
		  			'skip$
				if$

			} 
 		if$

		namesleft #0 >
        { namesleft #1 >
            { namesleft #2 =
    		        	{ s numnames "{ll}" format.name$ "others" =
    		        	  {" " * t * }
    		        	  {" \AND " * t * }
    		        	  if$
    		        	}
    		        	{", " * t * }
		          if$
           	}
            {""}
          if$
        }
        't
      
      if$
      nameptr #1 + 'nameptr := 
      namesleft #1 - 'namesleft :=
    }
  while$
}


FUNCTION {format.editors}
{ editor empty$
	{""}
    {
    	bother #0 =
			{author empty$
   		  		{"editor"}
   				{"nothing"}
   		 	if$
  			}
			{"editor"}
		if$  
	  	format.author.editor
      editor num.names$ #1 >
        { ", eds." * }
        { ", ed." * }
      if$
    }
  if$
}

FUNCTION {format.authors}
{ author empty$
	{""}
    {"author"  format.author.editor}
  if$
}

FUNCTION {make.editors}
{ editor empty$
    { "" }
    { "("  

    	bother #0 =
			{author empty$
   		  		{"editor"}
   				{"nothing"}
   		 	if$
  			}
			{"editor2"}
		if$  
	  	format.author.editor
						 *
      editor num.names$ #1 >
        { ", eds.)" * }
        { ", ed.)" * }
      if$
    }
  if$
}



FUNCTION {cite.author.editor}
{ 's :=

  s #1 "{vv~}{ll}" format.name$
  s num.names$ duplicate$
  #3 >
    { pop$ " et~al." * }
    { #3 =
        { s #3 "{vv~}{ll}{ jj}{ f}" format.name$ "others" =
            { " et~al."  * }
            { ", " * s #2 "{vv~}{ll}" format.name$ * 
             " and " * s #3 "{vv~}{ll}" format.name$ *  
            }
          if$
        }
		    {s num.names$ #2 =
    		        {s #2 "{vv~}{ll}{ jj}{ f}" format.name$ "others" =
            				{ " et~al."  * }
     		    				{ " and " * s #2 "{vv~}{ll}" format.name$ * }
     		    			if$
     		    		}
     		    		'skip$
        	 if$
        }
      if$
    }
  if$
}


FUNCTION {check.auth.edit.org}
{author empty$
		{
			editor empty$
					{
						organization empty$
								{""}
								{organization}
						if$		
					}
					{editor cite.author.editor}
			if$		
		}
		{author cite.author.editor}
 if$	
}

FUNCTION {check.year}
{year empty$
		{""}
		{year extra.label *
		}
	if$	
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem"
  "type=nameyear" is.in.list
     {
 	    "[\protect\citeauthoryear{" * write$
	   			check.auth.edit.org write$ 
	   	"}{" write$ 
	   			check.year write$ 
	   	"}]" 
    }
    'skip$
  if$
  "type=alpha" is.in.list
     {
 	    "[" * write$
  	  label write$
	    "]" 
    }
    'skip$
  if$

  "{" * write$  
  cite$ write$
  "}" write$
  newline$
  "" before.all 'output.state :=
}

INTEGERS { multiresult char.num k }

 
FUNCTION {string.to.integer}
{ 't :=
    t text.length$ 'k :=
  #1 'char.num :=
      { t char.num #1 substring$ 's :=
	 	  s is.num
	 	  s "." =
	 	  or 
	 	  char.num k = not
	 	  and
	 	 	}
	 	 {char.num #1 + 'char.num :=}
  while$
  char.num #1 - 'char.num :=
  t #1 char.num substring$ 
}

FUNCTION {check.mrnumber}
{mrnumber 't :=
  ""
    { t empty$ not }
    { t #1 #2 substring$ "\#" = 
			{ t #1 #2 substring$ *
	 			 t #2 global.max$ substring$ 't :=
			}
			{
			  t #1 #1 substring$ "#" = 
					{ "\#" *
		 					 t #2 global.max$ substring$ 't :=
					}
				{ t #1 #1 substring$ *
	 			 t #2 global.max$ substring$ 't :=
				}
     	 if$
      }
      if$
    }
  while$
}


FUNCTION {remove.braces}
{'t :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "{" = 
			t #1 #1 substring$ "}" = 
			or
				{ 
		 			 t #2 global.max$ substring$ 't :=
				}
				{ t #1 #1 substring$ *
		 			 t #2 global.max$ substring$ 't :=
				}
			if$
    }
  while$
}

FUNCTION {format.mrnumber}
{ mrnumber empty$
    { "" }
    {	bother #0 =
		     {check.mrnumber} 
		     {"\bmrnumber{" check.mrnumber * "}" * }
			if$
    }
  if$
}

INTEGERS { found }
FUNCTION {cut.info}
{ 't :=
 #0 'found := 
 "" 's :=
 "" 'v :=
    { t empty$ not }
    { 
      t #1 #5 substring$ "info:" = 
			  { 
    		  t #6 global.max$ substring$ 't :=
    		  #1 'found := 
          "}" 'v :=
			  }
			  'skip$
      if$

      t #1 #1 substring$ "/" = 
      #1 found =
      and
			  { 
    		  t #2 global.max$ substring$ 't :=
    		  s "={" * 's :=
    		  #0 'found := 
           
			  }
			  'skip$
      if$   

      t #1 #2 substring$ ", " = 
      v "}" =
      and
			  { 
    		  t #2 global.max$ substring$ 't :=
    		  s "}," * 's :=
			  }
			  'skip$
      if$   
            s t #1 #1 substring$ * 's :=  
	 			    t #2 global.max$ substring$ 't :=
    }
  while$
s v *
}

FUNCTION {format.id}
{ id empty$
    { "" }
    {	bother #0 =
		     { "" } 
		     {"\bid{" id cut.info * "}" * }
			if$
    }
  if$
}

FUNCTION {format.journal}
{ journal empty$
    { "" }
    {	bother #0 =
		     {journal "t" change.case$} 
    		 {"\bjournal{" journal  * "}" * } 
			if$
    }
  if$
}
FUNCTION {title.sep}
{ type$ "article" =
	type$ "incollection" =
	type$ "inproceedings" =
	type$ "booklet" =
	type$ "unpublished" =
	or or or or
		'add.period$
		'skip$
	if$

	type$ "inbook" =
	type$ "manual" =
	or
	edition empty$ not
	and 
		{"," *}
		{
			edition empty$ 
			series empty$ not
			and
				'add.period$
				'skip$
			if$	
		}
	if$

	type$ "book" =
		{
			edition empty$ not
			series empty$ not
			and
				{"," *}
				{
				 edition empty$ 
				 series empty$ not
				 and
						'add.period$
						'skip$
				 if$		
				}
			if$
		}
		'skip$
	if$
	
}

FUNCTION {format.title}
{ title empty$
    { "" }
    {
    	title "title" make.tag
    	title.sep
    }
  if$
}
FUNCTION {format.year}
{ year empty$
    {""}
    {	bother #0 =
    		{"(" year  extra.label * * ")." *}  
    		{"(" year byear * ")." *}  
			if$
    }
    if$
}

FUNCTION {format.month}
{ month empty$
    {""}
		{ "\bmonth{" month  * "}" *}
	if$
}
FUNCTION {format.type}
{ type empty$
    {""}
		{ "\btype{" type * "}" *}
	if$
}

FUNCTION {formatpatent.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$}
         
      if$
    }
    { month empty$
       { year byear}
        {format.month " " * year byear *}
      if$
    }
  if$
}
FUNCTION {format.btitle}
{ title "btitle" make.tag
}



FUNCTION {format.note}
{ note empty$
    {""}
    {	note "note" make.tag}
  if$
}
FUNCTION {format.bptnote}
{bpt_note empty$
	{""}
	{"\bptnote{" bpt_note * "}%" * 	}
if$	
}
FUNCTION {format.bptok}
{bpt_ok empty$
	{""}
	{"\bptok{" bpt_ok * "}%" * 	}
if$	
}

FUNCTION {add.note}
{ note empty$
    {""}
    { note }
  if$
}
FUNCTION {format.chapter}
{chapter empty$
	{""}
	{"\bchapter{" chapter * "}" * 	}
if$	
}


FUNCTION {chap.type}
{chapter empty$
	{""}
	{	type empty$
			{ "Chapter "}
			{ type "Section" = 
	 				{	"Section "}
					{ "Chapter "}
				if$	
			}
		if$
		 "\bchapter{" chapter * "}" * *
	}
if$	
}
								
  
FUNCTION {chap.note}
{	format.note output 
     new.sentence
}

FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}
FUNCTION {no.space.connect}
{ duplicate$ text.length$ #3 <
    { "" }
    { "" }
  if$
  swap$ * *
}


%%%%%%%%%%%%%%%%%%%%%%%%%% patent names
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}
FUNCTION {format.series}
{ series empty$
	{ "" } 
    {	bother #0 =
		     {series} 
    		 {"\bseries{" series * "}" * } 
			if$
    }
  if$
}
FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
        { edition  "l" change.case$ }
        { edition  "t" change.case$ }
      if$
      "edition" make.tag
      " ed." *
    }
  if$
}


FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult 
}
FUNCTION {format.isbn}
{ isbn empty$
    { "" }
	{"\bisbn{" isbn * "}" *}
  if$
}

FUNCTION {format.school}
{ school empty$
	{""}
    {"\bpublisher{" school * "}" * } 
  if$
}

FUNCTION {format.institution}
{ institution empty$
	{""}
    {	bother #0 =
		     {institution} 
    		 { "techreport" type$ =
    		 			{"\bpublisher{" }
    		 			{"\binstitute{" }
    		 		if$	
    		 		
    		 		institution * "}" * 
    		 } 
			if$
    }
  if$
}
FUNCTION {format.howpublished}
{ howpublished empty$
	{""}
    { howpublished "howpublished" make.tag }
  if$
}

FUNCTION {format.vol}
{ volume empty$
  number empty$
  and
  	{""}
 		{ volume empty$ 
			  {number} 
		    {volume}
 		  if$
      "volume" make.tag
	  }
  if$
}

FUNCTION {note.presented}
 {note #1 #9 substring$ "presented" = 
 	note #1 #9 substring$ "Presented" = 
 or}
 


FUNCTION {format.url}
{ url empty$
    { "" }
		{"\url{" url * "}" * }
	if$
}

FUNCTION {format.arxiv}
{ arxiv empty$
    { "" }
	{"\arxiv{" arxiv * "}" * } 
  if$
}

FUNCTION {format.doi}
{ doi empty$
	{""}
	{"\bdoi{" doi  * "}" * } 
  if$
}

FUNCTION {format.ppages}
{ pages  empty$ 
	{""}
	{pages "pages" make.tag 
     add.period$
    }
  if$
}


FUNCTION {format.booktitle}
{ booktitle empty$
    { "" }
    {	bother #0 =
		     {"In " booktitle *} 
    		 {"In \bbooktitle{" booktitle * "}" *} 
			if$
			type$ "incollection" =
				{	series empty$
					volume empty$
					and
						'skip$
						{ editor empty$ series empty$ not and
						   {"." *} 
						   {"," *} 
							if$
						}
					if$	
				}
				'skip$
			if$
				
			type$ "inproceedings" =
				{	series empty$
					editor empty$
%					volume empty$ not
					and 
						'skip$
						{editor empty$
							  {"." *}
							  'skip$
						 if$ 
						}
					if$	
				}
				'skip$
			if$	
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { "\btype{Technical Report}" }
    { "\btype{" type * "}" * }
  if$

  number empty$
		 'skip$
    { " No. \bnumber{" number * "}" * * }
  if$

%  type empty$ not 
%  number empty$
	institution empty$ not
    	{"," *}
    	'skip$
 	if$

}

FUNCTION {format.number}
{number empty$
		{""}
    {"\bnumber{" number * "}" * } 
  if$
}
INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}   
 

FUNCTION {bcomment.note}
{note empty$
'skip$
 {note  "note" make.tag output add.period$}
 if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      "\btype" type * "}" *
    }
  if$
}


FUNCTION {element.type}
{	bother #0 =
  		{"\begin{botherref}" write$ newline$}
  		{"\begin{" write$
			"b"
			"conference" type$ =
              	{"inproceedings"}
				{
					"proceedings" type$ =
              			{"book"}
						'type$
					if$
				} 
            if$ 
			*  		write$
  			"}["  write$
  					src empty$
  						{"author" write$}
  						{src write$ }
  					if$
  			"]" write$ newline$
  		}
  if$
}
FUNCTION {end.element.type}
{write$ newline$
	bother #0 =
  		{"\end{botherref}" write$ newline$}
  		{"\end{" write$
			"b"
			"conference" type$ =
              	{"inproceedings"}
				{
					"proceedings" type$ =
              			{"book"}
						'type$
					if$
				} 
            if$ 
			*	write$
  			"}" write$ newline$
  		}
  if$
  "\endbibitem" write$ newline$
}
FUNCTION {same.end}
{ add.period$
  format.doi output
	%new.sentence
  format.mrnumber output
	%new.sentence
  %format.url output
	new.sentence
  format.arxiv output
	new.sentence
	format.id       output
	format.bptnote  output
	format.bptok  output
 }

FUNCTION {settings}{}

FUNCTION {article}
{ output.bibitem
	#1 'bother := 
	element.type
	format.authors output.nonnull
	format.year output
	format.title "title" output.check
	format.journal  output 
	format.vol 			output 
  	format.ppages 	output
  	new.sentence
	bcomment.note
  	same.end
	end.element.type
}


FUNCTION {manual}
{ output.bibitem
	#1 'bother := 
	element.type
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.organization output.nonnull}
      	  if$
    	}
    	{ format.authors output.nonnull}
  	if$
    format.year output
  	new.sentence
  	format.title "title" output.check
  
  	format.edition output
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.address output}
      	  if$
    	}
    	{ 	format.organization output
      		address empty$
         		'skip$
         		{ insert.comma }
      		if$
	      	format.address output
    	}
  	if$
 % new.sentence
	bcomment.note
  	same.end
	end.element.type
}
 

FUNCTION {patent}
{  #1 'bother := 
 	output.bibitem
 	element.type
  format.authors output.nonnull
  format.year output
  format.title "title" output.check
	format.number output
  new.sentence
	bcomment.note
  same.end
	end.element.type
}

FUNCTION { other } { patent }

FUNCTION {book}
{ output.bibitem
	#1 'bother := 
	element.type
  	author empty$
    	{ format.editors output}
    	{ format.authors output.nonnull}
  	if$
  	format.year output
  	format.title  output
	series empty$
	  {
		  format.vol output
		  edition empty$
    		'new.sentence
				'insert.comma	  
		  if$
			format.edition output
    	new.sentence
		}
		{
			format.edition output
	    new.sentence
  		format.series output
		  format.vol output
    	new.sentence
		}
	if$
  	format.pub.address output
	bcomment.note
  	same.end  
	end.element.type
}

FUNCTION {booklet}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	format.authors output.nonnull
  	format.year  output
  	format.title "title" output.check
  	format.howpublished output
 	address empty$
		'new.sentence
    	'insert.comma
	if$
	format.address output
	bcomment.note
  	same.end
 	end.element.type
}

FUNCTION {inbook}
{ output.bibitem
	#1 'bother := 
	element.type
  	author empty$
    	{ format.editors output}
    	{ format.authors output.nonnull}
  	if$
 	format.year output
 	format.title output
 	format.booktitle output
 	format.edition output
 	series empty$
 		'skip$
  		{new.sentence}
 	if$ 	
 	format.series output
 	format.vol output
 	format.chapter output
 	chapter empty$ not
	pages empty$ not
	and
	  	'insert.comma
	  	'skip$
	if$
 	format.ppages output
 	new.sentence
 	format.pub.address output
 	chap.note %output
 	new.sentence
 	same.end
	end.element.type
}

FUNCTION {incollection}
{ output.bibitem
	#1 'bother := 
	element.type
	format.authors output.nonnull
	format.year output
 	format.title "title" output.check
	format.booktitle "booktitle" output.check
  	format.edition output
  	make.editors output 
  	series empty$ editor empty$
  	or
  		'skip$
  		'new.sentence
	if$
	format.series output
  format.vol output
  format.chapter output
 	chapter empty$ not
	pages empty$ not
	and
	  	'insert.comma
	  	'skip$
	if$
  format.ppages output
  format.pub.address output
	bcomment.note
 	same.end
	end.element.type
}

FUNCTION {inproceedings}
{ output.bibitem
	#1 'bother := 
	element.type
	format.authors output.nonnull
	format.year output
  	format.title "title" output.check
  	format.booktitle "booktitle" output.check
  	make.editors output  
  	editor empty$ series empty$
  	or
  		'skip$
  		'new.sentence
  	if$
	format.series output
 	format.vol output
 	format.ppages output
  	new.sentence
	publisher empty$
    	{format.organization output}
        {format.org output}
    if$
  	format.pub.address output
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {conference} { inproceedings }


FUNCTION {mastersthesis}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	format.authors output.nonnull
  	format.year  output
  	format.title "title" output.check
  	type empty$
    	{"\btype{Master's thesis}" output.nonnull}
     	{format.type output}
  	if$     
  	school empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.school  output
  	address empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.address output
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {misc}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.org output.nonnull}
      	  if$
    	}
    	{ format.authors output.nonnull}
  	if$
  	format.year output
  	format.title "title" output.check
  	new.sentence
  	format.howpublished output
  	new.sentence
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.address output}
      	  if$
    	}
    	{ 	format.organization output
      		address empty$
         		'skip$
         		{ insert.comma }
      		if$
	      	format.address output
    	}
  	if$
  	new.sentence
 	bcomment.note
  	same.end
 	empty.misc.check
 	end.element.type
}

FUNCTION {phdthesis}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	format.authors output.nonnull
  	format.year output
  	format.title "title" output.check
  	type empty$
    	{"\btype{PhD thesis}" output.nonnull}
     	{format.type output}
  	if$     
  	school empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.school output
  	address empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.address output
	bcomment.note
  	same.end 
 	end.element.type
}

FUNCTION {proceedings}{book}

FUNCTION {techreport}
{  #1 'bother := 
	output.bibitem
	element.type
  	format.authors output.nonnull
  	format.year output
  	format.title "title" output.check
  	format.tr.number output
	format.institution output
	new.sentence
  	address empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.address output
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {unpublished}
{  #1 'bother := 
	output.bibitem
	element.type
  	format.authors output.nonnull
  	format.year output
  	format.title "title" output.check
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {default.type} { unpublished }


READ

FUNCTION {sortify}
{ purify$
  "l" change.case$
}

%%%%% setting default options
FUNCTION {default.option.string}
{"sort=1,type=nameyear"}

FUNCTION {set.default.opt}
{default.option.string 'list.string :=}

EXECUTE {set.default.opt}
INTEGERS {length2}


FUNCTION {in.string}{
	l 'tmp1 :=
	v 'tmp2 :=  
 
 	'l := % chars
	'v := % string 
	l text.length$ 'length2 :=
  	v text.length$ 'str.length :=

  	int   'save.num1 :=
  	count 'save.num2 :=
  	#1 'int :=
  	#0 'count :=
  	#0 'found :=
	
	length2 str.length =
		'skip$
		{
			l v = 
				{#1 'found :=}
				{
    				{ 
      					count str.length = not 
      					#0 str.length = not
      					and
    				}
    				{
	   					count #1 + 'count :=
	   					v int length2 substring$ l =
      						{
      							#1 'found :=
								str.length 'count :=  % to finish while$ loop
      						}
      						'skip$
      					if$	
      					int #1 + 'int :=
    				}
  					while$
					
				}
			if$
		}
	if$
  	save.num1 'int   :=
  	save.num2 'count :=
	tmp1 'l :=
	tmp2 'v :=  
		
	found
}


FUNCTION {split}{
	l 'tmp1 :=
	v 'tmp2 :=  
 
	'l := % split by
	'v := % string to split
	
	l text.length$ 'length2 :=
  	v text.length$ 'str.length :=
  	
  	int   'save.num1 :=
  	count 'save.num2 :=
  	found 'save.num4 :=
 
  	#1 'int :=
  	#0 'count :=
  	#0 'found :=
    {
      count str.length = not 
      #0 str.length = not
      and
    }
    {
	   count #1 + 'count :=

	   v int length2 substring$ l =
      	{
			v #1 int #1 - substring$    'l :=	% surasta dalis
			v int #1 + #100 substring$  'v :=   % likusi dalis
			#1 'found :=
			str.length 'count :=                 % kad nutruktu ciklas
      	}
      	'skip$
      if$	
      int #1 + 'int :=
    }
  while$
  	save.num1 'int   :=
  	save.num2 'count :=

  	found #0 =
  		{
  			%l  'l :=
  			"" 'l :=
  		}
  		'skip$ 
  	if$
	save.num4 'found :=

	v l

	tmp1 'l :=
	tmp2 'v :=  
}

FUNCTION {add.option}{
	l 'tmp3 :=
	v 'tmp4 :=  

 
	'l := % option 
	'v := % list
	
	v
	v "" =
		{""}
		{","}
	if$
	l * * 
	tmp3 'l :=
	tmp4 'v :=  
}

FUNCTION {remove.option}{
	
	%%%% issisaugoju originalius "s" ir "t"
	l 'j :=
	v 'f :=  
 
	'l := % option name
	'v := % list
	
	"" 'temp.str := % temporary list
	 
	l text.length$ 'length2 :=
  	v text.length$ 'str.length :=

  	int   'save.num1 :=
  	count 'save.num2 :=
  	done  'save.num3 :=
  	
  	#1 'int :=
  	#0 'count :=
  	#0 'found :=
	
	length2 str.length > 
		'skip$
		{
			#0 'done :=
			v  'f :=

			{done #0 = }
			{
				
				 v "," in.string
				 	{
				 		v	"," split 
				 		'f :=	% rasta
				 		'v :=  % kas liko
					 	
				 	}
				 	{
					 		#1 'done :=
					 		v 'f :=  
				 	}
				 if$

				f l in.string
   					'skip$
					{
						temp.str f add.option 'temp.str :=
					}
				if$
			}
			while$

		}
	if$
  	save.num1 'int   :=
  	save.num2 'count :=
  	save.num3 'done  :=

	temp.str
	j 'l :=
	f 'v :=  
	
}

FUNCTION {assign.opt}{
  % priskiriu options lauka, kad galeciau i(is)jungti "unsort"
  "settings" type$ =
  	{options empty$
		'skip$
  		{	
  			"" 'b :=
  			"" 'tmp5 :=
  			#0 'done :=  	
  			
  			options "=" in.string                % if options has '='
  				{
  					options 'b :=
  					b 'tmp5 :=
  					
					{done #0 = }
					{
						 b "," in.string
						 	{
						 		b	"," split 
						 		'tmp5 :=	% rasta
						 		'b :=  % kas liko
						 	}
						 	{
 						 		#1 'done :=
 						 		b 'tmp5 :=
						 	}
						 if$

						 tmp5 "=" in.string
						 			{
						 				tmp5 "=" split
						 				's :=	% before
						 				't :=   % after
						 				list.string s remove.option 'list.string :=
						 			}
						 			'skip$
						 if$
						 		
						 list.string tmp5 add.option 'list.string :=
					}
					while$
  				
  				}
  				'skip$
  			if$		
  		}
  	 if$
  	}
  	'skip$
  if$
  
}

ITERATE {assign.opt}

INTEGERS { et.al.char.used }

FUNCTION {initialize.et.al.char.used}
{ #0 'et.al.char.used :=
}
EXECUTE {initialize.et.al.char.used}

FUNCTION {format.lab.names.nameyear}
{ remove.braces 's :=
  s num.names$ 'numnames :=
  numnames #3 >% nuo kada daryti et~al.
    { s #1 "{vv~}{ll}" format.name$ " et~al." * } 
    {
      numnames #1 - 'namesleft :=
      #2 'nameptr :=
      s #1 "{vv~}{ll}" format.name$
			{ namesleft #0 > }
			{ 	nameptr numnames =
	    			{ s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
						{ " et~al." * }
						{ " and " * s nameptr "{vv~}{ll}" format.name$ * }
	      			  if$
	    			}
	    			{ ", " * s nameptr "{vv~}{ll}" format.name$ * }
	  			if$
	  			nameptr #1 + 'nameptr :=
	 			namesleft #1 - 'namesleft :=
			}
      while$
    }
  if$
}


FUNCTION {format.lab.names.number}
{ remove.braces 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{ vv }{ ll }{ f }{ jj }" format.name$ 't :=
      
       t sortify * "  " *
	     	  nameptr #1 + 'nameptr :=
  	    	namesleft #1 - 'namesleft :=
    }
  while$}

FUNCTION {format.lab.names.alpha}
{ 's :=
  s num.names$ 'numnames :=
  numnames #1 >
    { numnames #4 >
	{ #3 'namesleft := }
	{ numnames 'namesleft := }
      if$
      #1 'nameptr :=
      ""
	{ namesleft #0 > }
	{ nameptr numnames =
	    { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
		{ "+" *
		  #1 'et.al.char.used :=
		}
		{ s nameptr "{v{}}{l{}}" format.name$ * }
	      if$
	    }
	    { s nameptr "{v{}}{l{}}" format.name$ * }
	  if$
	  nameptr #1 + 'nameptr :=
	  namesleft #1 - 'namesleft :=
	}
      while$
      numnames #4 >
	{ "+" *
	  #1 'et.al.char.used :=
	}
	'skip$
      if$
    }
    { s #1 "{v{}}{l{}}" format.name$
      duplicate$ text.length$ #2 <
	{ pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
	'skip$
      if$
    }
  if$
}
FUNCTION {format.lab.names}{
	"type=nameyear" is.in.list
		'format.lab.names.nameyear
		{
			"type=alpha" is.in.list
				'format.lab.names.alpha
				'format.lab.names.number
			if$
		}
	if$
}
FUNCTION {author.key.label}
{ author empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
        { key empty$
            { cite$ #1 #3 substring$ }
            'key
          if$
        }
        { editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.key.organization.label}
{ author empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.organization.label
        { type$ "manual" =
            'author.key.organization.label
            'author.key.label
          if$
        }
      if$
    }
  if$
  'short.list :=
}

FUNCTION {calc.label}
{ calc.short.authors
  short.list

  "type=alpha" is.in.list
  {
    duplicate$
    year field.or.null purify$ #-1 #2 substring$
    *
    'label :=
    year field.or.null purify$ #-1 #4 substring$
    *
    sortify 'sort.label :=
  }
  {
    "("
    *
    year duplicate$ empty$
    short.list key field.or.null = or
      { pop$ "" }
      'skip$
    if$
    *
    'label :=
    label 'sort.label :=
  } 
  if$
}

FUNCTION {sort.format.names.nameyear}
{ remove.braces 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    {% nameptr #1 >
     %   { "   " * numnames int.to.str$ * "   " *}
     %   'skip$
     % if$
      s nameptr "{vv }{ll}" format.name$ 't :=
      nameptr numnames = 
      t "others" = 
      and
        { "et al" * }
        { t sortify * "  " *
      		#3 numnames  =
        	#2 numnames  =
        	or
        	#2 nameptr  =
          and
        	  {year empty$
        	     'skip$
        	     {year * "  " *}
        	   if$  
        	  }
        	  'skip$
          if$
        }
      if$
		#3 numnames  <
  			{#0 'namesleft :=
  				 	"zzz   " *
  			}    
	      {
	     	  nameptr #1 + 'nameptr :=
  	    	namesleft #1 - 'namesleft :=
  	    }
  	  if$  	
    }
  while$
}

FUNCTION {sort.format.names.number}
{ remove.braces 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{vv }{ll }{f }{jj}" format.name$ 't :=
    	nameptr numnames = 
      t "others" = 
      and
        { "et al" * }
        { t sortify * "  " *}
      if$
   	  	nameptr #1 + 'nameptr :=
    	namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.names.alpha}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
        { "   " * }
        'skip$
      if$
      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
      nameptr numnames = 
      t "others" = 
      and
        { "et al" * }
        { t sortify * }
      if$
  	  	nameptr #1 + 'nameptr :=
   		namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.names}{
	"type=nameyear" is.in.list
		'sort.format.names.nameyear
		{
			"type=alpha" is.in.list
				'sort.format.names.alpha
				'sort.format.names.number
			if$
		}
	if$
}

FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          "zzz"
        }
        { key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
        { key empty$
            { "to sort, need author, editor, or key in " cite$ * warning$
              "z"
            }
            { key sortify }
          if$
        }
        { editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
        { key empty$
            { "to sort, need author, organization, or key in " cite$ * warning$
              "z"
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
        { key empty$
            { "to sort, need editor, organization, or key in " cite$ * warning$
              "z"
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

FUNCTION {presort}
{ calc.label
  sort.label sortify
  "    "
  *
  type$ "book" =
  type$ "inbook" =
  or
 		{author empty$
   		'editor.organization.sort
      'author.organization.sort
     if$
    }
    { type$ "proceedings" =
      type$ "incollection" =
       or
    		{author empty$
        		'editor.organization.sort
            	'author.organization.sort
        if$
        }
        { type$ "manual" =
          type$ "misc" =
          or
            'author.organization.sort
            'author.sort
          if$
        }
      if$
    }
  if$
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  %%%% removing title from the sorting line 
  %title field.or.null sort.format.title
  %*
  #1 entry.max$ substring$ 'sort.label :=
%  sort.label top$
  sort.label *
  #1 entry.max$ substring$ 'sort.key$ :=
  
  %sort.key$ top$
}

ITERATE {presort}

FUNCTION {bib.sort.order}
{ 
  "settings" type$ =
  	{"aaa"}
  	{"sort=0" is.in.list
    	{"bb"}
    	{"type=alpha" is.in.list
    		{sort.key$}
    		{sort.label}
      	if$  
   		}
  	 if$
  	}
  	if$
  'sort.key$ :=
	%sort.key$ top$ 
}

ITERATE {bib.sort.order}

SORT


INTEGERS { longest.label.width last.extra.num number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.label :=
  "" 'j :=
  #0 'longest.label.width :=
  #0 'last.extra.num :=
  #0 'number.label :=
}

FUNCTION {forward.pass}
{ last.label "l" change.case$ label "l" change.case$ =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      label 'last.label :=
    }
  if$
  number.label #1 + 'number.label :=
}

FUNCTION {reverse.pass}
{ j "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  extra.label 'j :=
  label extra.label * 'label :=
  %label top$
}

EXECUTE {initialize.longest.label}

ITERATE {forward.pass}

REVERSE {reverse.pass}


FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
    "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ newline$
	"% BibTex style file: imsart-nameyear.bst, 2013-01-28" write$ newline$
	default.option.string "" =
		'skip$
		{ 
			"% Default style options (" default.option.string * ")." * write$ newline$
			"% Used options (" list.string * ")." * write$ newline$
		}
	if$
	
}
EXECUTE {begin.bib}

EXECUTE {init.state.consts}


ITERATE {call.type$}

FUNCTION {end.bib}
{ newline$
 "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}
imsart-number.bst · 38 KB
%% This is file `imsart-number.bst'
%%
%%
%% You are free to use this style file as you see fit, provided 
%% that you do not make changes to the file. 
%% If you DO make changes, you are required to rename this file.
%%
%% It may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% TeX programming: Linas Stonys, VTeX, Lithuania, [email protected] 
%%
%% This bibtex style produces structured bibliography (.bbl) file which could be
%% converted back into the database (.bib) format.
%% bibtex program must be invoked with the maximum allocation of memory (-w switch)
%%
%% This bibtex style could be used only with the imsart package 
%% starting with version from 2009/08/13

%% 2010-02-01 - splited inits "A.D." -> "A. D." and "A.{\,}D." -> "A. D."
%% 2010-03-19 - fixed sorting.
%% 2011-01-07 - inserted options: sort, nameyear, alpha, number.
%% 2013-01-28 - added: arxiv, mrnumber. Changed tags.

ENTRY
  { address
    author
    arxiv
    booktitle
    bpt_note
    bpt_ok
    chapter
    doi
    edition
    editor
    howpublished
    institution
    isbn
    journal
    key
    month
    mrnumber
    note
    number
    organization
    pages   
    publisher
    school
    series
    src
    sortkey
    title
    type
    volume
    year
    url
    id
    options
  }
  {}
   { label extra.label sort.label short.list }

INTEGERS { output.state before.all mid.sentence after.sentence
           after.block between.elements }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #5 'between.elements :=
}

STRINGS { s t tmp1 tmp2 tmp3 tmp4 tmp5}
STRINGS { longest.label last.label list.string temp.str default.list}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}


FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { " " * write$ newline$}
    { output.state after.block =
        { add.period$ write$
          newline$
         % "\newblock " write$
        }
        { output.state between.elements =
            { ", " * write$ newline$}
            { output.state before.all =
                'write$
                { add.period$ " " * write$ newline$}
              if$
            }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    {output.nonnull}
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    {output.nonnull}
  if$
}



FUNCTION {insert.comma}
{ output.state before.all =
    'skip$
    { between.elements 'output.state := }
  if$
}
FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state :=}
      if$
    }
  if$
}


FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

STRINGS { v l f j b ff}
INTEGERS { nameptr namesleft numnames bother}
INTEGERS {str.length count return save.num1 save.num2 save.num3 save.num4 int done}
FUNCTION {is.in.list}{
	'f :=
	%%%% issisaugoju originalius "s" ir "t"
	s 'j :=
	f 's :=
	t 'f :=  
  list.string text.length$ 'str.length :=
  list.string 't :=
%  s text.length$ 'slen :=
  int   'save.num1 :=
  count 'save.num2 :=
  #1 'int :=
  #1 'count :=
  #0 'return :=
    
    { count str.length = not 
      #0 str.length = not
      and
    }
    {
			count #1 + 'count :=
		  t int #1 substring$ "," =
      	{
      	  t #1 int substring$ s "," * =
      	    {
		  		   #1 'return :=
  			      str.length 'count :=
			   	  }
	    			'skip$
         if$
	        
	        int #1 + 'int :=
   		    t int global.max$ substring$ 't :=
				  #0 'int :=
      	}
      	'skip$
      if$	
      int #1 + 'int :=
%			"count=" count int.to.str$ * " slen=" * str.length int.to.str$ * top$
    }
  while$

  save.num1 'int   :=
  save.num2 'count :=
  
  #0 return =
  	{ s t =
		    {#1 'return :=}
		    'skip$
		  if$
  	}
  	'skip$
  if$
	%%%% grazinu originalius "s" ir "t"
	j 's :=
	f 't :=  
	
	return		
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%% formating bbl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

FUNCTION {make.tag}
{ 't :=
  duplicate$ empty$
    { pop$ "" }
    { bother #0 =
    	{	t "volume" =
    			{"\textbf{"  swap$ * "}" * }
    			'skip$
    		if$
    	}
	    { "\b" t * "{" * swap$ * "}" * }
	  if$
    }
  if$
}

INTEGERS {sk}
FUNCTION {is.num}
{ chr.to.int$
  duplicate$ "0" chr.to.int$ < not
  swap$ "9" chr.to.int$ > not and
}

FUNCTION {byear}
{ duplicate$ empty$
    { pop$ "" }
    {'t :=
     t text.length$ 'sk :=
			#5 sk =
					{t #1 #4 substring$ 's :=
					 t #5 #1 substring$ 'longest.label :=
					 	longest.label is.num not	
							{"\byear{" s * "}" * longest.label * }
							{"\byear{"  t * "}" * }
						if$
					}
					{t "year" make.tag 
  						"type=nameyear" is.in.list						
							{extra.label *}
							'skip$
						if$
					}
			if$
    }
  if$
}



FUNCTION {format.address}
{address empty$
	{ "" }
	{address "address" make.tag }
  if$
}

FUNCTION {format.organization}
{organization empty$
		{ "" }
		{organization "publisher" make.tag}
  if$
}

FUNCTION {format.org}
{organization empty$
	{ "" }
	{organization "organization" make.tag add.period$}
  if$
}




FUNCTION {format.pub.address}
{ publisher empty$
    { "" }
    { publisher "publisher" make.tag
      address empty$
        'skip$
        {", " * format.address * add.period$}
      if$
    }
  if$
}

FUNCTION {mk.tag}
{ 'temp.str :=
  duplicate$ empty$
    { pop$ "" }
    { 
    	b "nothing" =
    		'skip$
			{"\b" temp.str * "{" * swap$ * "}" * }
		if$
	}
  if$
}

FUNCTION {space.after.dot}
{'t :=
	"" 'l :=
	"" 's :=
  { t empty$ not }
  {   t #1 #1 substring$ 's :=
		  l  s * 'l := 
      s "." = 
				{ t #2 #1 substring$ " " =
    	      'skip$
		 			  {
						  l  " " * 'l := 
						  t #2 #4 substring$ "{\,}" =
		 			  		{
						  	  t #5 global.max$ substring$ 't :=
		 			  		}
    	     		  'skip$
      	  		if$ 
		 			  }
      	  if$  
				} 
				'skip$
				
      if$
  	  t #2 global.max$ substring$ 't :=
    }
  while$
  l 
}

FUNCTION {format.author.editor}
{ 	'b :=
  	
  	b "editor" =
  	b "beditor" =
  	b "editor2" =
  	or or
		{editor space.after.dot 's :=}
		{author space.after.dot 's :=}
	if$

  	#1 'nameptr :=
  	s num.names$ 'numnames :=
  	numnames 'namesleft :=
    { namesleft #0 > }
    {	
    	s nameptr "{vv}" format.name$ "particle" mk.tag  'v := 
       	s nameptr "{ll}" format.name$ "snm"      mk.tag  'l :=   
    	s nameptr "{f.}" format.name$ "inits"    mk.tag  'f := 
    	s nameptr "{ff}" format.name$ "fnm"      mk.tag  'ff := 
     	s nameptr "{jj}" format.name$ "suffix"   mk.tag  'j := 
  		
  		j empty$
	   		{"" 'j :=} 		
	   		{" " j * 'j :=} 		
		if$
 		
 		v empty$
	   		{"" 'v :=} 		
	   		{v " " * 'v :=} 		
		if$
 		
 		l  "\bsnm{others}" =
  			{  "et~al." "etal" make.tag * }
  			{
   				b "editor2" =
	 				{"\beditor{" * ff * f * 
						ff "" = f "" = and
		  					'skip$
		  					{"~" * }
		  				if$
	 					v * l * j * "}" * "" 't :=
	 				}
		  			'skip$
				if$

			   	b "author" =
   				b "editor" =
   				or
	 				{"\b" * b * "{" * v * l * 
						ff "" = f "" = and
		  					'skip$
		  					{",~" * }
		  				if$
	 					ff * f * j * "}" * "" 't :=}
		  			'skip$
				if$

			} 
 		if$

		namesleft #0 >
        { namesleft #1 >
            { namesleft #2 =
    		        	{ s numnames "{ll}" format.name$ "others" =
    		        	  {" " * t * }
    		        	  {" \AND " * t * }
    		        	  if$
    		        	}
    		        	{", " * t * }
		          if$
           	}
            {""}
          if$
        }
        't
      
      if$
      nameptr #1 + 'nameptr := 
      namesleft #1 - 'namesleft :=
    }
  while$
}


FUNCTION {format.editors}
{ editor empty$
	{""}
    {
    	bother #0 =
			{author empty$
   		  		{"editor"}
   				{"nothing"}
   		 	if$
  			}
			{"editor"}
		if$  
	  	format.author.editor
      editor num.names$ #1 >
        { ", eds." * }
        { ", ed." * }
      if$
    }
  if$
}

FUNCTION {format.authors}
{ author empty$
	{""}
    {"author"  format.author.editor}
  if$
}

FUNCTION {make.editors}
{ editor empty$
    { "" }
    { "("  

    	bother #0 =
			{author empty$
   		  		{"editor"}
   				{"nothing"}
   		 	if$
  			}
			{"editor2"}
		if$  
	  	format.author.editor
						 *
      editor num.names$ #1 >
        { ", eds.)" * }
        { ", ed.)" * }
      if$
    }
  if$
}



FUNCTION {cite.author.editor}
{ 's :=

  s #1 "{vv~}{ll}" format.name$
  s num.names$ duplicate$
  #3 >
    { pop$ " et~al." * }
    { #3 =
        { s #3 "{vv~}{ll}{ jj}{ f}" format.name$ "others" =
            { " et~al."  * }
            { ", " * s #2 "{vv~}{ll}" format.name$ * 
             " and " * s #3 "{vv~}{ll}" format.name$ *  
            }
          if$
        }
		    {s num.names$ #2 =
    		        {s #2 "{vv~}{ll}{ jj}{ f}" format.name$ "others" =
            				{ " et~al."  * }
     		    				{ " and " * s #2 "{vv~}{ll}" format.name$ * }
     		    			if$
     		    		}
     		    		'skip$
        	 if$
        }
      if$
    }
  if$
}


FUNCTION {check.auth.edit.org}
{author empty$
		{
			editor empty$
					{
						organization empty$
								{""}
								{organization}
						if$		
					}
					{editor cite.author.editor}
			if$		
		}
		{author cite.author.editor}
 if$	
}

FUNCTION {check.year}
{year empty$
		{""}
		{year extra.label *
		}
	if$	
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem"
  "type=nameyear" is.in.list
     {
 	    "[\protect\citeauthoryear{" * write$
	   			check.auth.edit.org write$ 
	   	"}{" write$ 
	   			check.year write$ 
	   	"}]" 
    }
    'skip$
  if$
  "type=alpha" is.in.list
     {
 	    "[" * write$
  	  label write$
	    "]" 
    }
    'skip$
  if$

  "{" * write$  
  cite$ write$
  "}" write$
  newline$
  "" before.all 'output.state :=
}

INTEGERS { multiresult char.num k }

 
FUNCTION {string.to.integer}
{ 't :=
    t text.length$ 'k :=
  #1 'char.num :=
      { t char.num #1 substring$ 's :=
	 	  s is.num
	 	  s "." =
	 	  or 
	 	  char.num k = not
	 	  and
	 	 	}
	 	 {char.num #1 + 'char.num :=}
  while$
  char.num #1 - 'char.num :=
  t #1 char.num substring$ 
}

FUNCTION {check.mrnumber}
{mrnumber 't :=
  ""
    { t empty$ not }
    { t #1 #2 substring$ "\#" = 
			{ t #1 #2 substring$ *
	 			 t #2 global.max$ substring$ 't :=
			}
			{
			  t #1 #1 substring$ "#" = 
					{ "\#" *
		 					 t #2 global.max$ substring$ 't :=
					}
				{ t #1 #1 substring$ *
	 			 t #2 global.max$ substring$ 't :=
				}
     	 if$
      }
      if$
    }
  while$
}


FUNCTION {remove.braces}
{'t :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "{" = 
			t #1 #1 substring$ "}" = 
			or
				{ 
		 			 t #2 global.max$ substring$ 't :=
				}
				{ t #1 #1 substring$ *
		 			 t #2 global.max$ substring$ 't :=
				}
			if$
    }
  while$
}

FUNCTION {format.mrnumber}
{ mrnumber empty$
    { "" }
    {	bother #0 =
		     {check.mrnumber} 
		     {"\bmrnumber{" check.mrnumber * "}" * }
			if$
    }
  if$
}

INTEGERS { found }
FUNCTION {cut.info}
{ 't :=
 #0 'found := 
 "" 's :=
 "" 'v :=
    { t empty$ not }
    { 
      t #1 #5 substring$ "info:" = 
			  { 
    		  t #6 global.max$ substring$ 't :=
    		  #1 'found := 
          "}" 'v :=
			  }
			  'skip$
      if$

      t #1 #1 substring$ "/" = 
      #1 found =
      and
			  { 
    		  t #2 global.max$ substring$ 't :=
    		  s "={" * 's :=
    		  #0 'found := 
           
			  }
			  'skip$
      if$   

      t #1 #2 substring$ ", " = 
      v "}" =
      and
			  { 
    		  t #2 global.max$ substring$ 't :=
    		  s "}," * 's :=
			  }
			  'skip$
      if$   
            s t #1 #1 substring$ * 's :=  
	 			    t #2 global.max$ substring$ 't :=
    }
  while$
s v *
}

FUNCTION {format.id}
{ id empty$
    { "" }
    {	bother #0 =
		     { "" } 
		     {"\bid{" id cut.info * "}" * }
			if$
    }
  if$
}

FUNCTION {format.journal}
{ journal empty$
    { "" }
    {	bother #0 =
		     {journal "t" change.case$} 
    		 {"\bjournal{" journal  * "}" * } 
			if$
    }
  if$
}
FUNCTION {title.sep}
{ type$ "article" =
	type$ "incollection" =
	type$ "inproceedings" =
	type$ "booklet" =
	type$ "unpublished" =
	or or or or
		'add.period$
		'skip$
	if$

	type$ "inbook" =
	type$ "manual" =
	or
	edition empty$ not
	and 
		{"," *}
		{
			edition empty$ 
			series empty$ not
			and
				'add.period$
				'skip$
			if$	
		}
	if$

	type$ "book" =
		{
			edition empty$ not
			series empty$ not
			and
				{"," *}
				{
				 edition empty$ 
				 series empty$ not
				 and
						'add.period$
						'skip$
				 if$		
				}
			if$
		}
		'skip$
	if$
	
}

FUNCTION {format.title}
{ title empty$
    { "" }
    {
    	title "title" make.tag
    	title.sep
    }
  if$
}
FUNCTION {format.year}
{ year empty$
    {""}
    {	bother #0 =
    		{"(" year  extra.label * * ")." *}  
    		{"(" year byear * ")." *}  
			if$
    }
    if$
}

FUNCTION {format.month}
{ month empty$
    {""}
		{ "\bmonth{" month  * "}" *}
	if$
}
FUNCTION {format.type}
{ type empty$
    {""}
		{ "\btype{" type * "}" *}
	if$
}

FUNCTION {formatpatent.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$}
         
      if$
    }
    { month empty$
       { year byear}
        {format.month " " * year byear *}
      if$
    }
  if$
}
FUNCTION {format.btitle}
{ title "btitle" make.tag
}



FUNCTION {format.note}
{ note empty$
    {""}
    {	note "note" make.tag}
  if$
}
FUNCTION {format.bptnote}
{bpt_note empty$
	{""}
	{"\bptnote{" bpt_note * "}%" * 	}
if$	
}
FUNCTION {format.bptok}
{bpt_ok empty$
	{""}
	{"\bptok{" bpt_ok * "}%" * 	}
if$	
}

FUNCTION {add.note}
{ note empty$
    {""}
    { note }
  if$
}
FUNCTION {format.chapter}
{chapter empty$
	{""}
	{"\bchapter{" chapter * "}" * 	}
if$	
}


FUNCTION {chap.type}
{chapter empty$
	{""}
	{	type empty$
			{ "Chapter "}
			{ type "Section" = 
	 				{	"Section "}
					{ "Chapter "}
				if$	
			}
		if$
		 "\bchapter{" chapter * "}" * *
	}
if$	
}
								
  
FUNCTION {chap.note}
{	format.note output 
     new.sentence
}

FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}
FUNCTION {no.space.connect}
{ duplicate$ text.length$ #3 <
    { "" }
    { "" }
  if$
  swap$ * *
}


%%%%%%%%%%%%%%%%%%%%%%%%%% patent names
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}
FUNCTION {format.series}
{ series empty$
	{ "" } 
    {	bother #0 =
		     {series} 
    		 {"\bseries{" series * "}" * } 
			if$
    }
  if$
}
FUNCTION {format.edition}
{ edition empty$
    { "" }
    { output.state mid.sentence =
        { edition  "l" change.case$ }
        { edition  "t" change.case$ }
      if$
      "edition" make.tag
      " ed." *
    }
  if$
}


FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult 
}
FUNCTION {format.isbn}
{ isbn empty$
    { "" }
	{"\bisbn{" isbn * "}" *}
  if$
}

FUNCTION {format.school}
{ school empty$
	{""}
    {"\bpublisher{" school * "}" * } 
  if$
}

FUNCTION {format.institution}
{ institution empty$
	{""}
    {	bother #0 =
		     {institution} 
    		 { "techreport" type$ =
    		 			{"\bpublisher{" }
    		 			{"\binstitute{" }
    		 		if$	
    		 		
    		 		institution * "}" * 
    		 } 
			if$
    }
  if$
}
FUNCTION {format.howpublished}
{ howpublished empty$
	{""}
    { howpublished "howpublished" make.tag }
  if$
}

FUNCTION {format.vol}
{ volume empty$
  number empty$
  and
  	{""}
 		{ volume empty$ 
			  {number} 
		    {volume}
 		  if$
      "volume" make.tag
	  }
  if$
}

FUNCTION {note.presented}
 {note #1 #9 substring$ "presented" = 
 	note #1 #9 substring$ "Presented" = 
 or}
 

FUNCTION {format.url}
{ url empty$
    { "" }
		{"\url{" url * "}" * }
	if$
}

FUNCTION {format.arxiv}
{ arxiv empty$
    { "" }
	{"\arxiv{" arxiv * "}" * } 
  if$
}

FUNCTION {format.doi}
{ doi empty$
	{""}
	{"\bdoi{" doi  * "}" * } 
  if$
}

FUNCTION {format.ppages}
{ pages  empty$ 
	{""}
	{pages "pages" make.tag 
     add.period$
    }
  if$
}


FUNCTION {format.booktitle}
{ booktitle empty$
    { "" }
    {	bother #0 =
		     {"In " booktitle *} 
    		 {"In \bbooktitle{" booktitle * "}" *} 
			if$
			type$ "incollection" =
				{	series empty$
					volume empty$
					and
						'skip$
						{ editor empty$ series empty$ not and
						   {"." *} 
						   {"," *} 
							if$
						}
					if$	
				}
				'skip$
			if$
				
			type$ "inproceedings" =
				{	series empty$
					editor empty$
%					volume empty$ not
					and 
						'skip$
						{editor empty$
							  {"." *}
							  'skip$
						 if$ 
						}
					if$	
				}
				'skip$
			if$	
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { "\btype{Technical Report}" }
    { "\btype{" type * "}" * }
  if$

  number empty$
		 'skip$
    { " No. \bnumber{" number * "}" * * }
  if$

%  type empty$ not 
%  number empty$
	institution empty$ not
    	{"," *}
    	'skip$
 	if$

}

FUNCTION {format.number}
{number empty$
		{""}
    {"\bnumber{" number * "}" * } 
  if$
}
INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}   
 

FUNCTION {bcomment.note}
{note empty$
'skip$
 {note  "note" make.tag output add.period$}
 if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      "\btype" type * "}" *
    }
  if$
}


FUNCTION {element.type}
{	bother #0 =
  		{"\begin{botherref}" write$ newline$}
  		{"\begin{" write$
			"b"
			"conference" type$ =
              	{"inproceedings"}
				{
					"proceedings" type$ =
              			{"book"}
						'type$
					if$
				} 
            if$ 
			*  		write$
  			"}["  write$
  					src empty$
  						{"author" write$}
  						{src write$ }
  					if$
  			"]" write$ newline$
  		}
  if$
}
FUNCTION {end.element.type}
{write$ newline$
	bother #0 =
  		{"\end{botherref}" write$ newline$}
  		{"\end{" write$
			"b"
			"conference" type$ =
              	{"inproceedings"}
				{
					"proceedings" type$ =
              			{"book"}
						'type$
					if$
				} 
            if$ 
			*	write$
  			"}" write$ newline$
  		}
  if$
  "\endbibitem" write$ newline$
}
FUNCTION {same.end}
{ add.period$
  format.doi output
	%new.sentence
  format.mrnumber output
	%new.sentence
  %format.url output
	new.sentence
  format.arxiv output
	new.sentence
	format.id       output
	format.bptnote  output
	format.bptok  output
 }

FUNCTION {settings}{}

FUNCTION {article}
{ output.bibitem
	#1 'bother := 
	element.type
	format.authors output.nonnull
	format.year output
	format.title "title" output.check
	format.journal  output 
	format.vol 			output 
 	format.ppages 	output
 	new.sentence
	bcomment.note
  	same.end
	end.element.type
}


FUNCTION {manual}
{ output.bibitem
	#1 'bother := 
	element.type
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.organization output.nonnull}
      	  if$
    	}
    	{ format.authors output.nonnull}
  	if$
    format.year output
  	new.sentence
  	format.title "title" output.check
  
  	format.edition output
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.address output}
      	  if$
    	}
    	{ 	format.organization output
      		address empty$
         		'skip$
         		{ insert.comma }
      		if$
	      	format.address output
    	}
  	if$
 % new.sentence
	bcomment.note
  	same.end
	end.element.type
}
 

FUNCTION {patent}
{  #1 'bother := 
 	output.bibitem
 	element.type
  format.authors output.nonnull
  format.year output
  format.title "title" output.check
	format.number output
  new.sentence
	bcomment.note
  same.end
	end.element.type
}

FUNCTION { other } { patent }

FUNCTION {book}
{ output.bibitem
	#1 'bother := 
	element.type
  	author empty$
    	{ format.editors output}
    	{ format.authors output.nonnull}
  	if$
  	format.year output
  	format.title  output
	series empty$
	  {
		  format.vol output
		  edition empty$
    		'new.sentence
				'insert.comma	  
		  if$
			format.edition output
    	new.sentence
		}
		{
			format.edition output
	    new.sentence
  		format.series output
		  format.vol output
    	new.sentence
		}
	if$
  	format.pub.address output
	bcomment.note
  	same.end  
	end.element.type
}

FUNCTION {booklet}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	format.authors output.nonnull
  	format.year  output
  	format.title "title" output.check
  	format.howpublished output
 	address empty$
		'new.sentence
    	'insert.comma
	if$
	format.address output
	bcomment.note
  	same.end
 	end.element.type
}

FUNCTION {inbook}
{ output.bibitem
	#1 'bother := 
	element.type
  	author empty$
    	{ format.editors output}
    	{ format.authors output.nonnull}
  	if$
 	format.year output
 	format.title output
 	format.booktitle output
 	format.edition output
 	series empty$
 		'skip$
  		{new.sentence}
 	if$ 	
 	format.series output
 	format.vol output
 	format.chapter output
 	chapter empty$ not
	pages empty$ not
	and
	  	'insert.comma
	  	'skip$
	if$
 	format.ppages output
 	new.sentence
 	format.pub.address output
 	chap.note %output
 	new.sentence
 	same.end
	end.element.type
}

FUNCTION {incollection}
{ output.bibitem
	#1 'bother := 
	element.type
	format.authors output.nonnull
	format.year output
 	format.title "title" output.check
	format.booktitle "booktitle" output.check
  	format.edition output
  	make.editors output 
  	series empty$ editor empty$
  	or
  		'skip$
  		'new.sentence
	if$
	format.series output
  format.vol output
  format.chapter output
 	chapter empty$ not
	pages empty$ not
	and
	  	'insert.comma
	  	'skip$
	if$
  format.ppages output
  format.pub.address output
	bcomment.note
 	same.end
	end.element.type
}

FUNCTION {inproceedings}
{ output.bibitem
	#1 'bother := 
	element.type
	format.authors output.nonnull
	format.year output
  	format.title "title" output.check
  	format.booktitle "booktitle" output.check
  	make.editors output  
  	editor empty$ series empty$
  	or
  		'skip$
  		'new.sentence
  	if$
	format.series output
 	format.vol output
 	format.ppages output
  	new.sentence
	publisher empty$
    	{format.organization output}
        {format.org output}
    if$
  	format.pub.address output
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {conference} { inproceedings }


FUNCTION {mastersthesis}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	format.authors output.nonnull
  	format.year  output
  	format.title "title" output.check
  	type empty$
    	{"\btype{Master's thesis}" output.nonnull}
     	{format.type output}
  	if$     
  	school empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.school  output
  	address empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.address output
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {misc}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.org output.nonnull}
      	  if$
    	}
    	{ format.authors output.nonnull}
  	if$
  	format.year output
  	format.title "title" output.check
  	new.sentence
  	format.howpublished output
  	new.sentence
  	author empty$
    	{ organization empty$
        	'skip$
        	{ format.address output}
      	  if$
    	}
    	{ 	format.organization output
      		address empty$
         		'skip$
         		{ insert.comma }
      		if$
	      	format.address output
    	}
  	if$
  	new.sentence
 	bcomment.note
  	same.end
 	empty.misc.check
 	end.element.type
}

FUNCTION {phdthesis}
{  #1 'bother := 
  	output.bibitem
 	element.type
  	format.authors output.nonnull
  	format.year output
  	format.title "title" output.check
  	type empty$
    	{"\btype{PhD thesis}" output.nonnull}
     	{format.type output}
  	if$     
  	school empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.school output
  	address empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.address output
	bcomment.note
  	same.end 
 	end.element.type
}

FUNCTION {proceedings}{book}

FUNCTION {techreport}
{  #1 'bother := 
	output.bibitem
	element.type
  	format.authors output.nonnull
  	format.year output
  	format.title "title" output.check
  	format.tr.number output
	format.institution output
	new.sentence
  	address empty$
    	'skip$
     	{ insert.comma }
  	if$
  	format.address output
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {unpublished}
{  #1 'bother := 
	output.bibitem
	element.type
  	format.authors output.nonnull
  	format.year output
  	format.title "title" output.check
	bcomment.note
  	same.end
	end.element.type
}

FUNCTION {default.type} { unpublished }


READ

FUNCTION {sortify}
{ purify$
  "l" change.case$
}

%%%%% setting default options
FUNCTION {default.option.string}
{"sort=1,type=number"}

FUNCTION {set.default.opt}
{default.option.string 'list.string :=}

EXECUTE {set.default.opt}
INTEGERS {length2}


FUNCTION {in.string}{
	l 'tmp1 :=
	v 'tmp2 :=  
 
 	'l := % chars
	'v := % string 
	l text.length$ 'length2 :=
  	v text.length$ 'str.length :=

  	int   'save.num1 :=
  	count 'save.num2 :=
  	#1 'int :=
  	#0 'count :=
  	#0 'found :=
	
	length2 str.length =
		'skip$
		{
			l v = 
				{#1 'found :=}
				{
    				{ 
      					count str.length = not 
      					#0 str.length = not
      					and
    				}
    				{
	   					count #1 + 'count :=
	   					v int length2 substring$ l =
      						{
      							#1 'found :=
								str.length 'count :=  % to finish while$ loop
      						}
      						'skip$
      					if$	
      					int #1 + 'int :=
    				}
  					while$
					
				}
			if$
		}
	if$
  	save.num1 'int   :=
  	save.num2 'count :=
	tmp1 'l :=
	tmp2 'v :=  
		
	found
}


FUNCTION {split}{
	l 'tmp1 :=
	v 'tmp2 :=  
 
	'l := % split by
	'v := % string to split
	
	l text.length$ 'length2 :=
  	v text.length$ 'str.length :=
  	
  	int   'save.num1 :=
  	count 'save.num2 :=
  	found 'save.num4 :=
 
  	#1 'int :=
  	#0 'count :=
  	#0 'found :=
    {
      count str.length = not 
      #0 str.length = not
      and
    }
    {
	   count #1 + 'count :=

	   v int length2 substring$ l =
      	{
			v #1 int #1 - substring$    'l :=	% surasta dalis
			v int #1 + #100 substring$  'v :=   % likusi dalis
			#1 'found :=
			str.length 'count :=                 % kad nutruktu ciklas
      	}
      	'skip$
      if$	
      int #1 + 'int :=
    }
  while$
  	save.num1 'int   :=
  	save.num2 'count :=

  	found #0 =
  		{
  			%l  'l :=
  			"" 'l :=
  		}
  		'skip$ 
  	if$
	save.num4 'found :=

	v l

	tmp1 'l :=
	tmp2 'v :=  
}

FUNCTION {add.option}{
	l 'tmp3 :=
	v 'tmp4 :=  

 
	'l := % option 
	'v := % list
	
	v
	v "" =
		{""}
		{","}
	if$
	l * * 
	tmp3 'l :=
	tmp4 'v :=  
}

FUNCTION {remove.option}{
	
	%%%% issisaugoju originalius "s" ir "t"
	l 'j :=
	v 'f :=  
 
	'l := % option name
	'v := % list
	
	"" 'temp.str := % temporary list
	 
	l text.length$ 'length2 :=
  	v text.length$ 'str.length :=

  	int   'save.num1 :=
  	count 'save.num2 :=
  	done  'save.num3 :=
  	
  	#1 'int :=
  	#0 'count :=
  	#0 'found :=
	
	length2 str.length > 
		'skip$
		{
			#0 'done :=
			v  'f :=

			{done #0 = }
			{
				
				 v "," in.string
				 	{
				 		v	"," split 
				 		'f :=	% rasta
				 		'v :=  % kas liko
					 	
				 	}
				 	{
					 		#1 'done :=
					 		v 'f :=  
				 	}
				 if$

				f l in.string
   					'skip$
					{
						temp.str f add.option 'temp.str :=
					}
				if$
			}
			while$

		}
	if$
  	save.num1 'int   :=
  	save.num2 'count :=
  	save.num3 'done  :=

	temp.str
	j 'l :=
	f 'v :=  
	
}

FUNCTION {assign.opt}{
  % priskiriu options lauka, kad galeciau i(is)jungti "unsort"
  "settings" type$ =
  	{options empty$
		'skip$
  		{	
  			"" 'b :=
  			"" 'tmp5 :=
  			#0 'done :=  	
  			
  			options "=" in.string                % if options has '='
  				{
  					options 'b :=
  					b 'tmp5 :=
  					
					{done #0 = }
					{
						 b "," in.string
						 	{
						 		b	"," split 
						 		'tmp5 :=	% rasta
						 		'b :=  % kas liko
						 	}
						 	{
 						 		#1 'done :=
 						 		b 'tmp5 :=
						 	}
						 if$

						 tmp5 "=" in.string
						 			{
						 				tmp5 "=" split
						 				's :=	% before
						 				't :=   % after
						 				list.string s remove.option 'list.string :=
						 			}
						 			'skip$
						 if$
						 		
						 list.string tmp5 add.option 'list.string :=
					}
					while$
  				
  				}
  				'skip$
  			if$		
  		}
  	 if$
  	}
  	'skip$
  if$
  
}

ITERATE {assign.opt}

INTEGERS { et.al.char.used }

FUNCTION {initialize.et.al.char.used}
{ #0 'et.al.char.used :=
}
EXECUTE {initialize.et.al.char.used}

FUNCTION {format.lab.names.nameyear}
{ remove.braces 's :=
  s num.names$ 'numnames :=
  numnames #3 >% nuo kada daryti et~al.
    { s #1 "{vv~}{ll}" format.name$ " et~al." * } 
    {
      numnames #1 - 'namesleft :=
      #2 'nameptr :=
      s #1 "{vv~}{ll}" format.name$
			{ namesleft #0 > }
			{ 	nameptr numnames =
	    			{ s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
						{ " et~al." * }
						{ " and " * s nameptr "{vv~}{ll}" format.name$ * }
	      			  if$
	    			}
	    			{ ", " * s nameptr "{vv~}{ll}" format.name$ * }
	  			if$
	  			nameptr #1 + 'nameptr :=
	 			namesleft #1 - 'namesleft :=
			}
      while$
    }
  if$
}


FUNCTION {format.lab.names.number}
{ remove.braces 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{ vv }{ ll }{ f }{ jj }" format.name$ 't :=
      
       t sortify * "  " *
	     	  nameptr #1 + 'nameptr :=
  	    	namesleft #1 - 'namesleft :=
    }
  while$}

FUNCTION {format.lab.names.alpha}
{ 's :=
  s num.names$ 'numnames :=
  numnames #1 >
    { numnames #4 >
	{ #3 'namesleft := }
	{ numnames 'namesleft := }
      if$
      #1 'nameptr :=
      ""
	{ namesleft #0 > }
	{ nameptr numnames =
	    { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
		{ "+" *
		  #1 'et.al.char.used :=
		}
		{ s nameptr "{v{}}{l{}}" format.name$ * }
	      if$
	    }
	    { s nameptr "{v{}}{l{}}" format.name$ * }
	  if$
	  nameptr #1 + 'nameptr :=
	  namesleft #1 - 'namesleft :=
	}
      while$
      numnames #4 >
	{ "+" *
	  #1 'et.al.char.used :=
	}
	'skip$
      if$
    }
    { s #1 "{v{}}{l{}}" format.name$
      duplicate$ text.length$ #2 <
	{ pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
	'skip$
      if$
    }
  if$
}
FUNCTION {format.lab.names}{
	"type=nameyear" is.in.list
		'format.lab.names.nameyear
		{
			"type=alpha" is.in.list
				'format.lab.names.alpha
				'format.lab.names.number
			if$
		}
	if$
}
FUNCTION {author.key.label}
{ author empty$
    { key empty$
        { cite$ #1 #3 substring$ }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
        { key empty$
            { cite$ #1 #3 substring$ }
            'key
          if$
        }
        { editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.key.organization.label}
{ author empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
        { organization empty$
            { cite$ #1 #3 substring$ }
            { "The " #4 organization chop.word #3 text.prefix$ }
          if$
        }
        'key
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.short.authors}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
        'editor.key.organization.label
        { type$ "manual" =
            'author.key.organization.label
            'author.key.label
          if$
        }
      if$
    }
  if$
  'short.list :=
}

FUNCTION {calc.label}
{ calc.short.authors
  short.list

  "type=alpha" is.in.list
  {
    duplicate$
    year field.or.null purify$ #-1 #2 substring$
    *
    'label :=
    year field.or.null purify$ #-1 #4 substring$
    *
    sortify 'sort.label :=
  }
  {
    "("
    *
    year duplicate$ empty$
    short.list key field.or.null = or
      { pop$ "" }
      'skip$
    if$
    *
    'label :=
    label 'sort.label :=
  } 
  if$
}

FUNCTION {sort.format.names.nameyear}
{ remove.braces 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    {% nameptr #1 >
     %   { "   " * numnames int.to.str$ * "   " *}
     %   'skip$
     % if$
      s nameptr "{vv }{ll}" format.name$ 't :=
      nameptr numnames = 
      t "others" = 
      and
        { "et al" * }
        { t sortify * "  " *
      		#3 numnames  =
        	#2 numnames  =
        	or
        	#2 nameptr  =
          and
        	  {year empty$
        	     'skip$
        	     {year * "  " *}
        	   if$  
        	  }
        	  'skip$
          if$
        }
      if$
		#3 numnames  <
  			{#0 'namesleft :=
  				 	"zzz   " *
  			}    
	      {
	     	  nameptr #1 + 'nameptr :=
  	    	namesleft #1 - 'namesleft :=
  	    }
  	  if$  	
    }
  while$
}

FUNCTION {sort.format.names.number}
{ remove.braces 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{vv }{ll }{f }{jj}" format.name$ 't :=
    	nameptr numnames = 
      t "others" = 
      and
        { "et al" * }
        { t sortify * "  " *}
      if$
   	  	nameptr #1 + 'nameptr :=
    	namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.names.alpha}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
        { "   " * }
        'skip$
      if$
      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
      nameptr numnames = 
      t "others" = 
      and
        { "et al" * }
        { t sortify * }
      if$
  	  	nameptr #1 + 'nameptr :=
   		namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.names}{
	"type=nameyear" is.in.list
		'sort.format.names.nameyear
		{
			"type=alpha" is.in.list
				'sort.format.names.alpha
				'sort.format.names.number
			if$
		}
	if$
}

FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          "zzz"
        }
        { key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
        { key empty$
            { "to sort, need author, editor, or key in " cite$ * warning$
              "z"
            }
            { key sortify }
          if$
        }
        { editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
        { key empty$
            { "to sort, need author, organization, or key in " cite$ * warning$
              "z"
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
        { key empty$
            { "to sort, need editor, organization, or key in " cite$ * warning$
              "z"
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

FUNCTION {presort}
{ calc.label
  sort.label sortify
  "    "
  *
  type$ "book" =
  type$ "inbook" =
  or
 		{author empty$
   		'editor.organization.sort
      'author.organization.sort
     if$
    }
    { type$ "proceedings" =
      type$ "incollection" =
       or
    		{author empty$
        		'editor.organization.sort
            	'author.organization.sort
        if$
        }
        { type$ "manual" =
          type$ "misc" =
          or
            'author.organization.sort
            'author.sort
          if$
        }
      if$
    }
  if$
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  %%%% removing title from the sorting line 
  %title field.or.null sort.format.title
  %*
  #1 entry.max$ substring$ 'sort.label :=
%  sort.label top$
  sort.label *
  #1 entry.max$ substring$ 'sort.key$ :=
  
  %sort.key$ top$
}

ITERATE {presort}

FUNCTION {bib.sort.order}
{ 
  "settings" type$ =
  	{"aaa"}
  	{"sort=0" is.in.list
    	{"bb"}
    	{"type=alpha" is.in.list
    		{sort.key$}
    		{sort.label}
      	if$  
   		}
  	 if$
  	}
  	if$
  'sort.key$ :=
	%sort.key$ top$ 
}

ITERATE {bib.sort.order}

SORT


INTEGERS { longest.label.width last.extra.num number.label }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.label :=
  "" 'j :=
  #0 'longest.label.width :=
  #0 'last.extra.num :=
  #0 'number.label :=
}

FUNCTION {forward.pass}
{ last.label "l" change.case$ label "l" change.case$ =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      label 'last.label :=
    }
  if$
  number.label #1 + 'number.label :=
}

FUNCTION {reverse.pass}
{ j "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  extra.label 'j :=
  label extra.label * 'label :=
  %label top$
}

EXECUTE {initialize.longest.label}

ITERATE {forward.pass}

REVERSE {reverse.pass}


FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
    "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ newline$
	"% BibTex style file: imsart-number.bst, 2013-01-28" write$ newline$
	default.option.string "" =
		'skip$
		{ 
			"% Default style options (" default.option.string * ")." * write$ newline$
			"% Used options (" list.string * ")." * write$ newline$
		}
	if$
	
}
EXECUTE {begin.bib}

EXECUTE {init.state.consts}


ITERATE {call.type$}

FUNCTION {end.bib}
{ newline$
 "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}
ipart-layout-main.sty · 52 KB

52 KB — too long to show here. It arrives with the project.

ipart.cls · 8 KB
%%
%% This is file `ipart.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ipart.dtx  (with options: `class')
%% 
%% Copyright (C) 2020 by L. Tolen\.{e}, VTEX UAB
%% Mokslininku 2a, LT-08412 Vilnius, Lithuania
%% --------------------------------------------------------------------------
%%
%% PURPOSE: The International Press journals style class.
%% SOURCE: The initial source code was ipart.cls and imsart.sty.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ipart}
    [2025/10/14 v2.8, driver class for INTLPRESS journals]

%%  DEPENDENCIES:
%%  - article.cls
%%  - ipart-layout-bpam.sty
%%  - ipart-layout-cjjs.sty
%%  - ipart-layout-main.sty
%%  - ipart-layout-pamq.sty
%%  - ipart-layout-sii.sty
%%  - ipart-vtex.sty
%%  - ipart-vtex-bpam.sty
%%  - ipart-vtex-cjjs.sty
%%  - ipart-vtex-pamq.sty
%%  - ipart-vtex-sii.sty
%%
%%  CLASS FILE CONTENT:
%%  > OPTIONS
%%    - GENERAL
%%    - JOURNAL
%%  < OPTIONS
%%  - MAIN SETUP
%%  - VTeX SETUP
%%
%%  >>>>>>> OPTIONS >>>>>>>
%%
%%
%%  ======= GENERAL =======
%%
%%  Load natbib with correct settings
\newif\if@load@natbib@\@load@natbib@true
\DeclareOption{nonatbib}{\@load@natbib@false}
\newif\if@numbered@bibl\@numbered@bibltrue
\DeclareOption{authoryear}{\@numbered@biblfalse}

%%  When hyperref is loaded, makes a hyperlink
%%  only from year component of the cite command
\newif\if@linksfromyear\@linksfromyearfalse
\DeclareOption{linksfromyear}{\@linksfromyeartrue}

%%  Put "." after inline section headings
\newif\if@autosecdot
\DeclareOption{autosecdot}{\@autosecdottrue}
\DeclareOption{noautosecdot}{\AtBeginDocument{\@autosecdotfalse}}

\DeclareOption{seceqn}{\AtBeginDocument{\numberwithin{equation}{section}}}

%%  Spacing
\def\singlespacing{\renewcommand{\baselinestretch}{}\large\normalsize}
\def\doublespacing{\renewcommand{\baselinestretch}{1.6}\large\normalsize}
\DeclareOption{doublespacing}{\doublespacing}
\DeclareOption{singlespacing}{\singlespacing}
%%
%%  ======= JOURNAL =======
%%
\def\main@layout@id{0}
\def\pamq@layout@id{1}
\def\sii@layout@id{2}
\def\jbr@layout@id{3}
\def\bpam@layout@id{4}
\def\cjjs@layout@id{5}
\let\selected@layout\main@layout@id

\def\journal@id{}
\def\journal@name{}
\def\journal@issn{}
\def\journal@url{}
\def\ip@journal@url#1{%
    https://intlpress.com/#1%
    }
\def\@publisher{International Press, Inc.}
\def\@publisheraddress{387 Somerville Avenue, Somerville, MA 02143, U.S.A.}

\DeclareOption{joc}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-joc}%
    \def\journal@name{Journal of Combinatorics}%
    \def\journal@issn{ISSN: 2156-3527}%
    \def\journal@eissn{ISSN: 2150-959X}%
    \def\journal@url{\ip@journal@url{joc}}%
    \AtBeginDocument{%
        \def\bauthor@style{\rm}%
        }%
    }
\DeclareOption{cntp}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-cntp}%
    \def\journal@name{Communications in \break Number Theory and Physics}%
    \def\journal@issn{ISSN: 1931-4523}%
    \def\journal@eissn{ISSN: 1931-4531}%
    \def\journal@url{\ip@journal@url{cntp}}%
    \AtBeginDocument{%
        %%  Ensuring that journal title will be placed in two lines
        \AfterPackage{hyperref}{\hypersetup{breaklinks=True}}%
        \def\title@style{\bfseries}%
        \def\history@postfix{}%
        \def\revised@prefix{\\Revised~}%
        \def\accepted@prefix{\\Accepted~}%
        }%
    }
\DeclareOption{gic}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-gic}%
    \def\journal@name{Geometry, Imaging and Computing}%
    \def\journal@issn{ISSN: 2328-8876}%
    \def\journal@eissn{ISSN: 2328-8884}%
    \def\journal@url{\ip@journal@url{gic}}%
    }
\DeclareOption{mcgd}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-mcgd}%
    \def\journal@name{Mathematics, Computation and Geometry of Data}%
    \def\journal@issn{ISSN: 2642-1909}%
    \def\journal@eissn{ISSN: 2642-1917}%
    \def\journal@url{\ip@journal@url{mcgd}}%
    }
\DeclareOption{cjm}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-cjm}%
    \def\journal@name{Cambridge Journal of Mathematics}%
    \def\journal@issn{ISSN: 2168-0930}%
    \def\journal@eissn{ISSN: 2168-0949}%
    \def\journal@url{\ip@journal@url{cjm}}%
    \AtBeginDocument{%
        \def\bauthor@style{\rm}%
        \def\beditor@style{\rm}%
        }%
    \@autosecdottrue
    }
\DeclareOption{bpam}{%
    \PassOptionsToClass{11pt}{article}%
    \def\@JID{BPAM}%
    \def\journal@id{-bpam}%
    \def\journal@name{Beijing J. of Pure and Appl. Math.}%
    \def\journal@issn{ISSN: 2994-8444}%
    \def\journal@eissn{ISSN: 2994-8452}%
    \def\journal@url{\ip@journal@url{bpam}}%
    \AtBeginDocument{%
        \def\bauthor@style{\rm}%
        \def\beditor@style{\rm}%
        }%
    \@autosecdottrue
    \global\let\selected@layout\bpam@layout@id
    }
\DeclareOption{amsa}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-amsa}%
    \def\journal@name{Annals of Mathematical Sciences and Applications}%
    \def\journal@issn{ISSN: 2380-288X}%
    \def\journal@eissn{ISSN: 2380-2898}%
    \def\journal@url{\ip@journal@url{amsa}}%
    \AtBeginDocument{%
        \def\bauthor@style{\rm}%
        \def\beditor@style{\rm}%
        }%
    \@autosecdottrue
    }
\DeclareOption{cis}{%
    \PassOptionsToClass{11pt}{article}%
    \def\journal@id{-cis}%
    \def\journal@name{Communications in Information and Systems}%
    \def\journal@issn{ISSN: 1526-7555}%
    \def\journal@eissn{ISSN: 2163-4548}%
    \def\journal@url{\ip@journal@url{cis}}%
    \AtBeginDocument{%
        \def\bauthor@style{\rm}%
        \def\beditor@style{\rm}%
        }%
    }
\DeclareOption{pamq}{%
    \PassOptionsToClass{11pt}{article}%
    \def\@JID{PAMQ}%
    \def\journal@id{-pamq}%
    \def\journal@name{Pure and Applied Mathematics Quarterly}%
    \def\journal@issn{ISSN: 1558-8599}%
    \def\journal@eissn{ISSN: 1558-8602}%
    \def\journal@url{\ip@journal@url{pamq}}%
    \AtBeginDocument{%
        \def\oauthor@style{\sc}%
        }%
    \global\let\selected@layout\pamq@layout@id
    }
\DeclareOption{sii}{%
    \PassOptionsToClass{10pt,twocolumn}{article}%
    \def\journal@id{-sii}%
    \def\journal@name{Statistics and Its Interface}%
    \def\journal@issn{ISSN: 1938-7989}%
    \def\journal@eissn{ISSN: 1938-7997}%
    \def\journal@url{\ip@journal@url{sii}}%
    \AtBeginDocument{%
        \def\bauthor@style{\sc}%
        }%
    \global\let\selected@layout\sii@layout@id
    }
\DeclareOption{jbr}{%
    \PassOptionsToClass{10pt,twocolumn}{article}%
    \def\journal@id{-jbr}%
    \def\journal@name{Journal of Blockchain Research}%
    \def\journal@issn{ISSN: 2643-5748}%
    \def\journal@eissn{ISSN: 2643-5756}%
    \def\journal@url{\ip@journal@url{jbr}}%
    \AtBeginDocument{%
        \def\bauthor@style{\sc}%
        }%
    \global\let\selected@layout\jbr@layout@id
    }
\DeclareOption{cjjs}{%
    \PassOptionsToClass{11pt}{article}%
    \def\@JID{CJJS}%
    \def\journal@id{-cjjs}%
    \def\journal@name{Cambridge Journal for Junior Scientists}%
    \def\journal@issn{ISSN: 2998-1433}%
    \def\journal@eissn{ISSN: 2998-1441}%
    \def\journal@url{\ip@journal@url{cjjs}}%
    \AtBeginDocument{%
        \def\bauthor@style{\rm}%
        \def\beditor@style{\rm}%
        }%
    \@autosecdottrue
    \global\let\selected@layout\cjjs@layout@id
    }

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions*
%%
%%  <<<<<<< OPTIONS <<<<<<<
%%
%%
%%  ======= MAIN SETUP =======
%%
\PassOptionsToClass{twoside,leqno}{article}
\LoadClass{article}

%%  Load additional macros and modifications for "article.cls"
\ifcase\selected@layout  % 0 - main layout
    \RequirePackage{ipart-layout-main}
\or  % 1 - pamq layout
    \RequirePackage{ipart-layout-pamq}
\or  % 2 - sii layout
    \RequirePackage{ipart-layout-sii}
\or  % 3 - jbr layout
    \RequirePackage{ipart-layout-jbr}
\or  % 4 - bpam layout
    \RequirePackage{ipart-layout-bpam}
\or  % 5 - cjjs layout
    \RequirePackage{ipart-layout-cjjs}
\fi
%%
%%  ======= VTeX SETUP =======
%%
\AtEndOfPackage{%
    \IfFileExists{ipart-vtex\[email protected]}%
        {\RequirePackage{ipart-vtex\journal@id}}%
        {\IfFileExists{ipart-vtex.sty}{\RequirePackage{ipart-vtex}}{}}%
    \if@load@natbib@
        \@ifundefined{load@natbib}{}{\load@natbib}%
    \fi
    }

\ifdefined\HCode
  \let\noxml\@gobble
\else
  \let\noxml\@firstofone
\fi

\endinput
%%
%% End of file `ipart.cls'.

The first page, as this template compiles today. Click it to enlarge, and again to shrink. Open the file ↗