Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: scmbradley/draftinputlines
base: d875f03683
...
head fork: scmbradley/draftinputlines
compare: 5c898e955c
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 107 additions and 21 deletions.
  1. +85 −8 draftinputlines-man.tex
  2. +21 −12 draftinputlines.sty
  3. +1 −1  inputfile.tex
View
93 draftinputlines-man.tex
@@ -6,12 +6,30 @@
sectionline=true,
captionline=true,
dilbasicenvlines=true,
-inputfilesrule=true
+inputfilesrule=true,
+inputfloatname=true,
]{draftinputlines}
+\usepackage{listings}
+\lstloadlanguages{[LaTeX]TeX}
+\lstset{%
+ basicstyle=\ttfamily,
+ commentstyle=\itshape\ttfamily\small,
+ showspaces=false,
+ showstringspaces=false,
+ breaklines=true,
+ breakautoindent=true,
+ captionpos=t,
+ frame=single,
+ escapeinside={(*}{*)},
+}
+\lstMakeShortInline{|}
+\usepackage{enumitem}
+\setdescription{font=\ttfamily,leftmargin=4em}
+% \xdef\thefilename{\currfilename}
+% \chead{\texttt{\thefilename}\xdef\thefilename{\currfilename}}
+% \cfoot{\texttt{\currfilename}}
-\usepackage{lipsum}
-
\begin{document}
\section{Introduction}
@@ -30,16 +48,75 @@ \section{Introduction}
This should be rare since floats should have their own space.
\section{Examples}
-
\input{inputfile}
-\section{Commands}
+\section{Options}
+Here are the options that are currently defined and a description of
+what they do.
-environmentinputline
+\paragraph{\lstinline+headfootpackage+}
+This sets what package is used to do the headers and footers.
+Set it to whatever is setting the headers and footers in your
+document.
+The options are:
+\begin{description}[labelindent=1cm]
+\item[scrpage] Uses KOMA script's |scrpage2|
+\item[fancyhdr] Uses |fancyhdr|
+\item[memoir] Uses |memoir|. Awkwardly, given the way |memoir|'s
+ header and footer mechanisms work, this will overwrite any current
+ headers you have set.
+ So this just sets a page number somewhere where it isn't setting an
+ input line number.
+ If you want to add the input line number to your existing headers
+ instead, you can do that with these two macros:
+ \textsc{These macros don't exist yet.
+ When I make memoir work, I will fix this.}
+ \item[plain] Use the plain TeX macros.
+\end{description}
+
+\paragraph{\lstinline+dilfont+}
+
+This defines what font the input line numbers will appear in.
+The default is |\ttfamily|.
+
+\paragraph{\lstinline+environmentline+}
+
+This option takes a list of environment names.
+Those environments listed will then print the line number where they
+start.
+
+\paragraph{Switches}
+
+The following is a list of Boolean (true/false) options and what they
+control.
+\begin{description}
+\item[sectionline] Determines whether each section will print the line
+ it is printed on.
+\item[captionline] Determines whether captions to figures, tables and
+ so on, will print their input line number.
+ I expect this will break with subcaptions.
+ These marginpars don't float.
+\item[inputfloatname] Prints the name of the file the float is from.
+ If |captionline| is false, this has no effect.
+\item[dilbasicenvlines] This basically passes a bunch of basic
+ environments to |environmentline|, namely:
+ |itemize,enumerate,description,quote,displaymath,equation,equation*,quotation,verse,abstract,flushleft,center,flushright,eqnarry,minipage|
+\item[dilamsmathenvlines] Like |dilbasicenvlines| this makes some
+ |amsmath| environments print their input line numbers.
+ For now it only actually does this for |align| and |align*|.
+ Most of the other environments are supposed to be use \emph{inside}
+ another mathmode environment, and so the outer mathmode
+ environment's start should give enough of an indication of where
+ this environment is.
+\item[dilinputfiles] Prints the name and input line number of files
+ included with |\input| and |\include|.
+\item[dilinputfilesrule] Prints rules above the start and below the
+ end of an included file, so it's obvious where in the page it starts
+ and ends.
+ If |dilinputfiles| is false, this doesn't do anything.
+\end{description}
-setupinputlines
-\section{Options}
\end{document}
View
33 draftinputlines.sty
@@ -72,6 +72,8 @@
% The actual keys
%------------------------------
+% Here is a terribly messy looking way of doing what I want:
+
% \define@choicekey{dilfamily}{inputlineshead}[\val\nr]{%
% inside,outside,center,left,right,off}{%
% \AtEndPreamble{
@@ -109,6 +111,8 @@
% }
% }
+% Here's a much neater way of doing it:
+
\define@choicekey{dilfamily}{inputlineshead}{%
inside,outside,center,left,right,off}{%
\AtEndPreamble{\csname dil@#1head\endcsname}%
@@ -118,22 +122,21 @@
\AtEndPreamble{\csname dil@#1foot\endcsname}%
}
+%--------------------------------------------------
+% Other input line numbers
+%--------------------------------------------------
\def\dilfont{\ttfamily}
\define@cmdkey{dilfamily}{dilfont}{\def\dilfont{\cmdKV@dilfamily@dilfont}}
-% Package option for user coloured linenumbers?
-\RequirePackage{xcolor}
-\newcommand\useraddlineno{\dilmnote{\textcolor{red}{\the\inputlineno}}}
-
-% % Package option that loads showkeys?
-% \RequirePackage{showkeys}
% Here comes the meat of the functionality
-\newcommand\addlineno{\dilmnote{\dilfont{\the\inputlineno}}}
+\newcommand\addlineno{\dilmnote{{\dilfont\the\inputlineno}}}
-\define@boolkey{dilfamily}{sectionline}[true]{}
-\define@boolkey{dilfamily}{captionline}[true]{}
+% % Package option for user coloured linenumbers?
+% \RequirePackage{xcolor}
+% \newcommand\useraddlineno{\dilmnote{\textcolor{red}{\the\inputlineno}}}
+\define@boolkeys{dilfamily}{sectionline,captionline}[true]{}
\newcommand\dil@patchenv[1]{%
\AtBeginEnvironment{#1}{\addlineno}}
@@ -163,11 +166,15 @@
\setkeys{dilfamily}{
sectionline=true,
captionline=true,
- % inputlineshead=outside,
- % inputlinesfoot=outside,
+ inputlineshead=outside,
+ inputlinesfoot=outside,
dilinputfiles=true,
}
+%--------------------------------------------------
+% Here comes the options
+%--------------------------------------------------
+
\ProcessOptionsX<dilfamily>
%------------------------------
@@ -258,11 +265,13 @@
\ifKV@dilfamily@sectionline
\pretocmd{\@startsection}{\addlineno}{}{}
\fi
+
\ifKV@dilfamily@captionline
\pretocmd{\caption}{\dilmnotefloat{\texttt{%
\ifKV@dilfamily@inputfloatname\currfilename: \fi%
\the\inputlineno}}}{}{}
\fi
+
\ifKV@dilfamily@dilbasicenvlines
\setkeys{dilfamily}{environmentline={
itemize,enumerate,description,quote,displaymath,equation,equation*,
@@ -270,6 +279,7 @@
}
}
\fi
+
\ifKV@dilfamily@dilamsmathenvlines
\setkeys{dilfamily}{environmentline={
align,align*
@@ -290,7 +300,6 @@
\AtEndOfIncludes{\dilmnote{End of \texttt{\currfilename}}}
\fi
-
\AtBeginDocument{%
\setcounter{firstline}{\the\inputlineno}%
}
View
2  inputfile.tex
@@ -5,7 +5,7 @@
\item Two
\item Three
\end{itemize}
-
+\vspace{5cm}
\begin{enumerate}
\item One
\item Two

No commit comments for this range

Something went wrong with that request. Please try again.