تالار گفتگوی پارسی‌لاتک

زی‌پرشین XePersian => زی‌تک => نويسنده: vafa در اوت 02, 2014, 04:14:01 pm

عنوان: چگونه نسخه بسته‌های bidi و xepersian را چک کنیم و بسته به نسخه کدی بنویسیم؟
رسال شده توسط: vafa در اوت 02, 2014, 04:14:01 pm
\documentclass{article}
\usepackage{xepersian}
\makeatletter
\edef\strip@v@bidiversion{\expandafter\@gobble\bidiversion}
\edef\strip@v@xepersianversion{\expandafter\@gobble\xepersianversion}
\newcommand{\CheckbidiVersion}[2]{%
    \ifdim\strip@v@bidiversion pt #1 #2 pt %
        \expandafter\@firstoftwo
    \else
        \expandafter\@secondoftwo
    \fi}
\newcommand{\CheckxepersianVersion}[2]{%
    \ifdim\strip@v@xepersianversion pt #1 #2 pt %
        \expandafter\@firstoftwo
    \else
        \expandafter\@secondoftwo
    \fi}
\makeatother
\begin{document}
%% The `\CheckbidiVersion' and `\CheckxepersianVersion` macros
%% allows you to check for bidi and xepersian packages version,
%% respectively and execute code conditionally according to the version
%% number of each package. The macros accept four arguments:
%%
%% * The first argument is any of the three relation `<', `>', and `='.
%% * The second argument is the version number that you want
%%   to compare with the actual package version number.
%% * The third argument is the `true code'.
%% * The last argument is the `false code'.


%% Here we check that if \bidiversion=15.2, if this is true,
%% we typeset `true' and otherwise `false'.
\CheckbidiVersion{=}{15.2}{true}{false}

%% Here we check that if \xepersianversion>14.2, if this is true,
%% we typeset `true' and otherwise `false'.
\CheckxepersianVersion{>}{14.2}{true}{false}
\end{document}