به دلیل قطعی اینترنت و نبود دسترسی به ایمیل‌های خارجی، می‌توانید بدون نیاز به تایید ایمیل، ثبت‌نام کنید و پرسش‌های خود را بپرسید.

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

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

سپاسگزارم.

این باگ بسته bidi هست. سعی می‌کنم توی این هفته درست کنم و نسخه تازه‌ای به CTAN بدهم. پاسخ من رو بصورت کامل برای همه توضیحات بخونید.
ویرایش شده توسط
توسط (26.4k امتیاز)
سلام، پاسختون فوق العاده بود، سپاسگزارم.
توسط (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.2k پرسش

6.6k پاسخ

23.7k نظر

11.7k کاربر

basket cart icon

محصولات مرتبط با LaTeX

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


basket cart icon

حمایت مالی از پارسی‌لاتک

برای تامین هزینه‌های نگه‌داری و به‌روزرسانی

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

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