
Elements for LaTeX
作者:
Bon Crowder
最近上传:
10 年前
许可:
Creative Commons CC BY 4.0
摘要:
Just a collection of the code I've found and use regularly in projects. Includes crazy shapes, graph paper, margin changes and alignment of equations.

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{multicol}
\usepackage[margin=0.75in]{geometry}
\usepackage{parcolumns}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{bigints}
\usepackage{tkz-euclide}
\usepackage{gensymb}
\usetkzobj{all}
\usetikzlibrary{arrows}
\pagestyle{fancy}
\setlength{\parindent}{0pt}
\newcommand*{\xMin}{0}%
\newcommand*{\xMax}{6}%
\newcommand*{\yMin}{0}%
\newcommand*{\yMax}{6}%
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
\title{Elements for LaTeX}
\author{Bon Crowder\\ www.MathFour.com}
\begin{document}
\lhead{}
\chead{\bfseries Elements for LaTeX}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\section{Numbered Graph Paper 1-5}
\begin{tikzpicture}
\tkzInit[xmax=5,ymax=5,xmin=-5,ymin=-5]
\tkzGrid
\tkzAxeXY
\end{tikzpicture}
\vspace{.5in}
\section{Numbered Graph Paper 1-12}
\begin{tikzpicture}[scale=.72]
\tkzInit[xmax=12,ymax=2,xmin=-12,ymin=-2]
\tkzGrid
\tkzAxeXY
\end{tikzpicture}
\section{Numbered Lists}
\begin{enumerate}
\item first
\item second
\item third
\end{enumerate}
\vspace{.5in}
\section{Bulleted Lists}
\begin{itemize}
\item first
\item second
\item third
\end{itemize}
\vspace{.5in}
\section{Vocabulary Lists}
\begin{description}
\item[First] first
\item[Second] second
\item[Third] third
\end{description}
\vspace{.5in}
\section{Vocabulary Lists with Spaces}
\begin{description}
\item[First] \hfill \\
first
\item[Second] \hfill \\
second
\item[Third] \hfill \\
third
\end{description}
\vspace{.5in}
\section{Crazy Shapes}
\begin{tikzpicture}[thick]
\coordinate (O) at (2,0);
\coordinate (A) at (7,0);
\coordinate (B) at (7,5);
\coordinate (C) at (2,5);
\draw (B)--(C)--(O);
\draw [style=dashed] (O)--(A)--(B);
\tkzMarkSegment[color=black,pos=1,mark=|](C,B)
\tkzMarkSegment[color=black,pos=0,mark=|](C,B)
\tkzMarkSegment[color=black,pos=1,mark=|](C,O)
\tkzMarkSegment[color=black,pos=0,mark=|](C,O)
\draw (2,0) arc (-180:0:2.5cm);
\draw (7,5) arc (90:-90:2.5cm);
\node at (1,2.5){3 inches};
\node at (4.5,5.5){3 inches};
\end{tikzpicture}
\vspace{.5in}
\begin{tikzpicture}[thick]
\coordinate (O) at (0,0);
\coordinate (A) at (8,0);
\coordinate (B) at (4,5);
\draw (O)--(A)--(B)--cycle;
\tkzMarkAngle[fill= white,size=1cm,%
opacity=.4](A,O,B)
\tkzLabelAngle[pos = 1.65](A,O,B){$x$}
\tkzMarkAngle[fill= white,size=1cm,%
opacity=.4](B,A,O)
\tkzLabelAngle[pos = 1.65](B,A,O){$27\degree$}
\tkzMarkSegment[color=black,pos=.5,mark=|](A,B)
\tkzMarkSegment[color=black,pos=.5,mark=|](O,B)
\end{tikzpicture}
\vspace{.5in}
\begin{tikzpicture}[thick]
\draw (1,0) -- (11,0) -- (11,3) -- (5,3) --(5,8) -- (1,8) -- (1,0);
\node at (5,-0.5) {12 feet};
\node at (11.75,1.5) {3 feet};
\node at (9,3.5) {7 feet};
\node at (0,4){8 feet};
\end{tikzpicture}
\vspace{.5in}
NOTE: These dotted lines don't show up:\\
\begin{tikzpicture}[thick]
\draw (1,0) arc (270:90:2cm);
\draw (1,4) arc (180:0:3cm);
\draw (7,4) arc (90:-90:2cm)--(1,0);
\draw [dotted](1,0)--(1,4);
\draw [dotted](1,4)--(7,4);
\node at (2,2){3 inches};
\node at (4,3.5){4 inches};
\end{tikzpicture}\\
\section{Quoted text}
``Once you realize we are \textbf{all} idiots, only then can you do math.''\\
\pagebreak
\section{Page Break}
random words to show a page break
\pagebreak
\section{Multiple Columns}
\begin{multicols}{3}
one\\
two\\
three\\
\columnbreak
one\\
two\\
three\\
\columnbreak
one\\
two\\
three\\
\end{multicols}
\section{Aligning Equations (and labeling them)}
\begin{equation} \label{eq1}
\begin{split}
A & = \frac{\pi r^2}{2} \\
& = \frac{1}{2} \pi r^2
\end{split}
\end{equation}\\
\section{Blanks and flushed right}
\begin{flushright}
Name: \underline{\hspace{1.5in}}
\end{flushright}
\section{Change Margins for just a small part}
\begin{changemargin}{1in}{1in}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vulputate feugiat aliquam. Ut auctor mollis velit vel suscipit. Aenean rutrum nulla nisl, quis placerat turpis ullamcorper non. Aenean nec arcu nisi. Suspendisse ut tellus sodales, pharetra nisi viverra, egestas nunc. Integer sed eros vel justo sagittis laoreet vitae ac justo. Vivamus maximus pulvinar facilisis. Donec sed vestibulum mauris. Etiam vel quam nisl. Praesent faucibus ullamcorper cursus. Ut aliquet tempus metus, a convallis metus fringilla eget. Cras placerat, tellus dignissim rhoncus finibus, lacus neque ullamcorper erat, sit amet dapibus tortor ligula non magna.
\end{changemargin}
\section{Horizontal Line}
\begin{center}
\line(1,0){250}
\end{center}
\end{document}