How to Write a Thesis in LaTeX: Getting-Started Steps and Typesetting Essentials
Build a LaTeX paper skeleton from scratch, explaining how to write the document class, sections and cross-references, figures, tables and formulas, and references, and provide methods for compiling and proofreading a Chinese paper.
Key Points of This Article
- For Chinese theses, first choose a document class that supports Chinese. If the school provides a template, use it directly; do not configure fonts from scratch.
- In the body, write only content and structural markup. Use commands to define chapter levels, and let LaTeX generate numbering and references automatically.
- Wrap figures, tables, and formulas each in a floating environment or display environment, and add
labelandrefso they can be cross-referenced in the text. - Manage references with a BibTeX database, cite them in the body with
cite, and run the compilation several times in a fixed order during building. - After each modification, check the compilation log, cross-references, and headers and footers, and confirm there are no undefined references or overflowing tables.
Many people first encounter LaTeX because their advisor or school requires them to submit papers in it. Faced with a blank file full of backslash commands, curly braces, and error messages they can't understand, it's easy not to know where to start. People who search for "how to write a paper in LaTeX" usually already have a paper to write; what they need is not advice on choosing tools, but a writing method they can follow step by step to set everything up.
This article is written for readers with no typesetting experience who are preparing a graduation thesis or journal manuscript in LaTeX. After reading it, you should be able to build a complete paper skeleton, know how to write the body text, figures and tables, formulas, and references, and know where to look first when compilation fails. Where the article covers Chinese typesetting, it uses XeLaTeX as the example; differences for other compilation methods are noted where relevant.
How do I start writing a paper in LaTeX? One-sentence conclusion
First look for the template provided by the school or journal and edit the content within it. If there is no template, use a document class that supports Chinese to set up the preamble, then fill in the chapters step by step. The table below gives the approach for common situations.
| Your situation | Recommended Practices | Cause |
|---|---|---|
| The school or journal provides an official template. | Write directly on the template, without changing the layout commands. | The formatting requirements are already built in; making changes can easily lead to non-compliance with the specifications. |
| Without a template, write a Chinese essay. | Use a document class that supports Chinese, and compile with XeLaTeX. | Chinese fonts and punctuation require special handling; the default English configuration cannot display them correctly. |
| The paper is very long and has multiple chapters. | Use the book document class, put each chapter in its own file, and bring them in with \include. | Split the document into files for easier editing, so that only the current chapter needs to be recompiled. |
| There are many references. | Manage with a BibTeX database, cite in the body text with \cite | Numbering and formatting are generated automatically; adding or deleting references does not require manually changing the sequence numbers. |
| Write only short reports or assignments | Use the article class; a single file is enough. | The structure is simple, so there is no need to split it up. |
Before You Begin: Confirm These Points
Clarify the following points before you start, so that there will be far less rework later.
- School or journal formatting requirements. Thesis margins, font sizes, heading styles, and reference formats are often strictly specified. First check whether a template is provided; it is usually more reliable than configuring everything yourself.
- Compilation method. Chinese theses generally require XeLaTeX or LuaLaTeX. If the template specifies a compiler, follow the template and do not mix engines.
- Local TeX environment. Install a common TeX distribution and make sure the compiler can be invoked properly from the command line or your editor. If a package is missing, the compilation log will indicate which one.
- File organization. Place images in a separate folder, keep the bibliography database in its own .bib file, and split the main text by chapter. Use relative paths throughout so links won't break when you move to another computer.
- Encoding and fonts. Save all source files in UTF-8 encoding. Font names vary by system, so for Chinese font settings it is best to keep the defaults provided by the template or document class, and only modify them when necessary.
Steps to Set Up a Paper Skeleton in LaTeX
The steps below apply when there is no official template and you need to build the structure yourself. If you already have a template, you can skip the first two steps and start directly with filling in the content.
- Choose the document class and write the preamble. Write
\documentclassat the top of the file. For a long Chinese document, you can use the book class or the article class, both of which support Chinese. The preamble is the part before\begin{document}. It holds package imports and global settings. - Load the necessary packages. Commonly used ones cover Chinese support, math formulas, images, tables, hyperlinks, and bibliographies. Load only the packages you actually need, avoid conflicts between them, and troubleshoot errors one at a time.
- Fill in the title, author, and abstract. Set the basic information with
\title,\author, and\date, then generate the title page at the start of the body with\maketitle. Place the abstract inside the abstract environment. - Generate the table of contents. Write
\tableofcontentsafter the title page. The table of contents is generated automatically when you compile. Each time you add a section, the table of contents updates accordingly, so you don't need to maintain it manually. - Use commands to write the body at different levels. Chapters use
\chapter(in the article class,\section), sections use\section, and subsections use\subsection. LaTeX calculates the numbering automatically, so don't type numbers into the headings yourself. - Insert figures and tables and add labels. Wrap figures in the figure environment. Use
\includegraphicsto include an image,\captionto write the caption, and\labelto set a label. Wrap tables in the table environment, and use the tabular environment for the table body. In the text, use\refto reference numbers, which update automatically as chapters and sections are added or removed. - Write formulas. Use
$...$for inline formulas, the equation environment for display formulas on their own line, and the align environment when multiple lines need alignment. Equation numbers can also be referenced with\labeland\eqref. - Add references and compile. Write the bibliography information as entries in a .bib file, cite them in the text with
\cite, and specify the database and style at the end of the document with\bibliography. The usual compilation order is: run XeLaTeX first, then run BibTeX or Biber to process the references, and finally run XeLaTeX twice more to resolve cross-references.
Verify item by item after completion
The first successful PDF generation is only the beginning; before the formal submission, it is recommended to check each item one by one.
| Inspection item | How do you look at it? | What should I do if I have a problem? |
|---|---|---|
| Compilation log | Check whether there are any errors such as "Error" and "Undefined control sequence". | Go back to the source file at the line number in the error report and fix it there. If a package is missing, add the corresponding \usepackage. |
| Cross-reference | Search for ??, which indicates an unresolved reference | Check that the label names are spelled consistently, and compile one more time. |
| References | Check whether the reference numbers cited in the body text correspond one-to-one with the list at the end of the document. | Verify that the citation keys in the .bib file match those used in \cite, then re-run BibTeX or Biber. |
| Chart Position and Size | Page through each page and check whether figures or charts have been pushed too far onto the next page, and whether tables extend beyond the text block (type area). | Adjust the position parameters of the figure; when the table is too wide, reduce the font size or switch to a line-wrapped column format. |
| Table of Contents and Header | Check whether the directory (table of contents) headings match the body section headings, and whether the section names in the page headers are correct. | Modify the title, then recompile; if necessary, check the header settings in the template. |
| Chinese display | Check whether punctuation, heading fonts, and characters display correctly. | Confirm that XeLaTeX or LuaLaTeX is being used, and whether the font configuration has been inherited from the template. |
If the body text contains machine-translated or OCR-processed content, such as paragraphs copied from a foreign-language PDF, verify each paragraph against the original before submission to confirm that terms and numbers have not been mistranslated or misrecognized.
📝 Summary
Writing a thesis in LaTeX works best when you first build the structure and then fill in the content: set up the preamble, use commands to define chapter and section levels, and insert figures, tables, formulas, and references in their standard formats. If your school provides a template, follow the template. When compilation fails, check the log first, then go through cross-references and bibliography entries one by one. If you need online editing or conversion to and from Word, you can refer to the LaTeX round-trip editing feature offered by app.unidoc.top.
❓ Frequently Asked Questions (FAQ)
1. Do I need to learn many commands before writing a LaTeX paper?
Not necessary. At the beginner stage, mastering section commands, figure and table environments, formula environments, and the cite command is enough. The remaining commands can be looked up when needed. Many people learn by looking things up as they write.
2. Why won't my Chinese thesis compile, or why do the Chinese characters show up as boxes?
Most of the time, the compiler has been set incorrectly. Chinese text usually requires compiling with XeLaTeX or LuaLaTeX, and the preamble must load a Chinese support package. If the template is already configured, simply use the compilation method specified by the template.
3. Where should images be placed, and how should the paths be written?
It is recommended to put the images in a folder at the same level as the .tex file, write the relative path in \includegraphics, for example figures/fig1.pdf. This way, the entire project will still compile normally when moved to another computer.
4. Why are there citations in the text but no references at the end?
Usually the bibliography was not processed by BibTeX or Biber, or the keys in the .bib file do not match those used in \cite. Re-run the compilation in the correct order and check the spelling of the keys.
5. Migrating a Thesis from Word to LaTeX: How Should the Content Be Moved?
You can first organize the body text by chapter as plain text, then place each paragraph into the corresponding chapter command, and handle figures, tables, and formulas separately. Conversion tools can help with part of the formatting, but formulas and tables usually need manual checking, so be sure to compare the result against the original manuscript after conversion.
Open OmniDoc to edit, convert, or translate your LaTeX documents


