Skip to content

abrik1/tex-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

tex-commands

Some useful commands for LaTex

Mathematical Symbols:

NOTE: always use the $(dollar) sign before and afer the expression when you are writing a mathematical expression in LaTex

Without $:

\geq

- the above statement but with the dollar sign added on both sides of the expression


Mathematical Symbols:

  • $a^b$ is a b (exponents)
  • $a_b$ is a b (subscript.. can be used to write chemical formulaes like C h 6
  • \frac{first arg}{second arg} is f i r s t   a r g s e c o n d   a r g (fractions.. replace first arg and second arg by your expression)
  • \neq is (not equals to.. can be used when a != b)
  • \int is ($\int$) or Integral Sign
  • \lambda is λ ($lambda) or Lambda
  • \infty is or Infitnity
  • \pi is π or pi.. can be used to write the formula for circle's area( π r 2 )
  • \sum is or Sumation

Misc Symbols:

  • \circ is used to make a circle or degree symbol such as 180 ($180^{\circ}$)
  • \square is used to make a square.. like:
  • \space is used to add spacing inside a mathematical expression.. ( x )   + 1 ($\int(x) \space + 1$)
  • \rightarrow is (Right Arrow)
  • \leftarrow is (Left Arrow)

Text Coloring:

NOTE: in order for colorization you must add package xcolor

Adding It:

\usepackage{xcolor}

Usage:

The available colors are black, blue, brown, cyan, darkgray, gray, green, lightgray, lime, magenta, olive, orange, pink, purple, red, teal, violet, white, yellow

\color{your_color}This is a colored text\color{white} % white is the FG here

Demo:

Code:
\usepackage {xcolor}
\color{red}This is a red text\color{white}
\color{orange}This is an orange text\color{white}
\color{yellow}This is a yellow text\color{white}
\color{green}This is a green text\color{white}
\color{blue}This is a blue text\color{white}
\color{purple}This is a purple text\color{white}
Preview:

T h i s   i s   a   r e d   t e x t

T h i s   i s   a n   o r a n g e   t e x t

T h i s   i s   a   y e l l o w   t e x t

T h i s   i s   a   g r e e n   t e x t

T h i s   i s   a   b l u e   t e x t

T h i s   i s   a   p u r p l e   t e x t

Preamble

Your preamble is where you setup your LaTeX envioment and packages, often its imported from a spereate file called preamble.tex using the \input{} command.

Vectors

Creating vectors in LaTeX can be a hassle, use the folloing macros to make the process faster. This code introduces two new commands \vec{} and \pvec{}, \vec{ab} creates an arrow above your variable name like a b and \pvec{} creates a vector column such as \pvec{3 \\ 4 \\ 1}

image

Add the following code to your preamble after importing the amsmath (the amarecan mathmatical assosiation math package)

% Vectors
\renewcommand{\vec}[1]{\overrightarrow{#1}}

% Custom command for display vectors using pmatrix, use \pvec{1 \\ 2 \\ 3}
\newcommand{\pvec}[1]{%
  \begin{pmatrix}
  #1
  \end{pmatrix}%
}

Contributing:

On this README.md you may add an section or fix some mistakes