% ----------------------------------------------------------------------------
% ua-jecon.sty
%
% A wrapper package for ua-jecon.bst (an extended version of jecon.bst)
%
% Author:  Ryoya Ando
% URL:     https://ryoya9826.github.io/
%
% Copyright (C) 2021-2026 Ryoya Ando
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%   https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This work has the LPPL maintenance status `maintained'.
% The Current Maintainer of this work is Ryoya Ando.
%
% This work consists of the files ua-jecon.sty, ua-jecon.bst,
% ua-jecon-doc.tex, ua-jecon-example.bib and README.md.
%
% Description:
% This package provides a simple way to use ua-jecon.bst.
% ua-jecon.bst is a derived work of jecon.bst (v6.2.1) created by Shiro Takeda.
% It automatically loads the required `natbib` package, sets the bibliography
% style to `ua-jecon`, and defines the `\acite` command to output amsrefs-like
% compressed labels generated by ua-jecon.bst.
%
% Usage:
% \usepackage{ua-jecon}
% \acite{key}         -> [Label]
% \acite{key}*{note}  -> [Label, note]
% ----------------------------------------------------------------------------

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ua-jecon}[2026/11/16 v0.7.1 Wrapper package for ua-jecon.bst]

% 必須パッケージの読み込み
\RequirePackage{natbib}

% \acite{key} / \acite{key}*{note}
% ua-jecon.bst が .aux に書き出した \m@syu@ams@<key> を参照して圧縮ラベルを出力する
\newcommand{\acite}[1]{%
  \nocite{#1}%
  \gdef\m@syu@cite@temp{#1}%
  \@ifstar\m@syu@cite@\m@syu@cite
}
% ラベル本体を出力する（未定義なら ?? を出して警告する）
\def\m@syu@cite@label{%
  \@ifundefined{m@syu@ams@\m@syu@cite@temp}%
    {\textbf{??}%
     \PackageWarning{ua-jecon}{Compressed label for `\m@syu@cite@temp'
       undefined.\MessageBreak Run (up)BibTeX and LaTeX again}}%
    {\csname m@syu@ams@\m@syu@cite@temp\endcsname}%
}
\def\m@syu@cite@#1{[\m@syu@cite@label, #1]}
\def\m@syu@cite{[\m@syu@cite@label]}

% デフォルトのスタイルとして ua-jecon を指定
\bibliographystyle{ua-jecon}

\endinput
