> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/ar/khas-balmjal/09-typesetting-exams-in-latex.md).

# تنضيد الامتحانات في LaTeX

## مقدمة

فئة LaTeX `exam.cls` يجعل إنشاء أوراق الامتحانات وتنضيد الأسئلة أمرًا بسيطًا. ويضبط هامشًا قدره 1 بوصة في جميع أحجام الورق، ويوفر أوامر خاصة لكتابة الدرجات وحسابها. لاستخدام `exam` الفئة يجب أن تضع السطر

```latex
\documentclass{exam}
```

في بداية `.tex` ملفك. سيُمكّن هذا أوامر الحزمة المتعلقة بالامتحانات، ويضبط تنسيق الصفحة بما يتيح هوامش للتصحيحات.

## مثال أساسي

لنبدأ بمثال عملي أساسي لـ `exam` الفئة.

```latex
\documentclass{exam}

\begin{document}

\begin{center}
\fbox{\fbox{\parbox{5.5in}{\centering
أجب عن الأسئلة في المساحات المخصّصة. إذا نفدت المساحة
للإجابة، فتابع على ظهر الصفحة.}}}
\end{center}

\vspace{5mm}
\makebox[0.75\textwidth]{الاسم والقسم:\enspace\hrulefill}

\vspace{5mm}
\makebox[0.75\textwidth]{اسم المدرّس:\enspace\hrulefill}

\begin{questions}
\question هل صحيح أن \(x^n + y^n = z^n\) إذا كانت \(x,y,z\) و\(n\)
أعدادًا صحيحة موجبة؟ اشرح.

\question أثبت أن الجزء الحقيقي لجميع الأصفار غير التافهة للدالة
\(\zeta(z)\) هو \(\frac{1}{2}\)

\question احسب \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]
\end{questions}
\end{document}
```

[افتح هذا المثال في Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Basic+exam+class+example\&snip=%5Cdocumentclass%7Bexam%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cfbox%7B%5Cfbox%7B%5Cparbox%7B5.5in%7D%7B%5Ccentering%0AAnswer+the+questions+in+the+spaces+provided.+If+you+run+out+of+room%0Afor+an+answer%2C+continue+on+the+back+of+the+page.%7D%7D%7D%0A%5Cend%7Bcenter%7D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cmakebox%5B0.75%5Ctextwidth%5D%7BName+and+section%3A%5Censpace%5Chrulefill%7D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cmakebox%5B0.75%5Ctextwidth%5D%7BInstructor%E2%80%99s+name%3A%5Censpace%5Chrulefill%7D%0A%0A%5Cbegin%7Bquestions%7D%0A%5Cquestion+Is+it+true+that+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+if+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+are%0Apositive+integers%3F.+Explain.%0A%0A%5Cquestion+Prove+that+the+real+part+of+all+non-trivial+zeros+of+the+function%0A%5C%28%5Czeta%28z%29%5C%29+is+%5C%28%5Cfrac%7B1%7D%7B2%7D%5C%29%0A%0A%5Cquestion+Compute+%5C%5B%5Cint_%7B0%7D%5E%7B%5Cinfty%7D+%5Cfrac%7B%5Csin%28x%29%7D%7Bx%7D%5C%5D%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

![ExamEx1OLV2b.png](/files/dc69a5b8fdf7b7b43820889a63a4113eb5ba224d)

بنية `questions` تشبه كثيرًا بنية `itemize` و `enumerate` . ويُكتب كل سؤال بوضع الأمر `\question` قبله.

الأوامر الأخرى في هذا المثال ليست خاصة بـ `exam` الفئة، لكنها قد تكون مفيدة لإنشاء ترويسة سريعة لامتحانك.

## إنشاء أسئلة جديدة

في القسم السابق، تم تقديم مثال أساسي يوضح كيفية إنشاء سؤال. يمكن تخصيص الأسئلة أكثر، وهذا القسم يشرح كيف.

### التباعد

إذا كان مطلوبًا من الطلاب الإجابة عن الامتحان في المساحة المخصّصة، فيمكن ضبط تلك المساحة يدويًا أو توزيعها بالتساوي. انظر المثال أدناه:

```latex
\begin{questions}

\question هل صحيح أن \(x^n + y^n = z^n\) إذا كانت \(x,y,z\) و\(n\) أعدادًا صحيحة موجبة؟ اشرح.
\vspace{\stretch{1}}

\question أثبت أن الجزء الحقيقي لجميع الأصفار غير التافهة للدالة \(\zeta(z)\) هو \(\frac{1}{2}\)
\vspace{\stretch{1}}

\question احسب \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]
\vspace{\stretch{1}}

\end{questions}
\clearpage
```

[افتح هذا المثال على Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=Providing+space+for+exam+questions\&snip=%5Cdocumentclass%7Bexam%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cfbox%7B%5Cfbox%7B%5Cparbox%7B5.5in%7D%7B%5Ccentering%0AAnswer+the+questions+in+the+spaces+provided.+If+you+run+out+of+room%0Afor+an+answer%2C+continue+on+the+back+of+the+page.%7D%7D%7D%0A%5Cend%7Bcenter%7D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cmakebox%5B0.75%5Ctextwidth%5D%7BName+and+section%3A%5Censpace%5Chrulefill%7D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cmakebox%5B0.75%5Ctextwidth%5D%7BInstructor%E2%80%99s+name%3A%5Censpace%5Chrulefill%7D%0A%5Cbegin%7Bquestions%7D%0A%0A%5Cquestion+Is+it+true+that+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+if+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+are+positive+integers%3F.+Explain.%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cquestion+Prove+that+the+real+part+of+all+non-trivial+zeros+of+the+function+%5C%28%5Czeta%28z%29%5C%29+is+%5C%28%5Cfrac%7B1%7D%7B2%7D%5C%29%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cquestion+Compute+%5C%5B%5Cint_%7B0%7D%5E%7B%5Cinfty%7D+%5Cfrac%7B%5Csin%28x%29%7D%7Bx%7D%5C%5D%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cend%7Bquestions%7D%0A%5Cclearpage%0A%5Cend%7Bdocument%7D)

يظهر الناتج من هذا الكود في الصورة أدناه — وتُضاف مقدمة مستند LaTeX تلقائيًا عندما تفتح الرابط:

![ExamEx2OLV2.png](/files/6cda5ab4188e55dfb40ca02dc86cb8b9a3899cdd)

في هذا المثال، يقوم الأمر `\vspace{\stretch{1}}` بعد كل سؤال بتوزيع المساحة المتاحة بالتساوي.

الأمر `\clearpage` يُدرج نقطة فاصل صفحة لمتابعة كتابة الأسئلة في صفحة جديدة.

إذا أردت تخصيص المساحة يدويًا لكل سؤال، فاستخدم الأمر `\vspace{}` واكتب بين الأقواس وحدات المسافة التي تحتاجها. على سبيل المثال، `\vspace{1in}` يُدرج مسافة رأسية مقدارها بوصة واحدة. راجع التوثيق حول [الأطوال في LaTeX](/latex/ar/altnsyq/01-lengths-in-latex.md) للحصول على قائمة الوحدات المتاحة.

### الأجزاء الفرعية

إذا كانت أسئلتك تحتوي على عدة أجزاء تركز على بعض الموضوعات الفرعية، فيمكنك استخدام البيئات `parts`, `subparts`, `subsubparts` والأوامر المقابلة `\part`, `\subpart` و `\subsubpart`. انظر المثال التالي:

```latex
\begin{questions}
\question بالنظر إلى المعادلة \(x^n + y^n = z^n\) لـ\(x,y,z\) و\(n\)
أعداد صحيحة موجبة.
\begin{parts}
\part لأي قيم لـ\(n\) تكون العبارة في السؤال السابق صحيحة؟
\vspace{\stretch{1}}

\part عندما \(n=2\) توجد نظرية ذات اسم خاص. ما ذلك الاسم؟
\vspace{\stretch{1}}

\part أي عالم رياضيات مشهور كان لديه برهان أنيق لهذه النظرية ولكن
لم تكن هناك مساحة كافية في الهامش لكتابته؟
\vspace{\stretch{1}}

\begin{subparts}
\subpart من الذي أثبت النظرية فعليًا؟
\vspace{\stretch{1}}
\subpart كم استغرق الأمر فعليًا لحل هذه المشكلة؟
\vspace{\stretch{1}}
\end{subparts}

\end{parts}

\question أثبت أن الجزء الحقيقي لجميع الأصفار غير التافهة للدالة
\(\zeta(z)\) هو \(\frac{1}{2}\)
...

\end{questions}
```

[افتح هذا المثال على Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=Multipart+exam+questions\&snip=%5Cdocumentclass%7Bexam%7D%0A%5Cbegin%7Bdocument%7D%0A%0A%5Cbegin%7Bcenter%7D%0A%5Cfbox%7B%5Cfbox%7B%5Cparbox%7B5.5in%7D%7B%5Ccentering%0AAnswer+the+questions+in+the+spaces+provided.+If+you+run+out+of+room%0Afor+an+answer%2C+continue+on+the+back+of+the+page.%7D%7D%7D%0A%5Cend%7Bcenter%7D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cmakebox%5B0.75%5Ctextwidth%5D%7BName+and+section%3A%5Censpace%5Chrulefill%7D%0A%0A%5Cvspace%7B5mm%7D%0A%5Cmakebox%5B0.75%5Ctextwidth%5D%7BInstructor%E2%80%99s+name%3A%5Censpace%5Chrulefill%7D%0A%5Cbegin%7Bquestions%7D%0A%5Cquestion+Given+the+equation+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+for+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+positive%0Aintegers.+%0A%5Cbegin%7Bparts%7D%0A%5Cpart+For+what+values+of+%5C%28n%5C%29+is+the+statement+in+the+previous+question+true%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart+For+%5C%28n%3D2%5C%29+there%27s+a+theorem+with+a+special+name.+What%27s+that+name%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart+What+famous+mathematician+had+an+elegant+proof+for+this+theorem+but%0Athere+was+not+enough+space+in+the+margin+to+write+it+down%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cbegin%7Bsubparts%7D%0A%5Csubpart+Who+actually+proved+the+theorem%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%5Csubpart+How+long+did+actually+take+to+solve+this+problem%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%5Cend%7Bsubparts%7D%0A%0A%5Cend%7Bparts%7D%0A%0A%5Cquestion+Prove+that+the+real+part+of+all+non-trivial+zeros+of+the+function+%0A%5C%28%5Czeta%28z%29%5C%29+is+%5C%28%5Cfrac%7B1%7D%7B2%7D%5C%29%0A...%0A%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

يظهر الناتج من هذا الكود في الصورة أدناه — وتُضاف مقدمة مستند LaTeX تلقائيًا عندما تفتح الرابط:

![ExamEx3OLV2.png](/files/a61391d7c8db10b35840f7d3edf004fec05618cc)

البيئات `parts` و `subparts` توفّر قوائم متداخلة شبيهة بالأسئلة. وكما في الأسئلة يمكنك ضبط التباعد الرأسي يدويًا.

## أسئلة اختيار من متعدد

هناك أربعة بيئات لإنشاء أسئلة اختيار من متعدد.

```latex
\begin{questions}
\question أيٌّ من هؤلاء الفيزيائيين المشهورين اخترع الزمن؟

\begin{oneparchoices}
 \choice ستيفن هوكينغ
 \choice ألبرت أينشتاين
 \choice إيمي نوثر
 \choice هذا لا معنى له
\end{oneparchoices}

\question أيٌّ من هؤلاء الفيزيائيين المشهورين نشر ورقة عن الحركة البراونية؟

\begin{checkboxes}
 \choice ستيفن هوكينغ
 \choice ألبرت أينشتاين
 \choice إيمي نوثر
 \choice لا أعرف
\end{checkboxes}
\end{questions}
```

[افتح هذا المثال في Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=Multiple+choice+exam+example\&snip=%5Cdocumentclass%7Bexam%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bquestions%7D%0A%5Cquestion+Which+of+these+famous+physicists+invented+time%3F%0A%0A%5Cbegin%7Boneparchoices%7D%0A+%5Cchoice+Stephen+Hawking+%0A+%5Cchoice+Albert+Einstein%0A+%5Cchoice+Emmy+Noether%0A+%5Cchoice+This+makes+no+sense%0A%5Cend%7Boneparchoices%7D%0A++++%0A%5Cquestion+Which+of+these+famous+physicists+published+a+paper+on+Brownian+Motion%3F%0A%0A%5Cbegin%7Bcheckboxes%7D%0A+%5Cchoice+Stephen+Hawking+%0A+%5Cchoice+Albert+Einstein%0A+%5Cchoice+Emmy+Noether%0A+%5Cchoice+I+don%27t+know%0A%5Cend%7Bcheckboxes%7D%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

يظهر الناتج من هذا الكود في الصورة أدناه — وتُضاف مقدمة مستند LaTeX تلقائيًا عندما تفتح الرابط:

![ExamMulti.png](/files/7ad089efffe67b6241414cffb9c2fe503248f5e9)

في هذا المثال، استُخدمت بيئتان مختلفتان لسرد الخيارات الممكنة لأسئلة الاختيار من متعدد.

* البيئة `oneparchoices` توسم الخيارات بحروف كبيرة وتطبعها أفقيًا. إذا أردت طباعة الخيارات بصيغة شبيهة بالقائمة، فبيئة `choices` هي الخيار المناسب.
* البيئة `checkboxes` تطبع مربعات اختيار قبل كل خيار. إذا كنت بحاجة إلى طباعة الخيارات أفقيًا فاستخدم البيئة `oneparcheckboxes` بدلًا من ذلك.

## التقييم

ميزة مهمة أخرى في `exam` الفئة هي أنها توفر أوامر تجعل تقييم الامتحانات أسهل.

### النقاط في كل سؤال

يمكنك إضافة معامل إلى كل `\question` أو `\part` لطباعة عدد النقاط التي تحصل عليها عند الإجابة عنه بشكل صحيح. يمثّل المعامل الإضافي، داخل الأقواس، بعد السؤال أو الجزء، عدد النقاط المخصّصة له. يمكنك تغيير المظهر والمكان الذي تُطبع فيه النقاط، راجع [دليل المراجع](#reference-guide) للاطلاع على أوامر إضافية.

```latex
\begin{questions}
\question بالنظر إلى المعادلة \(x^n + y^n = z^n\) لـ\(x,y,z\) و\(n\)
أعداد صحيحة موجبة.
\begin{parts}
\part[10] لأي قيم لـ\(n\) تكون العبارة في السؤال السابق صحيحة؟
\vspace{\stretch{1}}

\part[10] عندما \(n=2\) توجد نظرية ذات اسم خاص. ما ذلك الاسم؟
\vspace{\stretch{1}}

\part[10] أي عالم رياضيات مشهور كان لديه برهان أنيق لهذه النظرية ولكن لم تكن
هناك مساحة كافية في الهامش لكتابته؟
\vspace{\stretch{1}}

\end{parts}

\question[20] احسب \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]

\vspace{\stretch{1}}
\end{questions}
```

[افتح هذا المثال في Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=Adding+points+to+exam+questions\&snip=%5Cdocumentclass%7Bexam%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bquestions%7D%0A%5Cquestion+Given+the+equation+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+for+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+positive%0Aintegers.+%0A%5Cbegin%7Bparts%7D%0A%5Cpart%5B10%5D+For+what+values+of+%5C%28n%5C%29+is+the+statement+in+the+previous+question+true%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart%5B10%5D+For+%5C%28n%3D2%5C%29+there%27s+a+theorem+with+a+special+name.+What%27s+that+name%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart%5B10%5D+What+famous+mathematician+had+an+elegant+proof+for+this+theorem+but+there+was%0Anot+enough+space+in+the+margin+to+write+it+down%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cend%7Bparts%7D%0A%0A%5Cquestion%5B20%5D+Compute+%5C%5B%5Cint_%7B0%7D%5E%7B%5Cinfty%7D+%5Cfrac%7B%5Csin%28x%29%7D%7Bx%7D%5C%5D%0A%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

يظهر الناتج من هذا الكود في الصورة أدناه — وتُضاف مقدمة مستند LaTeX تلقائيًا عندما تفتح الرابط:

![ExamEx4OLV2b.png](/files/f955c6c682ed72f88057a84039ccb1dfac717989)

### حساب النقاط وأنصاف النقاط

أحيانًا يكون من الملائم تضمين أنصاف النقاط كقيمة لأجزاء من السؤال. يمكنك فعل ذلك ثم طباعة قيمة السؤال كاملة. انظر المثال أدناه:

```latex
\documentclass[addpoints]{exam}
\begin{document}
\begin{questions}
\question بالنظر إلى المعادلة \(x^n + y^n = z^n\) لـ\(x,y,z\) و\(n\)
أعداد صحيحة موجبة.
\begin{parts}
\part[5] لأي قيم لـ\(n\) تكون العبارة في السؤال السابق صحيحة؟
\vspace{\stretch{1}}

\part[2 \half] عندما \(n=2\) توجد نظرية ذات اسم خاص. ما ذلك الاسم؟
\vspace{\stretch{1}}

\part[2 \half] أي عالم رياضيات مشهور كان لديه برهان أنيق لهذه النظرية ولكن كانت هناك
هناك مساحة كافية في الهامش لكتابته؟
\vspace{\stretch{1}}

\end{parts}

\droptotalpoints

\question[20] احسب \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]
\end{questions}
\end{document}
```

[افتح هذا المثال في Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=exam+package+counting+points+and+half+points\&snip=%5Cdocumentclass%5Baddpoints%5D%7Bexam%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bquestions%7D%0A%5Cquestion+Given+the+equation+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+for+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+positive%0Aintegers.+%0A%5Cbegin%7Bparts%7D%0A%5Cpart%5B5%5D+For+what+values+of+%5C%28n%5C%29+is+the+statement+in+the+previous+question+true%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+For+%5C%28n%3D2%5C%29+there%27s+a+theorem+with+a+special+name.+What%27s+that+name%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+What+famous+mathematician+had+an+elegant+proof+for+this+theorem+but+there+was%0Anot+enough+space+in+the+margin+to+write+it+down%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cend%7Bparts%7D%0A%0A%5Cdroptotalpoints%0A%0A%5Cquestion%5B20%5D+Compute+%5C%5B%5Cint_%7B0%7D%5E%7B%5Cinfty%7D+%5Cfrac%7B%5Csin%28x%29%7D%7Bx%7D%5C%5D%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

يظهر الناتج من هذا الكود في الصورة أدناه — وتُضاف مقدمة مستند LaTeX تلقائيًا عندما تفتح الرابط:

![ExamCountPointsOLV2.png](/files/435518d16181785d088f947522cd599ec15b8a80)

الأمر `\half` يضيف أنصاف نقاط إلى سؤال. الأمر `\droptotalpoints` يطبع العدد الإجمالي للنقاط الخاصة بآخر سؤال. لكي يعمل هذا الأمر الأخير يجب أن تضيف الخيار `[addpoints]` إلى عبارة فئة المستند.

### النقاط الإضافية

من الممكن إضافة أسئلة إضافية، وستظهر هذه النقاط الإضافية لاحقًا في [جدول التقييم](#grading-table). إن إضافة الأسئلة والأجزاء الإضافية بسيطة في الواقع مثل إنشاء أسئلة وأجزاء عادية.

```latex
\begin{questions}

\question بالنظر إلى المعادلة \(x^n + y^n = z^n\) لـ\(x,y,z\) و\(n\)
أعداد صحيحة موجبة.
\begin{parts}
\part[5] لأي قيم لـ\(n\) تكون العبارة في السؤال السابق صحيحة؟
\vspace{\stretch{1}}

\part[2 \half] عندما \(n=2\) توجد نظرية ذات اسم خاص. ما ذلك الاسم؟
\vspace{\stretch{1}}

\bonuspart[2 \half] أي عالم رياضيات مشهور كان لديه برهان أنيق لهذه النظرية ولكن كانت هناك
هناك مساحة كافية في الهامش لكتابته؟
\vspace{\stretch{1}}

\end{parts}

\droptotalpoints

\question[20] احسب \[\int_{0}^{\infty} \frac{\sin(x)}{x}\]

\vspace{\stretch{1}}

\bonusquestion[30] أثبت أن الجزء الحقيقي لجميع الأصفار غير التافهة للدالة
\(\zeta(z)\) هو \(\frac{1}{2}\)
\vspace{\stretch{1}}

\end{questions}
```

[افتح هذا المثال في Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=exam+package+and+bonus+points\&snip=%5Cdocumentclass%5Baddpoints%5D%7Bexam%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bquestions%7D%0A%0A%5Cquestion+Given+the+equation+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+for+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+positive%0Aintegers.+%0A%5Cbegin%7Bparts%7D%0A%5Cpart%5B5%5D+For+what+values+of+%5C%28n%5C%29+is+the+statement+in+the+previous+question+true%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+For+%5C%28n%3D2%5C%29+there%27s+a+theorem+with+a+special+name.+What%27s+that+name%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cbonuspart%5B2+%5Chalf%5D+What+famous+mathematician+had+an+elegant+proof+for+this+theorem+but+there+was%0Anot+enough+space+in+the+margin+to+write+it+down%3F%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cend%7Bparts%7D%0A%0A%5Cdroptotalpoints%0A%0A%5Cquestion%5B20%5D+Compute+%5C%5B%5Cint_%7B0%7D%5E%7B%5Cinfty%7D+%5Cfrac%7B%5Csin%28x%29%7D%7Bx%7D%5C%5D%0A%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cbonusquestion%5B30%5D+Prove+that+the+real+part+of+all+non-trivial+zeros+of+the+function+%0A%5C%28%5Czeta%28z%29%5C%29+is+%5C%28%5Cfrac%7B1%7D%7B2%7D%5C%29%0A%5Cvspace%7B%5Cstretch%7B1%7D%7D%0A%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

يظهر الناتج من هذا الكود في الصورة أدناه — وتُضاف مقدمة مستند LaTeX تلقائيًا عندما تفتح الرابط:

![ExamEx6OLV2file.png](/files/45cd9073fa025cb38d4a495edc900c4109987da2)

الأوامر `\bonusquestion` و `\bonuspart` يطبع `(إضافي)` إلى جانب قيمة النقاط الخاصة بالسؤال.

### جدول التقييم

يمكن طباعة جدول يوضح نقاط كل سؤال بأمر خاص.

```latex
\begin{center}
\combinedgradetable[h][questions]
\end{center}
```

![ExamEx7.png](/files/489d7abf51a607e0423e8d97f146cb404ddeeef2)

هناك ثلاثة أوامر لطباعة جدول الدرجات:

**\gradetable**

يطبع جدولًا يحتوي على الدرجات المقابلة للأسئلة العادية. إذا كانت هناك أسئلة إضافية فلا تُدرج.

**\bonusgradetable**

يطبع جدولًا يحتوي على الدرجات المقابلة للأسئلة الإضافية فقط

**\combinedgradetable**

يطبع جدولًا يحتوي على كلٍّ من الأسئلة العادية والإضافية.

تأخذ هذه الأوامر معلمتين إضافيتين، كل معلمة داخل أقواس.

* الأولى يمكن أن تكون `[h]` لجدول أفقي أو `[v]` لجدول عمودي.
* تحدد المعلمة الثانية كيفية فهرسة الجدول: `[questions]` لفهرسة النقاط حسب السؤال و `[pages]` لسرد النقاط حسب رقم الصفحة.

## مثال على مشروع امتحان في Overleaf

تم دمج الأمثلة السابقة لإنشاء قالب مشروع أساسي يمكنك استخدامه كنقطة بداية لعملك. يمكنك إنشاء مشروع جديد بالنقر/اختيار الرابط التالي: [افتح مثالًا لمشروع `exam` في Overleaf](https://www.overleaf.com/project/new/template/20093?id=68314645\&templateName=Example+project+using+the+exam+class\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=) .

### لغات أخرى

لا يوجد دعم للغات غير الإنجليزية في `exam` الفئة. ومع ذلك، من السهل ترجمة الكلمات الافتراضية إلى لغتك المحلية. يتضمن المشروع أعلاه مقتطف كود معلَّق يوضح كيفية ترجمة بعض عناصر المستند إلى الإسبانية.

```latex
\usepackage[spanish]{babel}

\pointpoints{punto}{puntos}
\bonuspointpoints{punto extra}{puntos extra}

\totalformat{Pregunta \thequestion: \totalpoints puntos}

\chqword{Pregunta}
\chpgword{Página}
\chpword{Puntos}
\chbpword{Puntos extra}
\chsword{Puntos obtenidos}
\chtword{Total}

...
```

![ExamEx8.png](/files/fc952fff8193c0de062e1d629cbddd424a7d013f)

بقية المستند ستكون مطابقة تمامًا لما هو معروض في الأمثلة السابقة. الأوامر المكتوبة هنا تغيّر الكلمات الافتراضية في `exam` الفئة.

**\pointpoints{punto}{puntos}**

تغيّر كلمتي point وpoints إلى الكلمتين punto وpuntos في الأسئلة العادية والأجزاء.

**\bonuspointpoints{punto extra}{puntos extra}**

تكتب punto extra وpuntos extras بدلًا من bonus point وbonus points في الأسئلة الإضافية والأجزاء الإضافية.

**\totalformat{Pregunta \thequestion: \totalpoints puntos}**

تغيّر النص الذي يطبعه \droptotalpoints. في المثال يطبع Pregunta 1: 7 1/2 puntos.

**\chqword{Pregunta}**

تغيّر كلمة Question إلى الكلمة Pregunta في جدول التقييم. تغيّر بقية الأوامر الكلمات الأخرى في ذلك الجدول: chpgword إلى Page، و\chpword إلى Points، و\chbpword إلى Bonus points، و\chsword إلى Score، و\chtword إلى Total. قد تتغير هذه الأوامر حسب نوع الجدول الذي تنشئه، راجع دليل المراجع للأوامر المطلوبة في الجداول الأخرى.

## دليل المراجع

### وضع علامة النقاط وتنسيقها للأسئلة

يمكن كتابة هذه الأوامر في المقدمة لتغيير تنسيق المستند كله، أو مباشرة قبل سؤال لتغيير التنسيق من ذلك السؤال حتى أمر التنسيق التالي أو نهاية المستند.

* `\poinstinmargin` (أو `\pointsinleftmargin`) سيؤدي إلى طباعة قيم النقاط في الهامش الأيسر.
* `\pointsinrightmargin` سيؤدي إلى طباعة قيم النقاط في الهامش الأيمن.
* `\nopointsinmargin` (أو `\nopointsinrightmargin`) ستعود إلى الحالة الافتراضية.
* `\bracketedpoints` سيستخدم أقواسًا مربعة بدلًا من الأقواس الدائرية حول قيم النقاط.
* `\boxedpoints` يرسم إطارًا حول قيم النقاط.

إليك مثالًا يستخدم `\pointsinmargin` و `\pointsinrightmargin`:

```latex
هنا سنستخدم \verb|\pointsinmargin|
\begin{questions}
\pointsinmargin
\question بالنظر إلى المعادلة \(x^n + y^n = z^n\) لـ\(x,y,z\) و\(n\)
أعداد صحيحة موجبة.
\begin{parts}
\part[5] لأي قيم لـ\(n\) تكون العبارة في السؤال السابق صحيحة؟
\vspace{40pt}

\part[2 \half] عندما \(n=2\) توجد نظرية ذات اسم خاص. ما ذلك الاسم؟
\vspace{40pt}

\part[2 \half] أي عالم رياضيات مشهور كان لديه برهان أنيق لهذه النظرية ولكن كانت هناك
هناك مساحة كافية في الهامش لكتابته؟

\vspace{40pt}
\end{parts}

الآن سنستخدم \verb|\pointsinrightmargin|

\pointsinrightmargin
\question بالنظر إلى المعادلة \(x^n + y^n = z^n\) لـ\(x,y,z\) و\(n\)
أعداد صحيحة موجبة.
\begin{parts}
\part[5] لأي قيم لـ\(n\) تكون العبارة في السؤال السابق صحيحة؟
\vspace{40pt}

\part[2 \half] عندما \(n=2\) توجد نظرية ذات اسم خاص. ما ذلك الاسم؟
\vspace{40pt}

\part[2 \half] أي عالم رياضيات مشهور كان لديه برهان أنيق لهذه النظرية ولكن كانت هناك
هناك مساحة كافية في الهامش لكتابته؟
أعداد صحيحة موجبة.
\end{parts}
\end{questions}
```

[افتح هذا المثال في Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=exam+class+with+point+in+margins\&snip=%5Cdocumentclass%5Baddpoints%5D%7Bexam%7D%0A%5Cusepackage%5Ba4paper%2C+total%3D%7B6in%2C+8in%7D%5D%7Bgeometry%7D%0A%5Cbegin%7Bdocument%7D%0AHere+we%27ll+use+%5Cverb%7C%5Cpointsinmargin%7C%0A%5Cbegin%7Bquestions%7D%0A%5Cpointsinmargin%0A%5Cquestion+Given+the+equation+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+for+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+positive%0Aintegers.+%0A%5Cbegin%7Bparts%7D%0A%5Cpart%5B5%5D+For+what+values+of+%5C%28n%5C%29+is+the+statement+in+the+previous+question+true%3F%0A%5Cvspace%7B40pt%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+For+%5C%28n%3D2%5C%29+there%27s+a+theorem+with+a+special+name.+What%27s+that+name%3F%0A%5Cvspace%7B40pt%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+What+famous+mathematician+had+an+elegant+proof+for+this+theorem+but+there+was%0Anot+enough+space+in+the+margin+to+write+it+down%3F%0A%0A%5Cvspace%7B40pt%7D%0A%5Cend%7Bparts%7D%0A%0ANow+we%27ll+use+%5Cverb%7C%5Cpointsinrightmargin%7C%0A%0A%5Cpointsinrightmargin%0A%5Cquestion+Given+the+equation+%5C%28x%5En+%2B+y%5En+%3D+z%5En%5C%29+for+%5C%28x%2Cy%2Cz%5C%29+and+%5C%28n%5C%29+positive%0Aintegers.+%0A%5Cbegin%7Bparts%7D%0A%5Cpart%5B5%5D+For+what+values+of+%5C%28n%5C%29+is+the+statement+in+the+previous+question+true%3F%0A%5Cvspace%7B40pt%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+For+%5C%28n%3D2%5C%29+there%27s+a+theorem+with+a+special+name.+What%27s+that+name%3F%0A%5Cvspace%7B40pt%7D%0A%0A%5Cpart%5B2+%5Chalf%5D+What+famous+mathematician+had+an+elegant+proof+for+this+theorem+but+there+was%0Anot+enough+space+in+the+margin+to+write+it+down%3F%0Aintegers.+%0A%5Cend%7Bparts%7D%0A%5Cend%7Bquestions%7D%0A%5Cend%7Bdocument%7D)

توضح الصورة التالية ناتج الكود أعلاه:

![Examclassmargins.png](/files/c1d61d05d3f3f7a821b130bb751370a94305fe37)

### تغيير الأسماء الافتراضية في جداول الدرجات

تعتمد الأوامر على التنسيق والمعلومات المعروضة في الجدول. إن **h** و **v** داخل كل أمر تعني اتجاهًا أفقيًا أو عموديًا. إذا سبق الأمر **b** فهذا يعني أنه يغيّر التنسيق في جدول إضافي، وإذا سبق الأمر **c** فهذا يعني أنه يعمل على الجداول المجمعة. على سبيل المثال، لتغيير كلمة "Score" في جدول إضافي عمودي إلى كلمتي "Points Awarded" يجب أن تستخدم `\bvsword{Points Awarded}`.

فيما يلي يُعرض جدول بالقيم الافتراضية.

|                          | **أفقي**                                                                                                                                                                                                             | **عمودي**                                                                                                                                                                                                        |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **جدول الدرجات**         | <p><code>\hqword{Question:}</code><br><code>\hpgword{Page:}</code><br><code>\hpword{Points:}</code><br><code>\hsword{Score:}</code><br><code>\htword{Total}</code></p>                                               | <p><code>\vqword{Question}</code><br><code>\vpgword{Page}</code><br><code>\vpword{Points}</code><br><code>\vsword{Score}</code><br><code>\vtword{Total:}</code></p>                                              |
| **جدول النقاط الإضافية** | <p><code>\bhqword{Question:}</code><br><code>\bhpgword{Page:}</code><br><code>\bhpword{Bonus Points:}</code><br><code>\bhsword{Score:}</code><br><code>\bhtword{Total}</code></p>                                    | <p><code>\bvqword{Question}</code><br><code>\bvpgword{Page}</code><br><code>\bvpword{Bonus Points}</code><br><code>\bvsword{Score}</code><br><code>\bvtword{Total:}</code></p>                                   |
| **الجدول المجمّع**       | <p><code>\chqword{Question:}</code><br><code>\chpgword{Page:}</code><br><code>\chpword{Points:}</code><br><code>\chbpword{Bonus Points:}</code><br><code>\chsword{Score:}</code><br><code>\chtword{Total}</code></p> | <p><code>\cvqword{Question}</code><br><code>\cvpgword{Page}</code><br><code>\cvpword{Points}</code><br><code>\cvbpword{Bonus Points}</code><br><code>\cvsword{Score}</code><br><code>\cvtword{Total:}</code></p> |

## قراءة إضافية

لمزيد من المعلومات، انظر:

* [إنشاء مستند في LaTeX](/latex/ar/asasyat-latex/01-learn-latex-in-30-minutes.md)
* [غامق، ومائل، وتسطير](/latex/ar/asasyat-latex/03-bold-italics-and-underlining.md)
* [القوائم](/latex/ar/asasyat-latex/04-lists.md)
* [التعابير الرياضية](/latex/ar/alryadhyat/01-mathematical-expressions.md)
* [الأسس السفلية والعليا](/latex/ar/alryadhyat/02-subscripts-and-superscripts.md)
* [الأقواس والقوسان](/latex/ar/alryadhyat/03-brackets-and-parentheses.md)
* [محاذاة المعادلات](/latex/ar/alryadhyat/06-aligning-equations-with-amsmath.md)
* [قائمة الحروف اليونانية والرموز الرياضية](/latex/ar/alryadhyat/11-list-of-greek-letters-and-math-symbols.md)
* [إدراج الصور](/latex/ar/mzyd-mn-almwdhwaat/27-inserting-images.md)
* [تموضع الصور والجداول](/latex/ar/alashkal-waljdawl/02-positioning-images-and-tables.md)
* [أحجام الخطوط، والعائلات، والأنماط](/latex/ar/alkhtwt/01-font-sizes-families-and-styles.md)
* [وجوه الخطوط](/latex/ar/alkhtwt/02-font-typefaces.md)
* [ال **exam** توثيق الفئة](https://mirror.ox.ac.uk/sites/ctan.org/macros/latex/contrib/exam/examdoc.pdf).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/ar/khas-balmjal/09-typesetting-exams-in-latex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
