0

I mean the question,figure and the answers be in the same rectangular.

My code:

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

enter image description here

  • Is this for a question paper exam – js bibra Jun 10 at 1:06
  • Yes kind of. I am writing some questions to be practiced by others. – Ali Jun 10 at 1:30
  • Remove the blank line before \begin{tikzpicture}. The blank line makes a new paragraph. – Cicada Jun 10 at 11:46
  • No, I mean it beside the options just on the left of the A,B,C and D. – Ali Jun 11 at 17:34
1
+50

I may have misinterpreted what your desired result is but you can easily put an itemize (or similar) and a tikzpicture next to each other using minipages:

% !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}

Which yields (I did not bother to figure out the font handling):

output of the above code

| improve this answer | |
  • Hint A mistake that is often made is, there is a blank line between the \end{minipage} and \begin{minipage} left. Then the pages are no longer together. Source: sascha-frank.com/latex-minipage.html – Ali Jun 18 at 23:35
0

You could use the mulitcol package and place the tikzpicture and tasks environment inside a 2 columned block. A few helpful tipps can be found in this overleaf tutorial.

% !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}

output

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.