Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor

Showing 3 changed files with 107 additions and 21 deletions. Show diff stats Hide diff stats

  1. +85 8 draftinputlines-man.tex
  2. +21 12 draftinputlines.sty
  3. +1 1  inputfile.tex
93 draftinputlines-man.tex
@@ -6,12 +6,30 @@
6 6 sectionline=true,
7 7 captionline=true,
8 8 dilbasicenvlines=true,
9   -inputfilesrule=true
  9 +inputfilesrule=true,
  10 +inputfloatname=true,
10 11 ]{draftinputlines}
  12 +\usepackage{listings}
  13 +\lstloadlanguages{[LaTeX]TeX}
  14 +\lstset{%
  15 + basicstyle=\ttfamily,
  16 + commentstyle=\itshape\ttfamily\small,
  17 + showspaces=false,
  18 + showstringspaces=false,
  19 + breaklines=true,
  20 + breakautoindent=true,
  21 + captionpos=t,
  22 + frame=single,
  23 + escapeinside={(*}{*)},
  24 +}
  25 +\lstMakeShortInline{|}
  26 +\usepackage{enumitem}
  27 +\setdescription{font=\ttfamily,leftmargin=4em}
  28 +% \xdef\thefilename{\currfilename}
  29 +% \chead{\texttt{\thefilename}\xdef\thefilename{\currfilename}}
  30 +% \cfoot{\texttt{\currfilename}}
11 31
12 32
13   -\usepackage{lipsum}
14   -
15 33 \begin{document}
16 34
17 35 \section{Introduction}
@@ -30,16 +48,75 @@ \section{Introduction}
30 48 This should be rare since floats should have their own space.
31 49
32 50 \section{Examples}
33   -
34 51 \input{inputfile}
35 52
36   -\section{Commands}
  53 +\section{Options}
  54 +Here are the options that are currently defined and a description of
  55 +what they do.
37 56
38   -environmentinputline
  57 +\paragraph{\lstinline+headfootpackage+}
  58 +This sets what package is used to do the headers and footers.
  59 +Set it to whatever is setting the headers and footers in your
  60 +document.
  61 +The options are:
  62 +\begin{description}[labelindent=1cm]
  63 +\item[scrpage] Uses KOMA script's |scrpage2|
  64 +\item[fancyhdr] Uses |fancyhdr|
  65 +\item[memoir] Uses |memoir|. Awkwardly, given the way |memoir|'s
  66 + header and footer mechanisms work, this will overwrite any current
  67 + headers you have set.
  68 + So this just sets a page number somewhere where it isn't setting an
  69 + input line number.
  70 + If you want to add the input line number to your existing headers
  71 + instead, you can do that with these two macros:
  72 + \textsc{These macros don't exist yet.
  73 + When I make memoir work, I will fix this.}
  74 + \item[plain] Use the plain TeX macros.
  75 +\end{description}
  76 +
  77 +\paragraph{\lstinline+dilfont+}
  78 +
  79 +This defines what font the input line numbers will appear in.
  80 +The default is |\ttfamily|.
  81 +
  82 +\paragraph{\lstinline+environmentline+}
  83 +
  84 +This option takes a list of environment names.
  85 +Those environments listed will then print the line number where they
  86 +start.
  87 +
  88 +\paragraph{Switches}
  89 +
  90 +The following is a list of Boolean (true/false) options and what they
  91 +control.
  92 +\begin{description}
  93 +\item[sectionline] Determines whether each section will print the line
  94 + it is printed on.
  95 +\item[captionline] Determines whether captions to figures, tables and
  96 + so on, will print their input line number.
  97 + I expect this will break with subcaptions.
  98 + These marginpars don't float.
  99 +\item[inputfloatname] Prints the name of the file the float is from.
  100 + If |captionline| is false, this has no effect.
  101 +\item[dilbasicenvlines] This basically passes a bunch of basic
  102 + environments to |environmentline|, namely:
  103 + |itemize,enumerate,description,quote,displaymath,equation,equation*,quotation,verse,abstract,flushleft,center,flushright,eqnarry,minipage|
  104 +\item[dilamsmathenvlines] Like |dilbasicenvlines| this makes some
  105 + |amsmath| environments print their input line numbers.
  106 + For now it only actually does this for |align| and |align*|.
  107 + Most of the other environments are supposed to be use \emph{inside}
  108 + another mathmode environment, and so the outer mathmode
  109 + environment's start should give enough of an indication of where
  110 + this environment is.
  111 +\item[dilinputfiles] Prints the name and input line number of files
  112 + included with |\input| and |\include|.
  113 +\item[dilinputfilesrule] Prints rules above the start and below the
  114 + end of an included file, so it's obvious where in the page it starts
  115 + and ends.
  116 + If |dilinputfiles| is false, this doesn't do anything.
  117 +\end{description}
39 118
40   -setupinputlines
41 119
42   -\section{Options}
43 120
44 121
45 122 \end{document}
33 draftinputlines.sty
@@ -72,6 +72,8 @@
72 72 % The actual keys
73 73 %------------------------------
74 74
  75 +% Here is a terribly messy looking way of doing what I want:
  76 +
75 77 % \define@choicekey{dilfamily}{inputlineshead}[\val\nr]{%
76 78 % inside,outside,center,left,right,off}{%
77 79 % \AtEndPreamble{
@@ -109,6 +111,8 @@
109 111 % }
110 112 % }
111 113
  114 +% Here's a much neater way of doing it:
  115 +
112 116 \define@choicekey{dilfamily}{inputlineshead}{%
113 117 inside,outside,center,left,right,off}{%
114 118 \AtEndPreamble{\csname dil@#1head\endcsname}%
@@ -118,22 +122,21 @@
118 122 \AtEndPreamble{\csname dil@#1foot\endcsname}%
119 123 }
120 124
  125 +%--------------------------------------------------
  126 +% Other input line numbers
  127 +%--------------------------------------------------
121 128 \def\dilfont{\ttfamily}
122 129 \define@cmdkey{dilfamily}{dilfont}{\def\dilfont{\cmdKV@dilfamily@dilfont}}
123   -% Package option for user coloured linenumbers?
124   -\RequirePackage{xcolor}
125   -\newcommand\useraddlineno{\dilmnote{\textcolor{red}{\the\inputlineno}}}
126   -
127   -% % Package option that loads showkeys?
128   -% \RequirePackage{showkeys}
129 130
130 131 % Here comes the meat of the functionality
131   -\newcommand\addlineno{\dilmnote{\dilfont{\the\inputlineno}}}
  132 +\newcommand\addlineno{\dilmnote{{\dilfont\the\inputlineno}}}
132 133
133   -\define@boolkey{dilfamily}{sectionline}[true]{}
134   -\define@boolkey{dilfamily}{captionline}[true]{}
  134 +% % Package option for user coloured linenumbers?
  135 +% \RequirePackage{xcolor}
  136 +% \newcommand\useraddlineno{\dilmnote{\textcolor{red}{\the\inputlineno}}}
135 137
136 138
  139 +\define@boolkeys{dilfamily}{sectionline,captionline}[true]{}
137 140
138 141 \newcommand\dil@patchenv[1]{%
139 142 \AtBeginEnvironment{#1}{\addlineno}}
@@ -163,11 +166,15 @@
163 166 \setkeys{dilfamily}{
164 167 sectionline=true,
165 168 captionline=true,
166   - % inputlineshead=outside,
167   - % inputlinesfoot=outside,
  169 + inputlineshead=outside,
  170 + inputlinesfoot=outside,
168 171 dilinputfiles=true,
169 172 }
170 173
  174 +%--------------------------------------------------
  175 +% Here comes the options
  176 +%--------------------------------------------------
  177 +
171 178 \ProcessOptionsX<dilfamily>
172 179
173 180 %------------------------------
@@ -258,11 +265,13 @@
258 265 \ifKV@dilfamily@sectionline
259 266 \pretocmd{\@startsection}{\addlineno}{}{}
260 267 \fi
  268 +
261 269 \ifKV@dilfamily@captionline
262 270 \pretocmd{\caption}{\dilmnotefloat{\texttt{%
263 271 \ifKV@dilfamily@inputfloatname\currfilename: \fi%
264 272 \the\inputlineno}}}{}{}
265 273 \fi
  274 +
266 275 \ifKV@dilfamily@dilbasicenvlines
267 276 \setkeys{dilfamily}{environmentline={
268 277 itemize,enumerate,description,quote,displaymath,equation,equation*,
@@ -270,6 +279,7 @@
270 279 }
271 280 }
272 281 \fi
  282 +
273 283 \ifKV@dilfamily@dilamsmathenvlines
274 284 \setkeys{dilfamily}{environmentline={
275 285 align,align*
@@ -290,7 +300,6 @@
290 300 \AtEndOfIncludes{\dilmnote{End of \texttt{\currfilename}}}
291 301 \fi
292 302
293   -
294 303 \AtBeginDocument{%
295 304 \setcounter{firstline}{\the\inputlineno}%
296 305 }
2  inputfile.tex
@@ -5,7 +5,7 @@
5 5 \item Two
6 6 \item Three
7 7 \end{itemize}
8   -
  8 +\vspace{5cm}
9 9 \begin{enumerate}
10 10 \item One
11 11 \item Two

No commit comments for this range

Something went wrong with that request. Please try again.