% Free sample LaTeX file from 99helpers.com/file-types/tex % Build it with: pdflatex sample-article.tex (run it twice, see comment 9) % A % sign starts a comment: everything after it on the line is ignored. % 1. The document class: article, on A4 paper, 11 pt body text. \documentclass[a4paper,11pt]{article} % 2. The preamble: packages that add features, loaded before the text. \usepackage[utf8]{inputenc} % read the file as UTF-8 (default since 2018) \usepackage[margin=25mm]{geometry} \usepackage{amsmath} % equation environments such as align \usepackage{booktabs} % proper rules for tables \usepackage{tikz} % drawing pictures with code \usetikzlibrary{positioning} % placement such as right=of \usepackage{microtype} % finer spacing and fewer bad line breaks \usepackage[hidelinks]{hyperref}% clickable links and PDF bookmarks; load last % 3. Metadata: used by \maketitle and stored in the PDF by hyperref. \title{A Sample \LaTeX{} Article} \author{Ada Example} \date{27 October 2026\\[4pt]\small Free sample from 99helpers.com/file-types/tex} \hypersetup{ pdftitle={A Sample LaTeX Article}, pdfauthor={Ada Example}, pdfsubject={Free sample LaTeX file from 99helpers.com/file-types/tex}, } % 4. A macro of your own: \file{name} sets a file name in typewriter type. \newcommand{\file}[1]{\texttt{#1}} \begin{document} \maketitle \begin{abstract} This article is a sample \LaTeX{} source file. It shows the parts most documents use: sections, mathematics, a table, a figure drawn with Ti\emph{k}Z, cross-references and a bibliography. Read the source next to the PDF to see which commands produced what. \end{abstract} % 5. Sections are numbered automatically; \label names them for references. \section{Introduction}\label{sec:intro} \TeX{} was written by Donald Knuth to typeset mathematics well~\cite{knuth84}. \LaTeX{} adds commands for structure, so authors mark up \emph{what} each part is and the class decides how it looks~\cite{lamport94}. Section~\ref{sec:maths} shows some mathematics, Table~\ref{tab:engines} compares engines and Figure~\ref{fig:cycle} shows the build cycle. \section{Mathematics}\label{sec:maths} % 6. Maths: $...$ inside a line, equation and align environments on their own. Inline maths sits in the text, like $e^{i\pi} + 1 = 0$ or $\sum_{k=1}^{n} k = \frac{n(n+1)}{2}$. Displayed equations get a number: \begin{equation}\label{eq:gauss} \int_{-\infty}^{\infty} e^{-x^2}\,\mathrm{d}x = \sqrt{\pi}. \end{equation} The \file{align} environment lines up several equations at the \verb|&|: \begin{align} (a+b)^2 &= a^2 + 2ab + b^2, \label{eq:square}\\ \nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0}. \end{align} Equation~\eqref{eq:gauss} is the Gaussian integral; \eqref{eq:square} expands a square. \section{A table} % 7. A floating table: LaTeX places it where it fits, often at the top of a page. \begin{table}[htbp] \centering \caption{Three common \TeX{} engines}\label{tab:engines} \begin{tabular}{@{}lll@{}} \toprule Engine & Output & Fonts \\ \midrule pdf\TeX & PDF & Type~1, 8-bit encodings \\ Xe\TeX & PDF & System OpenType and TrueType, Unicode \\ Lua\TeX & PDF & OpenType, Unicode, scriptable in Lua \\ \bottomrule \end{tabular} \end{table} \section{A figure} Figure~\ref{fig:cycle} has no image file: it is drawn by Ti\emph{k}Z commands in the source, so it stays sharp at any zoom. % 8. A figure drawn with TikZ: no image file, the picture is code. \begin{figure}[ht] \centering \begin{tikzpicture}[ box/.style={draw, rounded corners, minimum width=24mm, minimum height=9mm, font=\small}, >=stealth, node distance=8mm] \node[box] (tex) {\file{article.tex}}; \node[box, right=of tex] (engine) {pdflatex}; \node[box, right=of engine] (pdf) {\file{article.pdf}}; \node[box, below=of engine] (aux) {\file{.aux .log .toc}}; \draw[->] (tex) -- (engine); \draw[->] (engine) -- (pdf); \draw[->] (engine.south west) to[bend right=20] (aux.north west); \draw[->] (aux.north east) to[bend right=20] node[right, font=\footnotesize] {next run} (engine.south east); \end{tikzpicture} \caption{The build cycle: each run writes auxiliary files that the next run reads.} \label{fig:cycle} \end{figure} % 9. Cross-references: \ref and \cite are resolved from the .aux file, % so the first run prints ?? and a second run fills in the numbers. \section{Building this file} Run \file{pdflatex} twice. The first run writes labels and citations to \file{sample-article.aux}; the second reads them back, which is how Section~\ref{sec:intro} and page~\pageref{fig:cycle} get their numbers. % 10. The bibliography: thebibliography needs no BibTeX run. \begin{thebibliography}{9} \bibitem{knuth84} Donald E. Knuth. \emph{The \TeX book}. Addison-Wesley, 1984. \bibitem{lamport94} Leslie Lamport. \emph{\LaTeX: A Document Preparation System}. 2nd edition, Addison-Wesley, 1994. \end{thebibliography} \end{document}