In our previous article, we discussed how to create a title page using LaTeX. In this post, we’ll tackle one of the first challenges you’ll encounter in writing a thesis with LaTeX: creating sections and subsections. There are two types of heading structures we’ll cover: those with numbering and those without.
Headings with numbers are used for major sections like Introduction, Model, and Conclusion. Headings without numbers are typically used for sections like References and Appendix. You can create numbered headings using \section{}
and if you want them without numbering, you can use \section*{}
by adding an asterisk (*) to the command. Subsections can be created similarly using \subsection{} and \subsection*{}
for those without numbering. These are second-degree headings. If you want to add third-degree headings, you can use \subsubsection{}
and \subsubsection*{}
. All numbered headings you create in this way will automatically be added to the table of contents. For headings without numbers, you can add them to the table of contents using the \addcontentsline{toc}{section}{}
command.
\addcontentsline{toc}{section}{Unnumbered Title} \section*{Unnumbered Title}
Example of Creating Sections and Subsections
Let’s provide a complete example of creating sections and subsections. You can directly add this content to your LaTeX document and run it to see the output.
\documentclass{article} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \begin{document} \section{Introduction} Lorem ipsum dolor sit amet, consectetur adipiscing elit. In semper fringilla lectus, vel pellentesque orci facilisis ac. Aliquam quis imperdiet sem. Praesent tempus lacinia enim, quis suscipit urna finibus ac. Proin id tortor porttitor, maximus elit ut, semper mi. \section{Literature Review} Cras a sapien vel leo dictum convallis. Vivamus auctor condimentum faucibus. Donec vitae dolor et urna condimentum pretium. Integer vel magna quam. Sed neque orci, imperdiet sit amet viverra vel, pretium ac orci. \section{Model} \subsection{Introduction to the Model} Lorem ipsum dolor sit amet, consectetur adipiscing elit. In semper fringilla lectus, vel pellentesque orci facilisis ac. Aliquam quis imperdiet sem. Praesent tempus lacinia enim, quis suscipit urna finibus ac. Proin id tortor porttitor, maximus elit ut, semper mi. \subsection*{Results of the Model} Cras a sapien vel leo dictum convallis. Vivamus auctor condimentum faucibus. Donec vitae dolor et urna condimentum pretium. Integer vel magna quam. Sed neque orci, imperdiet sit amet viverra vel, pretium ac orci. \end{document}
In this example, we’ve assumed that the document consists of three chapters: Introduction, Literature Review, and Model. Under the Model chapter, we’ve added two subsections as examples. The first subsection, “Introduction to the Model,” is numbered, while the second subsection, “Results of the Model,” is not numbered.
When you compile the above example, you’ll get the output shown in the image below.
Adding numbered sections and subsections will automatically include them in the table of contents. If you plan to add fourth-degree headings or deeper, you’ll need to add additional commands for them to appear in the table of contents.
Feel free to ask us any questions if you encounter any problems while writing your thesis, article, assignment, or project with LaTeX. Learning to write with LaTeX can be a challenging and time-consuming process. If you don’t have the time or expertise, we can help you convert your handwritten or text editor documents into LaTeX. You can find more information about what we do on our services page. For inquiries about pricing, delivery, or any other questions related to LaTeX thesis writing, please contact us.