Added bunch of snippets to tex.snippets

This commit is contained in:
Maarten Slagter 2014-01-23 14:54:19 +01:00
parent ae611ccf95
commit 2fca23830b
2 changed files with 19 additions and 47 deletions

View File

@ -1,39 +1,26 @@
extends texmath
###########################################################################
# LATEX SNIPPETS #
###########################################################################
snippet r "\\ref{}" w
\ref{$1}
endsnippet
###########################################################################
# TEXTMATE SNIPPETS #
###########################################################################
#################
# GENERAL STUFF #
#################
snippet "b(egin)?" "begin{} / end{}" br
\begin{${1:something}}
${0:${VISUAL}}
\end{$1}
endsnippet
####################
# TABULARS, ARRAYS #
####################
snippet tab
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
$0${2/((?<=.)c|l|r)|./(?1: & )/g}
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
endsnippet
########################
# ENUM, DESCR, ITEMIZE #
########################
snippet fig "Figure environment" b
\begin{figure}${2:[htpb]}
\centering
\includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}}
\caption{${4/(\w+)\.\w+/\u$1/}$0}
\label{fig:${4/(\w+)\.\w+/$1/}}
\end{figure}
endsnippet
snippet enum "Enumerate" b
\begin{enumerate}
\item $0
@ -52,17 +39,16 @@ snippet desc "Description" b
\end{description}
endsnippet
#####################################
# SECTIONS, CHAPTERS AND THEIR LIKE #
#####################################
snippet it "Individual item" b
\item ${1}
$0
endsnippet
snippet part "Part" b
\part{${1:part name}}
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
${0}
% part $2 (end)
endsnippet
snippet cha "Chapter" b
@ -70,8 +56,6 @@ snippet cha "Chapter" b
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
% chapter $2 (end)
endsnippet
snippet sec "Section" b
@ -79,18 +63,13 @@ snippet sec "Section" b
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
% section $2 (end)
endsnippet
snippet sub "Subsection" b
\subsection{${1:subsection name}}
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
% subsection $2 (end)
endsnippet
snippet ssub "Subsubsection" b
@ -98,9 +77,6 @@ snippet ssub "Subsubsection" b
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
% subsubsection $2 (end)
endsnippet
snippet par "Paragraph" b
@ -108,30 +84,25 @@ snippet par "Paragraph" b
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
% paragraph $2 (end)
endsnippet
snippet subp "Subparagraph" b
\subparagraph{${1:subparagraph name}}
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
% subparagraph $2 (end)
endsnippet
###############
# Utilities #
###############
snippet ni "Non-indented paragraph" b
\noindent
${0}
endsnippet
snippet pac "Package" b
\usepackage[${1:options}]{${2:package}}$0
endsnippet
snippet lp "Long parenthesis"
snippet lp "Long parenthesis"
\left(${1:${VISUAL:contents}}\right)$0
endsnippet
# vim:ft=snippets:

View File

@ -1450,6 +1450,7 @@ Contributors listed in chronological order:
Bernhard Vallant (lazerscience)
Von Welch (von)
Nikola Petrov (nikolavp)
Maarten Slagter (slagtermaarten)
Thank you for your support.