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

سلام دوستان

میخواستم از این محیط که دارم بتوانم با استفاده از \begin{محیط} و \end{محیط} بکارش ببرم که انتخاب رنگ و عنوانش را هم تغییر دهم

 \documentclass[12pt,fleqn,explicit]{book}


\usepackage[left=1cm,right=1cm,bottom=2cm]{geometry}


\usepackage[x11names,usenames,dvipsnames,svgnames,table]{xcolor}

\usepackage{titlesec,titletoc}
\usepackage{xcolor}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}

\usepackage{tikz}

\usetikzlibrary{calc}
\usetikzlibrary{shapes,snakes}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
%----------
\definecolor{azzul}{RGB}{6,96,167}

%----------
\newcounter{counter}

\newcommand{\syBrisse}[6][\textwidth-\pgfkeysvalueof{/pgf/inner xsep}-4mm]{%
\begin{center}
\par\bigskip%
\begin{tikzpicture}
\node[rounded corners, text width=#1, align=justify, inner sep=8pt, outer sep=0] (one)
{\medskip\parbox[t]{\textwidth}{\vspace*{22pt}\par#6}};
\node[text=black,anchor=north east,align=center, minimum height=20pt, inner xsep=5pt] (two) at (one.north east) {#5 \hspace*{.5mm}};
\path[fill=#2,draw=#2]
    ($(one.north west)+(0ex,-4.5pt)$) [rounded corners=3pt] --
    ($(two.north west)+(-22pt,-4.5pt)$) --
    ($(two.south west)+(-4pt,0pt)$) [sharp corners] --
    (two.south east) [rounded corners] --
    (one.north east) --
    (one.north west) [sharp corners] -- cycle;
\node[text=black,anchor=north west,align=center, minimum height=20pt, text height=2ex,inner sep=8pt, inner ysep=3pt] (three) at ($(one.north west)+(0,-3pt)$) {#4};
\node[text=white,anchor=north east,align=center, minimum height=20pt, inner sep=8pt,inner ysep=6.5pt] (for) at ($(one.north east)+(0,1.5pt)$) {\stepcounter{counter}\thecounter.\thechapter#5\hspace*{0.8mm}};
\path[draw=#2,line width=0.8pt]
    (one.south west) [rounded corners] --
    (one.south east) [rounded corners] --
    (one.north east) --
    (one.north west) [rounded corners] -- cycle;
\foreach \x in {10,20,...,100}
\path[opacity=\x*0.01]
    ($(one.north west)+(0.4pt,-6.5pt+\x/100)$) [rounded corners=3pt,draw=gray!\x] --
    ($(two.north west)+(-23.3pt+\x/100,-6.5pt+\x/100)$) [rounded corners=3.5pt,draw=gray!\x] --
    ($(two.south west)+(-5.3pt+\x/100,-1.9pt+\x/100)$) --
    ($(two.south east)+(-0.4pt,-1.9pt+\x/100)$);
\path[draw=white,line width=1.1pt]
    ($(one.north west)+(0.4pt,-5.2pt)$) [rounded corners=3pt] --
    ($(two.north west)+(-22.3pt,-5.2pt)$) [rounded corners=3.5pt] --
    ($(two.south west)+(-4.3pt,-0.6pt)$) --
    ($(two.south east)+(-0.4pt,-0.6pt)$);
\begin{pgfonlayer}{background}
\path[fill=#3!5]
    (one.south west) [rounded corners] --
    (one.south east) [rounded corners] --
    (one.north east) --
    (one.north west) [rounded corners] -- cycle;
\path[opacity=0.5, top color=#3!5,bottom color=#3,middle color=#3!30]
    (one.south west) [rounded corners] --
    (one.south east) [sharp corners] --
    ($(one.south east)+(0ex,0.8cm)$) --
    ($(one.south west)+(0ex,0.8cm)$) [rounded corners] -- cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{center}
}

\usepackage{xepersian}
\settextfont{Yas}


\begin{document}
\syBrisse[12cm]{CornflowerBlue}{CornflowerBlue}{ }{\textbf{ تعریف‌‌:}}{
	\begin{RTL}
اینجا هم متن ریاضی یا هر چیز دیگه‌ هم باشد
\end{RTL}}


\end{document}

که به صورت

\begin{محیط}{رنگ}{عنوان}
متن اینجا
\end{محیط}

بتوانم ازش استفاده‌ بكنم

ممنون میشم راهنمایی کنید

1 پاسخ

+4 رای
 
بهترین پاسخ

سلام
خواسته‌ی شما با محیط mybox با تعریف زیر برآورده می‌شود:

\newenvironment{mybox}[3]{\syBrisse[12cm]{#2}{#2}{}{\textbf{#1:}}{\persian#3}}

پس دستورات شما به صورت زیر است:

\documentclass[12pt,fleqn,explicit]{book}
\usepackage[left=1cm,right=1cm,bottom=2cm]{geometry}
\usepackage[x11names,usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{titlesec,titletoc}
\usepackage{xcolor}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes,snakes}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
%----------
\definecolor{azzul}{RGB}{6,96,167}

%----------
\newcounter{counter}
\newcommand{\syBrisse}[6][\textwidth-\pgfkeysvalueof{/pgf/inner xsep}-4mm]{%
\begin{center}
\par\bigskip%
\begin{tikzpicture}
\node[rounded corners, text width=#1, align=justify, inner sep=8pt, outer sep=0] (one)
{\medskip\parbox[t]{\textwidth}{\vspace*{22pt}\par#6}};
\node[text=black,anchor=north east,align=center, minimum height=20pt, inner xsep=5pt] (two) at (one.north east) {#5 \hspace*{.5mm}};
\path[fill=#2,draw=#2]
    ($(one.north west)+(0ex,-4.5pt)$) [rounded corners=3pt] --
    ($(two.north west)+(-22pt,-4.5pt)$) --
    ($(two.south west)+(-4pt,0pt)$) [sharp corners] --
    (two.south east) [rounded corners] --
    (one.north east) --
    (one.north west) [sharp corners] -- cycle;
\node[text=black,anchor=north west,align=center, minimum height=20pt, text height=2ex,inner sep=8pt, inner ysep=3pt] (three) at ($(one.north west)+(0,-3pt)$) {#4};
\node[text=white,anchor=north east,align=center, minimum height=20pt, inner sep=8pt,inner ysep=6.5pt] (for) at ($(one.north east)+(0,1.5pt)$) {\stepcounter{counter}\thecounter.\thechapter#5\hspace*{0.8mm}};
\path[draw=#2,line width=0.8pt]
    (one.south west) [rounded corners] --
    (one.south east) [rounded corners] --
    (one.north east) --
    (one.north west) [rounded corners] -- cycle;
\foreach \x in {10,20,...,100}
\path[opacity=\x*0.01]
    ($(one.north west)+(0.4pt,-6.5pt+\x/100)$) [rounded corners=3pt,draw=gray!\x] --
    ($(two.north west)+(-23.3pt+\x/100,-6.5pt+\x/100)$) [rounded corners=3.5pt,draw=gray!\x] --
    ($(two.south west)+(-5.3pt+\x/100,-1.9pt+\x/100)$) --
    ($(two.south east)+(-0.4pt,-1.9pt+\x/100)$);
\path[draw=white,line width=1.1pt]
    ($(one.north west)+(0.4pt,-5.2pt)$) [rounded corners=3pt] --
    ($(two.north west)+(-22.3pt,-5.2pt)$) [rounded corners=3.5pt] --
    ($(two.south west)+(-4.3pt,-0.6pt)$) --
    ($(two.south east)+(-0.4pt,-0.6pt)$);
\begin{pgfonlayer}{background}
\path[fill=#3!5]
    (one.south west) [rounded corners] --
    (one.south east) [rounded corners] --
    (one.north east) --
    (one.north west) [rounded corners] -- cycle;
\path[opacity=0.5, top color=#3!5,bottom color=#3,middle color=#3!30]
    (one.south west) [rounded corners] --
    (one.south east) [sharp corners] --
    ($(one.south east)+(0ex,0.8cm)$) --
    ($(one.south west)+(0ex,0.8cm)$) [rounded corners] -- cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{center}
}

\usepackage[logo=on,
inlinemathdigits=persian,%
displaymathdigits=persian%
]{xepersian}
\settextfont[Scale=1.2]{Yas}
\settextdigitfont[Scale=.9]{Yas}
\setmathdigitfont[Scale=.9]{PGaramond}

\newenvironment{mybox}[3]{\syBrisse[12cm]{#2}{#2}{}{\textbf{#1:}}{\persian#3}}

\begin{document}
\null\vfill
\syBrisse[12cm]{CornflowerBlue}{CornflowerBlue}{ }{\textbf{تعریف‌‌:}}{
\begin{RTL}
اینجا هم متن ریاضی یا هر چیز دیگه‌ هم باشد
\end{RTL}}

\begin{mybox}{تعریف}{red}{
\begin{RTL}
اینجا هم متن ریاضی یا هر چیز دیگه‌ هم باشد
\end{RTL}	
}
\end{mybox}
\begin{mybox}{لم}{cyan}{
\[a^5=b^5+c^5\]	
}
\end{mybox}

\begin{mybox}{قضیه}{magenta}{
\begin{equation}
a^6=b^6+c^6
\end{equation}
}
\end{mybox}
\end{document}

و خروجی شما با نسخه‌های اولیه‌ی تک‌لایو 2018 به صورت زیر است:


enter image description here


موفق باشید.

پرسیدن سوال
وب‌سایت پرسش و پاسخ پارسی‌لاتک جایی برای پرسش و پاسخ درباره سیستم حروف‌چینی لاتک و بسته زی‌پرشین است. در اینجا می‌توانید سوال‌های خود را بپرسید و به سوال‌های دیگران پاسخ دهید.

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
...