summaryrefslogtreecommitdiff
path: root/biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty')
-rw-r--r--biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty186
1 files changed, 173 insertions, 13 deletions
diff --git a/biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty b/biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty
index 462ba68f12..e84bb0f935 100644
--- a/biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty
+++ b/biblio/bibtex/contrib/iran-bibtex/iran-bibtex.sty
@@ -1,8 +1,8 @@
%%
-%% This is file “iran-bibtex.sty”, v0.3.0 (2023/12/18)
+%% This is file “iran-bibtex.sty”, v0.4.0 (2024/01/8)
%%
%% __________________________________________________
-%% Copyright (c) 2023 Farshad Rasuli
+%% Copyright (c) 2023-2024 Farshad Rasuli
%%
%% It may be distributed and/or modified under the LaTeX Project
%% Public License version 1.3c or higher. The latest version of the
@@ -26,8 +26,8 @@
% === Package structure: Identification
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{iran-bibtex}
-\def\iranbibtex@version{0.3.0}
-\def\iranbibtexdate{2023/12/18} % December 18th, 2023
+\def\iranbibtex@version{0.4.0}
+\def\iranbibtexdate{2024/01/8} % January 8th, 2024
\def\iranbibtexfirstrelease{2023/12/12} % December 12th, 2023
\edef\@iranbibtex@info{%
****************************************************^^J%
@@ -39,7 +39,7 @@
* citation guide to Persian and English information^^J%
* sources in BibTeX.^^J%
* ^^J%
-* Copyright (c) 2023 Farshad Rasuli^^J%
+* Copyright (c) 2023-2024 Farshad Rasuli^^J%
* ^^J%
****************************************************^^J%
}
@@ -53,10 +53,10 @@
% === Package structures: Options
-%% iran bibliography style: author-year style, ordered by authors' name
+%% iran bibliography style: author-year style, sorted by authors' name
\DeclareOption{iran}
{%
- \setcitestyle{authoryear,% citation mode
+ \setcitestyle{authoryear,% citation mode
round,% braces
aysep={},% between author and year
}%
@@ -65,6 +65,114 @@
+%% iran bibliography style: numbered style, sorted by authors' name
+\DeclareOption{iran-plain}
+{%
+ \setcitestyle{numbers,% citation mode
+ square,% braces
+ sort&compress, % multiple numerical citations are compressed
+ }%
+ \bibliographystyle{iran}%
+}
+
+
+
+%% iran bibliography style: author-year style, sorted by year
+\DeclareOption{iran-year}
+{%
+ \setcitestyle{authoryear,% citation mode
+ round,% braces
+ aysep={},% between author and year
+ }%
+ \bibliographystyle{iran-year}%
+}
+
+
+
+%% iran bibliography style: numbered style, sorted by year
+\DeclareOption{iran-plainyr}
+{%
+ \setcitestyle{numbers,% citation mode
+ square,% braces
+ sort&compress, % multiple numerical citations are compressed
+ }%
+ \bibliographystyle{iran-year}%
+}
+
+
+
+%% iran bibliography style: numbered style, sorted by citation order
+\DeclareOption{iran-unsrt}
+{%
+ \setcitestyle{numbers,% citation mode
+ square,% braces
+ sort&compress, % multiple numerical citations are compressed
+ }%
+ \bibliographystyle{iran-unsrt}%
+}
+
+
+
+%% iran bibliography style for English/Latin document: author-year style, sorted by authors' name
+\DeclareOption{iranlatin}
+{%
+ \setcitestyle{authoryear,% citation mode
+ round,% braces
+ aysep={},% between author and year
+ }%
+ \bibliographystyle{iranlatin}%
+}
+
+
+
+%% iran bibliography style for English/Latin document: numbered style, sorted by authors' name
+\DeclareOption{iranlatin-plain}
+{%
+ \setcitestyle{numbers,% citation mode
+ square,% braces
+ sort&compress, % multiple numerical citations are compressed
+ }%
+ \bibliographystyle{iranlatin}%
+}
+
+
+
+%% iran bibliography style for English/Latin document: author-year style, sorted by year
+\DeclareOption{iranlatin-year}
+{%
+ \setcitestyle{authoryear,% citation mode
+ round,% braces
+ aysep={},% between author and year
+ }%
+ \bibliographystyle{iranlatin-year}%
+}
+
+
+
+%% iran bibliography style for English/Latin document: numbered style, sorted by year
+\DeclareOption{iranlatin-plainyr}
+{%
+ \setcitestyle{numbers,% citation mode
+ square,% braces
+ sort&compress, % multiple numerical citations are compressed
+ }%
+ \bibliographystyle{iranlatin-year}%
+}
+
+
+
+%% iran bibliography style for English/Latin document: numbered style, sorted by citation order
+\DeclareOption{iranlatin-unsrt}
+{%
+ \setcitestyle{numbers,% citation mode
+ square,% braces
+ sort&compress, % multiple numerical citations are compressed
+ }%
+ \bibliographystyle{iranlatin-unsrt}%
+}
+
+
+
\ProcessOptions\relax
@@ -83,20 +191,72 @@
-%% renew \cite command to behave like \citep in the netbib package
-\renewcommand{\cite}%
- {\begingroup\NAT@swatrue\def\NAT@ctype{0}\NAT@partrue
- \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
+% renew \cite command to behave like \citep in the natbib package
+\renewcommand{\cite}{%
+\begingroup\NAT@swatrue\def\NAT@ctype{0}\NAT@partrue
+\@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}%
+ }
-% === Package structure: Extra label appended to year for one author in same year
+% === Package structure: Modifying the extra label that is appended to the year for one author in the same year
+% Modify extra label of Latin items ----------------------------------
\providecommand{\extrayearlabelen}[1]{#1}
-\providecommand{\extrayearlabelfa}[1]{#1}
+
+
+% Set the equivalent Persian character for the English character -----
+
+% Implemeted by Bahman Mirzakhani (github.com/bahman-mirzakhani).
+% Inspired from tex.stackexchange.com/questions/64131/implementing-switch-cases
+
+\newcommand\addcase[3]{\expandafter\def\csname\string#1@case@#2\endcsname{#3}}
+\newcommand\makeswitch[2][]{%
+ \newcommand#2[1]{%
+ \ifcsname\string#2@case@##1\endcsname\csname\string#2@case@##1\endcsname\else#1\fi%
+ }%
+}
+\makeswitch[#1]\changealph
+\addcase\changealph{a}{الف}
+\addcase\changealph{b}{ب}
+\addcase\changealph{c}{پ}
+\addcase\changealph{d}{ت}
+\addcase\changealph{e}{ث}
+\addcase\changealph{f}{ج}
+\addcase\changealph{g}{چ}
+\addcase\changealph{h}{ح}
+\addcase\changealph{i}{خ}
+\addcase\changealph{j}{د}
+\addcase\changealph{k}{ذ}
+\addcase\changealph{l}{ر}
+\addcase\changealph{m}{ز}
+\addcase\changealph{n}{ژ}
+\addcase\changealph{o}{س}
+\addcase\changealph{p}{ش}
+\addcase\changealph{q}{ص}
+\addcase\changealph{r}{ض}
+\addcase\changealph{s}{ط}
+\addcase\changealph{t}{ظ}
+\addcase\changealph{u}{ع}
+\addcase\changealph{v}{غ}
+\addcase\changealph{w}{ف}
+\addcase\changealph{x}{ق}
+\addcase\changealph{y}{ک}
+\addcase\changealph{z}{گ}
+\addcase\changealph{aa}{ل}
+\addcase\changealph{ab}{م}
+\addcase\changealph{ac}{ن}
+\addcase\changealph{ad}{و}
+\addcase\changealph{ae}{ه‍}
+\addcase\changealph{af}{ی}
+
+
+
+% Modify extra label of Persian items --------------------------------
+\providecommand{\extrayearlabelfa}[1]{\changealph{#1}}