134 lines
6.5 KiB
TeX
134 lines
6.5 KiB
TeX
\usepackage{listings}
|
|
\usepackage[usenames,dvipsnames]{color} % Required for specifying custom colors and referring to colors by name
|
|
\definecolor{editorGray}{rgb}{0.95, 0.95, 0.95}
|
|
\definecolor{DarkGreen}{rgb}{0.0,0.4,0.0} % Comment color
|
|
\definecolor{highlight}{RGB}{255,255,255} % Code highlight color
|
|
|
|
|
|
%\usepackage{color}
|
|
%\definecolor{editorGray}{rgb}{0.95, 0.95, 0.95}
|
|
\definecolor{editorOcher}{rgb}{1, 0.5, 0} % #FF7F00 -> rgb(239, 169, 0)
|
|
\definecolor{editorGreen}{rgb}{0, 0.5, 0} % #007C00 -> rgb(0, 124, 0)
|
|
%\definecolor{editorGray}{cmyk}{0.6, 0.55, 0.55, 0.2}
|
|
\definecolor{editorPurple}{cmyk}{0.4, 0.9, 0, 0}
|
|
\definecolor{editorWhite}{cmyk}{0, 0, 0, 0}
|
|
\definecolor{editorOrange}{cmyk}{0, 0.8, 1, 0}
|
|
\definecolor{editorBlue}{cmyk}{0.8, 0.7, 0, 0}
|
|
\definecolor{editorPink}{cmyk}{0.01, 0.81, 0.05, 0}
|
|
\usepackage{upquote}
|
|
|
|
\lstdefinelanguage{PHP}{
|
|
language=php,
|
|
alsodigit={.:;},
|
|
tabsize=2,
|
|
showtabs=false,
|
|
showspaces=false,
|
|
showstringspaces=false,
|
|
extendedchars=true,
|
|
breaklines=false,
|
|
backgroundcolor=\color{editorWhite},
|
|
basicstyle={\small\ttfamily},
|
|
frame=l,
|
|
% Line numbers
|
|
xleftmargin={0cm},
|
|
numbers=left,
|
|
stepnumber=1,
|
|
firstnumber=1,
|
|
numberfirstline=true,
|
|
% Code design
|
|
keywordstyle=\color{editorPink}\bfseries,
|
|
commentstyle=\color{editorGray}\ttfamily,
|
|
ndkeywordstyle=\color{editorBlue}\bfseries,
|
|
stringstyle=\color{editorPurple},
|
|
sensitive=true,
|
|
alsoletter={<>=-},
|
|
otherkeywords={require_once, try, new, catch, die},
|
|
ndkeywords={setAttribute, getMessage},
|
|
morecomment=[s]{<!--}{-->},
|
|
tag=[s]
|
|
}
|
|
|
|
|
|
\lstdefinelanguage{JavaScript}{
|
|
morekeywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
|
|
morecomment=[s]{/*}{*/},
|
|
morecomment=[l]//,
|
|
morestring=[b]",
|
|
morestring=[b]'
|
|
}
|
|
|
|
\lstdefinelanguage{HTML5}{
|
|
language=html,
|
|
sensitive=true,
|
|
alsoletter={<>=-},
|
|
otherkeywords={
|
|
% HTML tags
|
|
<html>, <head>, <title>, </title>, <meta, />, </head>, <body>,
|
|
<canvas, \/canvas>, <script>, </script>, </body>, </html>, <!, html>, <style>, </style>, ><
|
|
},
|
|
ndkeywords={
|
|
% General
|
|
=,
|
|
% HTML attributes
|
|
charset=, id=, width=, height=,
|
|
% CSS properties
|
|
border:, transform:, -moz-transform:, transition-duration:, transition-property:, transition-timing-function:
|
|
},
|
|
morecomment=[s]{<!--}{-->},
|
|
tag=[s]
|
|
}
|
|
|
|
\lstdefinestyle{miEstilo}{ % Define a style for your code snippet, multiple definitions can be made if, for example, you wish to insert multiple code snippets using different programming languages into one document
|
|
language=bash, % Detects keywords, comments, strings, functions, etc for the language specified
|
|
backgroundcolor=\color{highlight}, % Set the background color for the snippet - useful for highlighting
|
|
basicstyle=\footnotesize\ttfamily, % The default font size and style of the code
|
|
breakatwhitespace=false, % If true, only allows line breaks at white space
|
|
breaklines=true, % Automatic line breaking (prevents code from protruding outside the box)
|
|
captionpos=b, % Sets the caption position: b for bottom; t for top
|
|
commentstyle=\usefont{T1}{pcr}{m}{sl}\color{DarkGreen}, % Style of comments within the code - dark green courier font
|
|
deletekeywords={}, % If you want to delete any keywords from the current language separate them by commas
|
|
%escapeinside={\%}, % This allows you to escape to LaTeX using the character in the bracket
|
|
firstnumber=1, % Line numbers begin at line 1
|
|
frame=single, % Frame around the code box, value can be: none, leftline, topline, bottomline, lines, single, shadowbox
|
|
frameround=tttt, % Rounds the corners of the frame for the top left, top right, bottom left and bottom right positions
|
|
keywordstyle=\color{Blue}\bf, % Functions are bold and blue
|
|
morekeywords={}, % Add any functions no included by default here separated by commas
|
|
numbers=left, % Location of line numbers, can take the values of: none, left, right
|
|
numbersep=10pt, % Distance of line numbers from the code box
|
|
numberstyle=\tiny\color{Gray}, % Style used for line numbers
|
|
rulecolor=\color{black}, % Frame border color
|
|
showstringspaces=false, % Don't put marks in string spaces
|
|
showtabs=false, % Display tabs in the code as lines
|
|
stepnumber=5, % The step distance between line numbers, i.e. how often will lines be numbered
|
|
stringstyle=\color{Purple}, % Strings are purple
|
|
tabsize=2, % Number of spaces per tab in the code
|
|
}
|
|
|
|
\lstdefinestyle{cTexto}{ % Define a style for your code snippet, multiple definitions can be made if, for example, you wish to insert multiple code snippets using different programming languages into one document
|
|
language=bash, % Detects keywords, comments, strings, functions, etc for the language specified
|
|
backgroundcolor=\color{highlight}, % Set the background color for the snippet - useful for highlighting
|
|
basicstyle=\footnotesize\ttfamily, % The default font size and style of the code
|
|
breakatwhitespace=false, % If true, only allows line breaks at white space
|
|
breaklines=true, % Automatic line breaking (prevents code from protruding outside the box)
|
|
captionpos=b, % Sets the caption position: b for bottom; t for top
|
|
commentstyle=\usefont{T1}{pcr}{m}{sl}\color{DarkGreen}, % Style of comments within the code - dark green courier font
|
|
deletekeywords={}, % If you want to delete any keywords from the current language separate them by commas
|
|
%escapeinside={\%}, % This allows you to escape to LaTeX using the character in the bracket
|
|
firstnumber=1, % Line numbers begin at line 1
|
|
frame=single, % Frame around the code box, value can be: none, leftline, topline, bottomline, lines, single, shadowbox
|
|
frameround=tttt, % Rounds the corners of the frame for the top left, top right, bottom left and bottom right positions
|
|
keywordstyle=\color{Blue}\bf, % Functions are bold and blue
|
|
morekeywords={}, % Add any functions no included by default here separated by commas
|
|
numbers=none, % Location of line numbers, can take the values of: none, left, right
|
|
numbersep=10pt, % Distance of line numbers from the code box
|
|
numberstyle=\tiny\color{Gray}, % Style used for line numbers
|
|
rulecolor=\color{black}, % Frame border color
|
|
showstringspaces=false, % Don't put marks in string spaces
|
|
showtabs=false, % Display tabs in the code as lines
|
|
stepnumber=5, % The step distance between line numbers, i.e. how often will lines be numbered
|
|
stringstyle=\color{Purple}, % Strings are purple
|
|
tabsize=2, % Number of spaces per tab in the code
|
|
}
|
|
|
|
\newcommand{\lstbash}[2]{\begin{itemize}\item[]\lstlisting[caption=#2,label=#1,style=miEstilo]{#1}\end{itemize}} % The first argument is the script location/filename and the second is a caption for the listing
|