Skip to content

Instantly share code, notes, and snippets.

@jafonsor
Last active May 12, 2017 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jafonsor/5564a08dcfee94ca83ee2fc094ee0d54 to your computer and use it in GitHub Desktop.
Save jafonsor/5564a08dcfee94ca83ee2fc094ee0d54 to your computer and use it in GitHub Desktop.
% tabela
\begin{table}[h]
\centering
\begin{tabular}{ l|rrrr }
\toprule
& Problematic methods & Search Duration & Transform Duration \\
\midrule
fenixedu-academic & 2 & 498.83s & 574.35s \\
fenixedu-ist-integration & 3 & 22.61s & 41.21s \\
fenixedu-ist-vigilancies & 2 & 9.92s & 35.91s \\
\bottomrule
\end{tabular}
\caption{Statistics for the transformation that fixes the problematic methods.}
\label{tab:fenix-transformation-statistics}
\end{table}
% Extra stuff file
% This file is included before begin{document} environment
% Use this to include extra packages and define your own commands
% This way, you can easily grab a most recent version
% of dissertation.tex file from the original repo
\usepackage{amssymb}
\usepackage{amsmath}
\setcounter{tocdepth}{3}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{epstopdf}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{subcaption}
\usepackage{verbatim}
\usepackage{bold-extra} % add bold to the tt family font
\usepackage[chapter]{minted} % better syntax highlighting.
\usepackage{pygmentize} % because of minted
% use same counters for minted and lstlistings
\AtBeginEnvironment{listing}{\setcounter{listing}{\value{lstlisting}}}
\AtEndEnvironment{listing}{\stepcounter{lstlisting}}
% attempt at using double quotes on listings
%\usepackage[T1]{fontenc}
%\lstset{upquote=true}
\lstset{captionpos=b}
\graphicspath{{images/}}
%\AtBeginDocument{
\catcode`_=12
%}
% special character to inline listings
\lstMakeShortInline[columns=fixed]^
% Macro to use inline lstlistings on captions.
% ex: caption=Some text \inlinecode{asf\_sdf}.
\makeatletter
\newcommand\inlinecode[1]
{\lst@basicstyle #1}
\makeatother
% put line numbers inside the listing frame
\lstset{
xleftmargin=2em
, framexleftmargin=2em
, frame=tb
, stepnumber=1
, basicstyle=\ttfamily
, keywordstyle=\color{blue}\ttfamily
, stringstyle=\color{red}\ttfamily
, commentstyle=\color{darkgray}\ttfamily
%, morecomment=[l][\color{magenta}]{\#}
% break lines in listings
, breaklines=true
% adds arrow indicating the break line in listings
, postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}
% avoids the overlaping of listing borders with text
, aboveskip=20pt
, belowskip=20pt
}
\lstdefinelanguage{JavaScript}{
keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
keywordstyle=\color{blue}\bfseries,
ndkeywords={class, export, boolean, throw, implements, import, this},
ndkeywordstyle=\color{darkgray}\bfseries,
identifierstyle=\color{black},
sensitive=false,
comment=[l]{//},
morecomment=[s]{/*}{*/},
commentstyle=\color{darkgray}\ttfamily,
stringstyle=\color{red}\ttfamily,
morestring=[b]',
morestring=[b]"
}
% -------------------------------------------------------------------------
% Prolog Hilighting
%--------------------------------------------------------------------------
% --- ugly internals for language definition ---
%
\makeatletter
% initialisation of user macros
\newcommand\PrologPredicateStyle{}
\newcommand\PrologVarStyle{}
\newcommand\PrologAnonymVarStyle{}
\newcommand\PrologAtomStyle{}
\newcommand\PrologOtherStyle{}
\newcommand\PrologCommentStyle{}
% useful switches (to keep track of context)
\newif\ifpredicate@prolog@
\newif\ifwithinparens@prolog@
% save definition of underscore for test
\lst@SaveOutputDef{`_}\underscore@prolog
% local variables
\newcount\currentchar@prolog
\newcommand\@testChar@prolog%
{%
% if we're in processing mode...
\ifnum\lst@mode=\lst@Pmode%
\detectTypeAndHighlight@prolog%
\else
% ... or within parentheses
\ifwithinparens@prolog@%
\detectTypeAndHighlight@prolog%
\fi
\fi
% Some housekeeping...
\global\predicate@prolog@false%
}
% helper macros
\newcommand\detectTypeAndHighlight@prolog
{%
% First, assume that we have an atom.
\def\lst@thestyle{\PrologAtomStyle}%
% Test whether we have a predicate and modify the style accordingly.
\ifpredicate@prolog@%
\def\lst@thestyle{\PrologPredicateStyle}%
\else
% Test whether we have a predicate and modify the style accordingly.
\expandafter\splitfirstchar@prolog\expandafter{\the\lst@token}%
% Check whether the identifier starts by an underscore.
\expandafter\ifx\@testChar@prolog\underscore@prolog%
% Check whether the identifier is '_' (anonymous variable)
\ifnum\lst@length=1%
\let\lst@thestyle\PrologAnonymVarStyle%
\else
\let\lst@thestyle\PrologVarStyle%
\fi
\else
% Check whether the identifier starts by a capital letter.
\currentchar@prolog=65
\loop
\expandafter\ifnum\expandafter`\@testChar@prolog=\currentchar@prolog%
\let\lst@thestyle\PrologVarStyle%
\let\iterate\relax
\fi
\advance \currentchar@prolog by 1
\unless\ifnum\currentchar@prolog>90
\repeat
\fi
\fi
}
\newcommand\splitfirstchar@prolog{}
\def\splitfirstchar@prolog#1{\@splitfirstchar@prolog#1\relax}
\newcommand\@splitfirstchar@prolog{}
\def\@splitfirstchar@prolog#1#2\relax{\def\@testChar@prolog{#1}}
% helper macro for () delimiters
\def\beginlstdelim#1#2%
{%
\def\endlstdelim{\PrologOtherStyle #2\egroup}%
{\PrologOtherStyle #1}%
\global\predicate@prolog@false%
\withinparens@prolog@true%
\bgroup\aftergroup\endlstdelim%
}
% language name
\newcommand\lang@prolog{Prolog-pretty}
% ``normalised'' language name
\expandafter\lst@NormedDef\expandafter\normlang@prolog%
\expandafter{\lang@prolog}
% language definition
\expandafter\expandafter\expandafter\lstdefinelanguage\expandafter%
{\lang@prolog}
{%
language = Prolog,
keywords = {}, % reset all preset keywords
showstringspaces = false,
alsoletter = (,
alsoother = @$,
moredelim = **[is][\beginlstdelim{(}{)}]{(}{)},
MoreSelectCharTable =
\lst@DefSaveDef{`(}\opparen@prolog{\global\predicate@prolog@true\opparen@prolog},
}
% Hooking into listings to test each ``identifier''
\newcommand\@ddedToOutput@prolog\relax
\lst@AddToHook{Output}{\@ddedToOutput@prolog}
\lst@AddToHook{PreInit}
{%
\ifx\lst@language\normlang@prolog%
\let\@ddedToOutput@prolog\@testChar@prolog%
\fi
}
\lst@AddToHook{DeInit}{\renewcommand\@ddedToOutput@prolog{}}
\makeatother
%
% --- end of ugly internals ---
% --- definition of a custom style similar to that of Pygments ---
% custom colors
\definecolor{PrologPredicate}{RGB}{000,031,255}
\definecolor{PrologVar} {RGB}{024,021,125}
\definecolor{PrologAnonymVar}{RGB}{000,127,000}
\definecolor{PrologAtom} {RGB}{186,032,032}
\definecolor{PrologComment} {RGB}{063,128,127}
\definecolor{PrologOther} {RGB}{000,000,000}
% redefinition of user macros for Prolog style
\renewcommand\PrologPredicateStyle{\color{PrologPredicate}}
\renewcommand\PrologVarStyle{\color{PrologVar}}
\renewcommand\PrologAnonymVarStyle{\color{PrologAnonymVar}}
\renewcommand\PrologAtomStyle{\color{PrologAtom}}
\renewcommand\PrologCommentStyle{\itshape\color{PrologComment}}
\renewcommand\PrologOtherStyle{\color{PrologOther}}
% custom style definition
\lstdefinestyle{Prolog-pygsty}
{
language = Prolog-pretty,
upquote = true,
stringstyle = \PrologAtomStyle,
commentstyle = \PrologCommentStyle,
literate =
{:-}{{\PrologOtherStyle :-}}2
{,}{{\PrologOtherStyle ,}}1
{.}{{\PrologOtherStyle .}}1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment