Latex Starter Templates

Source: Internet
Author: User

This is the Latex beginner template, copy the following content to a blank. tex file, and then compile with latex, and then use Dvi2pdf to generate PDF files, and the following basic not a word has parsing, it is worth studying.

% A4PAPER-A4 paper 11pt-font twoside-double-sided openany-New chapters can start on even pages
\documentclass[a4paper,11pt,twoside,openany]{article}
%------------------------------Paper size----------------------------------
% definition of paper size converted to PDF document should be consistent with \paperwidth \paperheight
%\special{pdf:pagesize width 20cm height 30cm}
The meaning of% true is to keep the dimensions from changing with some parameters, visible Knuth Texbook
%\paperwidth TRUECM% paper width
%\paperheight TRUECM% paper high
%------------------------------Page Layout----------------------------------
%\textwidth truecm% Body width
%\textheight truecm% Text high
%\headheight 14pt% Header height
%\headsep 16pt% Header distance
%\footskip 27pt% Footer distance
%\marginparsep10pt% side-note area distance
%\marginparwidth 100pt% margin Note area width
%----------------------------page margin Adjustment-------------------------------
\def\marginset#1#2{% margin Settings \marginset{left}{top}
\setlength{\oddsidemargin}{#1}% left (book inside) binding reserve blank distance
\iffalse% if you consider the margin of the left side (inside the book), change to \iftrue
\reversemarginpar
\ADDTOLENGTH{\ODDSIDEMARGIN}{\MARGINPARSEP}
\addtolength{\oddsidemargin}{\marginparwidth}
\fi

\setlength{\evensidemargin}{0mm}% 0
\iffalse% if you consider the margin area on the right side (outside the book), change to \iftrue
\ADDTOLENGTH{\EVENSIDEMARGIN}{\MARGINPARSEP}
\addtolength{\evensidemargin}{\marginparwidth}
\fi

% \paperwidth = h +\oddsidemargin+\textwidth+\evensidemargin + H
\setlength{\hoffset}{\paperwidth}
\addtolength{\hoffset}{-\oddsidemargin}
\addtolength{\hoffset}{-\textwidth}
\addtolength{\hoffset}{-\evensidemargin}
\setlength{\hoffset}{0.5\hoffset}
\addtolength{\hoffset}{-1in}% H = \hoffset + 1in

\setlength{\voffset}{-1in}% 0 = \voffset + 1in
\setlength{\topmargin}{\paperheight}
\addtolength{\topmargin}{-\headheight}
\ADDTOLENGTH{\TOPMARGIN}{-\HEADSEP}
\addtolength{\topmargin}{-\textheight}
\addtolength{\topmargin}{-\footskip}
\addtolength{\topmargin}{#2}% top reserved binding blank distance
\setlength{\topmargin}{0.5\topmargin}
}
% adjust margin to center content, two parameters for the left and top of the paper to reserve the binding blank distance
\marginset{10mm}{12mm}
%-----------------------------Font support-----------------------------------
\usepackage{times}% use times New Roman font
\usepackage{cjk,cjknumb,cjkulem}% Chinese Support macro Package
%\USEPACKAGE{CCMAP}% enable Pdflatex generated files to support replication, etc.
%\usepackage[mtbold,mtpluscal,mtplusscr]{mathtime}% mathematics environment with times New Roman
%-----------------------------Header and footer-----------------------------------
\USEPACKAGE{FANCYHDR}% header and footer related macro package
\pagestyle{fancy}% Header footer style
%-----------------------------Paragraph font formatting-------------------------------
\usepackage{color}% supports color
\usepackage{indentfirst}% First line indent macro package
%\SETLENGTH{\PARINDENT}{2EM}% paragraph indent
\setlength{\parskip}{0.7ex Plus0.3ex Minus0.3ex}% paragraph Spacing
%\linespread{1.2}% spacing multiple
\renewcommand{\baselinestretch}{1.2}% spacing multiple (IBID.)
%\renewcommand{\cjkglue}{\hskip 0pt plus 0.08\baselineskip}% Chinese character kerning
%\newcommand{\aaa}{this is the test}% custom Text block example
\newcommand{\song}{\cjkfamily{song}% Song body
\newcommand{\hei}{\cjkfamily{hei}}% Bold
\NEWCOMMAND{\FS}{\CJKFAMILY{FS}}% Imitation
\newcommand{\kai}{\cjkfamily{kai}}% italics
\newcommand{\li}{\cjkfamily{li}}% Script
\newcommand{\you}{\cjkfamily{you}}% young round
\newcommand{\wuhao}{\fontsize{10.5pt}{12.6pt}\selectfont}% Fifth font
\newcommand{\xiaosi}{\fontsize{12pt}{14pt}\selectfont}% Small four fonts
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}% Fourth font
%\marginparpush%
%-----------------------------Hyperlinks and labels-------------------------------
\iffalse% will be used here instead of \iftrue
\ifx\pdfoutput\undefined% not run pdfTeX
% \ifx
% \usepackage[dvips]{hyperref}
% \else
\USEPACKAGE[DVIPDFM]{HYPERREF}
% \fi
\atbegindvi{\special{pdf:tounicode GBK-EUC-UCS2}}% GBK-> Unicode
\else
\USEPACKAGE[PDFTEX]{HYPERREF}
\fi
\hypersetup{cjkbookmarks,%
bookmarksnumbered,%
colorlinks,%
linkcolor=blue,%
citecolor=blue,%
hyperindex,%
plainpages=false,%
Pdfstartview=fith}
\fi
%--------------------------------Comments------------------------------------
\iffalse% will be used here instead of \iftrue
% comment out a piece of content
\usepackage{verbatim}
\begin{comment}
This is a comment example.
\end{comment}
\fi
%\makeatletter% @ Now a normal ' letter ' for Tex
%\makeatother% @ is restored as a ' non-letter ' for Tex
%--------------------------------other macro packages--------------------------------
%\USEPACKAGE{AMSMATH,AMSTHM,AMSFONTS,AMSSYMB,BM}% Math Macro package
%\usepackage{graphicx,psfrag}% Graphics Macro package
%\USEPACKAGE{MAKEIDX}% build Index macro Package
%\usepackage{listings}% source Code macro Package
%---------------------------------Body-----------------------------------
\begin{document}% Start body
% song-Arial hei-blackbody fs-imitation kai-italics li-Arial you-young round com for Song+hei
\begin{cjk*}{gbk}{com}% start Chinese environment
\cjktilde% to define the white space distance represented
\cjkindent% Section First indent
\CJKCAPTION{GB}% Chinese Chapter title
\AUTHOR{CEO}% author
\title{a latex example}% topic
\maketitle% Generate title
%\thispagestyle{empty}% set the header and footer style of the first page
%\setlength{\baselineskip}{3ex Plus1ex Minus1ex}% adjust line spacing

\tex{}~ is from Turing Award winner \index{knuth, Donald E.} ~donald e.knuth\cite{texbook}~
A computer program that is written to be used for typesetting articles and mathematical formulas.

1977~ year ~knuth~ started writing ~\tex{}~ typesetting system engine, \% line
is to explore the potential of digital printing equipment that is beginning to enter the publishing industry. \newline% Line Change
In particular, he hopes to reverse the downward trend in the quality of typesetting and to keep his books and articles from being harmed.

\noindent% not indented
% below is special character # $% ^ & _ {} ~ \ ... The input
\# \$ \% \^{} \& \_ \{\} \~{} $\backslash$ \ldots

\indent% Restore Indent
% without Cjkulem package, \textit{me a} or \emph{me a} or {\em me a} to make English italic, Chinese variable font
% with Cjkulem package, \textit{me a} is still English italic, Chinese variable font, the latter two become underlined
\textit{Chinese Textit} \emph{Chinese emph} {\em Chinese em}
\textbf{Bold TEXTBF}% bold, in bold text instead of bold for Chinese recommendations
\uline{underscore Uline}% underline (requires Cjkulem package)
\textcolor{yellow}{YELLOW Yellow}% Color (need color package)
{\color{blue} Blue blue} {\color{red} Red Red} {\color{green} Green greens}
{\hei Bold} {\sihao No. Fourth} {\song\xiaosi arial small four}% font size
{\tiny Hi} {\small Hi} {\normalsize Hi} {\large Hi} {\large Hi} {\huge Hi}

\clearpage% Change page, \newpage also can, recommend \clearpage
We are now using the ~\tex{}~ system is released in ~1982~ years, 1989~ year and slightly improved, enhanced
Support for ~8~ byte characters and multiple languages. \tex{}~ with excellent stability, can be in a variety of different
Types of computers that are known to run on and almost without errors. \tex{}~ 's version number is constantly approaching ~$\pi$,
Now for $3.14159$. \clearpage
\end{cjk*}% End Chinese environment
\end{document}% End Body

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.