This weekend, I finished a new program: JvJsDoc, a program to extract documentation from JavaScript source code and to present the collected information in a set of HTML pages. It is meant to be used together with the Google Closure Library and the Google Closure Compiler. As an example: JvJsDoc can convert the JavaScript source file goog/disposable/disposable.js into the HTML documentation in goog/Disposable.html.
More information can be found on the JvJsDoc homepage, and you can download the program here:
First public release.
After taking much longer than I intended to, today I finally submitted a new paper (about a year later than planned). You can have a look at the preprint here:
jvlisting is a
LaTeX package which
provides an alternative to LaTeX's built-in verbatim
environment. The new release, version 0.5, fixes some bugs and cleans up
the TeX source code a bit.
jvlisting can be downloaded from
my webserver.
I hope you find this package useful. Bug reports and comments are very welcome!
Last week, Kanti and I submitted a new paper:
I am particularly curious about how the referees will react to my nice figures on pages 6 and 7.
I have typed my lectures notes for the statistical computing module I am teaching this term. The notes are available online:
Comments are very welcome!
I just started playing with Google+, not sure yet whether this will be useful or interesting to me. If you also want to play, and don't have an account yet, you can probably sign up at this link.
Just for reference, here is a recipe about how to watch your DVDs on an Apple iPad. I have read that some of the required steps may be illegal to perform when you are in the USA (or an American citizen?); don't follow these instructions if you are not allowed to!
The instructions provided here use MPlayer/MEncoder on Ubuntu Linux to convert the DVD content into a file of the required format, but many other options are available.
lsdvd) to find out which track of the DVD contains the actual movie. Normally this will be the longest track,
lsdvd helpfully lists the index of this track at the bottom
of its output.
lsdvd
mplayer) to verify that this is indeed the track you want:
TRACKNO=1 mplayer dvd://$TRACKNO
You have to replace the value of TRACKNO with the track
number found in the previous step.
mplayer to determine any cropping reqired:
mplayer dvd://$TRACKNO -vf cropdetect
This should print an option of the form
-vf crop=720:430:0:48 to the console.
The call to mencoder requires about a million arguments.
The following is inspired by a post at
Mike McCandless' blog.
CROP=720:430:0:48 X264OPTS=crf=28:vbv_maxrate=1500:nocabac:global_header\ :frameref=3:threads=auto:bframes=0:subq=6:mixed-refs=0\ :weightb=0:8x8dct=1:me=umh:partitions=all:qp_step=4\ :qcomp=0.7:trellis=1:direct_pred=auto FAACOPTS=br=160:mpeg=4:object=2:raw mencoder dvd://$TRACKNO \ -of lavf -lavfopts format=mp4 \ -vf crop=$CROP,pp=lb \ -ovc x264 -x264encopts $X264OPTS \ -oac faac -faacopts $FAACOPTS -channels 2 -srate 48000 \ -o out.mp4
You should replace the value of CROP with the value found
in the previous step. This command can take a considerable amount of time
to complete (comparable to the playing time of the DVD track), and should
produce a big file out.mp4 (about 225MB per hour of playing
time).
A while ago I finished my first home-made LaTeX package. The new package is called "jvlisting" and provides a replacement for LaTeX's verbatim environment.
This package provides the LaTeX environment listing, an
alternative to the built-in verbatim environment. The
listing environment is specially taylored for including
listings of computer program source code into documents. The main
advantages over the original verbatim environment are that
listing environment automatically fixes leading
whitespace so that the environment and program listing can be indented
with the rest of the document source, and
listing environments may easily be customised and
extended.
You can download the package and its documentation from
my webserver or from the
jvlisting page at the
Common TeX Archive Network (CTAN). I'd be happy if you could give my
package a try. Comments about jvlisting
are very welcome!
Recently I spent some time to understand how one can execute a macro repeatedly, once for every line of text in a LaTeX environment. Since the solution is a bit tricky and I found it diffcult to find answers on the web, here is a summary of what I learned.
Step 1. In order to prevent input lines from
being concatenated by TeX before we get access to them, we can use the
\obeylines macro. This allows to define a macro which matches
everything until the end of line:
\def\doline#1{line found: `#1'\par}
{\obeylines
\gdef\getline#1
{\doline{#1}}}
{\obeylines
\getline This is the \textbf{first} line.
This is the second line.}
Note that \obeylines must be in effect both while we
define the \getline macro and while scanning the text. The
outer pairs of enclosing brackets are there to contain the effect of
\obeylines. To make \getline visible outside
these brackets we use
\gdef to
define the macro in the global namespace. The output of the above TeX code
is
line found: ‘This is the first line.’
This is the second line.
Step 2. We would like to have the
\getline macro called for every line instead of just for the
first one. This can be achieved by putting a \getline
(without arguments) at the end of the \getline replacement
text. The only complication is that we somehow need to stop this procedure
once the end of the region of interest has been reached:
\def\marker{END}
{\obeylines
\gdef\getlines#1
{\def\text{#1}%
\ifx\text\marker \let\next\empty
\else \doline{#1}\let\next\getlines \fi
\next}}
{\obeylines
\getlines This is the \textbf{first} line.
This is the second line.
END
}
The
\ifx
command is used to test whether the matched line is the same as
\marker. Until we find the maker, we put a new call to
\getlines at the end of the \getlines
replacement text, thereby looping over all lines until the marker is
found. For this to work, the END
needs to occur on a line on its
own; therefore we have to move the closing brackets down one line. The TeX
code above leads to the following output.
line found: ‘This is the first line.’
line found: ‘This is the second line.’
Step 3. We are now ready to pack the commands from above into the definition of a LaTeX environment:
\def\marker{\end{dolines}}
{\obeylines
\gdef\getlines#1
{\def\text{#1}%
\ifx\text\marker \let\next\text
\else \doline{#1}\let\next\getlines \fi
\next}}
\newenvironment{dolines}{\begingroup\obeylines\getlines}%
{\endgroup}
\begin{dolines}
This is the \textbf{first} line.
This is the second line.
\end{dolines}
Here we had to change the definition of \getlines in order
to include the \end{dolines} in the replacement text when the
\ifx is true; otherwise it would have been swallowed by
\dolines. The resulting output is, a bit surprisingly, as
follows:
line found: ‘’
line found: ‘This is the first line.’
line found: ‘This is the second line.’
The extra empty line at the beginning is caused by the
\getlines macro matching the (empty) text between
\begin{dolines} and the end of line. The
\end{listing} must be on a line on its own for this
environment to work.
Step 4. If we want to prevent processing of the
TeX commands inside the dolines environment, we can do so by
changing the
category codes of
special characters like
to 12 (\other
). A
complication with this plan is, that \ifx also compares
category codes. Therefore, when we try to detect the end of our
environment while special characters are switched off, we need to define
\marker as the string
, but
with the category codes of all special charcters (the backslash and the
curly brackets) set to 12. This can be done by using the following,
contorted sequence of commands:
\end{dolines}
\begingroup
\catcode`|=0 \catcode`[=1 \catcode`]=2
\catcode`\{=12 \catcode`\}=12 \catcode`\\=12
|gdef|marker[\end{dolines}]
|endgroup
Two more changes are required to make this work: first, we need to disable all special characters at the beginning of the environment:
\let\do=\@makeother\dospecials
If you want to use this command outside a style file, you will need to
turn
into a letter by bracketing your definitions
with
@
\makeatletter ... \makeatother
Secondly, inside \getlines, the expansion of
\text still has the category codes as found in the input.
Therefore, if the input was read with special characters switched of, we
cannot write \let\next\text to get the closing
\end{dolines} (since the category codes of the backslash and
the curly brackets would be wrong). Instead, we need to use a definition
like \def\next{\end{dolines}}.
Example. Using the techniques explained above,
we can define a replacement for the LaTeX comment environment (contained
in the
verbatim
package) as follows:
\documentclass{article}
\makeatletter
\begingroup
\catcode`|=0 \catcode`[=1 \catcode`]=2
\catcode`\{=12 \catcode`\}=12 \catcode`\\=12
|gdef|marker[\end{comment}]
|endgroup
{\obeylines
\gdef\getlines#1
{\def\text{#1}%
\ifx\text\marker \def\next{\end{comment}}
\else \let\next\getlines \fi
\next}}
\newenvironment{comment}{\begingroup
\let\do=\@makeother\dospecials \obeylines\getlines}%
{\endgroup}
\makeatother
\begin{document}
\begin{comment}
Everything here will be ignored.
\Invalid LaTeX code and incomplete constructs like
\begin{itemize}
without the closing end are no problem.
\end{comment}
\end{document}
Funny coincidence: Yesterday I learned that the following paper which we first submitted in 2010 has been accepted:
And today I received an email notice that a paper we submitted in 2009(!) is finally going into print now:
Older entries can be found on the next page …
Copyright © 2011, Jochen Voss. All content on this website (including text, pictures, and any other original works), unless otherwise noted, is licensed under a Creative Commons Attribution-Share Alike 3.0 License.