Sideway
output.to from Sideway
Draft for Information Only

Content

LaTeX Typeset Document Structure
 Example
  Code
  Output 'file-name.tex' File
  Output
 Initial commands
 Document Class
  Arguments
   Options
   Class
   Optional Argument
 Preamble Commands
  \usepackage
   Arguments
    Option List
    Package Name
    Release Date
  \listfiles
  \setcounter
 Document Environment
 Ending
 Source and Reference

LaTeX Typeset Document Structure

A LaTeX typeset document can be divided into divisions, namely, initial commands, document class, preamble commands, document environment, and ending.

Example

Code

%%Initial Commands Division begin
\begin{filecontents}{file-name}
File 'file-name.tex' is saved
\end{filecontents}
%%Initial Commands Division end
%%Document Class Division begin
\documentclass{article} 
%%Document Class Division end
%%Preamble Commands Division begin
\usepackage[papersize={100mm,50mm} , total={40mm,10mm},showframe]{geometry}
%%Preamble Commands Division end
%%Document Environment Division begin
\begin{document}
Document...
\end{document}
%%Document Environment Division end
%%End Division begin
Ending
%%End Division end

Output 'file-name.tex' File

%% LaTeX2e file `file-name'
%% generated by the `filecontents' environment
%% from source `latex_document_structure_001a' on 2022/02/22.
%%
File 'file-name.tex' is saved

Output

image

Initial commands

Initial commands can only be placed before the \documentclass to ensure any package that have been bundled in the document are present when needed. The command syntax of initial commands is
\begin{filecontents}{⟨file-name⟩}
⟨file-contents⟩
\end{filecontents}
The filecontents environment is intended for bundling within a single document file the contents of packages, options, or other files. When the document file is run through LaTeX the body of this environment is written verbatim preceded by a comment line to a file whose name is given as the environment's only argument. However, if that file already exists then nothing happen. Only normal ASCII text characters (7-bit visible text) should be included in a filecontents environment. Anything else, such as tab characters, form-feeds or 8-bit characters, should not be included in a filecontents environment. The filecontents environment is used for including LaTeX files. For other plain text file, such as Encapsulated PostScript files, the filecontents* environment which does not add a comment line.

Document Class

LaTeX document class is actually a special preamble command which is used to define the fundamental properties of typeset document. The LaTex command used to specify the document class of a typeset document is \documentclass. Tne \documentclass command is used to replace the \documentstyle command ,documentclass [⟨option-list⟩]{⟨class-name⟩}. The syntax of document class is
\documentclass [⟨option-list⟩]{⟨class-name⟩}[⟨release-date⟩]

Arguments

Options

The ⟨option-list⟩ parameter is used to specify the behavior of the document class. The options are separated by commas. Some typical document class options are Paper Sizea4paper, a5paper, b5paper, letterpaper, legalpaper, executivepaper.
landscape with default portrait paper
Type Size10pt, 11pt, 12pt with default 10pt Two-side/One-side Printingoneside, twoside Draft Optiondraft, final titlepage Optiontitlepage, nottitlepage Openright Optionopenright, openany Twocolumn Printingonecolumn, twocolumn Equation Numbering on the Leftleqno Flush Left Displaysfleqn Open Bibliographyopenbib

Class

The ⟨class-name⟩ parameter is used to specify the .cls file of the document class used in typesetting. Some typical LaTeX document classes are articleDefault class for composing an article reportTypesetting a multi-chapter report bookTypesetting a book. letterTypesetting a standard LaTeX2 letter slidesTypesetting slides procTypesetting proceedings, based on article ltxdocTypesetting the LaTeX program, based on article ltxguideTypesetting the LaTex document, based on article ltnewsTypesetting the latest LaTeX news, based on article minimalThis class is the bare minimum (3 lines) that is needed in a LaTeX class file. It just sets the text width and height, and defines \normalsize

Optional Argument

The optional argument ⟨release-date⟩ is used to specify the earliest desired released date of the class file. It should contain a date in the format YYYY/MM/DD.

Preamble Commands

Preamble commands are commands that should only be used before \begin{document}. Preamble commands are commands that are not used to typeset the text of the document.

\usepackage

Since standard document class cannot always solve all typesetting problems. One common way is to load one or several package to enhance the capabilities of LaTeX for providing new facilities. The command used to load package is \usepackage. Any number of \usepackage commands is allowed. The command syntex of loading packages is
\usepackage [⟨option-list⟩]{⟨package-name⟩}[⟨release-date⟩]

Arguments

Option List
The ⟨option-list⟩ argument can contain a list of options, each of which can modify the formatting of elements which are defined in the ⟨package-name⟩ file. As well as processing the options given in the ⟨option-list⟩ of the \usepackage command, each package processes the ⟨option-list⟩ of the \documentclass command as well. This means that any option which should be processed by every package to be precise, by every package that specifies an action for it, can be specified just once, in the \documentclass command rather than being repeated for each package that needs it.
Package Name
Each package file as denoted by ⟨package-name⟩ defines new elements, or modifies those defined in the class file loaded by the ⟨class-name⟩ argument of the \documentclass command. A package file thus extends the range of document which can be processed. Each package is loaded only once. If the same package is requested more than once, nothing happens in the second or following attempt unless the package has been requested with options that were not given in the original \usepackage. If such extra options are specified then an error message is produced.
Release Date
⟨release-date⟩ can contain the earliest desired release date of the package file in the format YYYY/MM/DD; if an older version of the package is found, a warning is issued.

\listfiles

If \listfiles command is placed in the preambled then a list of the files read in as a result of processing the document will be displayed on the terminal and in the log file at the end of the run. Where possible, a short description will also be produced. This command wil list only files which were read using LaTeX commands such as \input{⟨file⟩} or \include{⟨file⟩}. If the file was read using the primitive TeX syntax \input file without {} braces around the file name, then it will not be listed, failure to use the LaTeX form with the braces can cause more severe problems, possibly leading to overwriting important files.

\setcounter

The syntax of \setcounter command is \setcounter{errorcontextlines}{⟨num⟩}. TeX3 introduced a new primitive \errorcontextlines which controls the format of error messages. LaTeX2 provides an interface to this through the standard \setcounter command. By default, this is set to -1 in order to suppress the internal definitions of an error.

Document Environment

Document environment is used to place the text and document structure of the document. Document environment is enclosed between two commands \begin{document} and \end{document} which identify the beginning and end of the actual document.
\begin{document}
...
\end{document}

Ending

Ending is the division after the \end{document} command. In general, LaTeX will not typeset any text or command after \end{document} command.

Source and Reference


©sideway

ID: 200501502 Last Updated: 2/22/2022 Revision: 1


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019