LaTeX Table of Contents Customization: Everything You Need to Know

📅 12 April 2024 👁️ المشاهدات: 315


📘 نبذة عن الدرس

📄 ماذا ستجد في هذه الصفحة؟

• ملف الدرس بصيغة PDF يمكنك معاينته هنا مباشرةً دون تنزيله.

• يمكنك تنزيل الملف من زر التحميل أسفل الصفحة والاحتفاظ به على جهازك.

• ستجد أيضًا دروسًا وامتحانات وتمارين ذات صلة تساعدك على المراجعة وتعميق الفهم.

• أُدرج مصدر LaTeX الكامل أسفل الصفحة لتتمكن من الاطلاع عليه أو تعديله والاستفادة منه.

• هل تحتاج تنسيقًا احترافيًا لموادك الخاصة؟ أقدم خدمة كتابة LaTeX — أرسل المحتوى المطلوب لتحصل على ملف PDF منسق وملف المصدر.

معاينة ملف الدرس لمادة latex، المستوى templates





\documentclass{article}

% Required packages
\usepackage{lipsum} % For generating dummy text
\usepackage{titletoc} % For customizing TOC
\usepackage{etoc} % For advanced control over TOC

\usepackage{hyperref}

\hypersetup{
    colorlinks=true,
    linkcolor=black
}

% Change depth of sections
\setcounter{tocdepth}{3} % Include subsubsections

% Customize formatting
\titlecontents{section}[0pt]{\bfseries}{\thecontentslabel\quad}{}{\hfill\bfseries\contentspage}



\begin{document}

% Change TOC title
\renewcommand{\contentsname}{My Table of Contents with dots}

\tableofcontents

% Change dots to spaces in TOC
\makeatletter
\renewcommand{\@dotsep}{10000} % Set dot separation to a large negative value
\makeatother

\renewcommand{\contentsname}{My Table of Contents with spaces}

\tableofcontents

\hypersetup{
    linkcolor=red
}
\renewcommand{\contentsname}{Change toc colors with hyperref}


\tableofcontents


\clearpage

\section{Section 1}
\lipsum[1]

\subsection{Subsection 1.1}
\lipsum[2]

\subsubsection{Subsubsection 1.1.1}
\lipsum[3]

\subsubsection{Subsubsection 1.1.2}
\lipsum[4]

\subsection{Subsection 1.2}
\lipsum[5]

\section{Section 2}
\lipsum[6]

\subsection{Subsection 2.1}
\lipsum[7]

\subsubsection{Subsubsection 2.1.1}
\lipsum[8]

\subsubsection{Subsubsection 2.1.2}
\lipsum[9]

\subsection{Subsection 2.2}
\lipsum[10]

\end{document}


📂 تصفّح جميع موارد مادة latex للمستوى templates

موارد ذات صلة: دروس وامتحانات وتمارين



يمكنك الاطلاع على المزيد من موارد latex للمستوى templates.

اترك تعليقًا

الحد الأقصى 5000 حرف.