summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-05-06 20:16:36 +0000
committerKarl Berry <karl@freefriends.org>2024-05-06 20:16:36 +0000
commit9b88fd9088e899622f3e89bf922e64c9f0d1751d (patch)
tree2bc81b8db0358995089eb8d23457fbc11c9851cf /Master/texmf-dist/tex/latex
parentfcf1e0fa22fa90e8da88239b678a366591dabe23 (diff)
iran-bibtex (6may24)
git-svn-id: svn://tug.org/texlive/trunk@71187 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty194
1 files changed, 88 insertions, 106 deletions
diff --git a/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty b/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty
index e84bb0f9357..1cc11bf54d3 100644
--- a/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty
+++ b/Master/texmf-dist/tex/latex/iran-bibtex/iran-bibtex.sty
@@ -1,5 +1,5 @@
%%
-%% This is file “iran-bibtex.sty”, v0.4.0 (2024/01/8)
+%% This is file “iran-bibtex.sty”, v0.4.1 (2024-05-06)
%%
%% __________________________________________________
%% Copyright (c) 2023-2024 Farshad Rasuli
@@ -26,28 +26,30 @@
% === Package structure: Identification
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{iran-bibtex}
-\def\iranbibtex@version{0.4.0}
-\def\iranbibtexdate{2024/01/8} % January 8th, 2024
-\def\iranbibtexfirstrelease{2023/12/12} % December 12th, 2023
+ [2024-05-06 v0.4.1 Iran Manual of Style (1st edn, 2016)]
+
+\def\iranbibtex@version{0.4.1}
+\def\iranbibtexdate{2024-05-06} % May 6th, 2024
+\def\iranbibtexfirstrelease{2023-12-12} % December 12th, 2023
\edef\@iranbibtex@info{%
-****************************************************^^J%
-* ^^J%
-* iran-bibtex package^^J%
-* ^^J%
-* Description: This package is an implementation of^^J%
-* the Iran Manual of Style (1st edition, 2016)^^J%
-* citation guide to Persian and English information^^J%
-* sources in BibTeX.^^J%
-* ^^J%
-* Copyright (c) 2023-2024 Farshad Rasuli^^J%
-* ^^J%
-****************************************************^^J%
+***************************************************************%
+* *%
+* iran-bibtex package v\iranbibtex@version\ (\iranbibtexdate) *%
+* *%
+* Description: This package is an implementation of *%
+* the Iran Manual of Style (1st edition, 2016) *%
+* citation guide to Persian and English information *%
+* sources in BibTeX. *%
+* *%
+* Copyright (c) 2023-2024 Farshad Rasuli *%
+* *%
+***************************************************************%
}
% === Package structure: Preliminary declarations
-\RequirePackage{natbib}
+
@@ -56,10 +58,7 @@
%% iran bibliography style: author-year style, sorted by authors' name
\DeclareOption{iran}
{%
- \setcitestyle{authoryear,% citation mode
- round,% braces
- aysep={},% between author and year
- }%
+ \PassOptionsToPackage{authoryear,round,sort&compress}{natbib}%
\bibliographystyle{iran}%
}
@@ -68,10 +67,7 @@
%% 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
- }%
+ \PassOptionsToPackage{numbers,square,sort&compress}{natbib}%
\bibliographystyle{iran}%
}
@@ -80,10 +76,7 @@
%% iran bibliography style: author-year style, sorted by year
\DeclareOption{iran-year}
{%
- \setcitestyle{authoryear,% citation mode
- round,% braces
- aysep={},% between author and year
- }%
+ \PassOptionsToPackage{authoryear,round,sort&compress}{natbib}%
\bibliographystyle{iran-year}%
}
@@ -92,10 +85,7 @@
%% iran bibliography style: numbered style, sorted by year
\DeclareOption{iran-plainyr}
{%
- \setcitestyle{numbers,% citation mode
- square,% braces
- sort&compress, % multiple numerical citations are compressed
- }%
+ \PassOptionsToPackage{numbers,square,sort&compress}{natbib}%
\bibliographystyle{iran-year}%
}
@@ -104,10 +94,7 @@
%% 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
- }%
+ \PassOptionsToPackage{numbers,square,sort&compress}{natbib}%
\bibliographystyle{iran-unsrt}%
}
@@ -116,10 +103,7 @@
%% 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
- }%
+ \PassOptionsToPackage{authoryear,round,sort&compress}{natbib}%
\bibliographystyle{iranlatin}%
}
@@ -128,10 +112,7 @@
%% 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
- }%
+ \PassOptionsToPackage{numbers,square,sort&compress}{natbib}%
\bibliographystyle{iranlatin}%
}
@@ -140,10 +121,7 @@
%% 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
- }%
+ \PassOptionsToPackage{authoryear,round,sort&compress}{natbib}%
\bibliographystyle{iranlatin-year}%
}
@@ -152,10 +130,7 @@
%% 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
- }%
+ \PassOptionsToPackage{numbers,square,sort&compress}{natbib}%
\bibliographystyle{iranlatin-year}%
}
@@ -164,20 +139,28 @@
%% 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
- }%
+ \PassOptionsToPackage{numbers,square,sort&compress}{natbib}%
\bibliographystyle{iranlatin-unsrt}%
}
+%% other options pass to natbib package
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}}
+
+
+
\ProcessOptions\relax
+\RequirePackage{natbib}
+\setcitestyle{aysep={}}% between author and year
+
+
+
+
% === Package structure: Provide commands
@@ -203,60 +186,59 @@
% === 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}
-
+%% Modify extra label of Latin bib items
+\def\extrayearlabelen#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
+%% Modify extra label of Persian bib items
+\newcommand\makeswitch[2][]%
+{%
+ \newcommand#2[1]% create a switch named #2 which takes one argument
+ {%
+ \ifcsname\string#2@case@##1\endcsname% check switch and case is exist or not
+ \csname\string#2@case@##1\endcsname% execute the switch and case
+ \else#1% expand #1 (first arugument of makeswitch)
+ \fi%
+ }%
+}
\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}}
+
+\makeswitch[#1]\extrayearlabelfa
+
+\addcase\extrayearlabelfa{a}{الف}
+\addcase\extrayearlabelfa{b}{ب}
+\addcase\extrayearlabelfa{c}{پ}
+\addcase\extrayearlabelfa{d}{ت}
+\addcase\extrayearlabelfa{e}{ث}
+\addcase\extrayearlabelfa{f}{ج}
+\addcase\extrayearlabelfa{g}{چ}
+\addcase\extrayearlabelfa{h}{ح}
+\addcase\extrayearlabelfa{i}{خ}
+\addcase\extrayearlabelfa{j}{د}
+\addcase\extrayearlabelfa{k}{ذ}
+\addcase\extrayearlabelfa{l}{ر}
+\addcase\extrayearlabelfa{m}{ز}
+\addcase\extrayearlabelfa{n}{ژ}
+\addcase\extrayearlabelfa{o}{س}
+\addcase\extrayearlabelfa{p}{ش}
+\addcase\extrayearlabelfa{q}{ص}
+\addcase\extrayearlabelfa{r}{ض}
+\addcase\extrayearlabelfa{s}{ط}
+\addcase\extrayearlabelfa{t}{ظ}
+\addcase\extrayearlabelfa{u}{ع}
+\addcase\extrayearlabelfa{v}{غ}
+\addcase\extrayearlabelfa{w}{ف}
+\addcase\extrayearlabelfa{x}{ق}
+\addcase\extrayearlabelfa{y}{ک}
+\addcase\extrayearlabelfa{z}{گ}
+\addcase\extrayearlabelfa{aa}{ل}
+\addcase\extrayearlabelfa{ab}{م}
+\addcase\extrayearlabelfa{ac}{ن}
+\addcase\extrayearlabelfa{ad}{و}
+\addcase\extrayearlabelfa{ae}{ه‍}
+\addcase\extrayearlabelfa{af}{ی}