Skip to main content
All modules

TemplateJournalsmathstatistics

IMS Journals (imsart)

Institute of Mathematical Statistics manuscript for the Annals of Statistics, Annals of Probability, Bernoulli, Statistical Science and the other IMS journals. One class option picks the journal.

LPPL 1.0+ (stated in the files; the vtex-soft repo also carries an MIT LICENSE)

Loading PDF preview…

What’s inside

  • Starter files
  • main.tex6.1 KB
    %% IMS journal submission (imsart). Pick the journal with the class option:
    %%   aos  Annals of Statistics        aap  Annals of Applied Probability
    %%   aop  Annals of Probability       aoas Annals of Applied Statistics
    %%   ejs  Electronic J. of Statistics sts  Statistical Science
    %%   bj   Bernoulli                   ba   Bayesian Analysis
    %% aoas, sts, ba and bj require author-year citations: switch natbib to
    %% [authoryear] and the bibliography style to imsart-nameyear.
    \documentclass[aos]{imsart}
    
    \RequirePackage{amsthm,amsmath,amsfonts,amssymb}
    \RequirePackage[numbers]{natbib}
    \RequirePackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}
    \RequirePackage{graphicx}
    \usepackage{booktabs}
    \usepackage{tikz}
    \usetikzlibrary{arrows.meta}
    
    \startlocaldefs
    \numberwithin{equation}{section}
    
    \theoremstyle{plain}
    \newtheorem{theorem}{Theorem}[section]
    \newtheorem{lemma}[theorem]{Lemma}
    \newtheorem{proposition}[theorem]{Proposition}
    \newtheorem{corollary}[theorem]{Corollary}
    
    \theoremstyle{definition}
    \newtheorem{definition}[theorem]{Definition}
    \newtheorem{assumption}[theorem]{Assumption}
    \newtheorem{remark}[theorem]{Remark}
    
    \newcommand{\E}{\mathbb{E}}
    \newcommand{\Prob}{\mathbb{P}}
    \newcommand{\R}{\mathbb{R}}
    \DeclareMathOperator{\Var}{Var}
    \endlocaldefs
    
    \begin{document}
    
    \begin{frontmatter}
    \title{Minimax Rates for Estimation under a Smoothness Constraint}
    \runtitle{Minimax rates under smoothness}
    
    \begin{aug}
    \author[A]{\fnms{First}~\snm{Author}\ead[label=e1]{first@university.edu}}
    \author[B]{\fnms{Second}~\snm{Author}\ead[label=e2]{second@institute.org}}
    
    \address[A]{Department of Statistics, University Name\printead[presep={,\ }]{e1}}
    \address[B]{Institute Name\printead[presep={,\ }]{e2}}
    \end{aug}
    
    \begin{abstract}
    We study estimation of a regression function from noisy observations when
    the target lies in a H\"older class. We establish a lower bound on the
    minimax risk and show that a kernel estimator with a data-driven bandwidth
    attains it up to constants. Simulations confirm the predicted rate.
    \end{abstract}
    
    \begin{keyword}[class=MSC]
    \kwdgroup[type=primary]{\kwd{62G08}}
    \kwdgroup[type=secondary]{\kwd{62G20}}
    \end{keyword}
    
    \begin{keyword}
    \kwd{nonparametric regression}
    \kwd{minimax risk}
    \kwd{H\"older class}
    \end{keyword}
    \end{frontmatter}
    
    \section{Introduction}\label{sec:intro}
    
    Let $(X_i, Y_i)$, $i = 1, \dots, n$, be independent pairs with
    $Y_i = f(X_i) + \xi_i$, where $f \colon [0,1] \to \R$ is unknown and the
    noise $\xi_i$ is centred with $\Var(\xi_i) = \sigma^2$. The goal is to
    estimate $f$ from the sample and to quantify the best achievable risk over a
    smoothness class; see \cite{tsybakov2009introduction} for background and
    \cite{wasserman2006all} for a broader survey.
    
    \section{Setting}\label{sec:setting}
    
    \begin{definition}[H\"older class]\label{def:holder}
    For $\beta > 0$ and $L > 0$, let $\Sigma(\beta, L)$ denote the set of
    functions $f \colon [0,1] \to \R$ that are $\lfloor \beta \rfloor$ times
    differentiable and satisfy
    $|f^{(\lfloor \beta \rfloor)}(x) - f^{(\lfloor \beta \rfloor)}(y)|
     \le L\, |x - y|^{\beta - \lfloor \beta \rfloor}$ for all $x, y \in [0,1]$.
    \end{definition}
    
    \begin{assumption}\label{ass:noise}
    The noise variables are i.i.d.\ with $\E \xi_1 = 0$ and
    $\E \exp(t \xi_1) \le \exp(t^2 \sigma^2 / 2)$ for all $t \in \R$.
    \end{assumption}
    
    \section{Main results}\label{sec:main}
    
    \begin{theorem}[Lower bound]\label{thm:lower}
    Under Assumption~\ref{ass:noise}, there is a constant $c > 0$ depending only
    on $(\beta, L, \sigma)$ such that
    \begin{equation}\label{eq:lower}
      \inf_{\hat f_n} \sup_{f \in \Sigma(\beta, L)}
      \E \| \hat f_n - f \|_2^2 \;\ge\; c\, n^{-2\beta / (2\beta + 1)},
    \end{equation}
    where the infimum ranges over all measurable estimators $\hat f_n$.
    \end{theorem}
    
    \begin{proof}[Proof sketch]
    Construct $M \asymp n^{1/(2\beta+1)}$ hypotheses $f_0, \dots, f_M$ in
    $\Sigma(\beta, L)$ that are pairwise $2s$-separated in $L_2$ with
    $s \asymp n^{-\beta/(2\beta+1)}$ while keeping the Kullback--Leibler
    divergence between any pair of induced distributions below $\alpha \log M$
    for a small $\alpha > 0$. Fano's inequality then gives \eqref{eq:lower}.
    Full details are in Appendix~\ref{app:proofs}.
    \end{proof}
    
    \begin{theorem}[Upper bound]\label{thm:upper}
    Let $\hat f_n$ be the Nadaraya--Watson estimator with a kernel of order
    $\lfloor \beta \rfloor$ and bandwidth $h_n \asymp n^{-1/(2\beta+1)}$. Then
    $\sup_{f \in \Sigma(\beta, L)} \E \| \hat f_n - f \|_2^2
     \le C\, n^{-2\beta/(2\beta+1)}$ for a constant $C$ depending only on
    $(\beta, L, \sigma)$ and the kernel.
    \end{theorem}
    
    \begin{remark}
    Theorems~\ref{thm:lower} and~\ref{thm:upper} together identify
    $n^{-2\beta/(2\beta+1)}$ as the minimax rate over $\Sigma(\beta, L)$.
    \end{remark}
    
    \section{Simulations}\label{sec:sim}
    
    Figure~\ref{fig:rate} plots the empirical risk of the estimator of
    Theorem~\ref{thm:upper} against $n$ on a log-log scale; the slope matches
    the predicted exponent. Table~\ref{tab:risk} reports the same quantities.
    
    \begin{figure}[t]
    \centering
    \begin{tikzpicture}[x=1.1cm,y=1.1cm]
      \draw[->] (0,0) -- (5.2,0) node[right] {$\log n$};
      \draw[->] (0,0) -- (0,3.4) node[above] {$\log \text{risk}$};
      \draw[thick] (0.4,3.0) -- (4.8,0.6) node[right] {slope $-\tfrac{2\beta}{2\beta+1}$};
      \foreach \x/\y in {0.6/2.85,1.5/2.45,2.4/1.85,3.3/1.45,4.2/0.95}
        \fill (\x,\y) circle (1.6pt);
    \end{tikzpicture}
    \caption{Empirical risk (dots) against sample size with the minimax rate
    (line) for $\beta = 2$.}
    \label{fig:rate}
    \end{figure}
    
    \begin{table}[t]
    \caption{Monte Carlo risk over 200 replications, $\beta = 2$, $\sigma = 1$.}
    \label{tab:risk}
    \centering
    \begin{tabular}{@{}rccc@{}}
    \toprule
    $n$ & Risk & Std.\ error & Rate $n^{-4/5}$ \\
    \midrule
     250 & 0.117 & 0.004 & 0.121 \\
    1000 & 0.040 & 0.001 & 0.040 \\
    4000 & 0.013 & 0.001 & 0.013 \\
    \bottomrule
    \end{tabular}
    \end{table}
    
    \begin{appendix}
    \section{Proofs}\label{app:proofs}
    Complete proofs of Theorems~\ref{thm:lower} and~\ref{thm:upper}.
    \end{appendix}
    
    \begin{acks}[Acknowledgments]
    The authors thank the editor and referees for helpful comments.
    \end{acks}
    
    \begin{funding}
    The first author was supported by Grant XXXX.
    \end{funding}
    
    \bibliographystyle{imsart-number}
    \bibliography{references}
    
    \end{document}
    
  • Libraries and docs
  • imsart-nameyear.bst38 KBVendored from github.com on 2026-08-19.
    %% 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, lstonys@vtex.lt 
    %%
    %% 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
            insert.comma
      	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
            insert.comma
      	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, 2017-11-03" 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.bst38 KBVendored from github.com on 2026-08-19.
    %% 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, lstonys@vtex.lt 
    %%
    %% 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
            insert.comma
      	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
            insert.comma 
      	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, 2017-11-03" 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.cls5.0 KBVendored from github.com on 2026-08-19.
    %% This is file `imsart.cls'
    %%
    %% LaTeX 2e class file for the processing of LaTeX2e files
    %% of the following IMS/BS journals:
    %%
    %%   The Annals of Probability
    %%   The Annals of Applied Probability
    %%   The Annals of Statistics
    %%   The Annals of Applied Statistics
    %%   Statistical Science
    %%   Probability Surveys
    %%   Statistics Surveys
    %%   Electronic Journal of Statistics
    %%   Bernoulli
    %%   Annales de l'Institut Henri Poincar\'e - Probabilit\'es et Statistiques
    %%   Brazilian Journal of Probability and Statistics
    %%   Bayesian Analysis
    %%
    %%   Institute of Mathematical Statistics, U.S.A.
    %%   Bernoulli Society
    %%   Institut Henry Poincare
    %%   Brazilian Statistical Association
    %%   International Society for Bayesian Analysis
    %%   
    %% Macros written by Vytas Statulevicius, VTeX, Lithuania
    %% Maintained by Deimantas Galcius, VTeX, Lithuania
    %% for Institute of Mathematical Statistics, U.S.A.
    %% Please submit bugs or your comments to latex-support@vtex.lt
    %%
    %% The original distribution is located at:
    %% http://www.e-publications.org/ims/support
    %%
    %% This class file loads standard "article.cls" with appropriate 
    %% settings and then style file "imsart.sty" with additional macros
    %%
    %% 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.
    %%
    %% \CharacterTable
    %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
    %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
    %%   Digits        \0\1\2\3\4\5\6\7\8\9
    %%   Exclamation   \!     Double quote  \"     Hash (number) \#
    %%   Dollar        \$     Percent       \%     Ampersand     \&
    %%   Acute accent  \'     Left paren    \(     Right paren   \)
    %%   Asterisk      \*     Plus          \+     Comma         \,
    %%   Minus         \-     Point         \.     Solidus       \/
    %%   Colon         \:     Semicolon     \;     Less than     \<
    %%   Equals        \=     Greater than  \>     Question mark \?
    %%   Commercial at \@     Left bracket  \[     Backslash     \\
    %%   Right bracket \]     Circumflex    \^     Underscore    \_
    %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
    %%   Right brace   \}     Tilde         \~}
    %%
    %%
    %% Bug fixes and changes: at end of file
    % 
    % TeX programming: Vytas Statulevicius, VTeX, Lithuania.
    % TeX programming: Deimantas Galcius, VTeX, Lithuania.
    % TeX programming: Edgaras Sakuras, VTeX, Lithuania.
    % Requires Latex2e, ver.2000.06
    % 
    \NeedsTeXFormat{LaTeX2e}
    \ProvidesClass{imsart}[2025/03/18 driver class for package imsart.sty]
    % 
    % set various options for different journals:
    \DeclareOption{ps}{%
        \PassOptionsToClass{10pt,twoside}{article}%
        }
    % 
    \DeclareOption{ss}{%
        \PassOptionsToClass{10pt,twoside}{article}%
        }
    % 
    \DeclareOption{ejs}{%
        \PassOptionsToClass{10pt,twoside}{article}%
        }
    \DeclareOption{ejsv2}{%
        \PassOptionsToPackage{nosetpagesize}{graphicx}%
        \PassOptionsToPackage{setpagesize=false}{hyperref}%
        \PassOptionsToClass{10pt,twoside}{article}%
        }
    % 
    \DeclareOption{aap}{%
        \PassOptionsToClass{11pt,oneside,leqno}{article}%
        \PassOptionsToPackage{leqno}{amsmath}%
        }
    % 
    \DeclareOption{aop}{%
        \PassOptionsToClass{11pt,oneside,leqno}{article}%
        \PassOptionsToPackage{leqno}{amsmath}%
        }
    % 
    \DeclareOption{aos}{%
        \PassOptionsToClass{11pt,oneside,leqno}{article}%
        \PassOptionsToPackage{leqno}{amsmath}%
        }
    % 
    \DeclareOption{aoas}{%
        \PassOptionsToClass{11pt,oneside,leqno}{article}%
        \PassOptionsToPackage{leqno}{amsmath}%
        }
    % 
    \DeclareOption{sts}{%
        \PassOptionsToClass{11pt,oneside,leqno}{article}%
        \PassOptionsToPackage{leqno}{amsmath}%
        }
    % 
    \DeclareOption{bj}{%
        \PassOptionsToClass{10pt,oneside}{article}%
        \g@addto@macro\@classoptionslist{,nosetpagesize}%
        }
    % 
    \DeclareOption{aihp}{%
        \PassOptionsToClass{10pt,oneside,leqno}{article}%
        \PassOptionsToPackage{leqno}{amsmath}%
        \PassOptionsToPackage{numbers,sort&compress}{natbib}%
        }
    % 
    \DeclareOption{bjps}{%
        \PassOptionsToClass{11pt,twoside}{article}%
        }
    % 
    \DeclareOption{ba}{%
        \PassOptionsToClass{10pt,oneside}{article}%
        }
    % 
    \PassOptionsToPackage{cmex10}{amsmath}
    % 
    \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
    \ProcessOptions*
    % 
    \LoadClass{article}
    % 
    \IfFileExists{imsart.sty}%
        {}%
        {%
            \ClassError{imsart}%
                {The complimentary style file "imsart.sty" is required}%
                {%
                    The complimentary style file "imsart.sty" is required\MessageBreak
                    You need to install file "imsart.sty" in your system\MessageBreak
                    File could be downloaded from http://www.e-publications.org/ims/support
                }%
        }
    % 
    % Load additional macros and modifications for "article.cls"
    \RequirePackage{imsart}
    % 
    \endinput
    %%
    %% End of file `imsart.cls'.
    
  • imsart.sty166 KBVendored from github.com on 2026-08-19.
    % This is file `imsart.sty'
    %%
    %% LaTeX 2e style file for the processing of LaTeX2e files
    %% of the following IMS/BS journals:
    %%
    %% - The Annals of Probability
    %% - The Annals of Applied Probability
    %% - The Annals of Statistics
    %% - The Annals of Applied Statistics
    %% - Statistical Science
    %% - Probability Surveys
    %% - Statistics Surveys
    %% - Electronic Journal of Statistics
    %% - Bernoulli
    %% - Annales de l'Institut Henri Poincar\'e - Probabilit\'es et Statistiques
    %% - Brazilian Journal of Probability and Statistics
    %% - Bayesian Analysis
    %%
    %% - Institute of Mathematical Statistics, U.S.A.
    %% - Bernoulli Society
    %% - Institut Henry Poincare
    %% - Brazilian Statistical Association
    %% - International Society for Bayesian Analysis
    %%
    %% Macros written by Vytas Statulevicius, VTeX, Lithuania
    %% Maintained by TeX group members, VTeX, Lithuania
    %% for Institute of Mathematical Statistics, U.S.A.
    %% Please submit bugs or your comments to latex-support@vtex.lt
    %%
    %% The original distribution is located at:
    %% https://www.e-publications.org/ims/support
    %%
    %% This style file contains additional macros and is designed to use
    %% with standard "article.cls"
    %%
    %% 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.
    %%
    %% \CharacterTable
    %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
    %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
    %%   Digits        \0\1\2\3\4\5\6\7\8\9
    %%   Exclamation   \!     Double quote  \"     Hash (number) \#
    %%   Dollar        \$     Percent       \%     Ampersand     \&
    %%   Acute accent  \'     Left paren    \(     Right paren   \)
    %%   Asterisk      \*     Plus          \+     Comma         \,
    %%   Minus         \-     Point         \.     Solidus       \/
    %%   Colon         \:     Semicolon     \;     Less than     \<
    %%   Equals        \=     Greater than  \>     Question mark \?
    %%   Commercial at \@     Left bracket  \[     Backslash     \\
    %%   Right bracket \]     Circumflex    \^     Underscore    \_
    %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
    %%   Right brace   \}     Tilde         \~}
    %%
    %% Bug fixes and changes: at end of file
    %
    % TeX programming: Vytas Statulevicius, VTeX, Lithuania.
    % TeX programming: Deimantas Galcius, VTeX, Lithuania.
    % TeX programming: Edgaras Sakuras, VTeX, Lithuania.
    % Requires Latex2e, ver.2000.06
    %
    \def\imsfmt@name{imsart}
    \def\imsfmt@version{2026/05/15}
    %
    \ProvidesFile{imsart.sty}[\imsfmt@version\space IMS article style]
    %
    \RequirePackage{etoolbox}
    %
    % hyperref must be loaded after:
    \@ifpackageloaded{hyperref}%
        {\@latex@error{Package 'hyperref' must be loaded after 'imsart'!}\@ehc}%
        {}
    %
    % Passoptions to hyperref:
    \ifdefined\loadhyperrefoptions
    \else
        \def\loadhyperrefoptions{%
            \PassOptionsToPackage{colorlinks,citecolor=blue,urlcolor=blue,%
                linkcolor=blue,linktocpage=true}{hyperref}%
            }
    \fi
    %
    \loadhyperrefoptions
    %
    % General options:
    %
    % prints out \bid{doi={}}
    \newif\if@print@bid@doi \@print@bid@doifalse
    \DeclareOption{printbiddoi}{\global\@print@bid@doitrue}
    %
    % Put keywords as footnote
    \newif\if@keywordsasfootnote
    \DeclareOption{keywordsasfootnote}{\@keywordsasfootnotetrue}
    %
    % Put history as footnote
    \newif\if@historyasfootnote
    \DeclareOption{historyasfootnote}{\@historyasfootnotetrue}
    %
    % Put address as footnote
    \newif\if@addressasfootnote
    \DeclareOption{addressasfootnote}{\@addressasfootnotetrue}
    %
    % Put addresses at end of document
    \newif\if@addressatend
    \DeclareOption{addressatend}{\@addressatendtrue}
    %
    % Put "." after inline section headings:
    \newif\if@autosecdot
    \DeclareOption{autosecdot}{\@autosecdottrue}
    \DeclareOption{noautosecdot}{\AtBeginDocument{\@autosecdotfalse}}
    %
    % do not print thanksref undefined marks
    \newif\if@noundefthanksref
    \DeclareOption{noundefthanksref}{\@noundefthanksreftrue}
    %
    \newif\if@front@back \@front@backfalse
    \DeclareOption{frontback}{\global\@front@backtrue}
    %
    % Load amsmath style with correct settings:
    \newif\if@load@amsmath
    \DeclareOption{amsmath}{\@load@amsmathtrue}
    %
    % Load amsthm style with correct settings:
    \newif\if@load@amsthm
    \DeclareOption{amsthm}{\@load@amsthmtrue}
    %
    % Resets equation number in each section
    \newif\if@imsart@seceqn
    \DeclareOption{seceqn}{\@imsart@seceqntrue}
    %
    % Load amsmath with leqno option
    \newif\if@amsmath@leqno
    %
    % Load natbib with correct settings:
    \newif\if@load@natbib
    \DeclareOption{natbib}{\@load@natbibtrue}
    %
    % When hyperref is loaded, makes a hyperlink only from year component of the cite command:
    \newif\if@linksfromyear\@linksfromyearfalse
    \DeclareOption{linksfromyear}{\@linksfromyeartrue}
    %
    \newif\if@imsart@numbers
    \newif\if@imsart@authoryear
    \newif\if@imsart@nameyear
    \DeclareOption{numbers}{%
        \@imsart@numberstrue
        \PassOptionsToPackage{numbers}{natbib}%
        }
    \DeclareOption{nameyear}{%
        \PassOptionsToPackage{authoryear}{natbib}%
        \@imsart@nameyeartrue
        \@imsart@authoryeartrue
        }
    \DeclareOption{authoryear}{%
        \PassOptionsToPackage{authoryear}{natbib}%
        \@imsart@nameyeartrue
        \@imsart@authoryeartrue
        }
    %
    \newif\if@ims@rotating
    \DeclareOption{rotating}{\@ims@rotatingtrue}
    %
    % enable writing to .aux
    \newif\if@supertoc \@supertocfalse
    \newif\if@changetoc \@changetocfalse
    %
    % for new thanksref syntax
    \newif\if@updated@thanksref \@updated@thanksreffalse
    %
    % error message if xr or xr-hyper packages are loaded
    \newif\if@load@xr@or@xr@hyper \@load@xr@or@xr@hyperfalse
    %
    % Information about journals
    %
    \def\set@generic{\def\@tempa{-generic}}
    \AtEndOfPackage{\set@generic}
    %
    \DeclareOption{ba}{%
        \def\journal@id{-ba}%
        \def\journal@name{Bayesian Analysis}%
        \def\journal@issn@print{1936-0975}%
        \def\journal@issn@electronic{1931-6690}%
        \def\journal@url{https://bayesian.org/resources/bayesian-analysis/}%
        \@balayouttrue
        \@noundefthanksreftrue
        \@updated@thanksreftrue
        \@addressasfootnotetrue
        }
    %
    \DeclareOption{ps}{%
        \def\journal@id{-ps}%
        \def\journal@name{Probability Surveys }%
        \def\journal@issn{ISSN: 1549-5787}%
        \def\journal@url{https://imstat.org/journals-and-publications/probability-surveys/}%
        \@ejs@ps@ss@layouttrue
        \@print@bid@doitrue
        \@imsart@showframetrue
        }
    %
    % Information about journals
    \DeclareOption{ss}{%
        \def\journal@id{-ss}%
        \def\journal@name{Statistics Surveys }%
        \def\journal@issn{ISSN: 1935-7516}%
        \def\journal@url{https://imstat.org/journals-and-publications/statistics-surveys/}%
        \@ejs@ps@ss@layouttrue
        \@print@bid@doitrue
        \@imsart@showframetrue
        }
    %
    % Information about journals
    \DeclareOption{ejs}{%
        \def\journal@id{-ejs}%
        \def\journal@name{Electronic Journal of Statistics }%
        \def\journal@issn{ISSN: 1935-7524}%
        \def\journal@url{https://imstat.org/journals-and-publications/electronic-journal-of-statistics/}%
        \@ejs@ps@ss@layouttrue
        \@print@bid@doitrue
        \@imsart@showframetrue
        }
    \newif\if@ejsvtwo@layout \@ejsvtwo@layoutfalse
    \DeclareOption{ejsv2}{%
        \def\journal@id{-ejs}%
        \def\journal@name{Electronic Journal of Statistics }%
        \def\journal@issn{ISSN: 1935-7524}%
        \def\journal@url{https://imstat.org/journals-and-publications/electronic-journal-of-statistics/}%
        \@ejs@ps@ss@layouttrue
        \@print@bid@doitrue
        \@imsart@showframetrue
        \@ejsvtwo@layouttrue
        }
    %
    % Options for the IMS journals:
    %
    \DeclareOption{aap}{%
        \def\journal@id{-aap}%
        \def\journal@name{Submitted to the Annals of Applied Probability }%
        \def\journal@url{https://imstat.org/journals-and-publications/annals-of-applied-probability/}%
        \set@page@layout{405bp}{646bp}%
        \@twosidetrue
        \input{leqno.clo}% formula numbers at left
        \@amsmath@leqnotrue
        \@historyasfootnotetrue
        \@keywordsasfootnotetrue
        \@imslayouttrue
        \@autosecdottrue
        \@print@bid@doitrue
        \@updated@thanksreftrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        }
    %
    \DeclareOption{aop}{%
        \def\journal@id{-aop}%
        \def\journal@name{Submitted to the Annals of Probability }%
        \def\journal@url{https://imstat.org/journals-and-publications/annals-of-probability/}%
        \set@page@layout{405bp}{646bp}%
        \@twosidetrue
        \input{leqno.clo}% formula numbers at left
        \@amsmath@leqnotrue
        \@historyasfootnotetrue
        \@keywordsasfootnotetrue
        \@imslayouttrue
        \@autosecdottrue
        \@print@bid@doitrue
        \@updated@thanksreftrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        }
    %
    \DeclareOption{aos}{%
        \def\journal@id{-aos}%
        \def\journal@name{Submitted to the Annals of Statistics }%
        \def\journal@url{https://imstat.org/journals-and-publications/annals-of-statistics/}%
        \set@page@layout{405bp}{646bp}%
        \@twosidetrue
        \input{leqno.clo}% formula numbers at left
        \@amsmath@leqnotrue
        \@historyasfootnotetrue
        \@keywordsasfootnotetrue
        \@imslayouttrue
        \@autosecdottrue
        \@print@bid@doitrue
        \@updated@thanksreftrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        }
    %
    \DeclareOption{aoas}{%
        \def\journal@id{-aoas}%
        \def\journal@name{Submitted to the Annals of Applied Statistics }%
        \def\journal@url{https://imstat.org/journals-and-publications/annals-of-applied-statistics/}%
        \set@page@layout{405bp}{646bp}%
        \@twosidetrue
        \input{leqno.clo}% formula numbers at left
        \@amsmath@leqnotrue
        \@historyasfootnotetrue
        \@keywordsasfootnotetrue
        \@imslayouttrue
        \@autosecdottrue
        \@print@bid@doitrue
        \@updated@thanksreftrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        \AtBeginDocument{%
            \@ifpackagewith{natbib}{numbers}{%
                \@latex@error{Only author-year citations are allowed!
                    Please use the option 'authoryear' of 'natbib' package}{}%
                }{}%
            }%
        }
    %
    \DeclareOption{sts}{%
        \def\journal@id{-sts}%
        \def\journal@name{Submitted to Statistical Science }%
        \def\journal@url{https://imstat.org/journals-and-publications/statistical-science/}%
        \set@page@layout{408.62625pt}{702.75pt}% twocol wd - 10pc
        \@twosidetrue
        \input{leqno.clo}% formula numbers at left
        \@amsmath@leqnotrue
        \@stslayouttrue
        \@autosecdottrue
        \@twocolumntrue
        \@print@bid@doitrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        \AtEndPreamble{\if@twocolumn\set@page@layout{528.62625pt}{702.75pt}\fi}%
        }
    %
    \DeclareOption{bj}{%
        \def\journal@id{-bj}%
        \def\journal@name{Submitted to Bernoulli }%
        \def\journal@url{https://www.bernoullisociety.org/index.php/publications/bernoulli-journal/bernoulli-journal}%
        \def\journal@issn{1350-7265}%
        \set@page@layout{34pc}{574pt}%
        \@twosidetrue
        \@bjlayouttrue
        \@autosecdottrue
        \@updated@thanksreftrue
        \@print@bid@doitrue
        \@load@amsthmtrue
        \@load@amsmathtrue
        \@load@natbibtrue
        \@imsart@showframetrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        }
    %
    \DeclareOption{aihp}{%
        \def\journal@id{-aihp}%
        \def\journal@name{Submitted to the Annales de l'Institut Henri Poincar\'e - 
            Probabilit\'es et Statistiques}%
        \def\journal@url{https://imstat.org/journals-and-publications/annales-de-linstitut-henri-poincare/}%
        \set@page@layout{169.475mm}{56pc}%
        \@twosidetrue
        \input{leqno.clo}% formula numbers at left
        \@amsmath@leqnotrue
        \@aihplayouttrue
        \@autosecdottrue
        \@updated@thanksreftrue
        \@print@bid@doitrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        \AtBeginDocument{%
            \@ifpackagewith{natbib}{authoryear}{%
                \@latex@error{Only numerical citations are allowed!
                    Please use the option 'numbers' of 'natbib' package}{}%
                }{}%
            }%
        }
    %
    \DeclareOption{bjps}{%
        \def\journal@id{-bjps}%
        \def\journal@name{Submitted to the Brazilian Journal of Probability and Statistics}%
        \def\journal@url{https://imstat.org/journals-and-publications/brazilian-journal-of-probability-and-statistics/}%
        \set@page@layout{405pt}{646pt}%
        \@twosidetrue
        \@historyasfootnotetrue
        \@keywordsasfootnotetrue
        \@bjpslayouttrue
        \@autosecdottrue
        \@updated@thanksreftrue
        \@print@bid@doitrue
        \@load@amsthmtrue
        \@load@xr@or@xr@hypertrue
        \@author@sep@by@numbertrue
        \AtBeginDocument{%
            \@ifpackagewith{natbib}{numbers}{%
                \@latex@error{Only author-year citations are allowed!
                    Please use the option 'authoryear' of 'natbib' package}{}%
                }{}%
            }%
        }
    %
    %% Layouts:
    % IMS journals AAP, AOP, AOS layout:
    \newif\if@imslayout \@imslayoutfalse
    %
    % IMS STS journal layout:
    \newif\if@stslayout \@stslayoutfalse
    %
    % EJS, PS, SS journals layout:
    \newif\if@ejs@ps@ss@layout \@ejs@ps@ss@layoutfalse
    %
    % BA journal layout:
    \newif\if@balayout \@balayoutfalse
    %
    % BS BJ journal layout:
    \newif\if@bjlayout \@bjlayoutfalse
    %
    % AIHP journal layout:
    \newif\if@aihplayout \@aihplayoutfalse
    %
    % BJPS journal layout:
    \newif\if@bjpslayout \@bjpslayoutfalse
    %
    % Spacing
    \DeclareOption{doublespacing}{\doublespacing}
    \DeclareOption{singlespacing}{\singlespacing}
    %
    \def\singlespacing{\renewcommand{\baselinestretch}{}\large\normalsize}
    \def\doublespacing{\renewcommand{\baselinestretch}{1.6}\large\normalsize}
    %
    % Do not print id line at bottom of the page:
    \DeclareOption{noinfoline}{\AtBeginDocument{\let\info@line\@empty}}
    \DeclareOption{infoline}{\AtBeginDocument{\let\info@line\infoline@text}}
    %
    % Put lines numbers in margins
    \newif\ifnumberlines@ \numberlines@false
    \DeclareOption{linenumbers}{\numberlines@true}
    \DeclareOption{nolinenumbers}{\numberlines@false}
    %
    % Put frame on page layout
    \newif\if@imsart@showframe \@imsart@showframefalse
    \DeclareOption{showframe}{\@imsart@showframetrue}
    \DeclareOption{noshowframe}{\@imsart@showframefalse}
    %
    % twoside (to catch direct use)
    \newif\if@imsart@twoside \@imsart@twosidefalse
    \DeclareOption{twoside}{\global\@imsart@twosidetrue}
    %
    % Combined options:
    %
    % Use this option for submission for pier review:
    \DeclareOption{submission}{%
        \singlespacing
        \AtBeginDocument{\let\info@line\infoline@text}%
        \numberlines@false
        }
    %
    % use this option for pre-edition
    \DeclareOption{preedit}{%
        \doublespacing
        \AtBeginDocument{%
            \let\info@line\@empty
            \set@preedit@page@layout
            }%
        \numberlines@false
        }
    %
    % for preprint or supplement articles - removes journal info
    \newif\if@imsart@preprint \@imsart@preprintfalse
    \ifcsundef{imsart@preprint@settings}%
        {%
            \def\imsart@preprint@settings{%
                \global\@imsart@preprinttrue
                \let\info@line\@empty
                \numberlines@false
                }%
        }%
        {}
    \DeclareOption{preprint}{%
        \imsart@preprint@settings
        }
    %
    \newif\if@author@sep@by@number \@author@sep@by@numberfalse
    %
    % Initiate some info:
    \def\journal@name{}
    \def\journal@url{}
    \def\journal@issn{}
    \def\journal@id{-generic}
    \def\paper@url{}
    \def\info@line{}
    \def\copyrightowner@text{}
    \def\msc@url{https://mathscinet.ams.org/mathscinet/msc/msc2020.html}
    %
    % set@page@layout
    %
    % \set@page@layout{\textwidth}{\textheight}
    \def\set@page@layout#1#2{%
        \setlength\textwidth{#1}%
        \@settopoint\textwidth
        \setlength\textheight{#2}%
        \@settopoint\textheight
        %
        % make side margins equal:
        \setlength\@tempdima{\paperwidth}%
        \addtolength\@tempdima{-\textwidth}%
        \setlength\oddsidemargin{.5\@tempdima}%
        \addtolength\oddsidemargin{-1in}%
        \setlength\evensidemargin{\oddsidemargin}%
        \@settopoint\oddsidemargin
        \@settopoint\evensidemargin
        %
        % topmargin
        \setlength\topmargin{\paperheight}%
        \addtolength\topmargin{-2in}%
        \addtolength\topmargin{-\headheight}%
        \addtolength\topmargin{-\headsep}%
        \addtolength\topmargin{-\textheight}%
        \addtolength\topmargin{-\footskip}% this might be wrong!
        \addtolength\topmargin{-.5\topmargin}%
        \@settopoint\topmargin
        %
        % check if tw and th aren't altered
        \xdef\imsart@check@textwidth{\the\textwidth}%
        \xdef\imsart@check@textheight{\the\textheight}%
        \AtEndDocument{%
            \@ifundefined{do@not@check@textbox@alter}%
                {%
                    \ifdim\textwidth=\imsart@check@textwidth
                    \else
                        \PackageError{imsart}{\string\textwidth\space cannot be altered}\@ehc
                    \fi
                    \ifdim\textheight=\imsart@check@textheight
                    \else
                        \PackageError{imsart}{\string\textheight\space cannot be altered}\@ehc
                    \fi
                }%
                {}%
            }%
        }
    %
    \def\set@preedit@page@layout{%
        \setlength\paperwidth{\textwidth}%
        \addtolength\paperwidth{2in}%
        \setlength\oddsidemargin{0in}%
        \let\evensidemargin\oddsidemargin
        \setlength\paperheight{\textheight}%
        \addtolength\paperheight{2in}%
        \addtolength\paperheight{\headheight}%
        \addtolength\paperheight{\headsep}%
        \setlength\topmargin{0in}%
        }
    %
    % Load imsart.cnf with additional options:
    \@input{\imsfmt@name.cnf}
    %
    % Execute options
    \ExecuteOptions{}
    \ProcessOptions
    %
    \csname imsart@fileinfo\endcsname
    \ifdefined\jobstart@date@info
    \else
        \edef\jobstart@date@info{\the\year\two@digits{\the\month}\two@digits{\the\day}}
    \fi
    %
    \if@bjlayout
        \if@imsart@nameyear
        \else
            \PassOptionsToPackage{sort&compress}{natbib}%
        \fi
    \fi
    %
    % dimensions
    %
    \setlength\parindent{12\p@}
    \setlength\headsep{14\p@}
    \setlength\footskip{14\p@}
    \if@aihplayout
        \setlength\footskip{24\p@}
    \fi
    \if@bjlayout
        \setlength\parindent{10\p@}
        \setlength\footskip{24\p@}
    \fi
    %
    \setlength\smallskipamount{6\p@ \@plus 1\p@ \@minus 1\p@}
    \setlength\medskipamount{12\p@ \@plus 3\p@ \@minus 3\p@}
    \setlength\bigskipamount{18\p@ \@plus 3\p@ \@minus 3\p@}
    %
    \if@imsart@twoside
    \else
        \if@ejs@ps@ss@layout
            % it's twoside but centered
            \advance\evensidemargin by \oddsidemargin
            \divide\evensidemargin by \tw@
            \oddsidemargin=\evensidemargin
            \marginparwidth=65\p@% as in article with oneside
        \fi
    \fi
    %
    % setpkgattr, getpkgattr, do@option@list
    %
    \def\sep@key@value#1=#2/?/#3{\setpkgattr{#3}{#1}{#2}}
    \def\do@option@list#1#2{%
        \@for\curr@option:={#2}\do{%
            \expandafter\sep@key@value\curr@option/?/{#1}\relax
            }%
        }
    \def\pkgattr@namedef{\long\gdef}
    \def\pkgattr@namedef@def#1{\expandafter\pkgattr@namedef\csname #1\endcsname}
    \protected\def\setpkgattr{\@ifnextchar[{\@setpkgattr}{\@@setpkgattr}}
    \protected\def\getpkgattr#1#2{\csname #1@#2\endcsname}
    \long\def\@setpkgattr[#1]#2#3#4{%
        \pkgattr@namedef@def{#2@#3}{#4}%
        }
    \long\def\@@setpkgattr#1#2#3{%
        \pkgattr@namedef@def{#1@#2}{#3}%
        }
    %
    % newpseudoenvironment
    % same as \newenvironment, but new environment do not have additional groups \bgroup \egroup
    % (i.e. all definitions are not local
    %
    \let\org@begin\begin
    \let\org@end\end
    \def\begin#1{%
        \@ifundefined{pseudo@#1}%
            {\org@begin{#1}}%
            {\csname pseudo@#1\endcsname[0]\relax}%
        }
    \def\end#1{%
        \@ifundefined{pseudo@#1}%
            {\org@end{#1}}%
            {\csname pseudo@#1\endcsname[1]\relax}%
        }
    \def\newpseudoenvironment#1#2#3{%
        \expandafter\gdef\csname pseudo@#1\endcsname[##1]{%
            \relax
            \ifcase##1\relax\def\@@next@@{#2}\or\def\@@next@@{#3}\else\let\@@next@@\relax\fi
            \@@next@@
            }%
        }
    %
    % pubyear, volume, paperno
    %
    \def\pubyear#1{\gdef\@pubyear{(#1) }\gdef\@copyrightyear{#1 }}
    \def\@pubyear{}
    \def\@copyrightyear{}
    %
    \def\volumetitle#1{\gdef\volume@title{#1 }}
    %
    \def\volume#1{\gdef\@volume{Vol. #1 }}
    \gdef\@volume{}
    %
    \def\issue#1{\gdef\@issue{No. #1 }}
    \gdef\@issue{}
    %
    \def\paperno#1{\gdef\@paperno{Paper no. #1 }}
    \gdef\@paperno{00}
    %
    % firstpage, lastpage, pagerange
    %
    \newcounter{firstpage}
    \newcounter{lastpage}
    %
    \def\firstpage#1{%
        \def\@tempa{#1}%
        \ifx\@tempa\@empty
        \else
            \gdef\@firstpage{#1}%
            \global\c@firstpage=#1%
            \global\c@lastpage=#1%
            \global\c@page=#1 \ignorespaces\fi
        }
    %
    \def\lastpage#1{%
        \def\@tempa{#1}%
        \ifx\@tempa\@empty
        \else
            \gdef\@lastpage{#1}%
            \global\c@lastpage=#1%
            \ignorespaces
        \fi
        }
    %
    \def\pagerange@sep{--}
    %
    \def\set@pagerange{%
        \ifnum\c@firstpage=0%
        \else
            \ifnum\c@firstpage=\c@lastpage
                \gdef\@pagerange{\thefirstpage}%
            \else
                \gdef\@pagerange{\thefirstpage\pagerange@sep\thelastpage}%
            \fi
        \fi
        }
    %
    \def\@pagerange{}
    %
    \def\pagenumbering#1{%
        \gdef\thefirstpage{\csname @#1\endcsname\c@firstpage}%
        \gdef\thelastpage{\csname @#1\endcsname\c@lastpage}%
        \gdef\thepage{\csname @#1\endcsname\c@page}%
        }
    %
    % hyperref redefines \pagenumbering, so we must override hyperref definition:
    \let\ims@pagenumbering\pagenumbering
    %
    % check last page
    \newbool{checklpage}
    \def\check@last@page{%
        \ifbool{checklpage}%
            {%
                \ifnum0\number\c@lastpage>0\relax
                    \ifnum0\number\c@lastpage=\c@page
                    \else
                        \special{mt:error Wrong lastpage!}%
                        \@latex@error{Wrong lastpage: set to \number\c@lastpage, 
                            should be \the\c@page!}\@ehc
                    \fi
                \fi
            }%
            {}%
        }
    \AtEndDocument{\check@last@page}
    %
    % startlocaldefs, endlocaldefs
    %
    \def\startlocaldefs{\makeatletter}
    \def\endlocaldefs{\makeatother}
    %
    % thanksref, thanksmark, thankslabel, thankstext
    % to be safe with hyperref we will use original LaTeX definitions:
    %
    \def\saferef#1{\expandafter\safe@setref\csname r@#1\endcsname\@firstoftwo{#1}}
    \let\safe@setref\@setref
    %
    \def\safelabel#1{%
        \@bsphack
        \protected@write\@auxout{}%
            {\string\thanksnewlabel{#1}{{\@currentlabel}{\thepage}}}%
        \@esphack
        }
    %
    \long\def\safe@footnotetext#1{\insert\footins{%
        \reset@font\footnotesize
        \interlinepenalty\interfootnotelinepenalty
        \splittopskip\footnotesep
        \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
        \hsize\columnwidth \@parboxrestore
        \color@begingroup
            \def\@thefnmark{}%
            \@makefntext{%
                \rule\z@\footnotesep\ignorespaces #1\@finalstrut\strutbox}%
        \color@endgroup
        }}%
    %
    \long\def\orig@footnotetext#1{\insert\footins{%
        \reset@font\footnotesize
        \interlinepenalty\interfootnotelinepenalty
        \splittopskip\footnotesep
        \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
        \hsize\columnwidth \@parboxrestore
        \protected@edef\@currentlabel{%
            \csname p@footnote\endcsname\@thefnmark
        }%
        \color@begingroup
            \@makefntext{\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
        \color@endgroup
        }}%
    %
    \let\thanksnewlabel\newlabel
    %
    % we want to use various counters:
    \def\usethankscounter#1{%
        \@ifundefined{current@thankscounter}%
            {\gdef\previous@thankscounter{#1}}%
            {\xdef\previous@thankscounter{\current@thankscounter}}%
        \def\current@thankscounter{#1}%
        }
    %
    \def\restorethankscounter{\xdef\current@thankscounter{\previous@thankscounter}}
    %
    \newcounter{thanks}
    \def\thethanks{\@fnsymbol\c@thanks}
    \usethankscounter{thanks}
    %
    % address ref:
    \newcounter{addressref}
    \def\theaddressref{\arabic{addressref}}
    %
    \def\thanksmark@fmt#1{\@textsuperscript{\normalfont#1}}
    \def\thanksref@sep{,}
    %
    % hooks for the hyperref:
    \def\thankref@hyperlink#1{\saferef{#1thanks}}
    \def\thanks@hypertarget#1{}
    %
    % printing the marks
    \DeclareRobustCommand{\thanksref}{%
        \@ifnextchar[{\@tempswatrue\@thanksref}{\@tempswafalse\@thanksref[]}%
        }
    \let\orig@thanksref\thanksref
    %
    \def\@thanksref[#1]#2{%
        \if@tempswa% []
            \thanksmark@fmt{#1}%
        \else
            \let\@tempa\@empty
            \thanksmark@fmt{\@for\@tempb:=#2\do{%
                \csname thanksref@hook\endcsname
                \@tempa
                \let\@tempa\thanksref@sep
                \edef\@tempb{\expandafter\@firstofone\@tempb\@empty}%
                \thankref@hyperlink{\@tempb}%
                }}%
        \fi
        }
    %
    % form and print mark
    \def\thanksmark{\@ifnextchar[{\@tempswatrue\@thanksmark}{\@tempswafalse\@thanksmark[]}}
    %
    \def\@thanksmark[#1]#2{%
        \@thankslabel[#1]{#2}%
        \thanksmark@fmt{\expandafter\saferef{#2thanks}\thanks@hypertarget{#2}}%
        }
    %
    % form only mark
    \def\thankslabel{\@ifnextchar[{\@tempswatrue\@thankslabel}{\@tempswafalse\@thankslabel[]}}
    %
    \def\@thankslabel[#1]#2{%
        \if@tempswa% []
            \protected@edef\@currentlabel{#1}%
        \else
            \refstepcounter{\current@thankscounter}%
        \fi
        \@ifundefined{temp@label@#2thanks}%
            {\global\@namedef{temp@label@#2thanks}{}\safelabel{#2thanks}}%
            {}%
        }
    %
    % form a mark and place text in \@thanks:
    \def\thankstext{\@ifnextchar[{\@tempswatrue\@thankstext}{\@tempswafalse\@thankstext[]}}
    %
    \def\@thankstext[#1]#2#3{%
        \@thankslabel[#1]{#2}%
        \protected@xdef\@thanks{\@thanks\protect\thanks@thefnmark{#2thanks}%
        \protect\orig@footnotetext{\thanks@hypertarget{#2}#3}}%
        }
    %
    \def\thanks@thefnmark#1{\begingroup\unrestored@protected@xdef\@thefnmark{\saferef{#1}}\endgroup}
    %
    % ST macro for creation customized enumeration system
    \def\setvaluelist#1#2{%
        \@tempcnta=0\relax
        \@for\@curr@val:=#2\do{%
            \advance\@tempcnta by 1\relax
            \expandafter\protected@xdef\csname #1@item@\the\@tempcnta\endcsname{\@curr@val}%
            }%
        \expandafter\protected@xdef\csname #1@item@0\endcsname{\the\@tempcnta}%
        }
    \xdef\getitemvalue#1#2{\noexpand\csname #1@item@#2\endcsname}
    %
    % \ead, \printead
    %
    \RequirePackage{keyval}
    %
    \def\email@text{e-mail: }
    \def\url@text{url: }
    \def\fullurl@text{url: }
    \def\ead@sep{;~}
    \let\ead@size\relax
    \def\printead@fmt#1{#1}
    %
    \newcounter{emailref}
    \setvaluelist{emailmarks}{*,**,\textdagger,\textdaggerdbl}
    \def\theemailref{\getitemvalue{emailmarks}{\the\c@emailref}}
    \define@key{ead}{mark}[true]{%
        \usethankscounter{emailref}%
        \thankslabel{\ead@label}%
        }
    %
    \RequirePackage{ifpdf}
    \def\orcid@base{https://orcid.org/}
    \def\orcid@special@pdf#1{\special{pdf: #1}}
    \def\orcid@pic@pdf{%
        \hbox to 9bp{%
            \vrule width \z@ height 9bp%
            \orcid@special@pdf{% 
                q 1 0 0 -1 0 9 cm q 0.65098 0.807843 0.223529 rg 9 4.5 m 9 
                6.984 6.984 9 4.5 9 c 2.016 9 0 6.984 0 4.5 c 0 2.016 2.016 
                0 4.5 0 c 6.984 0 9 2.016 9 4.5 c h 9 4.5 m f 1 1 1 rg 2.492 
                2.781 0.543 3.766 re f 3.828 2.781 m 5.289 2.781 l 6.684 
                2.781 7.297 3.777 7.297 4.664 c 7.297 5.633 6.539 6.551 
                5.297 6.551 c 3.828 6.551 l h 4.371 6.062 m 5.23 6.062 l 
                6.457 6.062 6.738 5.129 6.738 4.664 c 6.738 3.91 6.258 3.27 
                5.203 3.27 c 4.371 3.27 l h 4.371 6.062 m f 3.117 1.996 m 
                3.117 2.191 2.961 2.352 2.762 2.352 c 2.566 2.352 2.41 2.191 
                2.41 1.996 c 2.41 1.801 2.566 1.641 2.762 1.641 c 2.961 
                1.641 3.117 1.805 3.117 1.996 c h 3.117 1.996 m f Q Q
                }\hss
            }%
        }
    \def\orcid@pic@ps{%
        \hbox to 9bp{%
            \vrule width \z@ height 9bp%
            \special{" gsave 0 0 9 9 rectclip
                1 0 0 -1 0 9 6 array astore concat gsave 0.65098 0.807843 0.223529 setrgbcolor
                9 4.5 moveto 9 6.984 6.984 9 4.5 9 curveto 2.016 9 0 6.984 0 4.5 curveto 
                0 2.016 2.016 0 4.5 0 curveto 6.984 0 9 2.016 9 4.5 curveto closepath
                9 4.5 moveto fill 1 setgray 2.492 2.781 0.543 3.766 exch dup neg 3 1 roll 5 3 roll 
                moveto 0 rlineto 0 exch rlineto 0 rlineto closepath fill
                3.828 2.781 moveto 5.289 2.781 lineto 6.684 2.781 7.297 3.777 7.297 4.664 curveto 
                7.297 5.633 6.539 6.551 5.297 6.551 curveto 3.828 6.551 lineto closepath
                4.371 6.062 moveto 5.23 6.062 lineto 6.457 6.062 6.738 5.129 6.738 4.664 curveto 
                6.738 3.91 6.258 3.27 5.203 3.27 curveto 4.371 3.27 lineto closepath
                4.371 6.062 moveto fill 3.117 1.996 moveto 3.117 2.191 2.961 2.352 2.762 2.352 curveto 
                2.566 2.352 2.41 2.191 2.41 1.996 curveto 2.41 1.801 2.566 1.641 2.762 1.641 curveto 
                2.961 1.641 3.117 1.805 3.117 1.996 curveto closepath
                3.117 1.996 moveto fill grestore grestore
                }\hss
            }%
        }
    \ifpdf
        \let\orcid@pic\orcid@pic@pdf
    \else
        \ifdefined\XeTeXversion
            \def\orcid@special@pdf#1{\special{pdf:literal #1}}
            \let\orcid@pic\orcid@pic@pdf
        \else
            \let\orcid@pic\orcid@pic@ps
        \fi
    \fi
    \def\orcid#1{%
        \ifcsundef{author@\the\c@author @orcid}%
            {\csxdef{author@\the\c@author @orcid}{#1}}%
            {%
                \PackageError{imsart}{author \the\c@author\space contains more than one orcid}\@ehc
            }%
        }
    \def\printorcid{%
        \ifcsundef{author@\the\c@author @orcid}%
            {}%
            {%
                \raisebox{-1.3\p@}[\z@][\z@]{{%
                    \def\null{}%
                    \ims@href
                        {\orcid@base\csname author@\the\c@author @orcid\endcsname}%
                        {\orcid@pic}%
                    }}%
            }%
        }
    \if@updated@thanksref
        \setvaluelist{emailmarks}{*,\textdagger,\textdaggerdbl,%
            \textsection,\textparagraph,||,**,\textdagger\textdagger,%
            \textdaggerdbl\textdaggerdbl
            }
        \define@key{ead}{mark}[true]{%
            \csxdef{ead@\ead@label @mark}{\the\c@author}%
            \ifcsundef{author@\the\c@author @ead@marks}%
                {\csxdef{author@\the\c@author @ead@marks}{\ead@label}}%
                {\csxappto{author@\the\c@author @ead@marks}{,\ead@label}}%
            }
        \if@balayout
        \else
            \def\theemailref{\@alph{\the\c@emailref}}
            \define@key{ead}{mark}[true]{}
            \def\ead@type@email@posthook{%
                \csxdef{ead@\ead@label @mark}{\the\c@author}%
                \ifcsundef{author@\the\c@author @ead@marks}%
                    {\csxdef{author@\the\c@author @ead@marks}{\ead@label}}%
                    {\csxappto{author@\the\c@author @ead@marks}{,\ead@label}}%
                }
            \let\ead@type@url@posthook\ead@type@email@posthook
            \let\ead@type@fullurl@posthook\ead@type@email@posthook
        \fi
    \fi
    %
    % we are using keyval package
    \define@key{ead}{email}[true]{\def\ead@type{email}}
    \define@key{ead}{url}[true]{\def\@tempa{fullurl}\ifx\ead@type\@tempa\else\def\ead@type{url}\fi}
    \define@key{ead}{label}{\def\ead@label{#1}}
    %
    \define@key{ead}{text}{%
        \bgroup
            \def\\{\string\break}%
            \def\break{\string\break}%
            \protected@edef\@currentlabel{#1}%
            \safelabel{\ead@label @\ead@type text}%
        \egroup
        }
    %
    \define@key{ead}{nopdflink}[true]{%
        \protected@edef\@currentlabel{nolink}%
        \safelabel{\ead@label @nopdflink}%
        }
    %
    \DeclareRobustCommand\ead[2][label= ,email]{{%
        \def\ead@type{email}% default
        \checkead@prefix#2://\end
        \def\texttildelow{\noexpand\texttildelow}%
        \def~{\string~}%
        \setkeys{ead}{#1}%
        \protected@edef\@currentlabel{#2}%
        \safelabel{\ead@label @\ead@type}%
        \csuse{ead@type@\ead@type @posthook}%
        }}
    %
    \def\checkead@prefix#1://#2\end{\ifx.#2.\else\def\ead@type{fullurl}\fi}
    %
    \newif\ifnot@ead@star
    \newif\if@printead@opt
    %
    \def\printead@presep{}
    \def\printead@text{}
    \define@key{printead}{text}{\def\printead@text{#1}}
    \define@key{printead}{presep}{\def\printead@presep{#1}}
    %
    \DeclareRobustCommand{\printead}{%
        \@ifstar{\not@ead@starfalse\@printead}{\not@ead@startrue\@printead}%
        }
    %
    \def\@printead{%
        \@ifnextchar[{\@printead@opttrue\@@printead}{\@printead@optfalse\@@printead[]}%
        }
    %
    \def\@@printead[#1]#2{{%
        \if@printead@opt%[]
            \setkeys{printead}{#1}%
            \printead@presep
            \ifx\printead@text\@empty
                \@printead@optfalse
            \else
                \def\safe@href@text{\printead@text}%
                \not@ead@starfalse
            \fi
        \fi
        \let\prev@ead@text\relax
        \let\@ead@sep\relax
        \let\ead@text\relax
        \let\ead@prefix\relax
        \def\ead@type{}%
        \@tempcnta=0%
        \let\sv@ims@href\ims@href
        \printead@fmt{%
            \@for\ead@ref:=#2\do{%
                \advance\@tempcnta by 1%
                \let\ims@href\sv@ims@href
                \@ead@sep\let\@ead@sep\ead@sep
                \@ifundefined{r@\ead@ref @nopdflink}%
                    {}%
                    {\def\ims@href##1##2{##2}}%
                \@ifundefined{r@\ead@ref @email}%
                    {}%
                    {\let\ead@text\email@text\def\ead@type{email}\def\ead@prefix{mailto:}}%
                \@ifundefined{r@\ead@ref @url}%
                    {}%
                    {\let\ead@text\url@text\def\ead@type{url}\def\ead@prefix{http://}}%
                \@ifundefined{r@\ead@ref @fullurl}%
                    {}%
                    {\let\ead@text\fullurl@text\def\ead@type{fullurl}\def\ead@prefix{}}%
                \ifx\prev@ead@text\ead@text
                    \let\ead@text\relax
                \fi
                \csname printead@hook\endcsname
                \if@printead@opt
                    \ifnum\@tempcnta>1%
                        \@latex@error{Command \@backslashchar printead[]{e1} could 
                            have only one parameter "e1"!}\@eha
                    \fi
                \else
                    \@ifundefined{r@\ead@ref @\ead@type text}%
                        {%
                            \def\ims@href@text{%
                                \@ifundefined{r@\ead@ref thanks}%
                                    {}%
                                    {\thanksref{\ead@ref}}%
                                \saferef{\ead@ref @\ead@type}%
                                }%
                        }%
                        {%
                            \def\ims@href@text{%
                                \@ifundefined{r@\ead@ref thanks}%
                                    {}%
                                    {\thanksref{\ead@ref}}%
                                \saferef{\ead@ref @\ead@type text}%
                                }%
                        }%
                \fi
                \bgroup
                    \def\null{}%
                    \@ifundefined{ead@\ead@ref @mark}%
                        {}%
                        {%
                            \usethankscounter{emailref}%
                            \thanksmark{\ead@ref}%
                            \restorethankscounter
                            \cslet{r@\ead@ref thanks}\relax
                        }%
                    \ifnot@ead@star
                        \ead@text
                    \fi
                    \ead@size
                    \ifcsundef{r@\ead@ref @\ead@type}%
                        {\ims@href@text}%
                        {%
                            \ims@href{\ead@prefix\saferef{\ead@ref @\ead@type}}{\csuse{ead@\ead@type @fmt}{\ims@href@text}}%
                        }%
                \egroup
                \@ifundefined{ead@text}%
                    {}%
                    {\let\prev@ead@text\ead@text}%
                }%
            }%
        }}
    %
    % \copyrightowner, \corref
    \def\copyrightowner#1{\def\copyrightowner@text{#1}}
    %
    % for corresponding author
    \def\corref#1{}
    %
    % normaltext, nohyphen, today
    %
    % normal text (justify)
    \def\normaltext{%
        \let\\=\@normalcr
        \leftskip=\z@
        \@rightskip=\z@
        \rightskip=\@rightskip
        \parfillskip=\@flushglue
        }
    %
    % to switch off hyphenation
    \def\nohyphen{%
        \pretolerance=\@M
        \tolerance=\@M
        \hyphenpenalty=\@M
        \exhyphenpenalty=\@M
        }
    %
    % \@ifemptyhbox
    \def\@ifnonempty#1{%
        \setbox\@tempboxa\hbox{\ignorespaces #1}%
        \ifdim\wd\@tempboxa>1pt #1\fi
        }
    %
    \@ifundefined{check@head@line@length}%
        {\let\check@head@line@length\@gobbletwo}%
        {}
    % pagestyle{imsheadings} \thispagestyle{copyright}
    \if@twoside
    %
        \def\ps@imsheadings{%
            \def\@oddfoot{\hfill\info@line}%
            \let\@evenfoot\@oddfoot
            \def\check@head@line@length@even{%
                \runninghead@size {\pagenumber@size 000\quad}%
                \evenhead@fmt{\leftmark}{\pagenumber@size\quad 000}%
                }%
            \def\@evenhead{%
                \runninghead@size
                \rlap{\pagenumber@size\thepage}\evenhead@fmt{\leftmark}%
                \check@head@line@length{\check@head@line@length@even}{author}%
                }%
            \def\check@head@line@length@odd{%
                \runninghead@size{\pagenumber@size 000\quad}%
                \oddhead@fmt{\rightmark}{\pagenumber@size\quad 000}%
                }%
            \def\@oddhead{%
                \runninghead@size
                \oddhead@fmt{\rightmark}\llap{\pagenumber@size\thepage}%
                \check@head@line@length{\check@head@line@length@odd}{title}%
                }%
            }
    \else
        \def\ps@imsheadings{%
            \def\@oddfoot{\hfill\info@line}%
            \let\@evenfoot\@oddfoot
            \def\@evenhead{%
                \runninghead@size\hfill\leftmark/\rightmark\hfill
                \llap{\pagenumber@size\thepage}%
                }%
            \def\@oddhead{%
                \runninghead@size\hfill\leftmark/\rightmark\hfill
                \llap{\pagenumber@size\thepage}%
                }%
            }
    \fi
    %
    \def\ps@copyright{%
        \let\@mkboth\@gobbletwo
        \def\@evenhead{\parbox[t]{\textwidth}{\copyright@size\copyright@text}}%
        \let\@oddhead\@evenhead
        \def\@oddfoot{\hfill\pagenumber@size\thepage\hfill\llap{\info@line}}%
        \let\@evenfoot\@oddfoot
        }
    %
    \def\evenhead@fmt#1{\hfill#1\hfill}
    \def\oddhead@fmt#1{\hfill#1\hfill}
    %
    % url@fmt
    %
    \def\journalurl#1{\def\journal@url{#1}}
    \def\paperurl#1{\def\paper@url{#1}}
    %
    % DOI
    %
    \def\doi#1{%
        \gdef\@doi{#1}%
        \gdef\doi@text{\url@fmt{DOI: }{\ttfamily}{#1}{\doi@base\@doi}}%
        }
    %
    \let\@doi\relax
    %
    \def\doi@base{https://doi.org/}
    \@onlypreamble\doi
    %
    \protected\def\relateddoi{\@ifnextchar[{\@tempswatrue\@relateddoi}{\@tempswafalse\@relateddoi[]}}
    \def\@relateddoi[#1]#2#3{\protect\ims@href{\doi@base#3}{#3}}
    %
    \protected\def\relateddois{%
        \@ifnextchar[{\@tempswatrue\@relateddois}{\@tempswafalse\@relateddois[]}%
        }
    \def\@relateddois[#1]#2#3{%
        \@thankslabel[#1]{#2}%
        \bgroup
            \protected@xdef\@thanks{\@thanks\protect\thanks@thefnmark{#2thanks}%
            \protect\@footnotetext{\thanks@hypertarget{#2}#3}}%
        \egroup
        }
    %
    % arXiv
    %
    \def\arxiv#1{%
        \gdef\@arxiv{#1}%
        \thankstext[]{fm@arXiv}{\protect\url@fmt{arXiv: }{}{#1}{\arxiv@base\@arxiv}}%
        }%
    %
    \let\@arxiv\relax
    \@onlypreamble\arxiv
    %
    % https://arxiv.org/abs/math.PR/0603300
    \def\arxiv@base{https://arxiv.org/abs/}
    %
    % {url}{text}
    \def\ims@href#1#2{#2}
    \def\ims@nolinkurl#1{#1}
    %
    % {prefix}{font}{text}{url}
    \def\url@fmt#1#2#3#4{%
        \edef\@tempa{#3}%
        \ifx\@tempa\@empty
        \else
            #1{#2\ims@href{#4}{#3}}%
        \fi
        }
    %
    % LIST ENVIRONMENTS
    %
    \parsep=\z@
    \topsep=\smallskipamount
    \partopsep=\z@
    \itemsep=\z@
    \labelsep=.5em
    %
    \def\@listI{%
        \leftmargin=\leftmargini
        \parsep=\z@
        \topsep=\smallskipamount
        \itemsep=\z@
        }
    %
    \def\list@parindent{1pc}
    %
    % quotation
    \let\quotation@size\footnotesize
    \def\quotation@itemindent{\list@parindent}
    \def\quotation@parindent{\list@parindent}
    \def\quotation@leftmargin{\list@parindent}
    \let\quotation@rightmargin\z@
    \let\quotation@topsep\smallskipamount
    %
    \def\quotation{%
        \list{}{%
            \quotation@size
            \listparindent=\quotation@parindent
            \itemindent=\quotation@itemindent
            \rightmargin=\quotation@rightmargin
            \leftmargin=\quotation@leftmargin
            \partopsep=\z@
            \topsep=\quotation@topsep
            \parsep=\z@
            \csname quotation@hook\endcsname
            }%
            \item[\Q@strut]\relax
        }
    \def\endquotation{\endlist}
    %
    \def\Q@strut{\leavevmode\hbox{\vrule height9pt depth1pt width0pt}}
    %
    % quote
    \let\quote@size\footnotesize
    \def\quote@indent{\z@}
    \def\quote@leftmargin{2pc}
    \def\quote@rightmargin{2pc}
    \let\quote@topsep\smallskipamount
    %
    \def\quote{%
        \list{}{%
            \quote@size
            \listparindent=\quote@indent
            \itemindent=\listparindent
            \rightmargin=\quote@rightmargin
            \leftmargin=\quote@leftmargin
            \part
  • references.bib651 B
    @book{tsybakov2009introduction,
      author    = {Tsybakov, Alexandre B.},
      title     = {Introduction to Nonparametric Estimation},
      publisher = {Springer},
      address   = {New York},
      year      = {2009}
    }
    
    @book{wasserman2006all,
      author    = {Wasserman, Larry},
      title     = {All of Nonparametric Statistics},
      publisher = {Springer},
      address   = {New York},
      year      = {2006}
    }
    
    @article{stone1982optimal,
      author  = {Stone, Charles J.},
      title   = {Optimal global rates of convergence for nonparametric regression},
      journal = {The Annals of Statistics},
      volume  = {10},
      number  = {4},
      pages   = {1040--1053},
      year    = {1982}
    }
    
  • main.pdfprebuilt · 156 KBReplaced by the first recompile.

    Binary file, seeded as-is.

  • main.synctex.gzprebuilt · 16 KBReplaced by the first recompile.

    Binary file, seeded as-is.