• Welcome to پارسی‌لاتک.
 
از تاریخ ۱۳۹۳/۸/۱۴ به دلیل ارائه خدمات بهتر به سایت جدید پرسش و پاسخ مهاجرت کرده‌ایم؛ از این رو امکان عضویت و ارسال پست در تالار غیرفعال شده است. لطفاً برای پرسیدن سوال‌های خود به سایت جدید مراجعه کنید.

ورود به سایت جدید

چگونه نسخه بسته‌های bidi و xepersian را چک کنیم و بسته به نسخه کدی بنویسیم؟

نویسنده vafa, آگوست 02, 2014, 04:14:01 بعد از ظهر

« قبلی - بعدی »

vafa


\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}