From 9ec59a52efe9f9a4e9dbdfb47f893f66e718ab69 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 18 May 2009 18:21:01 +0000 Subject: new latex package ulqda (15may09) git-svn-id: svn://tug.org/texlive/trunk@13209 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/ulqda/ulqda.sty | 245 ++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/ulqda/ulqda.sty (limited to 'Master/texmf-dist/tex/latex/ulqda/ulqda.sty') diff --git a/Master/texmf-dist/tex/latex/ulqda/ulqda.sty b/Master/texmf-dist/tex/latex/ulqda/ulqda.sty new file mode 100644 index 00000000000..da0f8ccc5c8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ulqda/ulqda.sty @@ -0,0 +1,245 @@ +%% +%% This is file `ulqda.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ulqda.dtx (with options: `package') +%% +%% 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. +%% +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{ulqda} + [2009/05/15 v1.0 Qualitative Data Analysis package] +\RequirePackage{soul} +\RequirePackage{color} +\RequirePackage{multicols} +\RequirePackage{tikz} +\RequirePackage[cache]{dot2texi} +\usetikzlibrary{backgrounds,shapes,arrows,positioning} + +\definecolor{UlQda@lightblue}{rgb}{0.80,0.85,1} +\sethlcolor{UlQda@lightblue} + +\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 + +%% 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 + +\newcommand{\ulqdaHighlight}[2]{% + \hl{\protect\ul{#2}}% + \marginpar% + {\raggedright\hbadness=10000\tiny\it \hl{#1}\par}% + \par% + } + +\newcommand{\ulQda}{\textsf{ul\kern -.075em\lower .3ex\hbox {\protect\emph{q}}da}} + +\ifUlQda@active + \AtBeginDocument{% + \typeout{ulqda: Loaded - 2009/05/15 v1.0 Qualitative Data Analysis 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 + + % Code macro + \ifUlQda@cachepresent + \newcommand{\ulqdaCode}[2]{\ulqdaHighlight{#1}{#2}} + \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} % + + \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"} + \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 + +\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} + \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}} + } + \newcommand{\ulqdaClearSectFilter}{\def\UlQda@filter{}} + \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}% + \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}% + \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}% + } + + \newcommand{\UlQda@DoGraph}[1]{ + \IfFileExists{\UlQda@GraphVizFileName}{ + \ifUlQda@shellescape + \begin{lrbox}{\UlQda@GraphSaveBox} + \stepcounter{dtt@fignum} + \setkeys{dtt}{#1} + \immediate\write18{cp "\UlQda@GraphVizFileName" "\dtt@figname.dot"} + \dottotexgraphicsinclude + \end{lrbox} + \framebox{\usebox{\UlQda@GraphSaveBox}} \par + \else + \typeout{ulqda: shell escape not enabled} + \typeout{ulqda: unable to process \UlQda@GraphVizFileName} + \fi + } + } + \newcommand{\ulqdaTable}{ + \IfFileExists{\jobname_table.tex}{ + \input{\jobname_table.tex} + }{ + \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} + } + } + } +\else % UlQda@activefalse + \newcommand{\ulqdaTable}{} + \newcommand{\ulqdaGraph}[2]{} + \newcommand{\ulqdaCode}[2]{} + \newcommand{\ulqdaSetSectFilter}[1]{} + \newcommand{\ulqdaClearSectFilter}{} +\fi +\endinput +%% +%% End of file `ulqda.sty'. -- cgit v1.2.3