Complete step-by-step guide to creating your first LaTeX project. Learn project setup, document structure, compilation, and best practices for beginners.
This comprehensive guide walks you through creating your first LaTeX project from scratch, covering everything from initial setup to producing a polished PDF document.
Time to complete: 15-20 minutes Prerequisites: Access to LaTeX Cloud Studio or a LaTeX installation Outcome: A complete, well-structured LaTeX document
\documentclass[12pt, a4paper]{article}% Preamble - Package imports and settings\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}\usepackage[english]{babel}\usepackage{amsmath, amssymb, amsthm}\usepackage{graphicx}\usepackage[margin=1in]{geometry}\usepackage{hyperref}% Document metadata\title{My First LaTeX Document}\author{Your Name}\date{\today}% Document content\begin{document}\maketitle\begin{abstract}This is my first LaTeX document, demonstrating the basic structureand common elements used in academic writing.\end{abstract}\tableofcontents\newpage\section{Introduction}Welcome to LaTeX! This document will help you understand the basicsof document creation and formatting.\section{Getting Started}Let's explore the fundamental concepts and features of LaTeX.\subsection{Why Use LaTeX?}LaTeX offers several advantages:\begin{itemize} \item Professional typesetting \item Excellent mathematical notation \item Automatic numbering and references \item Consistent formatting\end{itemize}\section{Conclusion}You've successfully created your first LaTeX document!\end{document}
% Essential packages for any document\usepackage[utf8]{inputenc} % Input encoding\usepackage[T1]{fontenc} % Font encoding\usepackage[english]{babel} % Language support\usepackage{geometry} % Page layout\usepackage{graphicx} % Images\usepackage{hyperref} % Clickable links% Math and science\usepackage{amsmath, amssymb} % Math symbols and environments\usepackage{siunitx} % SI units% Tables and lists\usepackage{booktabs} % Professional tables\usepackage{enumitem} % List customization% References and citations\usepackage{biblatex} % Bibliography\addbibresource{references.bib} % Bibliography file
\usepackage{microtype} % Subtle typography improvements\usepackage{fontspec} % Custom fonts (XeLaTeX/LuaLaTeX)\usepackage{lmodern} % Latin Modern fonts\usepackage{setspace} % Line spacing control
Copy
Ask AI
\usepackage{microtype} % Subtle typography improvements\usepackage{fontspec} % Custom fonts (XeLaTeX/LuaLaTeX)\usepackage{lmodern} % Latin Modern fonts\usepackage{setspace} % Line spacing control
Copy
Ask AI
\usepackage{tikz} % Drawings and diagrams\usepackage{pgfplots} % Plots and charts\usepackage{subcaption} % Subfigures\usepackage{wrapfig} % Text wrapping
\section{Text Formatting Examples}% Basic formattingThis is \textbf{bold text}, \textit{italic text}, and \underline{underlined text}.You can also combine them: \textbf{\textit{bold italic}}.% Font sizes{\tiny tiny} {\small small} {\normalsize normal} {\large large} {\huge huge}% Emphasis and quotes\emph{Emphasized text} adapts to context. Use ``double quotes'' for quotations.% Paragraph formatting\paragraph{Named paragraph} This creates a named paragraph with special formatting.% Line breaks and spacingFirst line\\Second line with forced breakFirst paragraph.Second paragraph with extra spacing.
% Bullet points\begin{itemize} \item First item \item Second item \begin{itemize} \item Nested item \item Another nested item \end{itemize} \item Third item\end{itemize}% Numbered lists\begin{enumerate} \item First step \item Second step \item Third step\end{enumerate}% Description lists\begin{description} \item[LaTeX] A document preparation system \item[PDF] Portable Document Format \item[BibTeX] Bibliography management tool\end{description}% Custom lists with enumitem\usepackage{enumitem}\begin{enumerate}[label=(\alph*)] \item First item with (a) \item Second item with (b)\end{enumerate}
% In preamble\usepackage{biblatex}\addbibresource{references.bib}% In document\section{Literature Review}According to \textcite{knuth1984}, TeX is a typesetting system.The LaTeX system \parencite{lamport1994} builds upon TeX.Recent developments are discussed in \cite{modern2023}.% At document end\printbibliography
\documentclass[12pt, a4paper]{article}% ==================% PREAMBLE% ==================% Encoding and fonts\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}\usepackage{lmodern}% Language\usepackage[english]{babel}% Page layout\usepackage[margin=1in]{geometry}\usepackage{setspace}\onehalfspacing% Graphics and color\usepackage{graphicx}\usepackage[dvipsnames]{xcolor}% Math packages\usepackage{amsmath, amssymb, amsthm}% Tables\usepackage{booktabs}\usepackage{array}% References\usepackage{hyperref}\hypersetup{ colorlinks=true, linkcolor=blue, citecolor=green, urlcolor=red}% Bibliography\usepackage{biblatex}\addbibresource{references.bib}% Custom commands\newcommand{\R}{\mathbb{R}}\newcommand{\important}[1]{\textcolor{red}{\textbf{#1}}}% Theorem environments\newtheorem{theorem}{Theorem}[section]\newtheorem{lemma}[theorem]{Lemma}% Document info\title{A Complete LaTeX Project Example}\author{Your Name\\\small Department of Computer Science\\\small University Name}\date{\today}% ==================% DOCUMENT BODY% ==================\begin{document}\maketitle\begin{abstract}This document demonstrates a complete LaTeX project structure,including all common elements used in academic writing. It servesas a template for creating professional documents.\end{abstract}\tableofcontents\newpage\section{Introduction}\label{sec:intro}LaTeX is a powerful typesetting system particularly suited fortechnical and scientific documentation. This document demonstratesits capabilities through practical examples.\subsection{Motivation}The motivation for using LaTeX includes:\begin{itemize} \item Superior mathematical typesetting \item Consistent document formatting \item Excellent bibliography management \item Cross-platform compatibility\end{itemize}\section{Mathematical Content}\label{sec:math}\subsection{Equations}The quadratic equation \cite{mathbook2020} is given by:\begin{equation} ax^2 + bx + c = 0 \label{eq:quadratic}\end{equation}The solutions to Equation~\eqref{eq:quadratic} are:\begin{equation} x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\end{equation}\subsection{Theorems}\begin{theorem}[Pythagorean Theorem]\label{thm:pythagoras}In a right triangle with legs $a$ and $b$ and hypotenuse $c$:\begin{equation} a^2 + b^2 = c^2\end{equation}\end{theorem}\begin{proof}The proof follows from geometric considerations...\end{proof}\section{Tables and Figures}\label{sec:visual}\subsection{Tables}Table~\ref{tab:results} shows experimental results.\begin{table}[htbp] \centering \caption{Experimental results} \label{tab:results} \begin{tabular}{lccc} \toprule Method & Accuracy & Precision & Recall \\ \midrule Baseline & 0.85 & 0.82 & 0.88 \\ Improved & 0.92 & 0.90 & 0.94 \\ \important{Proposed} & \important{0.96} & \important{0.95} & \important{0.97} \\ \bottomrule \end{tabular}\end{table}\subsection{Figures}Figure~\ref{fig:example} shows an example image.\begin{figure}[htbp] \centering \includegraphics[width=0.6\textwidth]{example-image} \caption{Example figure with caption} \label{fig:example}\end{figure}\section{Code Listings}\label{sec:code}Here's an example algorithm:\begin{verbatim}def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)\end{verbatim}\section{Conclusion}\label{sec:conclusion}This document has demonstrated the essential elements of a LaTeXproject. For more information, see \cite{latex2023}.\printbibliography\appendix\section{Additional Resources}\begin{itemize} \item Official LaTeX documentation \item TeX Stack Exchange \item LaTeX Wikibook\end{itemize}\end{document}
Congratulations! You’ve successfully created your first LaTeX project. Continue exploring our guides to master advanced features and create professional documents.