% \iffalse meta-comment
%<*batchfile>
%%
%% ulQda
%% A LaTeX package supporting Qualitative Data Analysis
%%
%% Copyright (C) 2009 by Ivan Griffin
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 of this license or (at your option) any later
%% version. The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
\begingroup
\input docstrip.tex
\keepsilent
\usedir{tex/latex/ulqda}
\preamble

This is a generated file.

Copyright (C) 2009 by Ivan Griffin

This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.2 of this license or (at your option) any later
version. The latest version of this license is in:

    http://www.latex-project.org/lppl.txt

and version 1.2 or later is part of all distributions of
LaTeX version 1999/12/01 or later.

\endpreamble
\askforoverwritefalse
\generate{\file{ulqda.sty}{\from{ulqda.dtx}{package}}}
\generate{\usepreamble\empty \usepostamble\empty \file{ulqda.pl}{\from{ulqda.dtx}{perl}}}
\endgroup
%</batchfile>
%<*package>
%
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{ulqda}
  [2009/06/11 v1.1 Qualitative Data Analysis package]
%
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage{color}
\usepackage{soul} 
\usepackage{tikz}
\usetikzlibrary{backgrounds,shapes,arrows,positioning}
\definecolor[named]{UlQda@lightblue}{rgb}{0.80,0.85,1}
\usepackage{alltt}
\usepackage{ulqda}
\usepackage{hyperref}
\usepackage{subfigure}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks,
  linkcolor=linkcolour,citecolor=linkcolour,
  filecolor=linkcolour, urlcolor=linkcolour}
\GetFileInfo{ulqda.sty}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\newenvironment{UsageEnv}
{
  % Begin Code
    \vspace*{0.12em}
    \textsc{Usage}: 
}
{
  % End Code
    \\ \vspace*{0.25em}
}
\def\TikZ{Ti{\em k}Z}
\begin{document}
\DocInput{ulqda.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
% \changes{v1.0}{2009/05/15}{Initial Version.}
% \changes{v1.1}{2009/06/11}{Changes to support xcolor, multicol, and to fix some typos and bugs. dot2texi.sty in CTAN doesn't currently support cache option. Also added |\ulqdaCloud| macro.}
% \GetFileInfo{ulqda.sty}
%
% \title{\ulQda: A \LaTeX\ package supporting Qualitative Data Analysis}
% \author{Ivan Griffin
%   \\%
%   \texttt{ivan.griffin@ul.ie}}
% \date{\filedate}
% \maketitle
%
% ^^A  The following were copied verbatim from source2e.tex.
% \DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
% \DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,%
%             \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi}
% \DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,%
%             \vbox,\vtop,\vcenter}
% \DoNotIndex{\@empty,\immediate,\write}
% \DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup}
% \DoNotIndex{\divide,\advance,\multiply,\count,\dimen}
% \DoNotIndex{\relax,\space,\string}
% \DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,%
%             \closein,\closeout}
% \DoNotIndex{\catcode,\endinput}
% \DoNotIndex{\jobname,\message,\read,\the,\m@ne,\noexpand}
% \DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss}
% \DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@}
% \DoNotIndex{\dp,\wd,\ht,\vss,\unskip,}
%
% ^^A  The following are for this package.
% \DoNotIndex{\begin,\day,\time,\year,\month,\par,\hl,\hbadness,\typeout}
% \DoNotIndex{\input,\lower,\index,\emph,\RequirePackage}
% \DoNotIndex{\it,\protect,\sethlcolor,\setkeys,\stepcounter,\thepage,\thesection,\tiny,\ul,\verb,\tmpfile}
% 
% \begin{abstract}
%  \ulQda\ is a \LaTeX\ package for use in Qualitative Data Analysis research.
%  It assists in the analysis of textual data such as interview transcripts
%  and field notes.  This document corresponds to \ulQda~\fileversion, 
%  dated~\filedate.
% \end{abstract}
%
% \tableofcontents
%
% \section{Introduction}
%   This document describes \ulQda, a \LaTeX\ package which supports
%   the integration of Qualitative Data Analysis (QDA) research tasks,
%   specifically for Grounded Theory, into the
%   \LaTeX\ work flow. For a quick start example, see 
%   section~\ref{sect:example}.
%
% \subsection{What is Qualitative Data Analysis?}
%   Qualitative Data Analysis is a field of inquiry that is popular in 
%   social science research~\cite{miles_and_huberman}. 
%   Scientific methods within QDA aim to gain 
%   comprehensive and holistic understandings of the motivations for 
%   human behaviour in many different situations.
%
%   Grounded Theory is a qualitative methodology that emphasises the
%   generation of new theory from its natural emergency through the
%   process of continual collection, compaction and analysis~\cite{glaser_strauss,strauss_corbin}.
%
% \subsection{What does this package do?}
%
%   The \ulQda\ package provides the \LaTeX\ user with macros which 
%   are used to markup textual information - for example, in-depth 
%   interviews - in order to facilitate the distillation of emerging 
%   themes from the data in a consistent and reliably manner, and to 
%   support visualisation of these themes.  
%
%   In other words, this package lets the computer do the grunt work, and 
%   the researcher focus on recognising and comprehending the 
%   emerging theories from the work.  
%
%   The package works by creating a comma-separate values (CSV) cache file
%   of the codes and associated text it finds in your \LaTeX\ source.
%   It then post-processes this CSV file to 
%   \href{http://www.graphviz.org}{GraphViz} Dot language, and
%   uses \texttt{dot2texi.sty} to optionally render this data as graphs.
%   The filename for the CSV file is generated automatically from the
%   \LaTeX\ current jobname.
%
% \subsection{Why is this package named \ulQda?}
%   The name \ulQda\ is simply the initials of my \emph{alma mater}, the 
%   \href{http://www.ul.ie/}{University of Limerick}, prepended onto the 
%   abbreviation QDA to generate a unique name. The \ulQda\ prefix is used 
%   within the package on macro names and conditionals to prevent naming 
%   clashes.
%
% \subsection{Acknowledgements}
%   Special thanks to Marc van Dongen and Peter Flynn of the 
%   \href{https://listserv.heanet.ie/cgi-bin/wa?A0=ITALIC-L}%
%        {Irish \TeX{} and \LaTeX{} In-Print Community} 
%   for their assistance in creating the \LaTeX\ macro to perform the coding.
%
%   Thanks to Kjell Magne Fauskes for the excellent \texttt{dot2tex} and
%   \texttt{dot2texi.sty} packages.
%
%   And finally, a special shout out to Matthias Noe for pointing out
%   some issues with an earlier version of this package.
%
% \subsection{Legal Mumbo-Jumbo}
%
% This document and the \ulQda\ package are copyright \copyright~2009 
% Ivan Griffin.
%
% The \ulQda\ package may be distributed under the 
% conditions of the \LaTeX\ Project Public License, either
% version 1.2 of this license or (at your option) any later
% version. The latest version of this license is in: 
% \begin{quote}
% \url{http://www.latex-project.org/lppl.txt}
% \end{quote}
% and version 1.2 or later is part of all distributions of
% \LaTeX\ version 1999/12/01 or later.
%
% \section{Prerequisites}
%   \ulQda\ requires the use of pdfe\TeX.  The following \LaTeX\ packages, 
%   available on \href{http://www.ctan.org/}{CTAN}, are needed by the \ulQda\ 
%   package:
%   \begin{itemize}
%     \item color.sty - provides \LaTeX\ support for colour;
%     \item soul.sty - provides support for highlighting text;
%     \item multicol.sty - defines an environment for typesetting text in 
%       multiple columns;
%     \item \href{http://sourceforge.net/projects/pgf/}{PGF/\TikZ} - macro 
%       package for the creation of graphics in \TeX;
%     \item \href{http://www.fauskes.net/nb/introducing-dot2texi/}{dot2texi.sty} - allows the embedding of GraphViz graphs (described in Dot language) in \LaTeX\ documents.
%   \end{itemize}
% 
%   In addition, the following external tools are required for processing
%   and graph/list generation:
%   \begin{itemize}
%     \item \href{http://www.graphviz.org/}{GraphViz} is a tool to automate 
%       graph visualisation~\cite{graphviz}, a means of graphically 
%       `representing structural information as diagrams of abstract graphs 
%       and networks';
%     \item \href{http://www.fauskes.net/code/dot2tex/}{dot2tex} is a tool 
%       for converting graphs generated by GraphViz to PGF/\TikZ\ that can 
%       be rendered with \LaTeX~\cite{dot2tex};
%     \item \href{http://www.perl.org/}{Perl} and the Digest::SHA1 Perl Module 
%       are used to automate the conversion of coded output to Dot language.
%   \end{itemize}
%
% \section{Known Limitations and Issues}
%
% For some reason, the underlining trick provided by soul.sty and used by
% this package fails to work when a color model option is passed to
% xcolor.sty.  The trouble seems to be with soul.sty's |\texthl{}| macro.
%
% A rather unsatisfactory workaround is to redefine |\ulqdaHighlight| to 
% something % like the following, somewhere in your own document after you 
% have used 
% |\usepackage[cmyk]{xcolor}| and |\usepackage{ulqda}|:
% \\
% |\renewcommand{\ulqdaHighlight}[2]{%| \\
% |  \colorbox{UlQda@lightblue}{\mbox{#2}}| \\
% |  \marginpar%| \\
% |  {\raggedright\hbadness=10000\tiny\it\colorbox{UlQda@lightblue}{#1}\par}%| \\
% |}|
%
% Note however that this is not without its own typesetting abberations.
%
% \subsection{docstrip woes - in this very document!}
%
% As I am using a single |.dtx| file to produce both |ulqda.sty| and |ulqda.pl|,
% I used mechanisms to separate each - notably |<package>| and |<perl>| filters established
% with the docstrip |\generate| macro.  However, for some reason these filters are
% being output in the typeset source listings for the \LaTeX\ macros in this document.
% Unfortunately, the docstrip documentation is suitable terse and has not as of yet
% enlightened me as to how to fix this issue. Please ignore them - or better, suggest
% the fix!
%
% \section{Why use \LaTeX\ for QDA Automation?}
%
%   An obvious question at this point is why use \LaTeX\ for QDA work flow
%   automation? Surely there are plenty of commercial offerings on the
%   market that can perform the same or similar task?
%
%   In my opinion, incorporating the coding markup into the \LaTeX\ 
%   typesetting flow has a number of benefits:
%
%   \begin{itemize}
%     \item it helps keep coding near the data - developer Brad Appleton 
%       describes this well~\cite{locality_of_ref}:
%       \begin{quote}
%         `\emph{The likelihood of keeping all or part of a software 
%         artifact consistent with any corresponding text that describes it, 
%         is inversely proportional to the square of the cognitive distance 
%         between them.}'
%       \end{quote}
%       Appleton also expands on the concept of cognitive 
%       distance~\cite{locality_of_ref}:
%       \begin{quote}
%         `\emph{The phrase ``out of sight, out of mind'' gives a vague 
%         indication of what is meant by ``cognitive distance'' \ldots
%         it relates to the interruption of ``flow'' 
%         of the developers' thoughts between the time they first thought of 
%         what they needed to do, and the time and effort expended before 
%         they were actually able to begin doing it. }'
%       \end{quote}
%     \item coding can easily be output as a recorded high-quality typeset 
%       deliverable - this is possible with other commercial tools, although 
%       the output is not as aesthetic as using \LaTeX\ - it is certainly more 
%       difficult to do this with pen, paper and scissors techniques;
%     \begin{itemize}
%       \item in addition, typesetting the coded data is very valuable - 
%         it allows others to check the validity of the output (theme 
%         emergence and theory building) of your work, and provides a resource 
%         for subsequent (perhaps affiliated) researchers to use (subject to 
%         confidentiality and disclosure agreements, etc.)
%       \item Using \LaTeX\ allows you to easily keep the interviews 
%         typographically consistent with the styles and notations used in 
%         the main dissertation;
%     \end{itemize}
%     \item it allows for a significant degree of flexible in the work flow, 
%       limited primarily by your imagination, and not by the functionality
%       of a commercial package. A \LaTeX\ based scheme can `fit naturally
%       into a work flow where there are many tools, each good at its own
%       job'\cite{LaTeX_goes_with_the_flow}.
%       As the \LaTeX\ typesetting run itself is generating the coded 
%       output data in an easily accessible format (comma-separated values), 
%       it is possible to post-process this and visualize the data in a 
%       number of different ways:
%     \begin{itemize}
%       \item coupled with an appropriate version control system, the 
%         \LaTeX\ QDA work flow can provide full traceability of a theme from
%         the collection of source interview data, condensation into codes,
%         iterative refinement of these codes into orthogonal and related 
%         sets, and presentation/visualisation of the generated ontologies;
%       \item it is possible to generate `heatmaps', mixing qualitative
%         analysis with some element of quantitative analysis, and to
%         use color coding or font/size scaling based on frequency of
%         occurrence of certain codes or themes;
%       \item it is also possible to visually recognize saturation
%         occurring in emerging themes - again through the use of 
%         appropriate color coding of new themes on a per-interview
%         basis - the output format includes the document section 
%         information per code to facilitate this post-processing;
%     \end{itemize}
%     \item this package and the \LaTeX\ typesetting system are freely 
%       available - you may be unwilling or unable to pay for commercial 
%       software;
%   \end{itemize}
%
% \section{Installation}
%   The package \ulQda\ is distributed as \texttt{dtx} archive together
%   with a corresponding \texttt{Makefile}. 
%   \texttt{dtx} files are text files which combines a \LaTeX\ package with  
%   other helper files and documentation for its own code. 
%    
%   In order to install this package, you must:
%   \begin{enumerate}
%   \item Run \texttt{make} to use the supplied \texttt{Makefile}. This will 
%     extract the macro and script files from the \texttt{dtx} 
%     archive, and it will also generate documentation for the packages 
%     user interfaced and code:
%     When built with \texttt{make}, the following files are generated:
%     \begin{itemize}
%       \item \texttt{ulqda.pdf} - contains this documentation;
%       \item \texttt{ulqda.sty} - contains the actual macro implementations;
%       \item \texttt{ulqda.pl} - a helper script to parse the CSV output.
%     \end{itemize} 
%   \item Copy \texttt{ulqda.sty} to either the working directory of your 
%     current \LaTeX\ project, or to your personal \TeX\ tree. 
%     For Unix users, the procedure to copy to your personal tree is:\\
%\verb+$ make+\\
%\verb+$ mkdir -p ~/texmf/tex/latex/ulqda+\\
%\verb+$ cp ulqda.sty ~/texmf/tex/latex/ulqda+
%   \item Tell \TeX\ to re-index its directories to enable it to recognize 
%     the new package:\\
%\verb+$ texhash ~/texmf+
%   \item Copy \texttt{ulqda.pl} to a directory in your path.  Again, for 
%     Unix users, the procedure to do this is as follows:\\
%\verb+$ cp ulqda.pl ~/bin+
%   \end{enumerate}
%
% \section{Usage}
%
%   We will now look at how the package is used - how to set
%   its various options, the macros it provides, and an example of its
%   operation.
%
% \subsection{Options}
% 
%   To use the package in your \LaTeX\ document, insert |\usepackage[...]{foo}| 
%   in the preamble.  There are a number of options which can be passed to the 
%   package:
%   \begin{itemize}
%     \item \texttt{active}: The default is inactive.  If this option is not 
%       specified, the \ulQda\ package will be inactive and the document 
%       will be typeset as if the \ulQda\ package were not loaded, except 
%       that all macros defined by the package are still legal but only 
%       the |\ulqdaHighlight| macro has an effect.
%
%       This allows final typesetting of the document and for page numbering to
%       stabilize before running through for a coding pass.  
%       The recommendation is to activate for the last two \LaTeX\ passes
%       through the document - that way the CSV file is generated once page
%       numbering is allowed to settle.  To activate 
%       subsequently, it is possible to invoke \LaTeX\ as follows:\\
%  \verb+$ pdflatex --shell-escape "\PassOptionsToPackage{active}{ulqda}+\\
%  \verb+     \input{filename.tex}"+
%     \item \texttt{cache}/\texttt{nocache}: This is an advanced option
%       which controls whether the CSV file is generated or not.
%     \item \texttt{debug}: This option enables verbose debug output from 
%       \ulQda.
%     \item \texttt{MiKTeX}: This determines whether 
%       \href{http://www.miktex.org/}{MiK\TeX} is supported or not. MiK\TeX\ is 
%       a version of \TeX\ that runs on Microsoft Windows platforms.
%     \item \texttt{shell}/\texttt{noshell}: These options control whether an 
%       attempt will be made to process the coding output file via spawning 
%       the \texttt{ulqda.pl} script directly, or whether it needs to be run 
%       explicitly by the user. \texttt{shell} is the default, but it requires 
%       \texttt{--shell-escape} (\TeX{} Live) or \texttt{--enable-write18} 
%       (MiK\TeX) as a command line argument to \texttt{latex} to enable it.
%     \item \texttt{counts}: This option determines whether code output will
%       include occurence counts or not. The default is to not output the counts.
%   \end{itemize}
%
%    In summary, to ensure correct section/page numbers, set the
%    \texttt{active} and leave the cache setting at its default 
%    (\texttt{nocache}) for each run.  It is possible to tweak both of these 
%    to reduce the processing time, being aware of potential side-effects!
%
%  \subsubsection{Advanced Options Usage}
%
%  The use of the \texttt{active} and \texttt{cache} options are 
%  primarily to speed up the process of performing QDA code extraction
%  through the \LaTeX\ typesetting flow.  Some care is needed with their
%  use, and it makes sense to select \texttt{active,nocache} as default
%  options until comfortable with the typesetting flow for a particular 
%  document -- otherwise section numbering/page numbering in the generated
%  CSV file may be incorrect.  
%
%  If this isn't a concern (i.e.~traceability and per-section filtering
%  for graph visualisation isn't required), then setting \texttt{active,cache}
%  on one pass through \LaTeX\ will give best performance.
%
%  If page numbers / section numbers are required, then the appropriate
%  use of these options will need to be made as required by the specific
%  \LaTeX\ flow being used -- i.e.~enable as appropriate.
%  It will need to run like this at least 3 times (once to generate the
%  CSV file, once to generate the~.Dot output, and once to import any
%  generated figures or tables.
%  I suggest integrating something like the following for the last 3 \LaTeX\
%  passes through the source:
%  \verb+$ pdflatex --shell-escape "\PassOptionsToPackage{active,nocache}{ulqda}+\\
%  \verb+     \input{filename.tex}"+\\
%  \verb+$ pdflatex --shell-escape "\PassOptionsToPackage{active,cache}{ulqda}+\\
%  \verb+     \input{filename.tex}"+\\
%  \verb+$ pdflatex --shell-escape "\PassOptionsToPackage{active,cache}{ulqda}+\\
%  \verb+     \input{filename.tex}"+\\
%
% \subsection{Macros}
%  \DescribeMacro{\ulqdaCode}
%    |\ulqdaCode| is used to assign a code a particular sentence or
%    passage of text.  Coding is a form of data condensing, where the 
%    words of the passage are compacted and distilled into as few 
%    succinct words as possible with the aim of capturing 
%    the essence or theme of the passage.
%
%    |\ulqdaCode| takes a list of codes as a first parameter, and the raw
%    text as its second. It invokes |\ulqdaHighlight| in order to 
%    format the passage for typesetting purposes, and outputs the
%    code, page number, section number, and raw text to the CSV file -
%    one line per code.
%
%    The list of codes is a comma separated list; code hierarchies and
%    connections can be expressed by chaining codes together using the
%    exclamation mark - for example, `\texttt{geographical!urgency}'
%    would indicate a relationship between the code `\texttt{geographical}'
%    and the code `\texttt{urgency}'. \\
%    \begin{UsageEnv}
%    \verb+\ulqdaCode{code1,code2,code3}{Common Text}+
%    \end{UsageEnv}
%
%  \DescribeMacro{\ulqdaHighlight}
%    |\ulqdaHighlight| is used to format coded text for typesetting
%    purposes.  By default, it highlights the coded text in a light
%    blue color, and it also lists the associated codes in the margin.
%    It can be redefined to whatever formatting codes the package user
%    requires. \\
%    \begin{UsageEnv}
%    \verb+\ulqdaHighlight{code1,code2,code3}{Common Text}+
%    \end{UsageEnv}
% 
%  \DescribeMacro{\ulqdaGraph}
%    |\ulqdaGraph| is a macro which invokes processing of the
%    generated CSV file to allow the visualisation of a coded ontology as a
%    GraphViz diagram. It take two arguments:
%    \begin{itemize}
%      \item graph type - this can be either `\texttt{flat}' which is
%        an unstructured graph (see figure~\ref{figure:viz:flat}), or 
%        `\texttt{net}' (see figure~\ref{figure:viz:net}), where the ontology
%        relationships are shown as a connected graph;
%      \item dot2texi options - this is a list of options that would typically
%        be used in a dot2tex environment. Listing these is outside the
%        scope of this document, but the following set of options is used
%        in the diagrams in this document:
%      \verb+neato,mathmode,options={--graphstyle "scale=0.5,transform shape"+.
%    \end{itemize}
%    \begin{UsageEnv}
%    \verb+\ulqdaGraph{+\emph{graph type}\verb+}{+\emph{dot2texi options}\verb+}+
%    \end{UsageEnv}
%
%   \DescribeMacro{\ulqdaTable}
%     |\ulqdaTable| is a macro which invokes processing of the 
%     generated CSV file to create a \LaTeX\ table
%     (see table~\ref{table:qda_codes}). \\
%   \begin{UsageEnv}
%   \verb+\ulqdaTable+
%   \end{UsageEnv}
% 
%   \DescribeMacro{\ulqdaCloud}
%     |\ulqdaCloud| is a macro which invokes processing of the 
%     generated CSV file to create a \LaTeX\ cloud
%     (see table~\ref{table:cloud}). \\
%   \begin{UsageEnv}
%   \verb+\ulqdaCloud+
%   \end{UsageEnv}
% 
%  \DescribeMacro{\ulqdaSetSectFilter}
%    |\ulqdaSetSectFilter| establishes a filter for the next |\ulqdaGraph|
%    or |\ulqdaTable| macro.  If interviews are logically structured in a
%    document with each in its own section (or sub-section etc.) then this
%    command can be used to establish a filter restricting the graphing or
%    table generation to a single interview. \\
%    \begin{UsageEnv}
%    \verb+\ulqdaSetSectFilter{+\emph{section label}\verb+}+
%    \end{UsageEnv}
%
%  \DescribeMacro{\ulqdaClearSectFilter}
%    |\ulqdaClearSectFilter| clears a section filter establihed by
%    |\ulqdaSetSectFilter| so that a subsequent |\ulqdaGraph| or a 
%    |\ulqdaTable| macro will process all sections from the CSV file. \\
%    \begin{UsageEnv}
%    \verb+\ulqdaClearSectFilter+
%    \end{UsageEnv}
%
% \subsection{Example}\label{sect:example}
%   What follows is an interview excerpt that has been taken through
%   the entire flow, i.e.:
%   \begin{itemize}
%     \item coded;
%     \item typeset; and
%     \item visualized as a tabular list of codes and also as graphs.  
%   \end{itemize}
%
% \subsubsection{Coding Example}
%
%   First, here is the raw \LaTeX\ source:
%   \\
%   \begin{center}
%     \framebox{
%       \begin{minipage}{0.95\textwidth}
%         \small
%         \texttt{$\backslash$textbf\{IG:\} Do you think the social aspect of face}\\
%         \texttt{to face is important  for the project? {\ldots}}\\
%         \\
%         \texttt{$\backslash$textbf\{Interviewee\~{}XYZ:\} \ldots{} A cup of coffee is really}\\
%         \texttt{important because then what happens is that you get a}\\
%         \texttt{real perspective. My general experience of having a}\\
%         \texttt{functional group in one site, while I was in the other}\\
%         \texttt{one, working for me and using video conferencing,}\\
%         \texttt{$\backslash$ulqdaCode\{geographical!urgency, geographical!face-eo-face\}\{if you}\\
%         \texttt{really wanted to get things done you had to jump on}\\
%         \texttt{a plane and fly over, there was nothing that could make}\\
%         \texttt{up for sitting in a room with people to both get across}\\
%         \texttt{the urgency and to ensure that communication among}\\
%         \texttt{the team took place to address any of the issues\ldots{}\}}
%       \end{minipage}
%     }\\
%   \end{center}
%
%
% \subsubsection{Typeset Example}
% Next, we will see what happens when this source is typeset.
% The mainbody text is itself highlighted so that it stands out from 
% surrounding text, and the codes are present in the margin.
% \\
% \begin{center}
% \framebox{
%   \begin{minipage}{0.75\textwidth}
%   \textbf{IG:} Do you think the social aspect of face to face is important 
%     for the project? {\ldots}
%
%   \textbf{Interviewee~XYZ:} \ldots{} A cup of coffee is 
%   really important because then what happens is that you get a real 
%   perspective. My general experience of having a functional group in one 
%   site, while I was in the other one, working for me and using video 
%   conferencing, \hl{\protect\ul{
%   if you really wanted to get things done you had to jump on a 
%   plane and fly over, there was nothing that could make up for sitting in a 
%   room with people to both get across the urgency and to ensure that 
%   communication among the team took place to address any of the 
%   issues.\ldots{}}}
%   \end{minipage}
%   \begin{minipage}{0.05\textwidth}
%   \end{minipage}
%   \begin{minipage}{0.15\textwidth}
%     \vfill
%     {
%       \tiny 
%       \hl{geographical!urgency, geographical!face-to-face}
%     }
%     \vfill
%   \end{minipage}
% }\\
% \end{center}
%
% \subsubsection{CSV Cache File}
%   The following shows an example of the comma-separated value cache file
%   generated for the coded text above. The first line of this file is a 
%   header and is ignored in processing by the \texttt{ulqda.pl} script.
% \\
%   \begin{center}
%     \framebox{
%       \begin{minipage}{0.95\textwidth}
%       \small
%       \texttt{Page Number, Section, Code, Text\\
% 2, 0, geographical!urgency, "if you really wanted to get things done you had to jump on a plane and fly over, there was nothing that could make up for sitting in a room with people to both get across the urgency and to ensure that communication among the team took place to address any of the issues\ldots{}"\\
% 2, 0, geographical!face-to-face, "if you really wanted to get things done you had to jump on a plane and fly over, there was nothing that could make up for sitting in a room with people to both get across the urgency and to ensure that communication among the team took place to address any of the issues\ldots{}"\\
%       }
%       \end{minipage}
%     }\\
%   \end{center}
%
% \subsubsection{Visualisation as a Table}
%
%   Table~\ref{table:qda_codes} illustrates the output from |\ulqdaTable|.
%
%   \begin{table}[h]
%     \centering
%     \caption{List of QDA Codes}
%     {
%       \vspace{0.1in}
%       \hrule
%
%       \begin{multicols}{3}
%         \label{table:qda_codes}
%         geographical\\
%         urgency\\
%         face-to-face
%       \end{multicols}
%       \hrule
%     }
%   \end{table}
%
% \subsubsection{Visualisation as a Cloud}
%
%   Table~\ref{table:qda_codes} illustrates the output from |\ulqdaCloud|.
%
%   \begin{table}[h]
%     \centering
%     \caption{List of QDA Codes}
%     {
%       \vspace{0.1in}
%       \hrule
%
%       \label{table:cloud}
%         {
%         \begin{center}
%         \noindent%
%         {\fontsize{7}{10}\selectfont FPGA}
%         {\fontsize{7}{10}\selectfont HW}
%         {\fontsize{7}{10}\selectfont HW attitude to risk}
%         {\fontsize{7}{10}\selectfont HW bias}
%         \raisebox{-1pt}{\fontsize{12}{15}\selectfont HW fear of risk}
%         {\fontsize{7}{10}\selectfont HW focus}
%         {\fontsize{7}{10}\selectfont HW is fixed}
%         {\fontsize{7}{10}\selectfont HW reluctance to design change}
%         \raisebox{-4pt}{\fontsize{24}{27}\selectfont HW vs SW}
%         {\fontsize{7}{10}\selectfont IM}
%         {\fontsize{9}{12}\selectfont IP}
%         {\fontsize{8}{11}\selectfont SQA}
%         {\fontsize{7}{10}\selectfont SW focus}
%         {\fontsize{7}{10}\selectfont SW influence on System Arch}
%         {\fontsize{7}{10}\selectfont SW is changeable}
%         {\fontsize{7}{10}\selectfont SW models}
%         {\fontsize{8}{11}\selectfont SW workarounds}
%         {\fontsize{7}{10}\selectfont adherence to process}
%         {\fontsize{7}{10}\selectfont adverse}
%         {\fontsize{8}{11}\selectfont aggressive schedules}
%         {\fontsize{7}{10}\selectfont agile methods}
%         {\fontsize{7}{10}\selectfont algorithmic software}
%         {\fontsize{7}{10}\selectfont ambition}
%         {\fontsize{7}{10}\selectfont approach to test}
%         {\fontsize{7}{10}\selectfont bring in software expertise early}
%         \raisebox{-5pt}{\fontsize{29}{32}\selectfont business model}
%         \raisebox{-1pt}{\fontsize{11}{14}\selectfont changeability of SW}
%         {\fontsize{8}{11}\selectfont changing market requirements}
%         {\fontsize{8}{11}\selectfont co-location}
%         \raisebox{-1pt}{\fontsize{11}{14}\selectfont communication}
%         {\fontsize{7}{10}\selectfont communications difficulties}
%         {\fontsize{7}{10}\selectfont competitive analysis}
%         \raisebox{-1pt}{\fontsize{12}{15}\selectfont competitiveness}
%         \raisebox{-2pt}{\fontsize{16}{19}\selectfont complexity}
%         {\fontsize{7}{10}\selectfont complexity in SW control code}
%         {\fontsize{8}{11}\selectfont complexity risk}
%         {\fontsize{7}{10}\selectfont confidence}
%         {\fontsize{7}{10}\selectfont constraints}
%         {\fontsize{7}{10}\selectfont consumer electronics}
%         {\fontsize{7}{10}\selectfont control software}
%         {\fontsize{9}{12}\selectfont cost of changing HW}
%         {\fontsize{8}{11}\selectfont cost of test}
%         {\fontsize{8}{11}\selectfont cost of wrong HW}
%         {\fontsize{8}{11}\selectfont cost-benefit of process}
%         {\fontsize{7}{10}\selectfont cross-functional}
%         \raisebox{-5pt}{\fontsize{28}{31}\selectfont culture}
%         {\fontsize{7}{10}\selectfont design modelling}
%         {\fontsize{7}{10}\selectfont dimensioning HW}
%         {\fontsize{7}{10}\selectfont early prototype}
%         {\fontsize{7}{10}\selectfont engineers over-simplify}
%         {\fontsize{9}{12}\selectfont experience}
%         {\fontsize{9}{12}\selectfont fabless}
%         {\fontsize{7}{10}\selectfont face to face}
%         {\fontsize{7}{10}\selectfont false perception}
%         {\fontsize{7}{10}\selectfont fluid specifications}
%         {\fontsize{7}{10}\selectfont focus}
%         {\fontsize{7}{10}\selectfont freedom to innovate}
%         {\fontsize{8}{11}\selectfont friction}
%         \raisebox{-4pt}{\fontsize{23}{26}\selectfont geographical}
%         {\fontsize{9}{12}\selectfont geographical mitigation}
%         {\fontsize{7}{10}\selectfont geographical more impact than technical}
%         {\fontsize{7}{10}\selectfont greatest impact}
%         {\fontsize{8}{11}\selectfont gsd}
%         {\fontsize{7}{10}\selectfont gsd mitigation}
%         {\fontsize{9}{12}\selectfont hardware}
%         {\fontsize{7}{10}\selectfont implementation}
%         {\fontsize{7}{10}\selectfont importance of cross-functional skills}
%         {\fontsize{10}{13}\selectfont importance of face to face}
%         {\fontsize{7}{10}\selectfont inadequate testing}
%         {\fontsize{7}{10}\selectfont incidental is most important}
%         {\fontsize{7}{10}\selectfont incidental knowledge}
%         {\fontsize{7}{10}\selectfont informal chats}
%         {\fontsize{9}{12}\selectfont information sharing}
%         {\fontsize{7}{10}\selectfont internalising}
%         {\fontsize{7}{10}\selectfont keep SW model in sync with HW}
%         {\fontsize{8}{11}\selectfont lack of mixed design skills}
%         {\fontsize{7}{10}\selectfont learning curve}
%         {\fontsize{7}{10}\selectfont limitations of SW models}
%         {\fontsize{7}{10}\selectfont management}
%         {\fontsize{7}{10}\selectfont market analysis}
%         {\fontsize{7}{10}\selectfont market change}
%         {\fontsize{7}{10}\selectfont market risk}
%         \raisebox{-1pt}{\fontsize{11}{14}\selectfont market window}
%         {\fontsize{8}{11}\selectfont methodology}
%         \raisebox{-1pt}{\fontsize{13}{16}\selectfont mindset gap}
%         {\fontsize{9}{12}\selectfont mitigation}
%         {\fontsize{7}{10}\selectfont moving SW into HW}
%         {\fontsize{7}{10}\selectfont moving schedule}
%         {\fontsize{7}{10}\selectfont moving software into hardware}
%         {\fontsize{7}{10}\selectfont multi-disciplinary}
%         {\fontsize{7}{10}\selectfont new platform}
%         {\fontsize{7}{10}\selectfont opportunity for HW change}
%         {\fontsize{7}{10}\selectfont opportunity to change}
%         {\fontsize{7}{10}\selectfont organisation}
%         {\fontsize{7}{10}\selectfont overconfidence}
%         {\fontsize{7}{10}\selectfont perception of other discipline}
%         {\fontsize{9}{12}\selectfont process}
%         {\fontsize{9}{12}\selectfont product specification}
%         {\fontsize{9}{12}\selectfont project inception}
%         {\fontsize{7}{10}\selectfont realtime missing from SW model}
%         {\fontsize{7}{10}\selectfont reluctance to change}
%         {\fontsize{7}{10}\selectfont requires hardware focus}
%         {\fontsize{7}{10}\selectfont resource requirements}
%         {\fontsize{7}{10}\selectfont resource usage analysis}
%         \raisebox{-10pt}{\fontsize{48}{51}\selectfont risk}
%         \raisebox{-1pt}{\fontsize{12}{15}\selectfont risk mitigation}
%         {\fontsize{9}{12}\selectfont schedule}
%         {\fontsize{7}{10}\selectfont schedule impact}
%         \raisebox{-2pt}{\fontsize{17}{20}\selectfont social}
%         {\fontsize{8}{11}\selectfont social familiarity}
%         {\fontsize{7}{10}\selectfont social risk}
%         {\fontsize{8}{11}\selectfont social tools}
%         {\fontsize{10}{13}\selectfont software}
%         {\fontsize{8}{11}\selectfont specialisation}
%         {\fontsize{7}{10}\selectfont specifying HW resources}
%         {\fontsize{7}{10}\selectfont system resources}
%         {\fontsize{8}{11}\selectfont system understanding}
%         {\fontsize{7}{10}\selectfont tapeout set by hardware}
%         {\fontsize{7}{10}\selectfont team building}
%         \raisebox{-2pt}{\fontsize{16}{19}\selectfont technical}
%         {\fontsize{8}{11}\selectfont technical determinism}
%         {\fontsize{8}{11}\selectfont technical language barrier}
%         {\fontsize{8}{11}\selectfont techno-geographical split}
%         {\fontsize{8}{11}\selectfont telecoms}
%         {\fontsize{7}{10}\selectfont test code sharing}
%         {\fontsize{7}{10}\selectfont testing HW without final SW}
%         {\fontsize{7}{10}\selectfont time to market}
%         {\fontsize{7}{10}\selectfont tool problems}
%         {\fontsize{7}{10}\selectfont tools}
%         {\fontsize{7}{10}\selectfont underestimate learning curve}
%         {\fontsize{7}{10}\selectfont unedited}
%         {\fontsize{8}{11}\selectfont validation}
%         {\fontsize{7}{10}\selectfont value in test bench}
%         {\fontsize{7}{10}\selectfont value of SW models}
%         {\fontsize{7}{10}\selectfont value of reference platforms}
%         \raisebox{-1pt}{\fontsize{14}{17}\selectfont verification}
%         {\fontsize{7}{10}\selectfont verification risk}
%         {\fontsize{7}{10}\selectfont verify SW without HW}
%         {\fontsize{7}{10}\selectfont visibility}
%         {\fontsize{7}{10}\selectfont weight of HW risk}
%         {\fontsize{7}{10}\selectfont workaround}
%         \end{center}
%         
%         }
%       \hrule
%     }
%   \end{table}
%
%
% \subsubsection{Visualisation as Graphs}
%   Figure~\ref{figure:viz} shows the visualisation output possible from \ulQda:
%   \begin{itemize}
%     \item figure~\ref{figure:viz:flat} shows the image created using\\
%       |\ulqdaGraph{flat}{neato,mathmode,|\\
%       |    options={--graphstyle "scale=0.5,transform shape"}}|
%     \item figure~\ref{figure:viz:net} shows the image created using\\
%       |\ulqdaGraph{net}{neato,mathmode,|\\
%       |    options={--graphstyle "scale=0.5,transform shape"}}|.
%     \end{itemize}
%
%  \newsavebox{\tikzPicSaveBoxA}
%  \begin{lrbox}{\tikzPicSaveBoxA}
%    \begin{tikzpicture}[>=latex,join=bevel,scale=0.475]
%
%      \definecolor{strokecolor}{rgb}{1.0,0.87,0.0};
%      \definecolor{fillcolor}{rgb}{1.0,0.87,0.0};
%      \node (Nodeda9c4808fb21d754e6a31daf84d13bbf43182dc5) at (384bp,42bp) [draw=strokecolor,fill=fillcolor,ellipse] {$urgency$};
%      \definecolor{strokecolor}{rgb}{0.54,0.67,0.83};
%      \definecolor{fillcolor}{rgb}{0.54,0.67,0.83};
%      \node (Node794199e201fec00805136c03a2f6517444e1d073) at (491bp,282bp) [draw=strokecolor,fill=fillcolor,ellipse] {$face-to-face$};
%      \definecolor{strokecolor}{rgb}{0.83,0.0,0.0};
%      \definecolor{fillcolor}{rgb}{0.83,0.0,0.0};
%      \node (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) at (266bp,162bp) [draw=strokecolor,fill=fillcolor,ellipse] {$geographical$};
%
%    \end{tikzpicture}
%  \end{lrbox}
%
%  \newsavebox{\tikzPicSaveBoxB}
%  \begin{lrbox}{\tikzPicSaveBoxB}
%    \begin{tikzpicture}[>=latex,join=bevel,scale=0.475]
%
%      \definecolor{strokecolor}{rgb}{1.0,0.87,0.0};
%      \definecolor{fillcolor}{rgb}{1.0,0.87,0.0};
%      \node (Nodeda9c4808fb21d754e6a31daf84d13bbf43182dc5) at (356bp,299bp) [draw=strokecolor,fill=fillcolor,ellipse] {$urgency$};
%      \definecolor{strokecolor}{rgb}{0.54,0.67,0.83};
%      \definecolor{fillcolor}{rgb}{0.54,0.67,0.83};
%      \node (Node794199e201fec00805136c03a2f6517444e1d073) at (217bp,42bp) [draw=strokecolor,fill=fillcolor,ellipse] {$face-to-face$};
%      \definecolor{strokecolor}{rgb}{0.83,0.0,0.0};
%      \definecolor{fillcolor}{rgb}{0.83,0.0,0.0};
%      \node (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) at (266bp,181bp) [draw=strokecolor,fill=fillcolor,ellipse] {$geographical$};
%      \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (240bp,108bp) and (238bp,101bp)  .. (Node794199e201fec00805136c03a2f6517444e1d073);
%      \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (317bp,247bp) and (318bp,249bp)  .. (Nodeda9c4808fb21d754e6a31daf84d13bbf43182dc5);
%
%    \end{tikzpicture}
%  \end{lrbox}
%
%  \begin{figure}[h]
%    \centering
%    \subfigure[Flat Graph]
%    {
%      \fbox{\usebox{\tikzPicSaveBoxA}}
%      \label{figure:viz:flat}
%    }
%    \hspace{0.5cm}
%    \subfigure[Hierarchical Graph with Connections]
%    {
%      \fbox{\usebox{\tikzPicSaveBoxB}}
%      \label{figure:viz:net}
%    }
%    \caption{Visualisation through GraphViz}
%    \label{figure:viz}
%  \end{figure}
%
%  Figure~\ref{figure:complex} shows a more complex visualisation generated from
%  a more comprehensive set of coding.
%
%
%  \newsavebox{\tikzPicSaveBoxComplex}
%  \begin{lrbox}{\tikzPicSaveBoxComplex}
%  \begin{tikzpicture}[>=latex,join=bevel,scale=0.11,transform shape]
%  \definecolor{strokecolor}{rgb}{0.64,0.73,0.88};
%   \definecolor{fillcolor}{rgb}{0.64,0.73,0.88};
%    \node (Node11907eb81526a671b74e000ef5abaffc932081ec) at (2584bp,1925bp) [draw=strokecolor,fill=fillcolor,ellipse] {$new platform$};
%    \definecolor{strokecolor}{rgb}{0.54,0.67,0.83};
%    \definecolor{fillcolor}{rgb}{0.54,0.67,0.83};
%    \node (Node24da2349705267e0db51531c0958413a9556e1a4) at (3277bp,2001bp) [draw=strokecolor,fill=fillcolor,ellipse] {$SW influence on System Arch$};
%    \definecolor{strokecolor}{rgb}{0.83,0.0,0.0};
%    \definecolor{fillcolor}{rgb}{0.83,0.0,0.0};
%    \node (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) at (2540bp,875bp) [draw=strokecolor,fill=fillcolor,ellipse] {$geographical$};
%    \definecolor{strokecolor}{rgb}{0.45,0.6,0.78};
%    \definecolor{fillcolor}{rgb}{0.45,0.6,0.78};
%    \node (Node0284c6ac58cb47bb52e427007beee58e0132bf71) at (2255bp,2459bp) [draw=strokecolor,fill=fillcolor,ellipse] {$tools$};
%    \definecolor{strokecolor}{rgb}{0.38,0.86,0.41};
%    \definecolor{fillcolor}{rgb}{0.38,0.86,0.41};
%    \node (Nodeffddae94a489d364c14bfa0bc20509be9bbd52cd) at (2192bp,1739bp) [draw=strokecolor,fill=fillcolor,ellipse] {$resource requirements$};
%    \definecolor{strokecolor}{rgb}{0.73,0.8,0.93};
%    \definecolor{fillcolor}{rgb}{0.73,0.8,0.93};
%    \node (Node857a3f01adebeadc2e3233e182485ad98fa4808b) at (2992bp,817bp) [draw=strokecolor,fill=fillcolor,ellipse] {$telecoms$};
%    \definecolor{strokecolor}{rgb}{0.73,0.8,0.93};
%    \definecolor{fillcolor}{rgb}{0.73,0.8,0.93};
%    \node (Nodee5ddf0cf596bc85b1d76e20d573522ab30c52dde) at (2696bp,3435bp) [draw=strokecolor,fill=fillcolor,ellipse] {$ambition$};
%    \definecolor{strokecolor}{rgb}{0.18,0.19,0.57};
%    \definecolor{fillcolor}{rgb}{0.18,0.19,0.57};
%    \node (Node6c912f1b9ece5fbfec963302cf1a6fcc1f72b641) at (2224bp,2906bp) [draw=strokecolor,fill=fillcolor,ellipse] {$early prototype$};
%    \definecolor{strokecolor}{rgb}{1.0,0.87,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.87,0.0};
%    \node (Node6bee1484bea1868299e58f40683ab3093d319d44) at (94bp,1678bp) [draw=strokecolor,fill=fillcolor,ellipse] {$fluid specifications$};
%    \definecolor{strokecolor}{rgb}{0.54,0.67,0.83};
%    \definecolor{fillcolor}{rgb}{0.54,0.67,0.83};
%    \node (Node13308f22bf33c24028a7196eaf01645c5dc63056) at (3361bp,2311bp) [draw=strokecolor,fill=fillcolor,ellipse] {$moving SW into HW$};
%    \definecolor{strokecolor}{rgb}{0.96,0.49,0.0};
%    \definecolor{fillcolor}{rgb}{0.96,0.49,0.0};
%    \node (Node0c18da7ce026bae350e071f9c9892f47854755f8) at (2269bp,3106bp) [draw=strokecolor,fill=fillcolor,ellipse] {$market window$};
%    \definecolor{strokecolor}{rgb}{0.98,0.66,0.0};
%    \definecolor{fillcolor}{rgb}{0.98,0.66,0.0};
%    \node (Node0dbe529c4dfad996667815f32902cb3a2b94c94f) at (2922bp,1310bp) [draw=strokecolor,fill=fillcolor,ellipse] {$social$};
%    \definecolor{strokecolor}{rgb}{0.18,0.19,0.57};
%    \definecolor{fillcolor}{rgb}{0.18,0.19,0.57};
%    \node (Noded1c21a4e5a354fe40e70739ba19c1ffda65b3e90) at (1884bp,3479bp) [draw=strokecolor,fill=fillcolor,ellipse] {$consumer electronics$};
%    \definecolor{strokecolor}{rgb}{0.34,0.46,0.71};
%    \definecolor{fillcolor}{rgb}{0.34,0.46,0.71};
%    \node (Node7febc4b16f23adf0fbe705a72b1e920a5f79d8e4) at (2485bp,20bp) [draw=strokecolor,fill=fillcolor,ellipse] {$team building$};
%    \definecolor{strokecolor}{rgb}{0.67,0.91,0.0};
%    \definecolor{fillcolor}{rgb}{0.67,0.91,0.0};
%    \node (Node12f73a5a4f409d241325ddb50d658c993327e9d7) at (2183bp,1175bp) [draw=strokecolor,fill=fillcolor,ellipse] {$overconfidence$};
%    \definecolor{strokecolor}{rgb}{1.0,0.87,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.87,0.0};
%    \node (Node546a0042646239cb2b8f5a48ede17044a7ef1890) at (2236bp,3563bp) [draw=strokecolor,fill=fillcolor,ellipse] {$changing market requirements$};
%    \definecolor{strokecolor}{rgb}{1.0,0.75,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.75,0.0};
%    \node (Node11e9ba26c91a2db7452a5ef9ff7051e19b6b377a) at (2614bp,2520bp) [draw=strokecolor,fill=fillcolor,ellipse] {$schedule$};
%    \definecolor{strokecolor}{rgb}{0.45,0.6,0.78};
%    \definecolor{fillcolor}{rgb}{0.45,0.6,0.78};
%    \node (Node957782c35eec7c1b95eaa3e080b7aa97d7d641d9) at (2317bp,3716bp) [draw=strokecolor,fill=fillcolor,ellipse] {$competitive analysis$};
%    \definecolor{strokecolor}{rgb}{0.73,0.8,0.93};
%    \definecolor{fillcolor}{rgb}{0.73,0.8,0.93};
%    \node (Nodeccabe2fccfc9d7d6adf8e0c37a8f794e0f70b66e) at (879bp,1144bp) [draw=strokecolor,fill=fillcolor,ellipse] {$cost of changing HW$};
%    \definecolor{strokecolor}{rgb}{1.0,0.87,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.87,0.0};
%    \node (Node1e7fceb82d739fd04658161f3e37ad7f866b317f) at (284bp,1371bp) [draw=strokecolor,fill=fillcolor,ellipse] {$fluid requirements$};
%    \definecolor{strokecolor}{rgb}{0.45,0.6,0.78};
%    \definecolor{fillcolor}{rgb}{0.45,0.6,0.78};
%    \node (Node797efd83f8c15deef7f4d4762a8c92d8b5a9305f) at (2242bp,1365bp) [draw=strokecolor,fill=fillcolor,ellipse] {$implementation$};
%    \definecolor{strokecolor}{rgb}{0.96,0.49,0.0};
%    \definecolor{fillcolor}{rgb}{0.96,0.49,0.0};
%    \node (Node2d5665952d74d765d3aad8ab414f96fe4dc51db9) at (2544bp,320bp) [draw=strokecolor,fill=fillcolor,ellipse] {$importance of face to face$};
%    \definecolor{strokecolor}{rgb}{0.89,0.35,0.14};
%    \definecolor{fillcolor}{rgb}{0.89,0.35,0.14};
%    \node (Node9fa7f61fda21f51c481ba3721c0f072e33d2abc0) at (2103bp,3328bp) [draw=strokecolor,fill=fillcolor,ellipse] {$business model$};
%    \definecolor{strokecolor}{rgb}{0.98,0.66,0.0};
%    \definecolor{fillcolor}{rgb}{0.98,0.66,0.0};
%    \node (Node925b4271c1d7533eb2d3cb2154cfec4eb06734cf) at (730bp,1710bp) [draw=strokecolor,fill=fillcolor,ellipse] {$changeability of SW$};
%    \definecolor{strokecolor}{rgb}{1.0,0.87,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.87,0.0};
%    \node (Nodec339980f75d565d568bed4943192f865402a85e2) at (3032bp,574bp) [draw=strokecolor,fill=fillcolor,ellipse] {$techno-geographical split$};
%    \definecolor{strokecolor}{rgb}{0.64,0.73,0.88};
%    \definecolor{fillcolor}{rgb}{0.64,0.73,0.88};
%    \node (Node70ef4adb6243a8757f5ac77a5cae9a726f406b98) at (2771bp,549bp) [draw=strokecolor,fill=fillcolor,ellipse] {$visibility$};
%    \definecolor{strokecolor}{rgb}{0.83,0.0,0.0};
%    \definecolor{fillcolor}{rgb}{0.83,0.0,0.0};
%    \node (Node60944e5702bdafb74ec9614120a88bdfa7084da0) at (2909bp,2152bp) [draw=strokecolor,fill=fillcolor,ellipse] {$technical$};
%    \definecolor{strokecolor}{rgb}{0.18,0.19,0.57};
%    \definecolor{fillcolor}{rgb}{0.18,0.19,0.57};
%    \node (Noded69683190ac95b492b7f1c19873463ff73c222fd) at (3372bp,1536bp) [draw=strokecolor,fill=fillcolor,ellipse] {$web tools$};
%    \definecolor{strokecolor}{rgb}{0.38,0.86,0.41};
%    \definecolor{fillcolor}{rgb}{0.38,0.86,0.41};
%    \node (Nodeb99f24955c90296fabf855bb4d54929a3fef70e1) at (1384bp,3260bp) [draw=strokecolor,fill=fillcolor,ellipse] {$HW fear of risk$};
%    \definecolor{strokecolor}{rgb}{0.0,0.02,0.45};
%    \definecolor{fillcolor}{rgb}{0.0,0.02,0.45};
%    \node (Node74d940dd3e717faa542bf612d28ec2542b71e963) at (3409bp,2124bp) [draw=strokecolor,fill=fillcolor,ellipse] {$communiction$};
%    \definecolor{strokecolor}{rgb}{0.98,0.66,0.0};
%    \definecolor{fillcolor}{rgb}{0.98,0.66,0.0};
%    \node (Node0172079aee21a5d804c9c2bd1ddb9261cfebb67e) at (739bp,2387bp) [draw=strokecolor,fill=fillcolor,ellipse] {$lack of mixed design skills$};
%    \definecolor{strokecolor}{rgb}{0.83,0.0,0.0};
%    \definecolor{fillcolor}{rgb}{0.83,0.0,0.0};
%    \node (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) at (1533bp,2059bp) [draw=strokecolor,fill=fillcolor,ellipse] {$risk$};
%    \definecolor{strokecolor}{rgb}{0.83,0.0,0.0};
%    \definecolor{fillcolor}{rgb}{0.83,0.0,0.0};
%    \node (Node4ab18acd3552592a0877a68a8e1c3494f03de7e5) at (2853bp,2659bp) [draw=strokecolor,fill=fillcolor,ellipse] {$HW vs SW$};
%    \definecolor{strokecolor}{rgb}{0.27,0.33,0.64};
%    \definecolor{fillcolor}{rgb}{0.27,0.33,0.64};
%    \node (Node9dc7651df0059af282ea6decf914838ca28b8d42) at (948bp,2914bp) [draw=strokecolor,fill=fillcolor,ellipse] {$multi-disciplinary$};
%    \definecolor{strokecolor}{rgb}{0.27,0.33,0.64};
%    \definecolor{fillcolor}{rgb}{0.27,0.33,0.64};
%    \node (Nodef90836d07f1e94806617725784c78e4e89824127) at (3314bp,2923bp) [draw=strokecolor,fill=fillcolor,ellipse] {$mindset gap$};
%    \definecolor{strokecolor}{rgb}{0.89,0.35,0.14};
%    \definecolor{fillcolor}{rgb}{0.89,0.35,0.14};
%    \node (Node8d08946e603eb0277964f9dffb00266975512736) at (2369bp,2085bp) [draw=strokecolor,fill=fillcolor,ellipse] {$complexity$};
%    \definecolor{strokecolor}{rgb}{0.45,0.6,0.78};
%    \definecolor{fillcolor}{rgb}{0.45,0.6,0.78};
%    \node (Node31aa07dda877d5f74de19f680f75d754866e74c6) at (2388bp,490bp) [draw=strokecolor,fill=fillcolor,ellipse] {$perception of other discipline$};
%    \definecolor{strokecolor}{rgb}{0.54,0.67,0.83};
%    \definecolor{fillcolor}{rgb}{0.54,0.67,0.83};
%    \node (Nodea9c032d95328db0ae1261c3c14d81e3a192f41c8) at (3214bp,2421bp) [draw=strokecolor,fill=fillcolor,ellipse] {$project inception$};
%    \definecolor{strokecolor}{rgb}{0.38,0.86,0.41};
%    \definecolor{fillcolor}{rgb}{0.38,0.86,0.41};
%    \node (Node7220917c7baf0d5b494b0211e77b5fd59fb11dd7) at (1148bp,3106bp) [draw=strokecolor,fill=fillcolor,ellipse] {$SW is changeable$};
%    \definecolor{strokecolor}{rgb}{0.89,0.35,0.14};
%    \definecolor{fillcolor}{rgb}{0.89,0.35,0.14};
%    \node (Node8f2e7cd784967d6a79abd59093146fb1f82e336d) at (2836bp,3076bp) [draw=strokecolor,fill=fillcolor,ellipse] {$culture$};
%    \definecolor{strokecolor}{rgb}{1.0,0.75,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.75,0.0};
%    \node (Node60c58ad2ef34d96fae028f1039fab03dec9eb9a2) at (3052bp,1616bp) [draw=strokecolor,fill=fillcolor,ellipse] {$communication$};
%    \definecolor{strokecolor}{rgb}{0.38,0.86,0.41};
%    \definecolor{fillcolor}{rgb}{0.38,0.86,0.41};
%    \node (Node94fe47c6f608bbd655277e4abb947276a838f03f) at (2501bp,2809bp) [draw=strokecolor,fill=fillcolor,ellipse] {$greatest impact$};
%    \definecolor{strokecolor}{rgb}{1.0,0.75,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.75,0.0};
%    \node (Node608cb271bb7fb52c99a1a8e003e0f80f57fb41e1) at (2083bp,1468bp) [draw=strokecolor,fill=fillcolor,ellipse] {$hardware$};
%    \definecolor{strokecolor}{rgb}{0.67,0.91,0.0};
%    \definecolor{fillcolor}{rgb}{0.67,0.91,0.0};
%    \node (Node179d813443470b5b4f03fae7eb20a074374b8749) at (3245bp,381bp) [draw=strokecolor,fill=fillcolor,ellipse] {$importance of cross-functional skills$};
%    \definecolor{strokecolor}{rgb}{0.27,0.33,0.64};
%    \definecolor{fillcolor}{rgb}{0.27,0.33,0.64};
%    \node (Node982d46d22d9597c30d79d368dc9197f5f1fe5956) at (2049bp,2167bp) [draw=strokecolor,fill=fillcolor,ellipse] {$management$};
%    \definecolor{strokecolor}{rgb}{0.73,0.8,0.93};
%    \definecolor{fillcolor}{rgb}{0.73,0.8,0.93};
%    \node (Node5e705951b3b2e85110d0d9edbca689b733f70893) at (1520bp,1353bp) [draw=strokecolor,fill=fillcolor,ellipse] {$methodology$};
%    \definecolor{strokecolor}{rgb}{0.27,0.33,0.64};
%    \definecolor{fillcolor}{rgb}{0.27,0.33,0.64};
%    \node (Nodea8488a1ffe30feefab69c6c99b92d74d6c36cf8d) at (2496bp,2311bp) [draw=strokecolor,fill=fillcolor,ellipse] {$underestimate learning curve$};
%    \definecolor{strokecolor}{rgb}{0.96,0.49,0.0};
%    \definecolor{fillcolor}{rgb}{0.96,0.49,0.0};
%    \node (Node0998cfed6ab699469c4465f74e75ec25367429d2) at (1865bp,3201bp) [draw=strokecolor,fill=fillcolor,ellipse] {$specialisation$};
%    \definecolor{strokecolor}{rgb}{0.18,0.19,0.57};
%    \definecolor{fillcolor}{rgb}{0.18,0.19,0.57};
%    \node (Nodedf14d801e4a359538f6a17654a1214fbc660c5ea) at (2153bp,490bp) [draw=strokecolor,fill=fillcolor,ellipse] {$informal communication$};
%    \definecolor{strokecolor}{rgb}{0.34,0.46,0.71};
%    \definecolor{fillcolor}{rgb}{0.34,0.46,0.71};
%    \node (Node65279e1ecf00d0d1177a5b3b458fd187a1d6135e) at (784bp,2685bp) [draw=strokecolor,fill=fillcolor,ellipse] {$verification$};
%    \definecolor{strokecolor}{rgb}{0.96,0.49,0.0};
%    \definecolor{fillcolor}{rgb}{0.96,0.49,0.0};
%    \node (Noded13b43f47c02e2d62f12116b4d6f2da47c8b0604) at (2184bp,866bp) [draw=strokecolor,fill=fillcolor,ellipse] {$mitigation$};
%    \definecolor{strokecolor}{rgb}{0.0,0.02,0.45};
%    \definecolor{fillcolor}{rgb}{0.0,0.02,0.45};
%    \node (Nodeb6e2fb5d60ebce8f644ef0eda9117caf6060247e) at (199bp,2027bp) [draw=strokecolor,fill=fillcolor,ellipse] {$inadequate testing$};
%    \definecolor{strokecolor}{rgb}{0.67,0.91,0.0};
%    \definecolor{fillcolor}{rgb}{0.67,0.91,0.0};
%    \node (Nodec2e2d6621334dc890bbd8a69430012c45a83bf65) at (1384bp,1373bp) [draw=strokecolor,fill=fillcolor,ellipse] {$process$};
%    \definecolor{strokecolor}{rgb}{0.34,0.46,0.71};
%    \definecolor{fillcolor}{rgb}{0.34,0.46,0.71};
%    \node (Node0165688353ca81071fdec1551c4ab96a2db65e88) at (3094bp,3367bp) [draw=strokecolor,fill=fillcolor,ellipse] {$confidence$};
%    \definecolor{strokecolor}{rgb}{0.54,0.67,0.83};
%    \definecolor{fillcolor}{rgb}{0.54,0.67,0.83};
%    \node (Nodeb93db90c74e59cca2710bbedbc56911482d72d3d) at (1923bp,1750bp) [draw=strokecolor,fill=fillcolor,ellipse] {$constraints$};
%    \definecolor{strokecolor}{rgb}{0.89,0.35,0.14};
%    \definecolor{fillcolor}{rgb}{0.89,0.35,0.14};
%    \node (Nodec981d125d1a564c9f5738faff51d59d98711f145) at (447bp,1733bp) [draw=strokecolor,fill=fillcolor,ellipse] {$software$};
%    \definecolor{strokecolor}{rgb}{0.64,0.73,0.88};
%    \definecolor{fillcolor}{rgb}{0.64,0.73,0.88};
%    \node (Node4d673c70f72c7f14606e048e062febb769b26b24) at (2081bp,2375bp) [draw=strokecolor,fill=fillcolor,ellipse] {$engineers over-simplify$};
%    \definecolor{strokecolor}{rgb}{1.0,0.75,0.0};
%    \definecolor{fillcolor}{rgb}{1.0,0.75,0.0};
%    \node (Nodedec8c6d379be0cb7cedbbe003f1b1f3671310f5c) at (1870bp,696bp) [draw=strokecolor,fill=fillcolor,ellipse] {$geographical mitigation$};
%    \definecolor{strokecolor}{rgb}{0.0,0.02,0.45};
%    \definecolor{fillcolor}{rgb}{0.0,0.02,0.45};
%    \node (Noded269766c1379693221ae73919ceb24643aab8e13) at (2472bp,3077bp) [draw=strokecolor,fill=fillcolor,ellipse] {$aggressive schedules$};
%    \draw [->] (Node608cb271bb7fb52c99a1a8e003e0f80f57fb41e1) ..controls (2139bp,1432bp) and (2178bp,1407bp)  .. (Node797efd83f8c15deef7f4d4762a8c92d8b5a9305f);
%    \draw [->] (Node0c18da7ce026bae350e071f9c9892f47854755f8) ..controls (2256bp,3045bp) and (2240bp,2975bp)  .. (Node6c912f1b9ece5fbfec963302cf1a6fcc1f72b641);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1256bp,1939bp) and (920bp,1792bp)  .. (Node925b4271c1d7533eb2d3cb2154cfec4eb06734cf);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2497bp,767bp) and (2427bp,589bp)  .. (Node31aa07dda877d5f74de19f680f75d754866e74c6);
%    \draw [->] (Node8f2e7cd784967d6a79abd59093146fb1f82e336d) ..controls (2800bp,3169bp) and (2734bp,3338bp)  .. (Nodee5ddf0cf596bc85b1d76e20d573522ab30c52dde);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2689bp,784bp) and (2898bp,656bp)  .. (Nodec339980f75d565d568bed4943192f865402a85e2);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (2829bp,2251bp) and (2692bp,2422bp)  .. (Node11e9ba26c91a2db7452a5ef9ff7051e19b6b377a);
%    \draw [->] (Node8d08946e603eb0277964f9dffb00266975512736) ..controls (2323bp,1994bp) and (2240bp,1834bp)  .. (Nodeffddae94a489d364c14bfa0bc20509be9bbd52cd);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1306bp,2249bp) and (922bp,2569bp)  .. (Node65279e1ecf00d0d1177a5b3b458fd187a1d6135e);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1868bp,2202bp) and (2404bp,2430bp)  .. (Node11e9ba26c91a2db7452a5ef9ff7051e19b6b377a);
%    \draw [->] (Node9fa7f61fda21f51c481ba3721c0f072e33d2abc0) ..controls (2145bp,3402bp) and (2192bp,3486bp)  .. (Node546a0042646239cb2b8f5a48ede17044a7ef1890);
%    \draw [->] (Nodec981d125d1a564c9f5738faff51d59d98711f145) ..controls (550bp,1724bp) and (583bp,1722bp)  .. (Node925b4271c1d7533eb2d3cb2154cfec4eb06734cf);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1372bp,2294bp) and (1049bp,2767bp)  .. (Node9dc7651df0059af282ea6decf914838ca28b8d42);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1498bp,2347bp) and (1407bp,3072bp)  .. (Nodeb99f24955c90296fabf855bb4d54929a3fef70e1);
%    \draw [->] (Nodec339980f75d565d568bed4943192f865402a85e2) ..controls (3096bp,517bp) and (3173bp,446bp)  .. (Node179d813443470b5b4f03fae7eb20a074374b8749);
%    \draw [->] (Node9fa7f61fda21f51c481ba3721c0f072e33d2abc0) ..controls (2156bp,3257bp) and (2213bp,3180bp)  .. (Node0c18da7ce026bae350e071f9c9892f47854755f8);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2751bp,849bp) and (2861bp,834bp)  .. (Node857a3f01adebeadc2e3233e182485ad98fa4808b);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1818bp,2193bp) and (2224bp,2383bp)  .. (2570bp,2537bp) .. controls (2639bp,2568bp) and (2717bp,2601bp)  .. (Node4ab18acd3552592a0877a68a8e1c3494f03de7e5);
%    \draw [->] (Node8d08946e603eb0277964f9dffb00266975512736) ..controls (2444bp,2029bp) and (2512bp,1979bp)  .. (Node11907eb81526a671b74e000ef5abaffc932081ec);
%    \draw [->] (Node8f2e7cd784967d6a79abd59093146fb1f82e336d) ..controls (2908bp,3157bp) and (3022bp,3286bp)  .. (Node0165688353ca81071fdec1551c4ab96a2db65e88);
%    \draw [->] (Node546a0042646239cb2b8f5a48ede17044a7ef1890) ..controls (2262bp,3612bp) and (2287bp,3658bp)  .. (Node957782c35eec7c1b95eaa3e080b7aa97d7d641d9);
%    \draw [->] (Nodec981d125d1a564c9f5738faff51d59d98711f145) ..controls (378bp,1814bp) and (269bp,1944bp)  .. (Nodeb6e2fb5d60ebce8f644ef0eda9117caf6060247e);
%    \draw [->] (Node8d08946e603eb0277964f9dffb00266975512736) ..controls (2340bp,2181bp) and (2285bp,2360bp)  .. (Node0284c6ac58cb47bb52e427007beee58e0132bf71);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (2942bp,2026bp) and (3017bp,1745bp)  .. (Node60c58ad2ef34d96fae028f1039fab03dec9eb9a2);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2429bp,968bp) and (2279bp,1094bp)  .. (Node12f73a5a4f409d241325ddb50d658c993327e9d7);
%    \draw [->] (Node8d08946e603eb0277964f9dffb00266975512736) ..controls (2289bp,2165bp) and (2162bp,2294bp)  .. (Node4d673c70f72c7f14606e048e062febb769b26b24);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2642bp,991bp) and (2828bp,1203bp)  .. (Node0dbe529c4dfad996667815f32902cb3a2b94c94f);
%    \draw [->] (Nodeffddae94a489d364c14bfa0bc20509be9bbd52cd) ..controls (2056bp,1744bp) and (2019bp,1746bp)  .. (Nodeb93db90c74e59cca2710bbedbc56911482d72d3d);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (3002bp,2234bp) and (3129bp,2346bp)  .. (Nodea9c032d95328db0ae1261c3c14d81e3a192f41c8);
%    \draw [->] (Node0c18da7ce026bae350e071f9c9892f47854755f8) ..controls (2364bp,3092bp) and (2376bp,3091bp)  .. (Noded269766c1379693221ae73919ceb24643aab8e13);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (3064bp,2207bp) and (3221bp,2262bp)  .. (Node13308f22bf33c24028a7196eaf01645c5dc63056);
%    \draw [->] (Node8d08946e603eb0277964f9dffb00266975512736) ..controls (2408bp,2155bp) and (2456bp,2239bp)  .. (Nodea8488a1ffe30feefab69c6c99b92d74d6c36cf8d);
%    \draw [->] (Node8f2e7cd784967d6a79abd59093146fb1f82e336d) ..controls (2840bp,2979bp) and (2847bp,2791bp)  .. (Node4ab18acd3552592a0877a68a8e1c3494f03de7e5);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (3041bp,2097bp) and (3156bp,2051bp)  .. (Node24da2349705267e0db51531c0958413a9556e1a4);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (3104bp,2141bp) and (3246bp,2133bp)  .. (Node74d940dd3e717faa542bf612d28ec2542b71e963);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1359bp,1817bp) and (990bp,1299bp)  .. (Nodeccabe2fccfc9d7d6adf8e0c37a8f794e0f70b66e);
%    \draw [->] (Node2d5665952d74d765d3aad8ab414f96fe4dc51db9) ..controls (2530bp,244bp) and (2502bp,109bp)  .. (Node7febc4b16f23adf0fbe705a72b1e920a5f79d8e4);
%    \draw [->] (Node9fa7f61fda21f51c481ba3721c0f072e33d2abc0) ..controls (2011bp,3279bp) and (1954bp,3249bp)  .. (Node0998cfed6ab699469c4465f74e75ec25367429d2);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1183bp,1954bp) and (695bp,1807bp)  .. (Nodec981d125d1a564c9f5738faff51d59d98711f145);
%    \draw [->] (Node608cb271bb7fb52c99a1a8e003e0f80f57fb41e1) ..controls (2109bp,1394bp) and (2153bp,1263bp)  .. (Node12f73a5a4f409d241325ddb50d658c993327e9d7);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2431bp,766bp) and (2248bp,584bp)  .. (Nodedf14d801e4a359538f6a17654a1214fbc660c5ea);
%    \draw [->] (Noded13b43f47c02e2d62f12116b4d6f2da47c8b0604) ..controls (2090bp,816bp) and (1981bp,756bp)  .. (Nodedec8c6d379be0cb7cedbbe003f1b1f3671310f5c);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1687bp,1777bp) and (2078bp,1060bp)  .. (Noded13b43f47c02e2d62f12116b4d6f2da47c8b0604);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1706bp,1873bp) and (1972bp,1587bp)  .. (Node608cb271bb7fb52c99a1a8e003e0f80f57fb41e1);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1848bp,2069bp) and (2123bp,2078bp)  .. (Node8d08946e603eb0277964f9dffb00266975512736);
%    \draw [->] (Nodec2e2d6621334dc890bbd8a69430012c45a83bf65) ..controls (1437bp,1365bp) and (1441bp,1365bp)  .. (Node5e705951b3b2e85110d0d9edbca689b733f70893);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1257bp,2173bp) and (934bp,2307bp)  .. (Node0172079aee21a5d804c9c2bd1ddb9261cfebb67e);
%    \draw [->] (Node60c58ad2ef34d96fae028f1039fab03dec9eb9a2) ..controls (3176bp,1585bp) and (3263bp,1563bp)  .. (Noded69683190ac95b492b7f1c19873463ff73c222fd);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (2716bp,2127bp) and (2562bp,2108bp)  .. (Node8d08946e603eb0277964f9dffb00266975512736);
%    \draw [->] (Node0dbe529c4dfad996667815f32902cb3a2b94c94f) ..controls (2955bp,1386bp) and (3012bp,1522bp)  .. (Node60c58ad2ef34d96fae028f1039fab03dec9eb9a2);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2541bp,741bp) and (2543bp,451bp)  .. (Node2d5665952d74d765d3aad8ab414f96fe4dc51db9);
%    \draw [->] (Node11a110bbef1bcc07ee6b72c48ab5c5b21afbab91) ..controls (1436bp,2324bp) and (1211bp,2934bp)  .. (Node7220917c7baf0d5b494b0211e77b5fd59fb11dd7);
%    \draw [->] (Node8d08946e603eb0277964f9dffb00266975512736) ..controls (2243bp,2118bp) and (2161bp,2138bp)  .. (Node982d46d22d9597c30d79d368dc9197f5f1fe5956);
%    \draw [->] (Nodec981d125d1a564c9f5738faff51d59d98711f145) ..controls (405bp,1639bp) and (329bp,1469bp)  .. (Node1e7fceb82d739fd04658161f3e37ad7f866b317f);
%    \draw [->] (Node60944e5702bdafb74ec9614120a88bdfa7084da0) ..controls (2895bp,2270bp) and (2869bp,2513bp)  .. (Node4ab18acd3552592a0877a68a8e1c3494f03de7e5);
%    \draw [->] (Node9fa7f61fda21f51c481ba3721c0f072e33d2abc0) ..controls (2021bp,3385bp) and (1958bp,3428bp)  .. (Noded1c21a4e5a354fe40e70739ba19c1ffda65b3e90);
%    \draw [->] (Node11e9ba26c91a2db7452a5ef9ff7051e19b6b377a) ..controls (2585bp,2594bp) and (2535bp,2721bp)  .. (Node94fe47c6f608bbd655277e4abb947276a838f03f);
%    \draw [->] (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83) ..controls (2610bp,776bp) and (2710bp,636bp)  .. (Node70ef4adb6243a8757f5ac77a5cae9a726f406b98);
%    \draw [->] (Noded13b43f47c02e2d62f12116b4d6f2da47c8b0604) ..controls (2294bp,869bp) and (2343bp,870bp)  .. (Node19a6c32cd6543441c9f5a7d4539e0435a4465c83);
%    \draw [->] (Nodec981d125d1a564c9f5738faff51d59d98711f145) ..controls (319bp,1713bp) and (240bp,1701bp)  .. (Node6bee1484bea1868299e58f40683ab3093d319d44);
%    \draw [->] (Node608cb271bb7fb52c99a1a8e003e0f80f57fb41e1) ..controls (2112bp,1539bp) and (2158bp,1654bp)  .. (Nodeffddae94a489d364c14bfa0bc20509be9bbd52cd);
%    \draw [->] (Node4ab18acd3552592a0877a68a8e1c3494f03de7e5) ..controls (3002bp,2744bp) and (3194bp,2854bp)  .. (Nodef90836d07f1e94806617725784c78e4e89824127);
% %
% \end{tikzpicture}
% \end{lrbox}
%
%  \begin{figure}
%    \centering
%    \fbox{\usebox{\tikzPicSaveBoxComplex}}
%    \caption{Complex Visualisation of Axial Coding Ontology}
%    \label{figure:complex}
%  \end{figure}
%
%  \pagebreak\clearpage
%  \StopEventually{\PrintIndex\PrintChanges}
%
% \section{Implementation}
% \subsection{Dependencies}
%   We start be ensuring that the required packages are loaded when this
%   file is loaded as a package by \LaTeX{}.
%
%    \begin{macrocode}
%<*package>
\RequirePackage{multicol}
\RequirePackage{tikz}
% \iffalse 
%%  dot2texi.sty in CTAN doesn't support the cache option yet
%%  The SVN version does.
% \RequirePackage[cache]{dot2texi}
% \fi
\RequirePackage{dot2texi}
\usetikzlibrary{backgrounds,shapes,arrows,positioning}

%</package>
%    \end{macrocode}
%
% \subsection{Highlighting Style}
%  We next setup some default highlighting formatting defines. The user is
%  free to change the highlighting formatting through redefining
%  |\ulqdaHighlight|.
%    \begin{macrocode}
%<*package>

\definecolor[named]{UlQda@lightblue}{rgb}{0.80,0.85,1}
\RequirePackage{soul} 
\sethlcolor{UlQda@lightblue}

%</package>
%    \end{macrocode}
%
% \subsection{Package Options}
%    \begin{macrocode}
%<*package>
\newif\ifUlQda@debug \UlQda@debugfalse
\newif\ifUlQda@cache \UlQda@cachefalse
\newif\ifUlQda@cachepresent \UlQda@cachepresentfalse
\newif\ifUlQda@shellescape \UlQda@shellescapetrue
\newif\ifUlQda@MiKTeX \UlQda@MiKTeXfalse 
\newif\ifUlQda@active \UlQda@activefalse
\newif\ifUlQda@counts \UlQda@countsfalse

\DeclareOption{active}{\UlQda@activetrue}
\DeclareOption{debug}{\UlQda@debugtrue}
\DeclareOption{cache}{\UlQda@cachetrue}
\DeclareOption{nocache}{\UlQda@cachefalse}
\DeclareOption{shell}{\UlQda@shellescapetrue}
\DeclareOption{noshell}{\UlQda@shellescapefalse}
\DeclareOption{MiKTeX}{\global\UlQda@MiKTeXtrue}
\DeclareOption{counts}{\global\UlQda@countstrue}

\DeclareOption*{%
  \PackageWarning{ulqda}{Unknown option `\CurrentOption'}%
}

\ExecuteOptions{shell}
\ProcessOptions\relax

\ifUlQda@counts
   \def\UlQda@counts{--number }
\else
   \def\UlQda@counts{ }
\fi

%</package>
%    \end{macrocode}
%
% \subsection{Testing the Shell Escape Mechanism}
%   Needs to work on both Unix-type platforms and on MiK\TeX{} on Microsoft Windows.
%    \begin{macrocode}
%<*package>
%% test if shell escape really works
\ifUlQda@shellescape
  \def\tmpfile{/tmp/shellEscapeTest-\the\year\the\month\the\day-\the\time}
  \immediate\write18{\ifUlQda@MiKTeX rem >"\tmpfile" \else touch \tmpfile \fi}
  \IfFileExists{\tmpfile}{
    \UlQda@shellescapetrue
    \immediate\write18{\ifUlQda@MiKTeX del "\tmpfile" \else rm -f \tmpfile \fi}
  }{\UlQda@shellescapefalse}
\fi

\ifUlQda@shellescape
  \ifUlQda@debug
    \PackageInfo{ulqda}{TeX Shell escape enabled.}
  \fi
\else
  \PackageWarningNoLine{ulqda} {TeX Shell escape not enabled.\MessageBreak%
     Manually process the CSV output with ulqda.pl}
\fi

%</package>
%    \end{macrocode}
%
% \subsection{Active Macro Implementation}
% \begin{macro}{\ulqdaHighlight}
% The most basic macro is a style macro - to format the typeset text, 
% indicating that it has been coded, and also to place the codes themselves 
% in the margin.
%    \begin{macrocode}
%<*package>
\newcommand{\ulqdaHighlight}[2]{%
    \hl{\protect\ul{#2}}%
    \marginpar%
    {\raggedright\hbadness=10000\tiny\it%
      \hl{#1}
  \par}%
  %\par%
  }

%</package>
%    \end{macrocode}
% \end{macro}
%
% We'll also create |\ulQda|, a vanity macro to typeset the \ulQda\ package name, in
% the \TeX\ tradition.
%
% \begin{macro}{\ulQda}
%    \begin{macrocode}
%<*package>
\newcommand{\ulQda}{\textsf{ul\kern -.075em\lower .3ex\hbox {\protect\emph{q}}da}}

%</package>
%    \end{macrocode}
% \end{macro}
%
% Next, we need to determine if the package is intended to be active for
% this \LaTeX\ processing run or not. This is essentially a big switch
% around the majority of the package definitions.
%    \begin{macrocode}
%<*package>
\ifUlQda@active
%</package>
%    \end{macrocode}
%
% \begin{macro}{\ulqdaCode}
% We now create a macro, |\ulqdaCode| to perform the actual coding of the 
% raw text.  % This macro, when invoked, will invoke the highlighting 
% macro |\ulqdaHighlight| and also conditionally invoke the package private 
% macro |\UlQda@ListIt| to output coded text to a comma separate values 
% (.csv) cache file.
%
% This is hooked (presently) to \verb+\begin{document}+, and contains some 
% conditional code to decide if caching is enabled, and if so, if the cache is
% present or not.
%    \begin{macrocode}
%<*package>
%
%
  \AtBeginDocument{%
    \typeout{ulqda: Loaded - 2009/06/11 v1.1 Qualitative Data Analysis package}
%    \end{macrocode}
%</package>
%
% If caching is enabled, the~.csv file will only be generated if necessary. 
% This is because the .csv generation can be quick slow - particularly when 
% dealing with a number of large portions of text, each having multiple codes.
%    \begin{macrocode}
%
%<*package>
    \ifUlQda@cache
      \IfFileExists{\jobname.csv} %
      {
        \ifUlQda@debug
          \typeout{ulqda: QDA cache file \jobname.csv found}
        \fi
        \UlQda@cachepresenttrue
      }
      {
        \ifUlQda@debug
          \typeout{ulqda: QDA cache file \jobname.csv not found}
        \fi
        \UlQda@cachepresentfalse
      }
    \else
      \ifUlQda@debug
        \typeout{ulqda: caching disabled}
      \fi
      \UlQda@cachepresentfalse
    \fi
%</package>
%    \end{macrocode}
%
% Without caching enabled, the~.csv file will be generated every run.
%
% If a cache file is detected and shell escape is enabled, the~.csv cache
% will be processed on demand: by |\ulqdaGraph| to generate GraphViz~.dot 
% file outputs, by |\ulqdaCloud| to generate tag cloud style maps, 
% and by |\ulqdaTable| to generate a multicolumn list of codes.
%
% In this case, the |\ulqdaCode| macro will not cause the cache file to
% update, but instead will only perform a typesetting function.
%
%    \begin{macrocode}
%<*package>

  % Code macro
    \ifUlQda@cachepresent
      \newcommand{\ulqdaCode}[2]{\ulqdaHighlight{#1}{#2}}
%</package>
%    \end{macrocode}
%
% Otherwise, any occurrence of the |\ulqdaCode| macro will update the cache 
% file for the run.
%
%    \begin{macrocode}
%<*package>
    \else
      \ifUlQda@debug
        \typeout{ulqda: Creating QDA cache file \jobname.csv} %
      \fi
      \newwrite\ulqdaCodeFile %
      \immediate\openout\ulqdaCodeFile=\jobname.csv %
      \immediate\write\ulqdaCodeFile{Page Number, Section, Code, Text} %

%</package>
%    \end{macrocode}
%
% The following macro outputs the coding to the code file.
%
%    \begin{macrocode}
%<*package>
      \def\UlQda@ListIt#1[#2,{%
        \ifUlQda@debug %
          \typeout{ulqda: Coding "#2" as "#1" on page \thepage, section \thesection}
        \fi %
        \immediate\write\ulqdaCodeFile{\thepage, \thesection, #2, "#1"}
%</package>
%    \end{macrocode}
%
% It also causes the code to be added to the index for the document, which is useful.
%
%    \begin{macrocode}
%<*package>
        \index{#2} %
        \@ifnextchar]%             Look ahead one token.
          {\eatthesquarebracket}%  End of list.
          {\UlQda@ListIt{#1}[}%     Process rest of list.
      }
      \def\eatthesquarebracket]{}  % Gobble the square bracket.
      %
      % Coding macro
      \newcommand{\ulqdaCode}[2]{\ulqdaHighlight{#1}{#2}\UlQda@ListIt{#2}[#1,]} %
    \fi
  } % end of \AtBeginDocument

%</package>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ulqdaSetSectFilter}
%   |\ulqdaSetSectFilter| enables filtering of CSV processing by
%   section label.
%    \begin{macrocode}
%<*package>
\newcommand{\UlQda@FirstOfTwo}[1]{
  \ifx#1\UlQda@MyUndefinedMacro
    ?\typeout{ulqda: undefined reference, please re-run}
  \else
    \expandafter\@firstoftwo#1
  \fi}
\newcommand{\UlQda@RefToSectNum}[1]{
  \expandafter \ifx\csname r@#1\endcsname\relax
    ?\typeout{ulqda: undefined reference, please re-run}
  \else
    \expandafter\UlQda@FirstOfTwo\csname r@#1\endcsname
  \fi}
%</package>
%    \end{macrocode}
%
% Now we start the actual filtering work. First, we delete any old files from
% previous builds. Next, we create a macro which will be used to pass a
% command line argument selecting the appropriate filtering to 
% \texttt{ulqda.pl}.
%
%    \begin{macrocode}
%<*package>
  \def\UlQda@filter{}
  \newcommand{\ulqdaSetSectFilter}[1]{
      \ifUlQda@shellescape
        \immediate\write18{\ifUlQda@MiKTeX del \else rm -f -- \fi \jobname_net.dot}
        \immediate\write18{\ifUlQda@MiKTeX del \else rm -f -- \fi \jobname_flat.dot}
        \immediate\write18{\ifUlQda@MiKTeX del \else rm -f -- \fi \jobname_table.tex}
      \fi
      \def\UlQda@filter{--filter \UlQda@RefToSectNum{#1}}
  }
%</package>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ulqdaClearSectFilter}
%
%   We also need to be able to clear any previously configured filter, and 
%   this is what the following macro does for us.
%
%    \begin{macrocode}
%<*package>
  \newcommand{\ulqdaClearSectFilter}{\def\UlQda@filter{}}
%</package>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ulqdaGraph}
% It is typical to want to present your coded data visually in a number of 
% different ways, perhaps focusing on a particular sub-theme if the entire 
% ontology is too cumbersome. However, I have provided a sample macro, 
% |\ulqdaGraph|, which will support the generation of an overall ontology 
% graph through the use of \verb+dot2texi.sty+.
%
% |\ulqdaGraph| uses the power of |\csname| to expand to either
% |\UlQda@GraphNet| or |\UlQda@GraphFlat|, depending on its first argument.
%    \begin{macrocode}
%<*package>
  \newcommand{\ulqdaGraph}[2]{\expandafter\csname UlQda@Graph#1\endcsname{#2}}
  \newcommand\UlQda@Graphflat[1]{\UlQda@GraphFlat{#1}}
  \newcommand\UlQda@Graphnet[1]{\UlQda@GraphNet{#1}}
  \newcommand{\UlQda@GraphVizFileName}{}
  \newsavebox{\UlQda@GraphSaveBox}
  \newcommand{\UlQda@GraphNet}[1]{%
    \renewcommand{\UlQda@GraphVizFileName}{\jobname_net.dot}%
%</package>
%    \end{macrocode}
%
% If a cache file is detected and shell escape is enabled, the~.csv cache
% will be processed on demand by |\UlQda@GraphNet| to generate
% GraphViz~.dot file output.
%
%    \begin{macrocode}
%<*package>
    \ifUlQda@cachepresent
      \ifUlQda@shellescape
        \ifUlQda@debug
          \typeout{ulqda: Converting .csv to hierarchical GraphViz dot file}
        \fi
        \immediate\write18{ulqda.pl --graphnet \UlQda@filter \UlQda@counts 
                             -- \jobname.csv \jobname_net.dot}
      \fi
    \fi
    
    \UlQda@DoGraph{#1}%
  }
  \newcommand{\UlQda@GraphFlat}[1]{%
    \renewcommand{\UlQda@GraphVizFileName}{\jobname_flat.dot}%
%</package>
%    \end{macrocode}
%
% If a cache file is detected and shell escape is enabled, the~.csv cache
% will be processed on demand by |\UlQda@GraphFlat| to generate
% GraphViz~.dot file output.
%
%    \begin{macrocode}
%<*package>
    \ifUlQda@cachepresent
      \ifUlQda@shellescape
        \ifUlQda@debug
          \typeout{ulqda: Converting .csv to flat GraphViz dot file}
        \fi
        \immediate\write18{ulqda.pl --graphflat \UlQda@filter \UlQda@counts 
                             -- \jobname.csv \jobname_flat.dot}
      \fi
    \fi
    
    \UlQda@DoGraph{#1}%
  }

%</package>
%    \end{macrocode}
%
% The following package internal macro, |\UlQda@DoGraph|, actually enacts 
% the graph generation.
%
%    \begin{macrocode}
%<*package>
  \newcommand{\UlQda@DoGraph}[1]{
    \IfFileExists{\UlQda@GraphVizFileName}{
      \ifUlQda@shellescape
        \begin{lrbox}{\UlQda@GraphSaveBox}
%</package>
%    \end{macrocode}
%
% The next few lines are a hack to enable \texttt{dot2texi.sty} to work with
% an external .dot file\footnote{I have suggested this to Kjell Magne Fauskes,
% the \texttt{dot2texi.sty} author, and he intends to include such a feature
% natively in a future version.}.
%
%    \begin{macrocode}
%<*package>
          \stepcounter{dtt@fignum}
          \setkeys{dtt}{#1}
          \immediate\write18{cp "\UlQda@GraphVizFileName" "\dtt@figname.dot"}
          \dottotexgraphicsinclude
%</package>
%    \end{macrocode}
%
% Now we finish the |\ulqdaGraph| command.
%
%    \begin{macrocode}
%<*package>
        \end{lrbox}
        \framebox{\usebox{\UlQda@GraphSaveBox}} \par
      \else
        \typeout{ulqda: shell escape not enabled}
        \typeout{ulqda: unable to process \UlQda@GraphVizFileName}
      \fi
    }
  }
%</package>
%    \end{macrocode}
% \end{macro}
%
% We now create a |\ulqdaTable| macro -- a command to process the table of 
% codes. It doesn't do terribly much, but it is there because it is useful 
% and conceptually consistent with the graph macros.
%
% \begin{macro}{\ulqdaTable}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaTable}{
    \IfFileExists{\jobname_table.tex}{
      \input{\jobname_table.tex}
    }{
%</package>
%   \end{macrocode}
% If a cache file is detected and shell escape is enabled, the~.csv cache
% will be processed on demand by |\ulqdaTable| to generate
% a multicolumn list of codes.
%   \begin{macrocode}
%<*package>
      \ifUlQda@cachepresent
        \ifUlQda@shellescape
          \ifUlQda@debug
            \typeout{ulqda: Converting .csv to TeX table}
          \fi
          \immediate\write18{ulqda.pl --list \UlQda@filter \UlQda@counts 
                               -- \jobname.csv \jobname_table.tex}
        \fi
      \fi
      \IfFileExists{\jobname_table.tex}{
        \input{\jobname_table.tex}
      }
    }
  }
%</package>
%    \end{macrocode}
%  \end{macro}
%
%
% Next, we create a |\ulqdaCloud| macro -- a command to process the table of
% codes and create a tag cloud style visualisation.
%
% \begin{macro}{\ulqdaCloud}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaCloud}{
    \IfFileExists{\jobname_cloud.tex}{
      \input{\jobname_cloud.tex}
    }{
%</package>
%   \end{macrocode}
% If a cache file is detected and shell escape is enabled, the~.csv cache
% will be processed on demand by |\ulqdaCloud| to generate the cloud.
%   \begin{macrocode}
%<*package>
      \ifUlQda@cachepresent
        \ifUlQda@shellescape
          \ifUlQda@debug
            \typeout{ulqda: Converting .csv to TeX cloud}
          \fi
          \immediate\write18{ulqda.pl --cloud \UlQda@filter \UlQda@counts
                               -- \jobname.csv \jobname_cloud.tex}
        \fi
      \fi
      \IfFileExists{\jobname_cloud.tex}{
        \input{\jobname_cloud.tex}
      }
    }
  }
%</package>
%    \end{macrocode}
%  \end{macro}
%
%
% \subsection{Inactive Macro Stubs}
% If the package is not intended to be active, we need to create
% stub definitions for the macros that the package provides, so that
% document runs where the package is not active will succeed.
%
%   \begin{macrocode}
%<*package>
\else % UlQda@activefalse
%</package>
%    \end{macrocode}
%  \begin{macro}{\ulqdaTable}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaTable}{}
%</package>
%    \end{macrocode}
%  \end{macro}
%  \begin{macro}{\ulqdaCloud}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaCloud}{}
%</package>
%    \end{macrocode}
%  \end{macro}
%  \begin{macro}{\ulqdaGraph}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaGraph}[2]{}
%</package>
%    \end{macrocode}
%  \end{macro}
%  \begin{macro}{\ulqdaCode}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaCode}[2]{#2}
%</package>
%    \end{macrocode}
%  \end{macro}
%  \begin{macro}{\ulqdaSetSectFilter}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaSetSectFilter}[1]{}
%</package>
%    \end{macrocode}
%  \end{macro}
%  \begin{macro}{\ulqdaSetSectFilter}
%   \begin{macrocode}
%<*package>
  \newcommand{\ulqdaClearSectFilter}{}
%</package>
%    \end{macrocode}
%  \end{macro}
% And finally close the conditional switch on whether active or not.
%   \begin{macrocode}
%<*package>
\fi
%</package>
%    \end{macrocode}
%
%\pagebreak
%
%\begin{thebibliography}{1}
%
%\bibitem{miles_and_huberman}
%M.~B. Miles and A.~M. Huberman, {\em {Qualitative Data Analysis: An Expanded
%  Sourcebook}}.
%\newblock {2455 Teller Road, Thousand Oaks, California 91320, USA}: {Sage
%  Publications, Inc.}, {1994}.
%\newblock {ISBN-10: 0-8039-5540-5}.
%
%\bibitem{glaser_strauss}
%B.~G. Glaser and A.~L. Strauss, {\em {The Discovery of Grounded Theory:
%  Strategies for Qualitative Research}}.
%\newblock {200 Saw Mill River Road, Hawthorne, New York 10532, USA}: {Aldine De
%  Gruyter}, {1967}.
%\newblock {ISBN-10: 0-202-30260-1}.
%
%\bibitem{strauss_corbin}
%A.~Strauss and J.~Corbin, eds., {\em {Grounded Theory in Practice}}.
%\newblock {2455 Teller Road, Thousand Oaks, California 91320, USA}: {Sage
%  Publications}, {1997}.
%\newblock {ISBN-10: 0-7619-0748-3}.
%
%\bibitem{graphviz}
%E.~R. Gansner and S.~C. North, ``{An open graph visualization system and its
%  applications to software engineering},'' {\em {Software - Practice and
%  Experience}}, vol.~{30}, pp.~1203--1233, {1999}.
%
%\bibitem{dot2tex}
%K.~M. Fauske, ``{dot2text -- A GraphViz to \LaTeX\ converter},'' 2006.
%\newblock {available: \url{http://www.fauskes.net/code/dot2tex/} [accessed
%  2009-03-02 17h31}.
%
%\bibitem{locality_of_ref}
%B.~Appleton, ``The LoRD Principle -- Locality breeds Maintainability,'' {\em
%  \href{http://c2.com/ppr/}{Portland Patterns Repository}
%  \href{http://c2.com/cgi-bin/wiki?WelcomeVisitors}{wiki}}, 1997.
%\newblock {available:
%  \url{http://c2.com/cgi/wiki?LocalityOfReferenceDocumentation} [accessed
%  2009-05-14 10h03]}.
%
%\bibitem{LaTeX_goes_with_the_flow}
%J.~Hefferon, ``{\LaTeX\ goes with the flow},'' {\em {The Prac\TeX\ Journal}},
%  no.~1, 2008.
%\newblock {available \url{http://www.tug.org/pracjourn/2008-1/hefferon/}
%  [accessed 2009-03-02 17h51]}.
%
%\end{thebibliography}\clearpage
%
% \iffalse
%<*perl>
#!/usr/bin/perl
#
# Helper Perl script for ulqda
# A LaTeX package supporting Qualitative Data Analysis
#
# Copyright (C) 2009 by Ivan Griffin
#
# This file may be distributed and/or modified under the
# conditions of the LaTeX Project Public License, either
# version 1.2 of this license or (at your option) any later
# version. The latest version of this license is in:
#
# http://www.latex-project.org/lppl.txt
#
# and version 1.2 or later is part of all distributions of
# LaTeX version 1999/12/01 or later.
#

use Getopt::Long;
use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);

sub Display_Version()
{
    print "Version: ulqda.pl [2009/06/11 v1.1 Qualitative Data Analysis package]\n\n";
    exit;
}

sub Display_Usage()
{
    print<<"EOF";
Usage: $0 \\
    <--list>|<--graphflat>|<--graphnet>|<--cloud>|<--help>|<--version>  \\
     [<--filter section>] [<--number-->] infile.csv outfile

--filter:      filter based on document section label
--graphflat:   Generate GraphViz .dot output of codes (unconnected)
--graphnet:    Generate GraphViz .dot output of codes (connected)
--cloud:       Generate Cloud output of codes
--help:        Print this help and exit
--list:        Generate LaTeX table of codes (labelled as table:qda_codes)
--number:      Output quantity details
--version:     Dispaly version information
EOF
    exit;
}

sub sort_codes_hashvalue_descending {
    $codes{$b} <=> $codes{$a};
}

sub sort_codes_alphabetic {
    $a cmp $b;
}

@colors = ("#d40000", "#e35a24", "#f67c00", "#faa800", "#ffc000", "#ffde00", "#aae900", "#62dc68", "#bbcced", "#a3bbe0", "#8aaad4", "#7299c7", "#5676b5", "#4554a3", "#2e3191", "#000472");

$result = GetOptions("number" => \$options{'n'},
           "list" => \$options{'l'},
           "cloud" => \$options{'c'},
           "graphflat" => \$options{'g'},
           "filter=s" => \$options{'f'},
           "graphnet" => \$options{'G'},
           "version" => \$options{'v'},
           "help" => \$options{'h'});

&Display_Usage() if !$result;
&Display_Usage() if $options{'h'};

&Display_Version() if $options{'v'};

if (!($options{'c'} || $options{'l'} || $options{'g'} || $options{'G'}))
{
    print "Requires one of --cloud, --list, --graphflat, --graphnet, --version or  --help\n\n";
    &Display_Usage()
}


if (($ARGV[0]) && ($ARGV[1]))
{
    open(FILEIN, "<$ARGV[0]") or die "Could not open input file $ARGV[0]\n";
    open(FILEOUT, ">$ARGV[1]") or die "Could not open output file $ARGV[1]\n";
}
else
{
    &Display_Usage();
}


if ($options{'l'})
{
    print FILEOUT << "EOF";
{
\\vspace{0.1in}
\\hrule

\\begin{multicols}{3}
\\label{table:qda_codes}
EOF
}
elsif ($options{'c'})
{
    # 
    print FILEOUT << "EOF";
{
\\begin{center}
\\noindent%
EOF
}
elsif ($options{'g'} || $options{'G'})
{
    print FILEOUT << "EOF";
digraph codes {
overlap=scale
ratio=compress
smoothType=spring
repulsiveforce=1.2
splines=true

#
# Nodes
#
EOF
}


<FILEIN>; # gobble first line (it is just header)

# now, for each line, parse into comma separated values
# codes are further split based on the '!' separator character
# e.g. risk!business becomes two codes, risk and business, with a
# connection between risk->business
GOBBLE_LOOP: while (<FILEIN>)
{
    chomp;
    ($page, $section, $code_list, $text) = split(/\,/, $_, 4);
#print"DEBUG: >>$code_list<< $_ \n";

    if (($options{'f'}) && ($options{'f'} != $section))
    {
        # filtering selected so if no match, then skip
        next GOBBLE_LOOP;
    }


    foreach $code ( split(/\!/, $code_list) )
    {
        $code =~ s/^ //g;
        $codes{$code} += 1;
    }

    @connections = (@connections, $code_list);
}
close(FILEIN);

#
# Find the maximum number of connections and the minimum number of connections
# This will be used for scaling subsequently
#
$iterationCount = 0; $nodeCount = 0;
$maxConnections = 0; $minConnections=65535;

if ($options{'c'})
{
    @key_list = (sort sort_codes_alphabetic keys %codes);
}
else
{
    @key_list = (sort sort_codes_hashvalue_descending keys %codes);
}

LOOP: foreach $i (sort sort_codes_hashvalue_descending keys %codes)
{
    if ($codes{$i} > $maxConnections) { $maxConnections = $codes{$i} }
    if ($codes{$i} < $minConnections) { $minConnections = $codes{$i} }
}

#
# For each code, output it as requested
#
foreach $i (@key_list)
{
    $digest = sha1_hex($i);

    if ($options{'l'} && ($iterationCount))
    {
         print FILEOUT "\\\\\n";
    }
    elsif ($options{'c'})
    {
         my $base = int(7 + ($codes{$i}/3));
         my $lead = $base + 3;
         my $raisept = int(($base - 7)/4);

         if ($raisept) { print FILEOUT "\\raisebox{-${raisept}pt}";}
         print FILEOUT "{\\fontsize{$base}{$lead}\\selectfont ";
    }
    elsif ($options{'g'} || $options{'G'})
    {
         $nodeCount++;
         print FILEOUT "Node$digest [label=\"";
    }

    $i =~ s/!/:/g;
    print FILEOUT "$i";

    if ($options{'c'})
     {
        print FILEOUT "}\n";
    }
    elsif ($options{'n'})
    {
        print FILEOUT "{\\textcolor{red}{" if ($options{'l'});
        print FILEOUT "($codes{$i})";
        print FILEOUT "}}" if ($options{'l'});
    }

    if ($options{'g'} || $options{'G'})
    {
         $fontSize = 15 + ((60 * $codes{$i})/$maxConnections);
         print FILEOUT "\", fontsize=$fontSize";
         #if ($iterationCount <= 5)
         {
             # heatmap based colors
             # $colorIndex = 6 - int((6*($codes{$i} - $minConnections))/($maxConnections - $minConnections));
             # index based colors
             $colorIndex = int(($iterationCount*16)/(keys %codes));
             print FILEOUT ",color=\"$colors[$colorIndex]\",style=filled";
         }
         print FILEOUT "]\n";
    }
    elsif (! ($options{'l'} || $options{'c'}) )
    {
        print FILEOUT "\n";
    }
    $iterationCount++;
}

#
# For connection graphs, process each connection between points
#
if ($options{'G'})
{
    print FILEOUT <<"EOF";

#
# Connections
#
EOF

    for $code_list (@connections)
    {
        print FILEOUT "// $code_list\n";
        @code_list_array = split(/\!/, $code_list);
        $previous_code = shift(@code_list_array);
        $previous_code =~ s/^ //g;

        if (defined($previous_code))
        {
            foreach $code ( @code_list_array )
            {
                $code =~ s/^ //g;
                $previous_digest = sha1_hex($previous_code);
                $digest = sha1_hex($code);

                # ensure only 1 connection between points
                if (!defined($connection{"$previous_digest-$digest"}))
                {
                    $connection{"$previous_digest-$digest"} = 1;
                    $len=0.25+(0.75*$codes{$previous_code}/$maxConnections);
                    $w=0.25+(0.75*$codes{$previous_code}/$maxConnections);
                    print FILEOUT "Node$previous_digest->Node$digest [label=\"\", w=$w, len=$len]\n";
                }

                $previous_code = $code;
            }
        }
    }
}

#
# Tidy up
#
if ($options{'l'})
{
    print FILEOUT << "EOF";
\\end{multicols}
\\hrule
EOF
}
elsif ($options{'c'})
{
    print FILEOUT << "EOF";
\\end{center}
EOF
}

print FILEOUT "\n}\n";

close(FILEOUT);
%</perl>
%  \fi
% \Finale
%
% \typeout{*********************************************************}
% \typeout{*}
% \typeout{* To finish the installation you have to move the}
% \typeout{* following file into a directory searched by TeX:}
% \typeout{*}
% \typeout{* \space\space ulqda.sty}
% \typeout{*}
% \typeout{* and move the following file into your path:}
% \typeout{*}
% \typeout{* \space\space ulqda.pl}
% \typeout{*}
% \typeout{* To produce the documentation run the file ulqda.dtx}
% \typeout{* through pdflatex.}
% \typeout{*}
% \typeout{*********************************************************}
%
\endinput
