latex-practice
Typesetting a Complete Paper
This chapter assembles all the knowledge from the previous ten chapters: using a multi-file project, typesetting a complete short paper with abstract, formulas, figures, tables, and references from scratch. It is recommended to follow along—watching is not the same as doing; walking through the whole process once makes LaTeX truly yours.
Project Structure
First plan the directory: skeleton separated from content, one file per chapter.
paper/
├── main.tex # Skeleton: preamble + assembling chapters in order
├── refs.bib # Reference database
├── figures/
│ └── fit.png # Figure
└── sections/
├── abstract.tex # Abstract
├── intro.tex # Introduction
├── method.tex # Method
├── result.tex # Experimental results
└── conclusion.tex# Conclusion
main.tex: Project Skeleton
The skeleton file does only three things: load packages, declare the title, and assemble the chapters in order.
Example: main.tex
\documentclass[12pt, a4paper]{ctexart}
% -------- Page layout and basic packages --------
\usepackage{geometry}
\geometry{margin=2.5cm}
\usepackage{amsmath, amssymb} % Math
\usepackage{graphicx} % Graphics
\usepackage{booktabs, multirow} % Three-line tables
\usepackage[colorlinks=true, linkcolor=blue,
citecolor=blue, urlcolor=blue]{hyperref}
% -------- Title information --------
\title{Research on Periodic Signal Fitting Based on Least Squares}
\author{UniResearch}
\date{\today}
\begin{document}
\maketitle
\input{sections/abstract} % Abstract
\input{sections/intro} % Introduction
\input{sections/method} % Method
\input{sections/result} % Experimental results
\input{sections/conclusion} % Conclusion
\bibliographystyle{plain}
\bibliography{refs} % References
\end{document}
Research on Periodic Signal Fitting Based on Least Squares
UniResearch
August 20, 2026
Abstract This paper studies parametric modeling of periodic signals. Based on the least squares criterion, the estimation procedure for the sinusoidal model is derived, and the method's effectiveness is verified on synthetic data. Experiments show that under low-noise conditions, the relative fitting error is below 1%.
Keywords: least squares; periodic signal; parameter estimation
Content of Each Chapter
Each file is just ordinary body text; the abstract and introduction are shown as examples.
Example: sections/abstract.tex
\begin{abstract}
This paper studies parametric modeling of periodic signals. Based on the least squares criterion, the estimation procedure for the sinusoidal model
$y = A\sin(\omega x + \varphi) + c$ is derived,
and the method's effectiveness is verified on synthetic data.
Experiments show that under low-noise conditions, the relative fitting error is below 1\%.
\medskip
\noindent\textbf{Keywords:} least squares; periodic signal; parameter estimation
\end{abstract}
Abstract This paper studies parametric modeling of periodic signals. Based on the least squares criterion, the estimation procedure for the sinusoidal model is derived, and the method's effectiveness is verified on synthetic data. Experiments show that under low-noise conditions, the relative fitting error is below 1%.
Keywords: least squares; periodic signal; parameter estimation
Example: sections/intro.tex
\section{Introduction}\label{sec:intro}
Periodic signals are widely found in communications, vibration analysis, and biomedical engineering;
parametric modeling of such signals is the common foundation for filtering, prediction, and compression~\cite{oppenheim1997}.
The classical least squares method provides a systematic solution framework for model parameter estimation~\cite{bjorck1996}.
The rest of this paper is organized as follows: Section~\ref{sec:method} establishes the model and gives the solution steps,
Section~\ref{sec:result} reports the experimental results, and Section~\ref{sec:conclusion} concludes.
1 Introduction
Periodic signals are widely found in communications, vibration analysis, and biomedical engineering; parametric modeling of such signals is the common foundation for filtering, prediction, and compression[2]. The classical least squares method provides a systematic solution framework for model parameter estimation[1].
The rest of this paper is organized as follows: Section 2 establishes the model and gives the solution steps, Section 3 reports the experimental results, and Section 4 concludes.
The method section holds formulas, and the experiment section holds figures and tables—you have already seen all the routines.
Example: sections/method.tex (formula part)
\section{Method}\label{sec:method}
Consider the following sinusoidal model:
\begin{equation}\label{eq:model}
y = A \sin(\omega x + \varphi) + c,
\end{equation}
where $A$ is amplitude, $\omega$ is angular frequency, $\varphi$ is initial phase, and $c$ is the DC component.
The goal of parameter estimation is to minimize the residual sum of squares
\begin{equation}\label{eq:loss}
S(A, \omega, \varphi, c)
= \sum_{i=1}^n \left( y_i - A \sin(\omega x_i + \varphi) - c \right)^2 .
\end{equation}
For fixed $\omega$, Eq.~\eqref{eq:loss} is a linear least squares problem with respect to the other parameters,
and can be solved directly by the normal equations.
2 Method
Consider the following sinusoidal model:
where is amplitude, is angular frequency, is initial phase, and is the DC component.
The goal of parameter estimation is to minimize the residual sum of squares
For fixed , Eq. (2) is a linear least squares problem with respect to the other parameters and can be solved directly by the normal equations.
Example: sections/result.tex (figures and tables part)
\section{Experimental Results}\label{sec:result}
Synthetic data were generated by sampling $n = 200$ points uniformly on $[0, 2\pi]$,
and Gaussian noise with standard deviation $0.05$ was added.
The comparison between the fitted curve and noisy sample points is shown in Figure~\ref{fig:fit},
and error metrics under different noise levels are shown in Table~\ref{tab:err}.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.65\textwidth]{figures/fit}
\caption{Fitted curve (solid line) and noisy sample points (scatter)}
\label{fig:fit}
\end{figure}
\begin{table}[htbp]
\centering
\caption{Root Mean Square Error under Different Noise Levels}
\label{tab:err}
\begin{tabular}{lccc}
\toprule
Noise Std. Dev. & 0.01 & 0.05 & 0.10 \\
\midrule
RMSE & 0.011 & 0.053 & 0.104 \\
Relative Error & 1.1\% & 5.3\% & 10.4\% \\
\bottomrule
\end{tabular}
\end{table}
\end{section}
3 Experimental Results
Synthetic data were generated by sampling points uniformly on , and Gaussian noise with standard deviation 0.05 was added. The comparison between the fitted curve and noisy sample points is shown in Figure 1; error metrics under different noise levels are shown in Table 1.

Figure 1: Fitted curve (solid line) and noisy sample points (scatter)
Table 1: Root Mean Square Error under Different Noise Levels
refs.bib contains two bibliographic entries, and the body cites \cite{oppenheim1997} and \cite{bjorck1996} (full syntax in Chapter 9).
Compilation and Output
For a multi-file project, only main.tex needs to be compiled; \input will expand automatically. The full workflow with bibliography:
$ cd paper
$ latexmk -xelatex main.tex # One-click completion (recommended)
# Or manually four steps: xelatex -> bibtex -> xelatex -> xelatex
First-page output (title area, abstract and keywords, introduction citation numbers):
\title{Research on Periodic Signal Fitting Based on Least Squares}
\author{UniResearch}
\date{\today}
\begin{abstract}
This paper studies parametric modeling of periodic signals. Based on the least squares criterion, the estimation procedure for the sinusoidal model
$y = A\sin(\omega x + \varphi) + c$ is derived,
and the method's effectiveness is verified on synthetic data.
Experiments show that under low-noise conditions, the relative fitting error is below 1\%.
\medskip
\noindent\textbf{Keywords:} least squares; periodic signal; parameter estimation
\end{abstract}
\section{Introduction}\label{sec:intro}
Periodic signals are widely found in communications, vibration analysis, and biomedical engineering;
parametric modeling of such signals is the common foundation for filtering, prediction, and compression~\cite{oppenheim1997}.
The classical least squares method provides a systematic solution framework for model parameter estimation~\cite{bjorck1996}.
The rest of this paper is organized as follows: Section~\ref{sec:method} establishes the model and gives the solution steps,
Section~\ref{sec:result} reports the experimental results, and Section~\ref{sec:conclusion} concludes.
Research on Periodic Signal Fitting Based on Least Squares
UniResearch
August 20, 2026
Abstract
This paper studies parametric modeling of periodic signals. Based on the least squares criterion, the estimation procedure for the sinusoidal model is derived, and the method's effectiveness is verified on synthetic data. Experiments show that under low-noise conditions, the relative fitting error is below 1%.
Keywords: least squares; periodic signal; parameter estimation
1 Introduction
Periodic signals are widely found in communications, vibration analysis, and biomedical engineering; parametric modeling of such signals is the common foundation for filtering, prediction, and compression[2]. The classical least squares method provides a systematic solution framework for model parameter estimation[1].
The rest of this paper is organized as follows: Section 2 establishes the model and gives the solution steps, Section 3 reports the experimental results, and Section 4 concludes.
Second-page output (formula numbering and references, floating figure, three-line table, conclusion, and references):
\section{Method}\label{sec:method}
Consider the following sinusoidal model:
\begin{equation}\label{eq:model}
y = A \sin(\omega x + \varphi) + c,
\end{equation}
where $A$ is amplitude, $\omega$ is angular frequency, $\varphi$ is initial phase, and $c$ is the DC component.
The goal of parameter estimation is to minimize the residual sum of squares
\begin{equation}\label{eq:loss}
S(A, \omega, \varphi, c)
= \sum_{i=1}^n \left( y_i - A \sin(\omega x_i + \varphi) - c \right)^2 .
\end{equation}
For fixed $\omega$, Eq.~\eqref{eq:loss} is a linear least squares problem with respect to the other parameters,
and can be solved directly by the normal equations; $\omega$ is determined by grid search over the interval $[\omega_{\min}, \omega_{\max}]$,
and the parameter combination that minimizes $S$ is selected.
\section{Experimental Results}\label{sec:result}
Synthetic data were generated by sampling $n = 200$ points uniformly on $[0, 2\pi]$,
and Gaussian noise with standard deviation $0.05$ was added.
The comparison between the fitted curve and noisy sample points is shown in Figure~\ref{fig:fit},
and error metrics under different noise levels are shown in Table~\ref{tab:err}.
\begin{figure}[htbp]
\centering
\includegraphics[width=0.65\textwidth]{figures/fit}
\caption{Fitted curve (solid line) and noisy sample points (scatter)}
\label{fig:fit}
\end{figure}
\begin{table}[htbp]
\centering
\caption{Root Mean Square Error under Different Noise Levels}
\label{tab:err}
\begin{tabular}{lccc}
\toprule
Noise Std. Dev. & 0.01 & 0.05 & 0.10 \\
\midrule
RMSE & 0.011 & 0.053 & 0.104 \\
Relative Error & 1.1\% & 5.3\% & 10.4\% \\
\bottomrule
\end{tabular}
\end{table}
\section{Conclusion}\label{sec:conclusion}
This paper decomposes sinusoidal fitting into two steps, "grid search + linear least squares,"
with a simple process and stable solution.
Future work will extend the method to multi-component harmonic signals,
and study automatic estimation of frequency initial values.
\begin{thebibliography}{9}
\bibitem{bjorck1996}
Åke Björck. \textit{Numerical Methods for Least Squares Problems}. SIAM, 1996.
\bibitem{oppenheim1997}
Alan V. Oppenheim and Alan S. Willsky. \textit{Signals and Systems}. Prentice Hall, 2 edition, 1997.
\end{thebibliography}
2 Method
Consider the following sinusoidal model:
where is amplitude, is angular frequency, is initial phase, and is the DC component.
The goal of parameter estimation is to minimize the residual sum of squares
For fixed , Eq. (2) is a linear least squares problem with respect to the other parameters and can be solved directly by the normal equations; is determined by grid search over the interval [ω_min, ω_max], and the parameter combination that minimizes is selected.
3 Experimental Results
Synthetic data were generated by sampling points uniformly on , and Gaussian noise with standard deviation 0.05 was added. The comparison between the fitted curve and noisy sample points is shown in Figure 1; error metrics under different noise levels are shown in Table 1.

Figure 1: Fitted curve (solid line) and noisy sample points (scatter)
Table 1: Root Mean Square Error under Different Noise Levels
4 Conclusion
This paper decomposes sinusoidal fitting into two steps, "grid search + linear least squares," with a simple process and stable solution. Future work will extend the method to multi-component harmonic signals and study automatic estimation of frequency initial values.
References
[1] Åke Björck. Numerical Methods for Least Squares Problems. SIAM, 1996.
[2] Alan V. Oppenheim and Alan S. Willsky. Signals and Systems. Prentice Hall, 2 edition, 1997.
Check a few "automation traces": the citation numbers [1] and [2] in the introduction correspond one-to-one with the references at the end; figures and tables each have their own numbers, and the body references "Figure 1" and "Table 1" are all correct; formulas (1) and (2) are referenced by \eqref in parenthesized form.
Modify any reference or number and rerun
latexmk; all numbers update automatically—this is the document that ten chapters of content bought you: "never manually check numbers again."
Real World: Start from a Template
In real paper writing, you should not build the skeleton from scratch—journals and schools provide ready-made templates.
| Template Source | Where to Find | Characteristics |
|---|---|---|
| Overleaf template library | Overleaf → Templates | Thousands of thesis, journal, and poster templates, open with one click |
| Journal official website | Journal Author Guidelines page | Submission-specified format; always follow this |
| School thesis template | School library / GitHub search "[school name] + thesis" | Meets school format review |
| GitHub | Search awesome-latex and similar collections | Community-maintained templates and resource summaries |
The one-sentence golden rule: Only fill in the placeholders, never touch the template structure. Those preamble settings in the template that you do not understand were tuned by others; deleting or changing one place may break the whole document.
Summary
| Aspect | Practice in This Chapter |
|---|---|
| Project organization | main.tex skeleton + sections/ chapters + figures/ images |
| Preamble | geometry, amsmath, graphicx, booktabs, hyperref |
| Body elements | Abstract, sections, formulas, figures/tables, cross-references, bibliography |
| Compilation | latexmk -xelatex in one step |
| Efficiency tip | Use official templates for real submissions; only fill content, do not change structure |