我的意思是问题、图形和答案在同一个矩形内。
我的代码:
\documentclass{article}
\usepackage{tasks,fontspec,tikz,color}
\usepackage{amsmath,pgf,pgffor,comment,polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\newcommand{\mymk}[1]{%
\tikz[baseline=(char.base)]\node[anchor=south west, draw,rectangle, rounded corners, inner sep=2pt, minimum size=7mm,
text height=2mm](char){\ensuremath{#1}} ;}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newfontfamily\arabicfont[Script = Arabic]{Scheherazade} % Replace 'Simplified Arabic' with a font from your system
\newcommand{\nodear}[1]{node{\begin{Arabic}{#1}\end{Arabic}}}
\begin{document}
\begin{comment}
\task[\circled{A}]\hspace{2pt}
\task[\circled{B}]\hspace{2pt}
\task[\circled{C}]\hspace{2pt}
\task[\circled{D}]\hspace{2pt}
\end{comment}
\begin{Arabic}
\begin{enumerate}
\item في الشكل المجاور؛ إذا كان $m\widehat{AB} = 120\textdegree$ فإنّ قيمة $x$ تساوي \dots
\begin{tikzpicture}
\clip[draw] (0,0) circle (0.5cm);
\draw (0,0) circle(0.5cm);
\end{tikzpicture}
\begin{tasks}(2)
\task[\circled{A}]\hspace{2pt}
\task[\circled{B}]\hspace{2pt}
\task[\circled{C}]\hspace{2pt}
\task[\circled{D}]\hspace{2pt}
\end{tasks}
\end{enumerate}
\end{Arabic}
\end{document}
答案1
我可能误解了您想要的结果,但您可以使用小页面轻松地将一个itemize
(或类似的)和一个tikzpicture
放在一起:
% !TeX TS-program = xelatex
\documentclass{article}
\usepackage{tasks,fontspec,tikz,color}
\usepackage{amsmath,pgf,pgffor,comment,polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\newcommand{\mymk}[1]{%
\tikz[baseline=(char.base)]\node[anchor=south west, draw,rectangle, rounded corners, inner sep=2pt, minimum size=7mm,
text height=2mm](char){\ensuremath{#1}} ;}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newfontfamily\arabicfont[Script = Arabic]{Noto Kufi Arabic}
\newcommand{\nodear}[1]{node{\begin{Arabic}{#1}\end{Arabic}}}
\begin{document}
\begin{Arabic}
\begin{enumerate}
\item في الشكل المجاور؛ إذا كان $m\widehat{AB} = 120\textdegree$ فإنّ قيمة $x$ تساوي \dots
\begin{minipage}{.6\linewidth}
\begin{tasks}(2)
\task[\circled{A}]\hspace{2pt}
\task[\circled{B}]\hspace{2pt}
\task[\circled{C}]\hspace{2pt}
\task[\circled{D}]\hspace{2pt}
\task[\circled{E}]\hspace{2pt}
\task[\circled{F}]\hspace{2pt}
\end{tasks}
\end{minipage}
\begin{minipage}{.4\linewidth} % use \begin{minipage}[t] for aligning the picture to the top
\begin{tikzpicture}
\clip[draw] (0,0) circle (0.5cm);
\draw (0,0) circle(0.5cm);
\end{tikzpicture}
\end{minipage}
\end{enumerate}
\end{Arabic}
\end{document}
结果是(我没有费心去弄清楚字体处理):
答案2
您可以使用mulitcol
打包并将 tikzpicture 和任务环境放在一个 2 列块内。可以在此处找到一些有用的提示overleaf 教程。
% !TeX TS-program = xelatex
\documentclass{article}
\usepackage{tasks,fontspec,tikz,color}
\usepackage{amsmath,pgf,pgffor,comment,polyglossia}
\usepackage{multicol}
\setmainlanguage{english}
\setotherlanguage{arabic}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\newcommand{\mymk}[1]{%
\tikz[baseline=(char.base)]\node[anchor=south west, draw,rectangle, rounded corners, inner sep=2pt, minimum size=7mm,
text height=2mm](char){\ensuremath{#1}} ;}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newfontfamily\arabicfont[Script = Arabic]{Noto Kufi Arabic} % Replace 'Simplified Arabic' with a font from your system
\newcommand{\nodear}[1]{node{\begin{Arabic}{#1}\end{Arabic}}}
\begin{document}
\begin{comment}
\task[\circled{A}]\hspace{2pt}
\task[\circled{B}]\hspace{2pt}
\task[\circled{C}]\hspace{2pt}
\task[\circled{D}]\hspace{2pt}
\end{comment}
\begin{Arabic}
\begin{enumerate}
\item في الشكل المجاور؛ إذا كان $m\widehat{AB} = 120\textdegree$ فإنّ قيمة $x$ تساوي \dots
\begin{multicols}{2}
\begin{tikzpicture}
\clip[draw] (0,0) circle (0.5cm);
\draw (0,0) circle(0.5cm);
\end{tikzpicture}
\begin{tasks}(2)
\task[\circled{A}]\hspace{2pt}
\task[\circled{B}]\hspace{2pt}
\task[\circled{C}]\hspace{2pt}
\task[\circled{D}]\hspace{2pt}
\end{tasks}
\end{multicols}
\end{enumerate}
\end{Arabic}
\end{document}