Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to write a book in LaTeX? [duplicate]

I wish to turn several of my blog article series into a PDF e-book but I have never used LaTeX before for creating books.

For example, I want to take my Awk One-Liners Explained article series, improve it and turn it into a book.

I'll probably start with this guide that I found - But that is just a small template. Any other tips, tricks and suggestions for doing it?

doncherry's user avatar

3 Answers 3

I think that you should try using either scrbook or the memoir document class. They are designed for this kind of work. IMHO Memoir has better documentation so you'll propably find it easier to configure it the way you want it.

There is also memdesign , which used to be part of the documentation of memoir.

pmav99's user avatar

If you don't have TeX habbits yet, I'd recommend using Koma-Script's scrbook right away instead of the book class.

Also, you might want to have syntax highliting for your examples. I'd recommended using minted for that, as it is quite flexible and powerful.

raphink's user avatar

From the comments,

Andrew, I am going to copy/paste the text into Latex file, I think. And then re-format it so it actually looked good. – Peteris Krumins

It would be absolutely heretical and the greatest of programming sins for a blog that focuses on programming to cut and paste content from a CMS into a LaTeX text file!

TeX is more than just a typesetting system. It's a full-fledged programming language and Turing complete. Although it might arguably at first glance appear insane to have a Turing complete programming language for a task like typesetting it makes sense the more you explore the needs of a typesetting system.

No other software implemented in the 1970s remains absolutely and unquestionably dominant in its domain other than TeX and the collection of macros known as LaTeX, which was developed in the eighties. The typesetting algorithms developed by Knuth and the glue-and-boxes model of text layout was a piece of absolute genius. One of the most masterful examples of capturing an extremely complex problem using an extremely simple model. It's beautiful and you are now using it in a somewhat different and handicapped way to display content within a browser. This is the part of TeX that is amazingly, gloriously, magnificently brilliant.

Welcome to our community, pick up a bit of skills in TeX/LaTeX programming and use whatever language you are comfortable with to pick up the content from your database and automatically generate the LaTeX content. For a person with your computer skills it shouldn't take more than two weekends.

Here is some code for inspiration:

Yiannis Lazarides's user avatar

Not the answer you're looking for? Browse other questions tagged books or ask your own question .

Hot Network Questions

write book latex

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

Books are long documents used for a large variety of purposes, such as for novels, non-fiction works, textbooks and cookbooks. The large amount of content is usually organized using extensive sectioning, a table of contents/figures/tables, an index and cross-references. Custom page types such as copyright pages and parts pages are used to describe and separate content and a bibliography is used to cite references used in the document body. This variety of document elements makes books one of the most complicated document types to typeset. Fortunately, LaTeX easily handles very large documents with complex referencing and large numbers of figures and tables so you can focus on writing rather than formatting.

write book latex

The Legrand Orange Book

This book template can be used for writing anything from fiction, to technical documentation, to advanced mathematics, due to its extensive examples of document elements and many levels of sectioning. A key feature of the template is the orange theme, parts pages and chapter images which give the template its unique aesthetic.

This template is designed for writing books and graduate-level theses and provides numerous examples and documentation to enable complex requirements. The design features a relatively narrow main text column with an adjacent wide margin to house notes, figures, tables, citations and captions.

This ebook template is for those wishing to create a book in a format that is easily readable on electronic screens. To facilitate this, the template features a layout with narrow margins and a large font size to use as much of your screen real estate as possible. Each page features a header with the author and title of the book, as well as a page count at the bottom to indicate progress. Book content can be divided by parts, chapters, sections, subsections and subsubsections. The spacious table of contents lets you rapidly select a chapter or part and takes you to it with a click. The large background image in the title page makes your book easily identifiable when browsing a large number of PDFs in a folder.

Tufte-Style Book

This book template has been designed to conform to Edward R. Tufte’s design style, used in his books and handouts. The most defining feature of this design is the large margin on every page and extensive use of sidenotes. This layout means that the central column of text is uncluttered since further descriptions and citations are housed in the margin. Tufte’s design style does not end there and numerous other typographic and layout tweaks are present in this template and are described in the documentation template.

write book latex

LaTeX Templates Information

General enquiries [email protected]

Most templates licensed under CC BY-NC-SA 4.0

LaTeX Templates is developed in New Zealand

© Creodocs Limited. All Rights Reserved.

Stack Exchange Network

Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Writing Stack Exchange is a question and answer site for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing. It only takes a minute to sign up.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Do Writers Use LaTex/TeX for writing?

I'm quite interested in the LaTex/TeX system and am wondering if any other fellow writers use it frequently to write in.

Dori's user avatar

15 Answers 15

For longer pieces, especially those with figures, tables, contents, or internal references, or citations.

For shorter pieces (such as an essay) I'd do it in Word or OpenOffice, since I normally don't need the power of Latex and getting it laid out properly won't involve much work.

Any writing of decent size, I use LaTeX because:

I only worry about content and not layout. If I'm writing a scientific paper, thesis, or dissertation, there is usually a latex style that I can apply once the content is there. If I need to apply a different layout (ie: change from two-column to one column), change figure titles, etc) this is as simple as applying a different style.

Managing internal references. Word does it but it's always been a pain personally to use. Latex handles it elegantly.

Citations. BibTex is awesome and works with pretty much every reference management software out there.

No mouse necessary. Latex has one hell of a learning curve. Making changes to layout can drive you to bang your head against a wall. However, once you've become comfortable with it, your output can speed up heavily. You stop thinking about formatting while you're writing. You don't worry about selecting the correct bullets, or making sure things are indented properly. You simply write text and put markers that define what that content is (chapter, section, caption, etc). Your style handles the rest.

Version control. Because Latex files are pure text, they go very easily with version controls and diff. Seeing changes between versions shows you exactly what changed.

Cross platform and repeatability. Because it's all text, you can edit it anywhere. Including vi through a shell. Latex will also always produce the exact same document, as a PDF if desired, so you don't have to worry about how someone is going to open it.

Equations. If you're writing equations, it really can't get much easier and much nicer output than Tex's math mode.

What I absolutely don't use it for:

Scriptwriting. Final Draft is much better suited to that task.

Flimzy's user avatar

I write everything in Vim with LaTeX, using the sffms package . As the name indicates, the sffms package was written for SF, but manuscript style is pretty much universal. I highly recommend it.

JSBձոգչ's user avatar

It seems there a significant bias in the responses - people who do use are much more likely to care about this question than people who don't.

I only use TeX when I'm writing something with lots of equations or figures (I'm a physics student/teacher, so I do that sometimes). Otherwise a word processor is easier for me.

Mark Eichenlaub's user avatar

Yes. I want my work look as good as possible and I've yet to find anything that even comes close to TeX. HTML is nice but printing it ...

Aaron Digulla's user avatar

I use it, but mainly because I hate Word. It's a little tricky to get started in, but in the long run you'll be happier. It's much easier to make things look professional, and there is no fighting with the stupid program.

Satanicpuppy's user avatar

I'm a huge fan of LaTeX.

Though I usually write in something ultra-minimalist (markdown syntax in pyroom lately), before actually showing it to anyone, I'll convert to LaTeX for better formatting control.

I'm not sure that counts as "writing in" TeX or LaTeX -- I find anything other than a plain text editor too distracting to the "get this down on screen or paper" phase -- but LaTeX is at the heart of my "make this presentable" phase.

HedgeMage's user avatar

I love LaTex, but I do not use it anymore simply because every editor I know uses word. Every piece I have written has required multiple rounds of editing using Word's "Track Changes" feature. Sending editors a PDF and asking them to mark it up via text comments (e.g. "2nd graf: capitalize "John") slows down the entire editing process.

Wolf's Dilemma's user avatar

La/TeX is a typesetting markup language. I wouldn't imagine ever actually writing in a TeX environment.

However, there are obviously lots of people above who do!

(I'm also voting to make this a CW since the answers are by natu highly subjective, unless someone cites an empirical study.)

I write books . The reading experience of a book comes not only from the abstract content of the text, but from its visual appearance as well. Text has a surface.

When I write, I need to see the text as it will appear on the printed page, otherwise I am unable to compose its visual rhythm and structure.

Community's user avatar

Matter of opinion and all that, but I prefer plain text with no formatting.

Writing and typesetting are separate activities that are not relevant to each other. When you're writing a story your focus should be the characters and the story, not what font you're using or whether your chapter titles should be centered. If you get wrapped up in text formatting while you're writing it's a distraction.

It can also be a trap. You can get into a thing of turning the formatting decisions into a major part of your creative effort. Then you might want to express something -- a mood, an atmosphere, an emotion -- and you'll slip up and express it using formatting rather than words because in that moment the formatting happens to be easier somehow, or more appealing.

I just stick with .txt. Of couse that means I can't use bold or italic. But C.S. Lewis said (somewhere) that a good writer has ways of indicating bold or italic using word choice and sentence structure.

This is regarding fiction -- if you're writing a scientific paper with equations that's another story.

Ethan's user avatar

If you're writing fiction, you're asking for trouble by using LaTeX. There are no real advantages to it, except perhaps that since it's only ASCII it will probably never fall into the same black hole as that .xyz file you created years ago in some word processor whose name you can't remember anymore.

For technical writing, especially if it includes equations and funky formatting requirements, it's a good tool. Even then, I'd try to use a GUI like LyX as the front end.

It's an intriguing and brilliant tool which makes some complex tasks simple, and provides a beautiful consistency. On the other hand, some simple things are nearly impossible, and other things require a degree and practical experience in programming to figure out.

Wayne's user avatar

It might sound very Silly, but the best thing you can do is to use the notepad with a different font, so that you like it.

Formatting will be a big waste of time, and using conventional MS Word or others different than the usual notepad won't allow you to use version control .

The best control version is through TXT files!

After finishing your story, edited, corrected, applied version control. Then you can use latex, Word, Libre Office, whatever you need to create a great formatting, or simply deal with the publisher.

Remember, the most important thing is the content, not the format.

And if you are worried about the format, you can do it with latex in a very easy way, just check this templates

user325198's user avatar

Yeah, I think there's a lot of bias in this community towards technical writing, since StackExchange seems to attract that type of community. However, the question isn't clear on the type of writing.

That being said, assuming you were writing fiction, you might want to consider a tool like Scrivener . Fiction writers, and even non-fiction writers, like it because it lets you write your story or article in sections or scenes and re-arranging your sections is a breeze. You can also easily keep notes within the same document.

And for those who still like LaTex/Tex, I believe there is an option for exporting your finished document to LaTex.

Best way to write in LaTeX, in my opinion, is to bypass it and use Org-mode in Emacs (a text editor used most commonly by programmers).

Org-mode is a feature rich multi-use outline-based editor environment that can export directly to LaTeX/PDF, among other things. Essentially it lets you write using Org-mode's simple formatting and outline hierarchy, then the export automatically adds all of the tedious LaTeX markup for you. Org-mode is largely responsible for the resurgence of interest in Emacs over last few years. Read more here:

A decent second choice would be to use LyX. Not sure if anyone has mentioned LyX or whether you already know about it, but it essentially adds a layer over LaTex and lets you write your LaTeX document using a GUI application that's similar to a regular word processing app.

Herbert Sitz's user avatar

If you are writing fiction (not technical), and if your fiction is along the lines of a detective novel or collection of short stories (but not a picture book), and if it is not in color, and if you need to produce a PDF/X compliant file for a print-on-demand paper book service (not an ebook):

I have recently placed the "novel" document class where it can be installed in your TeX distribution by the usual means. Some mirrors have it now, some might respond later.

I have previously used an earlier version of this document class for an actual. P.O.D. novel.

The document class uses high-level commands that directly get you to where you need to be. It is actually pre-configured for print layout 5.5"x8.5" with fonts and all.

LaTeX is definitely not for most users. Its only advantage over a word processor is that the typesetting engine can often produce more attractive-looking paragraphs. This is most noticeable if your writing style benefits from that kind of typesetting.

If you already know something about LaTeX, and say to yourself, "I am tired of writing academic math, I want to write a murder mystery," then maybe the "novel" document class is for you.

Not the answer you're looking for? Browse other questions tagged software latex or ask your own question .

Hot Network Questions

write book latex

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

SciSpace Resources

Learn LaTeX — A Beginner's Step-By-Step Guide

Deeptanshu D

Table of Contents

What is latex.

LaTeX, usually pronounced either as “Lay-tech” or “Lah-Tech” is a typesetting software used as a document preparation system, very often used by academicians, researchers, scientists, mathematicians, and other professionals. In contrast to the general word processing software like Microsoft Word, Google Docs, and others which function on the principle of WYSIWYG (What You See Is What You Get), LaTeX functions as a plain text markup language, that leverages optimal typographical rules which later gets compiled into a PDF document. A plain text format is usually used to write the content and then further annotations with subsequent commands are used, to control the display of various elements. As a result, you get documents that bear a more professionally designed appearance and belong to a completely different class to the output from a word processor.

LaTeX provides you with numerous customization options that allow you to introduce diversity in the documents with precise control over the layout and formatting. Moreover, creating templates in LaTeX is simple enough, it does not require a much-advanced level of knowledge for LaTeX to use and configure. All these features allow, even,  a novice LaTeX user to create beautiful documents and learn as they go.

Why you should read this beginner's guide to learning LaTeX?

This guide has been extensively curated to provide you with a hands-on introduction to LaTeX. No matter even if you have used word processors like MS- Word or Docx, LaTeX, being simple and easy enough, can be learned in no time.

Built on the assumption that the majority of the readers might not have any prior know-how of the LaTeX typesetting, this guide starts from the basics and then gradually delves into the advanced formatting. One feature at a time will be introduced as you progress through this guide.

Once you have completed this guide, you will be able to create a LaTeX document all by yourself. The introductory features will let you get versed with the basic features of the LaTeX typesetting, empowering you to typeset your research paper or dissertation easily. However, the advanced features will allow you to build fluency with LaTeX, therefore, boosting your productivity.

LaTeX: The Backstage Story

In the late 1960s, Donald Knuth, arguably one of the most prominent and well-respected scientists in the domain of Computer science, was deeply disappointed by the quality of his famous series “The Art of Programming”. In order to eradicate this misery in document typesetting, he started a project to create a new typesetting infrastructure, called TeX (Pronounced “TeK”).  The purpose of the project was to develop a typesetting program that can accommodate the texts and mathematical formulae easily.

He observed that the existing digital typesetting system of that era was not matching appropriate typographical standards. A decade later, he froze the system and TeX was born. TeX gave the fine-grained control and huge flexibility over the document layout, as envisioned by Knuth.

However, the enormous amount of flexibility associated with the TeX made it complex, too.  So, by the mid-1980s, Leslie Lamport introduced a higher language that used TeX as the base but made it a lot easier to use. Introduction of predefined document styles, sectioning, indexing, automatic cross-references, automatic numbering, and various other useful features, as integrated by  Lamport, brought real ease in the usage of TeX. Because of its user-friendliness LaTeX is sometimes referred to as “Lamport-TeX” too.

Difference between TeX and LaTeX

TeX exists as a combination of a program (that performs the typesetting; tex-core) and a format( a set of macros that engines bring into use; plain-tex). However, TeX lends itself with the basic features only. TeX can help you in formatting your document in great detail using its various commands( e.g. kerning, spacing, ligatures, font styles, etc.). Additionally, it provides different algorithms tailored to compute the optimal flow of text in your document( e.g. where to insert page breaks, line breaks, etc.) Therefore, TeX is built over providing users with various algorithms and commands to specify the tiniest detail to maintain the quality standards of the document.

Whereas, LaTeX, being built on the TeX, is a set of macros basically employed for formatting the documents. The idea behind LaTeX is to simplify the formatting so that users stay more focused on the content rather than the format. LaTeX generally provides you with commands that preside over the structure and appearance of your document. (e.g. sections, emphasis, tables, indices, etc.).

Assume you want to insert a section in your document. Now if you are using TeX, the procedure is to select a larger font, choose a different font style and insert spacings before and after the section heading. Whereas, in LaTeX, you just need to insert a command as \section{____} and you will find your section in front of your document with the appropriate font style, size, and spacings.

Moreover, since LaTeX functions over the same stack as TeX, a beautifully curated document is obtained as output, whereas the input also remains well structured, easier to read and write both for humans and machines as well.

Why should I learn LaTeX?

LaTeX is the best choice for creating any scientific and technical documents. Moreover, LaTeX provides easy typesetting of mathematical formulae. If you are a scholar or researcher, then LaTeX is the best tool that you can leverage to write down your thesis or research paper. Besides its top-notch technical features, it can help you produce extremely stable and high-quality output documents, built with the easy handling of the complex sections, no matter how large they are.

Apart from the fact that worldwide, most of the academic and non-academic journals strongly recommend or accept submissions in the LaTeX format, below are the 8 reasons why should you learn LaTeX :

Further remarkable features of LaTeX are its cross-referencing capabilities, automatic numbering, and generation of a table of contents, figures, indexes, glossaries, and bibliographies. Moreover, LaTeX provides multilingual benefits, through its language-specific features integrated with PostScript and PDF features.

While using LaTeX you can produce your output document in the format as per your choices. DVI (Device Independent) and PDF are the two formats that LaTeX supports natively, but using other software integrations, you can easily convert that to PostScript, PNG, JPEG, etc.

Getting Started With LaTeX

Installing latex.

To bring the magic of LaTeX to your system, we will be using the platform of LaTeX distribution-TeX Live. TeX Live has the huge benefit of being OS friendly i.e. it stays compatible with Windows, Mac OSX, and other Unix-based operating systems. TeX live is well managed and brings frequent updates. Therefore, a very trusted platform for anybody who wants LaTeX.

To start with, visit the homepage of TeX Live - TeX Users Group (

You should explore the homepage in detail to understand the depth of information available there.

write book latex

The installation can be done in two ways. The first method requires an internet connection whereas the second starts with a download of a file, which can be then installed in offline mode easily.

Installing the TeX Live through Net Installer Wizard for Windows

Follow through the steps described below and you will find LaTeX running on your system within a few clicks:

1. You can click the download link from the homepage of TeX Live - TeX Users Group ( or directly visit Installing TeX Live over the Internet - TeX Users Group ( .

write book latex

2. Download the install-tl-zip . This will provide the installation suite in zip format.

3. Extract the files using any zip extractor. Personally, I prefer WinRar.\

4. After the extraction is complete, open the containing folder and double click the windows batch file install-tl.

5. A window of TexLive will appear

write book latex

6. Choose the folder where you want the installation to happen and keep the paper size to A4 (recommended), or you can choose any other as per your choice.

7. Click the Install button at the right bottom.

8. A pop-up window showing the installation progress will appear.

write book latex

9. Click, Finish when the installation window  shows the installation progress as complete.

After the installation you can go to your start menu to check if the suite contains a TeX Live 2021 comprising 6 programs:

Installing LaTeX for Mac OS, Linux, and other OS

If you are a Mac OS user, you can visit TeX Live. Download the installation file in the .zip  provided. Once done with the extraction, double-click the setup file to install it.

For most Linux users, installation is quite easy. You can go to your systems package manager and search for TeX Live. For Ubuntu, you may use Synaptic, on SUSE systems use YaST, with Red Hat an RPM frontend, and on Debian systems use Aptitude.

Pro Tip : For easy and smooth installation, you can choose to use the MikTeX bundle . The platform provides all the options for different OS. It will provide you with regular use packages and comes with an easy & lightweight editor.

write book latex

Installing Extra-Packages or Add-On features

Add-on features built for introducing various kinds of document styling and formatting for the LaTeX documents are known as packages. A package usually exists as a file or sets of files comprising certain commands and programs that either add new typesetting features or modify the already existing ones. Usually, there are no restrictions on the number of packages that you want to install, however, there exists a configuration limit on the number of packages that can be executed under a single LaTeX document, although that also depends on the package size.

Usually, a large set of pre-installed style packages comes integrated with the LaTeX installations. You can easily configure and manage these packages through the package manager of the respective TeX distribution.

However, in some situations, you do need some extra packages to bring some uniqueness to your LaTeX document. In such situations, you can visit the CTAN website. Use the CTAN search page to find out the packages easily. Once you get the package of your choice, use the indexes on the CTAN server to find out the directory from where it can be downloaded.

Automatic Installation of Packages

You can find various packages in the repositories of the package manager, depending upon the OS you are currently using.

With MikTeX, you can choose the packages individually. MikTeX has an advantage; it asks you to download the missing packages by itself, after the compilation of the document.

In TeXLive, you will find the specific packages bundled with the distribution package. For example, to provide the document in different languages related to internationalization, you need to install a package like TeXLive-Lang. In addition, you can extensively use TeXLive Manager- tlmgr to configure and manage packages separately.

write book latex

Manual Installation of Packages

Before downloading any package, you need to ensure that it contains two files, one with .dtx and the other one as .ins. The first one is a DOCTex file, which functions to keep the program and its documentation as a single entity. The second one i.e. .ins is an installation file, usually smaller in size.

Besides, always keep the practice of keeping the downloaded packages in a temporary directory.

Now hopping onto the steps to install the package.

I have summarized the entire process into 5 easy steps to install a LaTeX package . Follow along and you will find it easier to run through your system.

1. Extracting the Files

Click on the .ins file and run it on the LaTeX. What I meant to say is that you should open the .ins file in your LaTeX Editor.  Another way is to visit the temporary directory, open the command window, and type LaTeX followed by the .ins file name. In this way, you will be able to extract the files required from the .dtx file (Because of this it is required that both the .dtx and .ins file remains in the temporary directory).

2. Preparing the Documentation

Click onto the .dtx file and Run LaTeX editor. To keep the cross-references in the correct sequence, it might happen that you need to run it multiple times. As a result, you will get a .dvi file that will explain the key features and functioning of the package.

If you want to create a PDF documentation file, then run the .dtx file on pdfLaTeX instead. In case the package contains an index file within, then you must make a  .idx file as well. In some situations the system itself creates a .glo(Glossary) file, then you can run the following command to keep it correct:

write book latex

3. Files Installation

Files installation means that you need to move or copy the files created in the previous step from the temporary directory to TeX Local Installation Directory Tree. you must ensure that you keep all the manually installed packages in the TeX Local Installation Directory Tree. It is important as it prevents the new packages from overwriting the files in the main directory or from getting overwritten by the main files.

In a TDS (TeX Directory Structure) compatible system, a TeX Local Installation Directory Tree is nothing but a folder containing many subfolders within it.  The main folder is usually named texmf-local/ or texmf/. The main folder’s location varies from system to system. You can access it as :

Moreover, you must refer to the documentation to understand if there are any prescribed locations or folders where the files should be moved.

write book latex

4. Index Update

This is the most important step, any mistake can be catastrophic as nothing will work.

After the package installation, it is required that you update your package database. To do this, run the TeX indexer program. The indexer program comes in various names depending upon the original TeX distribution package.

For example:

Also, in Win 8 and above, you can do it easily by:

MikTeX>Settings>Refresh FNDB>OK.

5. Updating Font Maps

Font mapping files require an update if, during the index, any files like TrueType or Type1 fonts have been installed by default. A .map file comes attached with the packages. Depending upon the LaTeX distribution, the font map updating program exists on the updmap.

For files stored on a personal tree, use updmap --enable

For files stored in the system directory, use updmap-sys --enable

Run initexmf --edit-config-file updmap, add the line "Map to the file that opens, then run initexmf --mkmaps.

Check any Package Status

To check if a package file is available with the TeX compiler, you can use the command as depicted below:

write book latex

Additionally, you can use the tool tlmgr in TeXLive to gain further information on packages. The command can be used as depicted below:

write book latex

Package Documentation Information

You must refer to the documentation files whenever you want to have a detailed idea about the commands and functions a package provides. For every installed package, there exists a corresponding .DVI file in the texmf/doc subdirectory. However, the location of these subdirectories varies for different LaTeX distribution packages.

write book latex

You can easily access the installed packages’ distribution information using the below command. In the editor, just use the texdoc command followed by the package name and you will find out the details in front.

write book latex

LaTeX Document Structure

Standard global structure of the document.

The basic structure of a simple LaTeX document will look like the following:





Here, the LaTeX document structure contains 2 main parts.

Preamble Part

Preamble part exists between \documentclass[10pt,a4paper]{article} and \begin{document} . The Preamble part actually tells the LaTeX program how to SciSpace the document.

In the example above, the code \documentclass[10pt,a4paper]{article} will SciSpace the content of the document using article class (produces article type) in 10pt font size, and its output would be generated in a4paper size. Like an article, one can produce different types of documents, such as books, reports, thesis, etc.

The line \usepackage{graphicx,geometry} tells the LaTeX to load additional style files for supporting more typesetting features. For example, graphicx package is loaded mainly for the support for including Images in the document, the geometry package provides more flexibility in defining page dimensions.

Document Class

Document class defines the standard layout under which LaTeX will create your document. You can access various layout standards within the class files folder. These files generally contain “.cls” extension.

write book latex

From the above image you can easily notice that the class parameter associated with the command \documentclass , tells LaTeX which “.cls” file to use for the current document. Also, you must put this declaration at the beginning. The option parameter will help you customize the document as desired. In case you use multiple options, you must use commas to separate the options.

For example,

write book latex

By using options, you can direct the LaTeX engine to create an article with a font size of 11pt and t an output file that is suitable for printing on both sides of A4 paper.

Below is a list of document class that you can easily incorporate while creating documents in LaTeX:

Additionally, LaTeX provides you with various options to customize your document. You can read the below mentioned list of options used quite often for document creation in LaTeX:

The packages generally come into use when you want to insert an image or graphics, colored texts, or a source code from a file into a document. LaTeX engines come with many pre-installed packages. Additionally, you can add some extra packages if the need arises.

The command to use a package is:

write book latex

Here, inside the curly brackets, you should enter the name of the package that you intend to use. Also, using options with the command that can let you use certain features of the entire package.

For example, in order to add some colors while typesetting a document in LaTeX, you can use the color package as:

write book latex

Body Part or The Environment

Body part is the place between \begin{document} and \end{document} , where the actual content of the document can be added, which includes Document Title, Author/Address/Date, Headings/Texts, Table/Figures/Equations/Lists/Quotations, Bibliography/Appendix/Glossary etc.

The LaTeX engine defines the document and author information as Top Matter. Although there does not exist any command as such \topmatter , the top matter includes document information like title, date, and author information like name, email, etc.

A standard article will begin with a document title, followed by author names and addresses. The code to obtain these are:

\title{Title of the document}

\author{Donald Knuth and Leslie Lamport \cr

{Address of Authors}


Here, \cr is used for breaking the line after the names in \author. The document date can be simply changed by writing the date in it, for example, \date{30 August 2021}, or the date can be ignored by leaving its content empty, i.e., \date{}.

The above code will produce the following output

write book latex

(a) The content of the document should be between \begin{document} and \end{document} environment as in the above example.

(b) The Title part should always end with \maketitle command. This command will produce the formatted output of Title and Authors.

(c) authblk package provides more flexible formatting of author/address.

Abstract and Keywords

While writing research papers it is mandatory to include the abstract and the keywords before the main section of the body. The LaTeX engine bears pre-defined commands that inform it what part of content makes up the abstract and keywords respectively. The command to include abstract and keywords in the document exist for document class like article and report, however, not available for book class of document.

Immediately after the Title part, the Abstract and Keywords can be added as follows:


Abstract text goes here ... a

Keywords: keyword; keyword; keyword


The above code will produce the following output of Abstract and Keywords:

write book latex

Note: For line break or new paragraph, leave a blank line space between lines as seen in the code of Abstract text and Keywords.

Different Levels of Heading

You can write different levels of headings using the following codes:

\section{Heading - Level 1}Text goes here ...

\subsection{Heading - Level 2}Text goes here ...

\subsubsection{Heading - Level 3}Text goes here ...

\paragraph{Heading - Level 4}Text goes here ...

\subparagraph{Heading - Level 5}Text goes here ...

Output of Headings produced with the above codes:

write book latex

Unnumbered Headings

Unnumbered headings can be obtained with the starred option of their respective sectioning commands. For example: \section*{Acknowledgements}

Sectioning Commands

In order to introduce different sections in your document you can use the section commands as provided by LaTeX. Also, certain section commands stand appropriate as per the document class. For example, an article contains sections and paragraphs whereas a book contains chapters. You can view the section commands as provided by the LaTeX below:

write book latex

Moreover, the LaTeX engine automatically sorts the section numbers for you. Therefore, no need to enter the section numbers separately. Note that you don’t need to use any \begin and \end commands while using section commands.

Additionally, there exist 7 levels of depth for introducing sections in a LaTeX document. In the table below you can see the various levels of sections, which exist as a subsection of its above-mentioned section:

write book latex

Section Numbering

Sections are numbered automatically in LaTeX. You just need to add the heading for different sections in the curly brackets. Roman numerals like I, II III are attached with parts, for chapters and sections decimal numbering like 2.1, 2.2, 2.3, etc., are attached and for appendices, alphabets are used like A, B, C, and so on.

In case you prefer only the main sections like parts, chapters, and sections to be numbered, not the subsections and subsubsections, then you can use the command setcounter, defining the level of depth as you like.

write book latex

You can use "*" sign after the section commands if you don’t want certain sections to be numbered. Additionally, using the "*" sign after the section commands will not reflect that particular section in the table of contents, too.

write book latex

However, if you want certain unnumbered sections to be a part of table of contents you can use the package unnumberedtotoc. This package comes bundled with commands like addchap , addsec , and addpart . You can use these commands as depicted below:


Moreover, if your document contains hyperlinks pointing towards different locations in the document, then you must use the hyperref package. The package includes a command, i.e., phantomsec that enables hyperlinks to perform in a proper way. You can refer to the below example to understand how this command works:

write book latex

Ordinary Paragraphs

Text paragraph follows after the section headings. You can simply switch to new paragraphs by simply leaving a blank line. The blank line tells the SciSpace engine about the commencement of a new paragraph. Note that you will not see any blank line in the output document.

Further details on formatting a paragraph will be separately provided in the Paragraph section.

Table Of Contents (ToC)

The LaTeX engine inserts all the numbered headings automatically in the ToC. You can get the ToC in your document by using the command \tableofcontents . The ToC is generally inserted after the Abstract or the Summary in the document.

If you have used multiple figures and tables in your document, you can insert a list of them as well. Use the commands \listoffigures and listoftables to insert a list of figures and tables respectively.

Moreover, you can use the \addcontentsline command to provide a preface or any un-numbered section headings for your document. For example, if you want to add a Foreword or Preface for the article, you can use the commands as,

write book latex

To rename the ToC, you can use the following code:

\renewcommand { \contentsname }{<New table of contents title>}

Likewise, you can rename the LoF and LoT using the same above mentioned command by replacing the \contentsname with \listfigurename and \listtablename respectively.

Depth for the ToC

The LaTeX Engine by default only includes section headings with level 3 and above. In case you want to modify the depth for the ToC, you can do so easily by adding the below-mentioned command.


Additionally, it is important that you use this command in the preamble part of the LaTeX document.

Book Structure

In the document class ‘book’, there lies few variations from the article class. The LaTeX engine by default typesets a book document with two columns format. Further, the header contains the information related to the current chapter and section.

Also, it is mandatory to use chapters in the book class. Otherwise, it won’t be technically called a book.

The basic syntax for a book class document appears like this:

write book latex

In the book, LaTeX uses Roman numerals to number pages in the front-matter chapters. Also, the front matter part will not be included in the numbering. Actually, the front-matter remains devoid of any sections and that’s why it is numbered as`0.n`.

No difference exists in the functioning of the main-matter chapter. It works as usual. However, Arabic numerals are used for page numbering in the main-matter chapters.

Similar to the article class, the \appendix command can be used to tell the SciSpace engine that the following sections or chapters are to be included and numbered as appendices. Moreover, you should use the \appendix command only once, even if you have used multiple appendices in your document. For example, to indicate multiple appendices, you can use the \section command.

write book latex

The backmatter and frontmatter functionality are same. The section numbering follows the same mechanism as the front matter.

Additionally, the book document class treats special entries like ToC as an unnumbered chapter.


A bibliography contains the list of references that were used for preparing a document.  To insert a bibliography in the document, you must create a .bib file first. The syntax to create a .bib file goes as follows:


AUTHOR="John Doe",

TITLE="The Book without Title"

PUBLISHER="Dummy Publisher" ,


The example contains the document class as book and other parameters are self explanatory.

Once done through the creation of the BiBtex file, you need to use commands \bibliography that informs the LaTeX engine the location of your bib file and \bibliographystyle that directs the engine to SciSpace the bibliography in a chosen style. You can use these commands as described below:

\documentclass { article }

\begin { document }

Random citation \cite { DUMMY:1 } embeddeed in text.

\bibliography { lesson7a1 }

\bibliographystyle { ieeetr }

\end { document }

The output document will appear like

write book latex

Note in the above example that the bibliography document is named “lesson7a1” and the corresponding style is ‘IEEEtr’ which is a common style used widely in the scientific domain.

Most of the LaTeX editors allow you to select and run the bibtex automatically after the compilation. In TeXworks or MiKTeX, this option exists as a default option.

write book latex

Formatting the LaTeX Document

This section of the guide will introduce you to the commands that can help you towards formatting the body text in different ways. It includes text formatting i.e making texts bold, italic, adding comments, inserting lists( both ordered and unordered), and inserting figures and images into your LaTeX document.

Text Formatting

You can use the command \emph to bring emphasis on some particular texts. This command will bring out the text shape in Italics. Also, the \emph command is the default way by which the LaTeX engine emphasizes any text. You can use this command as:

write book latex

Similarly, to make some texts appear bold, you can use the command \textbf and \textit for italicized appearance of the text.  You can refer to the below image for details:

write book latex

Note that the emph command is dynamic in its functionality, i.e., if you will use this command in a sentence that is already emphasized, then the second used text will revert back to the original font. For better understanding, refer to the below image:

write book latex

LaTeX comes equipped with various commands for text formatting. You can find a list of these commands below and use it accordingly.

write book latex

Adding Comments

Comments are inserted in a LaTeX document to add special notes. The Comments command is often used in templates to inform users about the functionality of a template.

The comments are added in a document using the % percentage sign. While processing an input file, whenever the LaTeX engine discovers a % sign, it ignores the text following the percentage sign. It means the engine won’t display any text, line breaks, and whitespaces written after the percentage sign until a new line begins.

The comment command, i.e., % sign is extensively used to put notes in a document that will not be visible in the output document.

Refer to the below image to understand the command functionality and the generated printable output version:

write book latex

Adding Floats (Tables And Figures)

Floats are those objects which float in the pages since they will not break the contents on their own. For example, a full-page Table placed at the middle of the page will automatically move to the next page. This is to avoid the possibility of Table content going beyond the bottom margin. By default, LaTeX defines Table and Figure as floats. More floats can be defined with custom LaTeX packages.

Tables and Figures shall be coded within the environment in its name itself. For example, \begin{table} ... \end{table} and \begin{figure} ... \end{figure} . Because of its power of floating nature, LaTeX will intelligently place them in the pages while typesetting documents. The placement of these floats can also be controlled by giving instructions in the optional argument in square brackets. For example:

\begin{figure}[t] or \begin{table}[b]

This means, the figure will be placed at the top of the page and the table will be placed at the bottom of the page if there is enough space within the page.

Following table shows the available options for the placement of floats.

write book latex

In two-column documents, the starred variants of these float environments can be used for spanning the floats over two columns. For example, \begin{figure*}   or \begin{table*}

Caption for the Tables and Figures

Another common feature of the float environment is Caption. The \caption{} command will typeset the caption in the required style and it will automatically produce the label and number. For example, the caption in the Table will be prefixed with Table 1, Table 2, etc. Similarly, the Figure captions will be prefixed with Figure 1, Figure 2, etc.

Adding a Table

The code for a simple Table will look like the following:


\caption{\label{tab1}Caption text goes here.}

\begin{tabular}{| l | c | r |}

Head 1 & \multicolumn{2}{c|}{Common Head}\\

Col 1 & Col 2 & Col 3 \\

\hlineCol 1 & Col 2 & Col 3 \\



Output of Table produced with the above codes:

write book latex

In the code above, the \caption{} command formats the caption text. It also produces label and numbering automatically. \label{tab1} given inside the caption is for cross-referencing the Table that can be cited with \ref{tab1} . The \centering command is used to center after that.

The tabular environment is an array-like construct of rows and columns. In tabular, the columns are separated by ‘&’ and the rows are separated by ‘\\’.

The code after \begin{tabular} defines the alignment of each column. So, in the example code above ({| l | c | r |}), there are three columns in total and they are defined as l, c, and r; “l” for left alignment, “c” for the center, and “r” for right column alignment. The pipe symbol (|) produces the vertical line between columns.

\hline produces horizontal rules between rows, while \\ multicolumn can be used to merge columns.

Useful packages:

float.sty : Defines new custom floats like Graph, Picture. Provides more formatting styles like boxed, ruled etc.

placeins.sty : Placing floats within the sections.

endfloat.sty : Placing floats at the end of the document.

caption.sty : Formatting caption text.

Adding Images

The images should be loaded as separate files in commonly used formats like .png, .jpg, .pdf, or .eps. You can copy the images in the same directory or in a different path, and these images can be loaded with \includegraphics command in the document. This command requires the graphicx package in the preamble, which may be loaded as \usepackage{graphicx} in the preamble.

The LaTeX code for including a figure as a float is as follows:



\caption{\label{fig1}Caption text goes here.}


It is also possible to set the default path(s) for loading images, the command is \graphicspath{{dir1}{dir2}...{dir3}} . The \includegraphics command provides many options to format the image, for example, adjusting width, height, scale, rotate, crop etc. For example \includegraphics[width=10cm,height=10cm]{fig1.eps}

Useful packages :

subcaption.sty : Handling of subfloats within a single float.

Adding Lists

In the academic domain, Lists are often used to present the document structure in a more orderly, clear, and concise manner. In LaTeX, Lists structures are a kind of environments that are generally classified as:

Lists can be either ordered (numbered) or unordered (bulleted/symbols), the number or bullets will be generated automatically.

Code for Ordered Lists


\item First item

\item Second item\

item Third item


Output of ordered list produced with the above codes:

write book latex

Code for Unordered  Lists


\item Second item

\item Third item


Output of unordered list produced with the above codes:

write book latex

Nested Lists

The nested lists can be used either as ordered/unordered or combination of both. Here is a sample:

\item Fourth item

Output of nested list produced with the above codes:

write book latex

enumitem , scrextend , tasks , exsheets for better & more formatting options.

Description Lists

Description lists may be used to produce a descriptive list, where there may be a definition term and its description.


\item[Term 1] This is the definition of the first term.

\item[Term 2] This is the definition of the second term.

\item[Term 3] This is the definition of the third term.


Output of description list produced with the above codes:

write book latex

Adding FootNotes

The footnote in a document can be created with \footnote command. The command can be used as \footnote{This is a sample footnote} in the document. The footnote number will be generated automatically.

Sample code: This is a sample text for footnote `\footnote{This is a sample footnote}, more text after footnote mark.`

The following image shows the output of the above code:

write book latex

Footnote Numbering

The format of footnote number can be changed with the following commands:

\renewcommand{\thefootnote}{\arabic{footnote}}}} - Arabic numerals, e.g., 1, 2, 3 ... \renewcommand{\thefootnote}{\roman{footnote}}}} - Roman numerals (lowercase), e.g., i, ii, iii ...

\renewcommand{\thefootnote}{\Roman{footnote}}}} - Roman numerals (uppercase), e.g., I, II, III ...

\renewcommand{\thefootnote}{\alph{footnote}}}} - Alphabetic (lowercase), e.g., a, b, c ...

\renewcommand{\thefootnote}{\Alph{footnote}}}} - Alphabetic (uppercase), e.g., A, B, C ...

\renewcommand{\thefootnote}{\fnsymbol{footnote}}}} - A sequence of nine symbols, like *, †, ‡, ...

Footnote number can also be given explicitly as: \footnotemark[33]\footnotetext[33]{Footnote text ...} , footnote number will be 33 in this case.

" footmisc " package provides many features for customizing the appearance of footnote.

Paragraph Formatting

Let's learn how to format paragraphs in your LaTeX document using LaTeX commands and environments.

Paragraph Alignment

The LaTeX engine by default incorporates a justified alignment in all the paragraphs, i.e., flush with both the left and right ends. In case you want to change the alignment of the paragraph in your document, you can easily do so by using some LaTeX environments and their equivalent commands:

It is advisable to prefer environments rather than commands as using the environment ensures that all the text between \begin and \end will be justified accordingly.

Paragraph Indent

Indenting a paragraph means moving it either left or right edges towards the center. The LaTeX engine by default does not allow the indentation of the first paragraph after the heading.  The indenting space of a paragraph is regulated by the command \parindent . This command tells the engine by how many points the left or the right end of a paragraph should be indented. The commonly used syntax for this command is:

write book latex

If you wish to indent a paragraph you can do so easily by using the command \indent . Additionally, you must ensure that the \parindent is not set to zero, otherwise, the \indent command will not work. Similarly, you can use the \noindent command to unindent any paragraph.

Moreover, you can indent the subsequent lines of a paragraph using the \hangindent command. By default, this command provides an indent of 0.7cm.

Besides, you can use the \leftskip or the \rightskip commands to provide an extra space to the ends of the document. This command will help you format the paragraphs that you want different from the original document margins.

Paragraph LineBreak

Line Breaks are not advisable while using paragraphs as the LaTeX engine does not bear compatibility to it. However, if the need arises, you can use a hack to insert a line break in a paragraph.

The simplest syntax to follow is; \paragraph{Title} \hspace{0pt} \\

Note, that there lies a space after the closing of the curly bracket. If you will not provide the space, the LaTeX will display the following error message.

write book latex

There is another shortcut method for bringing in the line breaks inside a paragraph ; \paragraph{Title}  ~\\

Line Spacing

You can modify the line spacing within the whole document using the command \linespread . Besides, you can use the packages like "setspace" which includes several commands that regulate the space between lines for different sections and paragraphs till the command ends. The \setspace package provides you with the following commands and environments:

Adding Mathematical Expressions and Equations

Typesetting mathematics is one of LaTeX's greatest strengths when compared with other word processors. With many predefined commands and environments, the mathematical equations can be typeset with good-looking and high-quality output, especially the spacing of variables, operators, symbols, parenthesis, etc. LaTeX is one of the most efficient and best available tools to typeset complex mathematical formulas.

By default, LaTeX provides all necessary commands and environments for typesetting math content. However, amsmath package provides more features like different kinds of alignment, the numbering of equations, etc. It is highly recommended to use the amsmath package if your document contains complex formulas. The syntax to use this package follows: \usepackage{amsmath}) .

Alternatively, another package that you can use is mathtools package. Moreover, you should try using this package with amsmath package to take advantage of the extra features and make the modifications as per your choice. The usual syntax to use this package follows: (\usepackage{mathtools}) .

Inline math

Inline math can be coded either as $ ... $ or \ (... \ ). It is also possible to use the math environment as \begin{math} ... \end{math} .

This is an inline math $f(x) = x^2$.

This is another inline math \(f(x) = x^2\).

The syntax for using Inline math using math environment  follows:

\begin{math}f(x) = x^2\end{math} .

Displayed Equations

Displayed equations are independent from the surrounding text and are displayed in their own lines. Displayed equations can be either numbered or unnumbered.

Numbered Equations

Single line numbered equations can be created with the equation environment.



Multiple line numbered equations can be created with  `eqnarray` environment.


a, b &=& c \\

a, b &=& cccc \\

a, b &=& cccccc \


eqnarray environment is an array-like construct of 3 columns. The columns are separated with & character and  rows are separated with \\ (double backslash). The \\ also produces equation numbers at the right side of the equation within parenthesis.

amsmath package ( \usepackage{amsmath} ) provides many environments like align, gather,  multline, alignat, etc., for different kinds of equation formatting.

Un-numbered Equations

Single line unnumbered equations can be created with any of the following codes:

\begin{displaymath} ... \begin{displaymath}

The starred version of eqnarray, align, gather  (for example: \begin{eqnarray*} .... \end{eqnarrray*} ) and other environments mentioned above can be used to produce unnumbered equations. With these environments, equations can be aligned in different ways.

Inserting Fractions

LaTeX carries the in-built capacity of inserting various forms of mathematical expressions including integrals, fractions, and more in the document. There are different syntaxes to use for various mathematical notions. For example, to insert a fraction mathematical notion in the document you can use the below-mentioned syntax:

\usepackage { amsmath }

\begin { align* }

f(x) &= x^2\\

g(x) &= \frac { 1 }{ x } \\

F(x) &= \int^a_b \frac { 1 }{ 3 } x^3

\end { align* }

The output generated through this appears like:

write book latex

Additionally, LaTeX provides flexibility in combining more commands and creating complex mathematical expressions like as described below: \frac { 1 }{ \sqrt { x }}

The output :

write book latex

Inserting Matrices

You can insert the matrix expression in your document by using the `amsmath environment. There exists a command `matrix that can be used for this purpose.

Follow the below syntax to add matrices in your document:

\begin { matrix }

1 & 0\\

\end { matrix }

The output displayed will be like:

write book latex

Inserting Brackets and Scaling

You can use the [ ] to insert brackets outside any mathematical expression. To insert brackets i.e. [ ] , you can use the following syntax:

\left(\frac { 1 }{ \sqrt { x }} \right)

write book latex

But using the same   [ ] command for the matrices will result in output error. You can see the below example of what happens when we simply use [ ]  command for matrices.

write book latex

While using matrices and brackets, it is required that you use scaling of parenthesis as described in the first example. See the below example for further clarity:

write book latex

Download Your Finished Document

Since this is the last section of this guide, I will tell you how to download the formatted document through an example. Just follow through. As an application of all that you have learned by now, you can create a new document with the following codes in the TeX editor (I personally use MikteX).

write book latex

After entering the code, click on the option File>Save in the Top menu. You will find a pop-up menu to save the file.

write book latex

Rename the file as per your choice and finally click the Save button to save it in your preferred location. Now to typeset and view the output document, click the green arrow button on the top left side (highlighted in the image below).

write book latex

The output document will open in a new window.

write book latex

In the output window, again go on the File>Print PDF option in the top menu at the top left corner. You can, also, use the keyboard shortcut, i.e., Ctrl + P to print the PDF document.

On clicking Print PDF, the document will open in a PDF viewer (like Adobe PDF, Google Chrome, etc.), from where you can download the document.

I certainly hope that you will enjoy creating documents in LaTeX. To get fluent with the LaTeX commands, you must execute the commands simultaneously while referring to this guide. Moreover, this guide has been divided into various sections so that any user, facing difficulties while typesetting documents in LaTeX can refer to particular sections of the LaTeX guide and easily format the document. There do exist online editors and freelancers that can work for you, but there is no loss, only advantages associated with learning LaTeX by yourself so that you can present the document in the best possible way.

Feel free to drop your queries regarding LaTeX in the comments section. Also, tell us what points did I miss that I should add later, to make this LaTeX guide more comprehensive.

Since you made it to the end you should definitely check out SciSpace LaTeX . It brings together the best of LaTeX and word processors into one simple tool. It was specifically designed to serve the research writing industry. It allows authors to collaborate and write their thesis/research papers in just a few clicks.

We also have the best-in-class academic repository called SciSpace discover where we cater to millions of peer-reviewed papers across domains in one place. This is a suite of products that covers everything, from literature searching and discovery to profile management and research writing and formatting.

write book latex

General FAQs about LaTeX:

1. what are the special characters in latex.

“#, $, %, &, ~, _, ^, \, { }” these characters are often called as special printing characters or special characters in LaTeX. Each of these characters bears a specific meaning which are:

~ (tilde)- unbreakable space, use it whenever you want to leave a space that is unbreakable, and cannot expand or shrink, as e.q. in names: A.~U.~Leslie.

Additionally, if you want the character to be displayed as it is, just introduce a “\” (backslash) in front of it. For example, a “\$” will produce the output as “$”, itself.

2. How do I change text color in LaTeX?

Using the “xcolor’ package, you can change the color of some text blocks in LaTeX. It comes with a command like \textcolor{<color>}{<text>} . Refer to the below sample LaTeX code that shows how you can change the color of the text:


This is a sample text in black.

\textcolor{blue}{This is a sample text in blue.}

Play with different colors and see how the LaTeX document appears.

3. How do you hyperlink i.e. make a clickable link in LaTeX?

You can use the “hyperref” package in your preamble to make clickable links in your LaTeX document. You can add a link with the description using the syntax: \href{URL}{DESCRIPTION} . Moreover, you can use the same “\href” command to provide clickable email links using the syntax:             \href{ mailto:[email protected] }{[email protected]}

4. How to highlight texts in LaTeX?

You have to use the package “xcolor.” Declaring the package in the environment you can use the command \hl{highlighted text} .This command will provide a yellow color highlight to your texts. Additionally, you can change the highlight color using \sethlcolor{color name} command.

5. How to write two equations in LaTeX?

In order to split lengthy equations in a LaTeX document, you can use the package amsmath or mathtools . After that, you can simply use the “\\” i.e. the double backslash to split the equation at a point you wish. Additionally, you can use the \boldmath environment to write equations in bold format. However, if you want to make a single equation appear bold, you can use the command \mathbf{equation inside} .

6. Which class file to make presentations in LaTeX?

LaTeX provides you with a document class by the name “beamer” through which you can easily create presentations. Additionally, you can use various slide templates and slideshow features integrated with it, to make your presentation more appealing. Moreover, it shows compatibility with pdfLaTeX, LaTeX + dvips, etc.

7. What is TikZ in LaTeX?

TikZ is a powerful package that is used to introduce various graphics in a LaTeX document. Basically, TikZ is a part of PGF(portable graphics format). By using the TikZ package, you can easily create lines, dots, curves, circles, graphs, etc., in a LaTeX document.

8. Is LaTeX better than word?

LaTeX, indeed, is better than Word or Docs. It is so because you can easily create footnotes, bibliography, table of contents, indexes, appendices, references, images, captions, cross-references, mathematical equations, etc. Even though Word or Docs provide some (not all like mathematical equations, graphs, cross-references, etc.) of these features, it lacks the ease, flexibility, and professional aesthetic appearance.

Related & Good Reads:

If you found the above LaTeX informative, here are some good reads for you:

Before You Go,

You might also like.

Plagiarism in Research — The Complete Guide [eBook]

Plagiarism in Research — The Complete Guide [eBook]

Deeptanshu D

APA Citation & APA Format — A beginner's guide

Alok Kumar

MLA Citation & MLA Format — A Roadmap For Researchers

How to write a book in LaTeX

Well, from my own experience I would suggest that you first focus on the content, then again on the content and after that, on the content. At the very end, you might play around with different styles and packages to modify the appearance of your text. With a long term project like a book it is very important to get not too much distracted by unimportant things.

In the end, there might be a publisher who insists on a particular style/class anyway. Many publishers in science have their own classes which one is obliged to use. But unless you have a complete manuscript, it is very unlikely that a publisher will agree on publishing your text. So first: just write the stuff with some standard class (the ordinary book class...) and finish the text.

EDIT: OK, maybe this was not too helpful, so here is some more addition:

In a first step you should ask yourself what kind of audience you would like to address. This will determine the way you write very much. In math you want a textbook with exercises and detailed proofs or more a monograph with extended bibliography, etc.

Structure and order your thoughts. Make a table of contents with preliminary summaries of all the sections/subsections. I used to do this in a separate tex-file "plan.tex" or so, which was also subject to change (quite a lot) during the writing.

Be consistent with notation. Before you write, you should fix some notational issues: in particular in math, it is very important that you use the same symbols throughout, use symbols familiar to others, etc.

Making a main.tex with inputs/includes of the chapters which input the sections etc. Here the style/class is not yet essential, it should just support a command like "\chapter". Note that input is a quicker, yet simpler and even limited, command . mwe :

Fill your files with content. This will take 99% of your time.

Check with some publisher etc where you want to place your work. They will provide a style-file or tell you which one of the standard ones is traditionally used with them. If they want to publish it at all.

Then, and this takes not much work at all compared to the rest, adapt your sources to the class/style needed, fix the hboxes, massage the bibliography, scale the pictures appropriately etc.

So I hope that this is a reasonable workflow. It will be point 5 which really requires the most attention and work, the rest is cosmetics.

If you're already familiar with (LaTeX), then I would heartily recommend just starting to write (as Yiannis says), but with the memoir class (which you can read up on in parallel as the work evolves), rather than book .

Memoir includes two really good manuals: The Memoir Class for Configurable Typesetting is a combination of good typography and how-to-do-it, and A Few Notes on Book Design which goes into a bit of history and underlying principles.

I've been a memoir user for around seven years now. There was an initial learning curve (but only because I was already demanding more tweaks than might be proper!), but it has repaid the investment many times over, and, today, apart from books, the only thing I don't use memoir for is presentations.

The only other recommendations I would make are these: as it's a "new project", go with LuaLaTeX, BibLaTeX, fontspec for font tweaking, and 100% unicode.

Separation of presentation and content

LaTeX is based on the idea that authors should be able to focus on the content of what they are writing without being distracted by its visual presentation. In preparing a LaTeX document, the author specifies the logical structure using familiar concepts such as chapter, section, table, figure, etc., and lets the LaTeX system worry about the presentation of these structures. It therefore encourages the separation of layout from content while still allowing manual typesetting adjustments where needed.

(from wikipedia)

I agree with a lot of things described by other contributors but I think if you want to avoid a waste of time , you need to prepare the separation of presentation and content .

All the good classes give sectioning tools. So you can start working with chapter, section etc. but if you want write a math book, you need theorem, definition, remark , examples, etc.

Some classes give you these tools but it's easy to create them. In a first time, these environments can do nothing : for example

Then you need to create some macros (fake or empty macros) \newword \GreatPerson \ImportantWord or FirstDef you can define these macros like this:

I forgot two important macros : \number and \unit . It's not important to choice directly "sinunitx" or "numprint" but you need to prepare the formatting of the numbers and unities. If you don't do that immediately, it's a waste of time to format the numbers at the end.

And you need to prepare the index and the bibliography. I think is very useful to prepare the index. In a first time you can use \index{thisword} but it can be useful to have some specific macros. You can look at the file Mathmode.ltx of Herbert Voss to get some ideas. You can find something like

But in a first time, fake macros are fine !

Now you can start writing "immediately", using the standard book class and not worrying too much about presentation.

With environments and macros you are ready to finish the presentation like you want. Without these environments and macros, it's difficult to find something in your text.

In terms of completeness and detail the best information is still in books rather than publications on the web. Personally I think The LaTeX Companion Second Edition   by Frank Mittelbach et al   is still the best place to start, especially for a new book project, although newer books are available.

My recommendation though since you already know a bit about LaTeX is to just start writing immediately, using the standard book class and not worrying too much about presentation. When you are in about Chapter 5, you can start experimenting with different classes or even writing your own. The book class virtually guarantees compatibility with any other class.

In oppostion to other answers here I really recommend to spent a few days to prepare a framework in LaTeX.

Think twice about your workflow and the technical tools you need.

For example, how will you leave comments and annotations for yourself? How do you delete them? I usually write them into the margin in small red print and use the marginfix package. To this end I define a new command, simply something like \Anm (German abbrev. for comment).

Will you need a comparison between versions ? Or even different versions? Take a day to become familiar with a version system . I'm using git and to build comparisons between versions the script latexdiff-git . A version system may help a lot in case you get stuck and you need to return to a earlier version.

I prefer scrbook to memoir, because KOMA-script adopts the european way to typeset, and for many more reasons.

To speed up compilation have a look at latexmk .

And the most important thing: Employ \label and \ref as much as possible for any reference . Learn how to use Zotero or whatever way to manage your bibliography! Probably you should prefer BibLaTeX to BibTeX.

Which encoding? utf-8 probably, but however, do not mix encondings, choose one which is sufficient for all kind of texts in your book.

Don't use LuaTeX or XeTeX for a serious project. LuaTeX simply is buggy and slow. pdfTeX still is the engine, for many years. There hasn't been a new LuaTeX version for a year!

How do you handle updates / upgrades of texlive or MikTeX? The former maintainer of the Libertine package one day published an incompatible update and after receiving some unfriendly comments withdrew from maintaining the package, leaving me behind with broken files. So it would be advisable to have way to test your monthly update before you encounter a lot of stress.

How will you backup your work consistently, inhouse and somewhere else?

I could go on writing, but I think you got the message: Think intensly on each step of your workflow at the beginning.

Edit due to comments below:

As user pmav99 argues, if you use non latin fonts, XeTeX is very helpfull. I agree with that; I was too narrow minded on the disadvantages of XeTeX. There surely are advantages which may justify using XeTeX »in a serious project«.

Edit three years later:

LuaTeX became a bit faster, but on a windows machine is much slower than pdftex, still. BibLaTeX and Biber are state of the art. And for the rest of my answer: no change.

Related videos on Youtube

How to write a thesis using LaTeX  **full tutorial**

Patrick Da Silva

I have taken a look at other questions, and I don't see any answer to my question. If this is a duplicate for some question I haven't seen, feel free to comment.

I am an experienced TeX user, I've been writing with TeX for about 3-4 years now. I am pretty good with TikZ too. The problem is, all that I have learned comes from one of my teachers that gave me packages so that I don't have much to worry about, and I never got in the technical stuff on my own (or at least never understood a thing of it).

I want to write a book, so I need to be able to deal with stuff like margins, labels, pagination, separating my TeX files into many files so that I don't have to compile the whole book each time I wanna remove/add a comma, etc. I am looking—not for a user manual that states what all commands do like a dictionary, because I know there are plenty out there and I have some—but rather like an introduction to using a book class, with examples and such. If you know what I'm talking about, the PGF-TikZ pdf is a great example of a such PDF ; it describes commands, yes, but there are plenty of examples and little commands are usually detailed while constructing a bigger example.


BibTeX entry type: book

BibTeX example of a whole book citation style abbrv

The book entry type is used to properly reference a book in BibTeX. You can use @book for any complete published work with a clearly defined publisher . In most cases, it is enough to provide the author, title, year, publisher, and address fields for BibTeX to generate a correct citation.

Below we provide a list of required and optional fields for the book type. There are also some non-standard fields that are only supported by some citation styles.

Sometimes only a section of a book, such as a chapter, is used. If only a part of a book is used then a proper reference is typically accomplished using the inbook entry type. This is considered the recommended method.

In this technologically evolving world we live in today, electronic versions of books (or e-books) are becoming ever the more commonplace. To cite a book you have read online, it is possible to include the url within the note’s field. In order for this to work, however, it is necessary to include the \usepackage{url} command within the your LaTeX file. See example:

The more commonplace method is to use the non-standard field “url”. It’s note supported by all BibTeX styles, but for those that do it is the best solution. To verify if a style supports the “url” field, click here.

Templates — Book

Templates tagged Book

Show all Templates

Whether you’re writing fiction or non-fiction, a short story or long textbook, these templates and examples provide a fast and effective way to start composing your latest work. All the required components – such as chapters, sections, title pages, glossaries, acknowledgements -- are set out ready for your content. Just open the template and start writing!

Book Template for Amazon KDP, Leanpub, and Google Play (e-book and PDF) 2023

Related Tags

Have you checked our knowledge base ?

Message sent! Our team will review it and reply by email.

LaTeX Beginners Guide by Stefan Kottwitz

Get full access to LaTeX Beginners Guide and 60K+ other titles, with a free 10-day trial of O'Reilly.

There are also live events, courses curated by job role, and more.

Time for action – writing a book with chapters

We will start to write a book. At first, we shall choose a class, further we will use some filler text to work out the page layout.

Time for action – writing a book with chapters

What just happened? ...

Get LaTeX Beginners Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Don’t leave empty-handed

Download a free report before you go.

Cover of DevOps and Business

DevOps and Business

Cover of Multicloud Architecture Migration and Security

Multicloud Architecture Migration and Security

Cover of Machine Learning at Enterprise Scale

Machine Learning at Enterprise Scale

Check it out now on O’Reilly

Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.

write book latex

This is a guide to the LaTeX typesetting system. It is intended as a useful resource for everybody, from new users who wish to learn, to old hands who need a quick reference.

TeX and LaTeX

TeX is a typesetting computer program created by Donald Knuth , originally for his magnum opus, The Art of Computer Programming . It takes a "plain" text file and converts it into a high-quality document for printing or on-screen viewing. LaTeX is a macro system built on top of TeX that aims to simplify its use and automate many common formatting tasks. It is the de-facto standard for academic journals and books in several fields, such as mathematics and physics, and provides some of the best typography free software has to offer.

This book is organized into different parts:

Contents [ edit | edit source ]

Edit the TOC or the stages

Other wikibooks [ edit | edit source ]

write book latex

Carnegie medal for writing announces all-female shortlist

Seven authors are in the running for prize celebrating outstanding achievement in children’s writing

Authors including Jessie Burton, Patrice Lawrence and Sita Brahmachari are part of an all-female shortlist for the Yoto Carnegie medal for writing.

The prize awards outstanding achievement in children’s writing and features seven authors. Burton, Lawrence and Brahmachari are all first-time shortlistees as is Manon Steffan Ros. The shortlist is completed by Katya Balen, who won the award in 2022, Louise Finch and Ruta Sepetys.

Alongside the prize for writing, the shortlist of six books for the Yoto Carnegie Medal for Illustration has also been announced.

The nominees, said chair of judges Janet Noble , show that “stories of bravery, compassion and community are told authentically and sensitively in a range of distinctive written and illustrative styles”.

On the writing shortlist, Burton – best known for adult novels including The Miniaturist – is shortlisted for Medusa, a retelling of the story of Medusa from mythology, illustrated by Olivia Lomenech Gill . Hepzibah Anderson in the Observer said the book’s prose is “ pulsing with irresistible, rhythmic energy ”.

Lawrence is shortlisted for Needle, which explores the criminal justice system for young people through the story of Charlene, a knitter who stabs her foster mum’s son when he destroys her latest creation. Imogen Russell Williams in the Guardian said it was a “ profoundly poignant YA story ”.

Brahmachari’s When Shadows Fall, illustrated by Natalie Sirett, is about a teenager struck by tragedy, and his friends’ efforts to save him. Russell Williams included it in her best children’s and YA books of 2021 , and said it was a “moving, hard-hitting journey for teens through grief and acceptance, interwoven with powerful illustration and viscerally vivid verse”.

Steffan Ros’s The Blue Book of Nebo was originally published in Welsh, and is set in a dystopian version of Wales where 21st century technology has disappeared, and people must survive learning new skills and returning to old ways of living. Russell Williams said it was a “ tender, tragic post-apocalyptic story, told with great simplicity and power ”.

Balen’s The Light in Everything is a story about blended families. The author’s October, October won last year’s prize , with judges calling it an “evocative exploration of what it means to be truly alive and wholly human”.

Finch’s The Eternal Return of Clara Hart follows a boy who keeps experiencing the same 24 hours again and again after seeing a classmate die in what looks like a tragic accident at a house party. It is the only debut in the running for the writing medal. Russell Williams said it was a “ careful, thoughtful, compulsively readable examination of toxic masculinity and normalised sexual abuse ”.

I Must Betray You by Sepetys, who won the writing prize in 2017 for Salt to the Sea, is based on the real events of the Romanian revolution of 1989 and is about a teenager who has grown up in a repressive dictatorship. Fiona Noble in the Observer said it was a “ tense, thought-provoking thriller ”.

The shortlist for the Yoto Carnegie Medal for Illustration features a range of illustrative and artistic styles.

Rescuing Titanic, illustrated and written by Flora Delargy, tells the lesser-known history of the Carpathia, the ship that heroically rescued 705 Titanic passengers. It is Delargy’s debut, with Russell Williams calling it a “ tour de force ”.

after newsletter promotion

Benjamin Phillips is shortlisted for illustrating Alte Zachen: Old Things , written by Ziggy Hanaor. It is a graphic novel about a young boy and his elderly grandmother, and follows them as as they traverse Brooklyn and Manhattan to gather the ingredients for a Friday night dinner.

Levi Pinfold is shortlisted for The Worlds We Leave Behind, written by AF Harrold. A story of friendship, revenge and redemption, it is a companion novel to the pair’s The Song from Somewhere Else, and the fourth time Pinfold has been shortlist for the illustration medal; he won in 2013 for his book Black Dog . Kitty Empire in the Guardian said The Worlds We Leave Behind was “ luxuriantly illustrated” with “very creepy” images .

Yu Rong is shortlisted for the second year in a row, this time for The Visible Sounds, written by Yin Jianling. The book is based on the true story of Chinese dancer Lihua Tai, and is about a young child dealing with the frustration and solitude of hearing loss.

The Comet illustrated and written by Joe Todd-Stanton, a nominee for the Yoto Carnegie Medal for Illustration 2023

The Comet, illustrated and written by Joe Todd-Stanton, is a picture book about a little girl trying to feel at home in a new place. Russell Williams said it was a “ luminously beautiful picture book ”.

Jeet Zdung is shortlisted for Saving Sorya: Chang and the Sun Bear, written by Trang Nguyen. It is based on the author’s own life and a bear from her childhood that moved her to become a wildlife conservationist and environmental activist. Saving Sorya is Zdung’s first children’s book published in the UK and fuses traditional Vietnamese art with manga.

The winners of both awards will be announced on 21 June at a live and streamed ceremony hosted by former children’s laureate Lauren Child. They will each receive £500 worth of books to donate to a library of their choice, a specially commissioned and newly designed golden medal and a £5,000 Colin Mears award cash prize.

Most viewed


  1. LaTeX Tutorial 2

    write book latex

  2. A Complete Book Writing in LaTeX (Latex Tutorial, Episode-30)

    write book latex

  3. Write a book using Latex!

    write book latex

  4. Latex Book Template

    write book latex

  5. LaTex Tutorial 1

    write book latex

  6. Write a book using Latex!

    write book latex


  1. A newbie's experiences with Lilypond, Lilypond--book, LaTeX, and Perl

  2. Writing Research paper in LATEX 2

  3. How to write thesis in LaTeX P1

  4. Re-Typesetting Books in LaTeX

  5. Latex: Thesis Writing: Explained in urdu

  6. SLD Latex Beginner AR : تعلم اساسيات اللاتكس 9 : المشروع الاول كتابة مقال الجزء الثاني


  1. How to write a book in LaTeX

    In preparing a LaTeX document, the author specifies the logical structure using familiar concepts such as chapter, section, table, figure, etc., and lets the LaTeX system worry about the presentation of these structures.

  2. How to write a book in LaTeX?

    How to write a book in LaTeX (6 answers) Closed 8 years ago. I wish to turn several of my blog article series into a PDF e-book but I have never used LaTeX before for creating books. For example, I want to take my Awk One-Liners Explained article series, improve it and turn it into a book.

  3. LaTeX Templates

    LaTeX Templates - Books Books Books are long documents used for a large variety of purposes, such as for novels, non-fiction works, textbooks and cookbooks. The large amount of content is usually organized using extensive sectioning, a table of contents/figures/tables, an index and cross-references.

  4. Learn LaTeX in 30 minutes

    Writing your first piece of LaTeX The first step is to create a new LaTeX project. You can do this on your own computer by creating a new .tex file; alternatively, you can start a new project in Overleaf . Let's start with the simplest working example, which can be opened directly in Overleaf:

  5. Do Writers Use LaTex/TeX for writing?

    You simply write text and put markers that define what that content is (chapter, section, caption, etc). Your style handles the rest. Version control. Because Latex files are pure text, they go very easily with version controls and diff. Seeing changes between versions shows you exactly what changed. Cross platform and repeatability.

  6. Learn LaTeX

    LaTeX is the best choice for creating any scientific and technical documents. Moreover, LaTeX provides easy typesetting of mathematical formulae. If you are a scholar or researcher, then LaTeX is the best tool that you can leverage to write down your thesis or research paper.

  7. Self-publishing 101: Using LaTeX to create a beautiful book

    Basically, to use LaTeX, you have to tag your text according to: Title Author Headings Subheading Any special formatting Citations Graphics LaTeX then typesets it for you according to how you...

  8. [Solved] How to write a book in LaTeX

    In a first step you should ask yourself what kind of audience you would like to address. This will determine the way you write very much. In math you want a textbook with exercises and detailed proofs or more a monograph with extended bibliography, etc. Structure and order your thoughts.

  9. BibTeX entry type: book [with examples]

    The book entry type is used to properly reference a book in BibTeX. You can use @book for any complete published work with a clearly defined publisher. In most cases, it is enough to provide the author, title, year, publisher, and address fields for BibTeX to generate a correct citation. Complete list of fields for a BibTeX article entry

  10. Templates

    A simple LaTeX template for a book of 5.5 × 8.5 inches (half Letter dimension). Created by Suresh Emre. This template was originally published on ShareLaTeX and subsequently moved to Overleaf in November 2019. Uploaded from ShareLaTeX Book template using the ClassicThesis package

  11. Time for action

    Time for action - writing a book with chapters - LaTeX Beginners Guide [Book] Time for action - writing a book with chapters We will start to write a book. At first, we shall choose a class, further we will use some filler text to work out the page layout. Create a new document with the following code:

  12. A Complete Book Writing in LaTeX (Latex Tutorial, Episode-30)

    22K views 4 years ago In this lecture, we will learn to create a book in latex. For this, book class will be used. By default, a book will be two-sided, i.e. left and right margins will...

  13. LaTeX

    LaTeX is a macro system built on top of TeX that aims to simplify its use and automate many common formatting tasks. It is the de-facto standard for academic journals and books in several fields, such as mathematics and physics, and provides some of the best typography free software has to offer. This book is organized into different parts:

  14. PDF Introduction to LATEX

    Writing LaTeX Code Basic Formatting 3 LATEX and You The Files Math Mode Figures and Tables 4 Beamer 5 LATEX Extended Common Errors More Math Macros 6 Conclusion. Introduction to LATEX ... book report article letter beamer Etc. You'll be using the 'article' class for your paper, 'beamer' class for your presentation. Introduction to LATEX

  15. PDF LATEX Tutorials

    article. If you want to write a book, this must be changed to \documentclass{book}. The whole document we want to typeset should be included between \begin{document} and \end{document}. In our example, this is just one line. Now compare this line in the source and the output. The first three words are produced as typed. Then \emph{first},

  16. PDF Writing Mathematics in LATEX by Example Jason B. Hill

    2.4 Labels and References For items in LATEX which contain some sort of number, we can assign a label to that number and reference it throughout the document. To place a label, use the \label{labelname} command. To reference the labelled item, use the \ref{labelname} command.

  17. LaTeX Beginner's Guide: Create visually appealing texts, articles, and

    If you are about to write mathematical or scientific papers, seminar handouts, or even plan to write a thesis, this book offers you a fast-paced and practical introduction to LaTeX. School and university students will find this easy-to-follow LaTeX guide helpful, as will mathematicians, physicists, engineers, and humanists.

  18. Carnegie medal for writing announces all-female shortlist

    The shortlist is completed by Katya Balen, who won the award in 2022, Louise Finch and Ruta Sepetys. Alongside the prize for writing, the shortlist of six books for the Yoto Carnegie Medal for ...