اولین بار است که به اینجا می‌آیید؟ راهنمای سایت را بخوانید!
0 رای
1.4k بازدید

سلام
وقتی در فرمول به قضیه (قضیه 1.1) ارجاع میدم عنوان "قضیه 1.1" در فرمول، clickable نمیشه. برای clickable شدن چه راه حلی رو پیشنهاد میکنید.

سپاسگزارم.

این باگ بسته bidi هست. سعی می‌کنم توی این هفته درست کنم و نسخه تازه‌ای به CTAN بدهم. پاسخ من رو بصورت کامل برای همه توضیحات بخونید.
ویرایش شده توسط
توسط (25.1k امتیاز)
سلام، پاسختون فوق العاده بود، سپاسگزارم.
توسط (18 امتیاز)

2 پاسخ

+1 رای

چرا \autoref داخل دستور \text در محیط ریاضی کار نمی‌کند؟

بسته amstext دستور شرطی \iffirstchoice@ را تعریف می‌کند که به صورت پیش‌فرض مقدارش درست است هرچند اگر تعریف دستور \text@ (که در تعریف دستور \textبه کار رفته است) را در این بسته نگاه کنید

\def\text@#1{{\mathchoice
  {\textdef@\displaystyle\f@size{#1}}%
  {\textdef@\textstyle\f@size{\firstchoice@false #1}}%
  {\textdef@\textstyle\sf@size{\firstchoice@false #1}}%
  {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}%
  \check@mathfonts
  }%
}

می‌بینید که در همه حالات غیر از حالت \displaystyle مقدار دستور شرطی نادرست است. از طرفی دیگر همین بسته دستور \addtocounter را تنها زمانی تعریف (بازتعریف) می‌کند که مقدار دستور شرطی درست باشد

\def\addtocounter#1#2{%
  \iffirstchoice@
  \@ifundefined {c@#1}{\@nocounterr {#1}}%
    {\global \advance \csname c@#1\endcsname #2\relax}%
  \fi}

بنابراین در نمونه شما دستور \addtocounter هیچ کاری انجام نمی‌دهد حال آنکه بسته hyperref از این دستور برای ارجاعات استفاده می‌کند.

راه‌حل کوتاه

در این نمونه از دستور \text استفاده شده است.

\documentclass{book}
\usepackage{amsmath,amssymb,amsthm,amsfonts}
\usepackage[colorlinks=true]{hyperref}
\usepackage{xepersian}
\settextfont[Scale=1]{Yas}
\setlatintextfont[Scale=.95]{Times New Roman}
\setdigitfont[Scale=1]{Yas}
\defpersianfont\chapfont[Scale=3.3]{Yas}
\def\theoremautorefname{قضیۀ}


\newtheoremstyle{Plain}% vahid
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{\parindent}% measure of space to indent
{\bf}%name of head font
{.}% punctuation between head and body
{0.5em}% space after theorem head; " " = normal interword space
{}%Manually specify head
\theoremstyle{Plain}
%\theoremstyle{definition}
\newtheorem{definition}{تعریف}[chapter]
\newtheorem{theorem}{قضیه}[chapter]
\newtheorem{Lemma}[theorem]{لم}
\begin{document}
\chapter{فضاهای متریک}
\begin{theorem}\label{theorem}
\end{theorem}

\begin{equation}
A\in G_{n}\stackrel{\text{\SetBoolean{firstchoice@}{true}
\autoref{theorem}}}{\Longleftrightarrow}B\in G_{n}
\end{equation}
\end{document}

راه‌حل بلند

در این نمونه دستوری به نام \mytext تعریف شده که مشابه دستور \text کار می‌کنه اما مشکل اون رو نداره و فقط برای محیط ریاضی طراحی شده.

\documentclass{book}
\usepackage{amsmath,amssymb,amsthm,amsfonts}
\usepackage[colorlinks=true]{hyperref}
\usepackage{xepersian}
\settextfont[Scale=1]{Yas}
\setlatintextfont[Scale=.95]{Times New Roman}
\setdigitfont[Scale=1]{Yas}
\defpersianfont\chapfont[Scale=3.3]{Yas}
\makeatletter
\def\theoremautorefname{قضیۀ}
\newcommand*{\mytext}[1]{%
{\mathchoice{{\hbox{%
\everymath{\displaystyle}%
\let\f@size\f@size\selectfont%
#1}}}{{\hbox{%
\everymath{\textstyle}%
\let\f@size\f@size\selectfont%
#1}}}{{\hbox{%
\everymath{\textstyle}%
\let\f@size\sf@size\selectfont%
#1}}}{{\hbox{%
\everymath{\textstyle}%
\let\f@size\ssf@size\selectfont%
#1}}}%
 \check@mathfonts
 }%
}
\makeatother

\newtheoremstyle{Plain}% vahid
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{\parindent}% measure of space to indent
{\bf}%name of head font
{.}% punctuation between head and body
{0.5em}% space after theorem head; " " = normal interword space
{}%Manually specify head
\theoremstyle{Plain}
%\theoremstyle{definition}
\newtheorem{definition}{تعریف}[chapter]
\newtheorem{theorem}{قضیه}[chapter]
\newtheorem{Lemma}[theorem]{لم}
\begin{document}
\chapter{فضاهای متریک}
\begin{theorem}\label{theorem}
\end{theorem}

\begin{equation}
A\in G_{n}\stackrel{\mytext{\autoref{theorem}}}{\Longleftrightarrow}B\in G_{n}
\end{equation}
\end{document}

ویرایش

در نسخه پیشین بسته hyperref در فایل hxetex.def که تعریفات درایور زی‌تک برای لینک‌هاست دستور \Hy@EndAnnot بصورت

\def\Hy@EndAnnot{%
  \ifnum\value{Hy@AnnotLevel}=\@ne
    \Hy@endcolorlink
    \@pdfm@mark{eann}%
  \fi
  \addtocounter{Hy@AnnotLevel}\m@ne
}

تعریف شده بود در صورتی که در حال حاضر تعریف این دستور به صورت

\def\Hy@EndAnnot{%
  \ifnum\value{Hy@AnnotLevel}=\@ne
    \Hy@endcolorlink
    \@pdfm@mark{eann}%
  \fi
  \global\advance\c@Hy@AnnotLevel\m@ne
}

تغییر کرده. همونوطوری که از مقایسه تعریف دو دستور مشاهده می‌کنید

\global\advance\c@Hy@AnnotLevel\m@ne

جایگزین

\addtocounter{Hy@AnnotLevel}\m@ne

شده. هر دوی اینها معادل هم هستند اما با توجه به توضیحی که در بالا دادم این تغییر در بسته hyperref پیش اومده تا مشکلی که بهش اشاره کردم پیش نیاد. شما وقتی از بسته bidi استفاده می‌کنید تعریف قدیمی وجود داره و به همین خاطر به مشکل برمی‌خورید. بنابراین برای حل مشکل از پایه بهتره تعریف این دستور در بسته bidi بروز بشود.

+1 رای

این مشکل در نسخه 30.9 بسته bidi که بهزودی به CTAN داده خواهد شد، حل شده است. بنابراین با نسخه 30.9 بسته bidi نمونه زیر مشکلی نخواهد داشت.

\documentclass{book}
\usepackage{amsmath,amssymb,amsthm,amsfonts}
\usepackage[colorlinks=true]{hyperref}
\usepackage{xepersian}
\settextfont[Scale=1]{Yas}
\setlatintextfont[Scale=.95]{Times New Roman}
\setdigitfont[Scale=1]{Yas}
\defpersianfont\chapfont[Scale=3.3]{Yas}
\def\theoremautorefname{قضیۀ}


\newtheoremstyle{Plain}% vahid
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{\parindent}% measure of space to indent
{\bf}%name of head font
{.}% punctuation between head and body
{0.5em}% space after theorem head; " " = normal interword space
{}%Manually specify head
\theoremstyle{Plain}
%\theoremstyle{definition}
\newtheorem{definition}{تعریف}[chapter]
\newtheorem{theorem}{قضیه}[chapter]
\newtheorem{Lemma}[theorem]{لم}
\begin{document}
\chapter{فضاهای متریک}
\begin{theorem}\label{theorem}
\end{theorem}

\begin{equation}
A\in G_{n}\stackrel{\text{\autoref{theorem}}}{\Longleftrightarrow}B\in G_{n}
\end{equation}
\end{document}
پرسیدن سوال
وب‌سایت پرسش و پاسخ پارسی‌لاتک جایی برای پرسش و پاسخ درباره سیستم حروف‌چینی لاتک و بسته زی‌پرشین است. در اینجا می‌توانید سوال‌های خود را بپرسید و به سوال‌های دیگران پاسخ دهید.

7.1k پرسش

6.6k پاسخ

23.5k نظر

7.5k کاربر

محبوب‌ترین برچسب‌ها

رفع خطا جدول xepersian مراجع ریاضی‌نویسی شکل bidi فونت فهرست مطالب شماره‌گذاری منابع پانویس بیب‌تک tikz parsilatex تک‌لایو بیمر اسلاید زی‌پرشین پاورقی bibtex سربرگ نماد رسم شکل فرمول‌نویسی ارجاع‌دهی biditexmaker هدر ویرایشگر قالب beamer واژه‌نامه اندازه فونت texstudio عنوان فصل ماتریس اعمال نشدن تغییرات در پی‌دی‌اف رسم جدول شماره صفحه bidipresentation حاشیه رنگ عنوان شکل اسلاید فارسی محیط قضیه گراف مکان شکل tikzpicture enumerate حروف‌چینی کد شماره فصل tabriz_thesis نمایه align زیرنویس شکل کادر itemize فهرست اشکال الگوریتم عدم اجرا listings نیم‌فاصله متن لاتین و فارسی بسته فاصله بین خطوط قالب پایان‌نامه فرمول نصب تک‌لایو فارسی‌تک hyperref شماره فرمول glossaries کپشن نمودار خروجی لاتک حروف‌چینی چندستونی فونت فارسی و انگلیسی ماکرونویسی biditools شماره پاورقی پیوست‌ سوال امتحانی فاصله‌گذاری فرمول چندضابطه‌ای extrafootnotefeatures subfigure biditufte-book header texmaker pdf خطا tex longtable تصویر شمارنده زیرنویس texlive2015 دیاگرام رسم نمودار شماره‌گذاری صفحات پایان نامه فهرست جداول میک‌تک texlive2016 تنظیم جدول آکولاد شعر kashida بولد تورفتگی texworks caption اندیس اعداد فارسی lollipop iust-thesis multicol فصل‌نویسی سوال چهارگزینه‌ای فاصله عمودی pgfplots xindy چپ‌چینی اوبونتو میکروسافت ورد قاب geometry xelatex texlive fancyhdr وسط‌چینی تک لایو 2015 tcolorbox عنوان بخش شماره گذاری به‌روزرسانی بسته aimc46 صفر توخالی فرمول طولانی بیرون‌زدگی کاما پوستر فاصله سطرها نوشتافت شکست خط tex-programming فونت اعداد قرآن tabriz-thesis
...