Cross-referencing labels in other files

With the xr package one can pull labels from different files, however it is not possible to create hyperref-Hyperlinks with this package.

Fortunately there is a was around this challenge:

“Label-Dokument.tex” with the label inside

%!TEX TS-program = Arara
% arara: pdflatex
\documentclass[12pt]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\hypersetup{
    bookmarks=true,                     % show bookmarks bar
    unicode=false,                      % non - Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                        % show Acrobat’s toolbar
    pdfmenubar=true,                        % show Acrobat’s menu
    pdffitwindow=false,                 % window fit to page when opened
    pdfstartview={FitH},                    % fits the width of the page to the window
    pdftitle={Title},                        % title
    pdfauthor={Author},                 % author
    pdfsubject={Subject},                   % subject of the document
    pdfcreator={LaTeX},                   % creator of the document
    pdfproducer={LaTeX},             % producer of the document
    pdfkeywords={keyword1} {key2} {key3},   % list of keywords
    pdfnewwindow=true,                  % links in new window
    colorlinks=true,                        % false: boxed links; true: colored links
    linkcolor=blue,                          % color of internal links
    citecolor=blue,                          % color of internal links
    filecolor=blue,                     % color of file links
    urlcolor=blue                        % color of external links
}
\begin{document}
 
\section{Some Section}
 
In this file I am setting a label. \label{lab:label1}
 
\end{document}
<pre>
 
<strong>"Ref-Dokument" with the reference to "Label-Dokument"</strong>
 
<pre lang="LaTeX">
%!TEX TS-program = Arara
% arara: pdflatex
\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{
    bookmarks=true,                     % show bookmarks bar
    unicode=false,                      % non - Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                        % show Acrobat’s toolbar
    pdfmenubar=true,                        % show Acrobat’s menu
    pdffitwindow=false,                 % window fit to page when opened
    pdfstartview={FitH},                    % fits the width of the page to the window
    pdftitle={Title},                        % title
    pdfauthor={Author},                 % author
    pdfsubject={Subject},                   % subject of the document
    pdfcreator={LaTeX},                   % creator of the document
    pdfproducer={LaTeX},             % producer of the document
    pdfkeywords={keyword1} {key2} {key3},   % list of keywords
    pdfnewwindow=true,                  % links in new window
    colorlinks=true,                        % false: boxed links; true: colored links
    linkcolor=blue,                          % color of internal links
    citecolor=blue,                          % color of internal links
    filecolor=blue,                     % color of file links
    urlcolor=blue                        % color of external links
}
\usepackage{zref-xr,zref-user}
\usepackage{nameref}
\zxrsetup{toltxlabel}
\zexternaldocument*{Label-Dokument}
\begin{document}
 
In this document I reference the external label in section \ref{lab:label1} on page \pageref{lab:label1} of the external document.
 
\end{document}

ref

Using LaTeX to generate PDFs for mobile phones and tablets

Here’s an example how LaTeX can be used to create PDF files for small screens. The following example is made for the Nokia Lumia 630 but can but easily adjusted.

%!TEX TS-program = LuaLaTeX
\documentclass[7pt,smallheadings]{scrartcl}
\usepackage[paperwidth=56mm,paperheight=92.5mm,top=1mm,left=1mm,bottom=1mm,right=3.5mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{xkeyval,polyglossia}
\setmainlanguage[spelling=new]{german}
\usepackage{fontspec}
\setmainfont{Verdana}
\usepackage{microtype}
\usepackage{blindtext}
\pagestyle{plain}
\begin{document}
 
\section{Ein Abschnitt}
\subsection{Ein Unterabschnitt}
 
\blindtext[2]
 
\end{document}

lumia

Folien von der FrosCon 2014

Hier meine Folien vom heutigen LaTeX-Vortrag auf der FrosCon.

Froscon-2014-Folien (PDF)

TeX Dateien (zip)

Für Einsteiger in Sachen LaTeX sind folgende Dokumente interessant:

Als Buch für Einsteiger empfehle ich das Einführungsbuch von Herbert Voss: http://www.dante.de/index/Literatur/Einfuehrung.html

Dateien verschlüsseln mit ccrypt

Auf der Suche nach einem Werkzeug, das Dateien mit hinreichender Sicherheit verschlüsseln kann, bin ich jetzt auf ccrypt (http://ccrypt.sourceforge.net/) gestoßen.

Dieses kleine Programm läuft unter allen möglichen Betriebssystemen und verschlüsselt eine Datei per AES.

Mit ccrypt --help bzw. man ccrypt kommt man an die Hilfeseite von ccrypt.

C:\Windows\System32>ccrypt --help
ccrypt 1.10. Secure encryption and decryption of files and streams.

Usage: ccrypt [mode] [options] [file...]
       ccencrypt [options] [file...]
       ccdecrypt [options] [file...]
       ccat [options] file...

Modes:
    -e, --encrypt         encrypt
    -d, --decrypt         decrypt
    -c, --cat             cat; decrypt files to stdout
    -x, --keychange       change key
    -u, --unixcrypt       decrypt old unix crypt files

Options:
    -h, --help            print this help message and exit
    -V, --version         print version info and exit
    -L, --license         print license info and exit
    -v, --verbose         print progress information to stderr
    -q, --quiet           run quietly; suppress warnings
    -f, --force           overwrite existing files without asking
    -m, --mismatch        allow decryption with non-matching key
    -E, --envvar var      read keyword from environment variable (unsafe)
    -K, --key key         give keyword on command line (unsafe)
    -k, --keyfile file    read keyword(s) as first line(s) from file
    -P, --prompt prompt   use this prompt instead of default
    -S, --suffix .suf     use suffix .suf instead of default .cpt
    -s, --strictsuffix    refuse to encrypt files which already have suffix
    -F, --envvar2 var     as -E for second keyword (for keychange mode)
    -H, --key2 key        as -K for second keyword (for keychange mode)
    -Q, --prompt2 prompt  as -P for second keyword (for keychange mode)
    -t, --timid           prompt twice for encryption keys (default)
    -b, --brave           prompt only once for encryption keys
    -y, --keyref file     encryption key must match this encrypted file
    -r, --recursive       recurse through directories
    -R, --rec-symlinks    follow symbolic links as subdirectories
    -l, --symlinks        dereference symbolic links
    -T, --tmpfiles        use temporary files instead of overwriting (unsafe)
    --                    end of options, filenames follow

Wichtigste Funktionen

  • ccrypt Dateiname verschlüsselt die übergebene Datei, fragt das Passwort interaktiv ab. Über den Parameter -K kann das Passwort auch übergeben werden.
  • ccrypt -d Dateiname.cpt entschlüsselt die übergebene Datei, fragt das Passwort interaktiv ab. -d muss zum Verschlüsseln angegeben werden, sonst wird die verschlüsselte Datei erneut verschlüsselt.

Emacs Einbindung

ccrypt kann auch in Emacs eingebunden werden, Details dazu unter http://ccrypt.sourceforge.net/#emacs. Die mitgelieferte Lisp Datei habe ich in einen Unterordner meines Emacs-Verzeichnisses gelegt und lade diese in der .emacs:

;; CCrypt Support
(setq load-path (cons "C:/Programme/emacs-24.3/myLisp/ccrypt" load-path))
(require 'ps-ccrypt "ps-ccrypt.el")

Lade ich jetzt eine verschlüsselte Datei, so fragt Emacs nach dem Passwort und entschlüsselt den Inhalt im Buffer. Auf der Dateiablage bleibt die Datei verschlüsselt.

A simple exsheets/tasks Example

Here’s a simple example for the exsheets/tasks packages, taken from the tasks Documentation.

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{tasks}
\usepackage{exsheets}
 
\begin{document}
 
\settasks{
counter-format = qu.tsk,
item-indent = 2em,
label-width = 2em,
label-offset = 0pt
}
 
\begin{question}[type=exam]{4}
I have these two tasks for you. Shall we begin?
\begin{tasks}(2)
\task The first task: easy!
\task The second task: even more so!
\end{tasks}
\end{question}
 
\begin{solution}[print]
Now, let's see\ldots\ ah, yes:
\begin{tasks}
\task This is the first solution. Told you it was easy.
\task This is the second solution. And of course you knew that!
\end{tasks}
\end{solution}
 
\end{document}

ex

MS Excel: Komplexe Wenn()-Formeln durch Vergleich ersetzen

Vor kurzem hatte ich eine kleine Herausforderung in Excel: Beträge in Spalte C mussten mit negativem Vorzeichen versehen werden, in Abhängigkeit einer Zahl in Spalte B (gelb markiert im Bild). Lösen lässt sich dies per verschachtelter WENN() Funktion, bei vielen Verschachtelungen wird die Formel aber schnell unübersichtlich und fehleranfällig. Deutlich einfacher und übersichtlicher geht es über eine Mischung aus VERGLEICH() und ISTNV(), die ich bei stackexchange gefunden hatte.

=WENN(ISTNV(VERGLEICH([@Unterkonto];unterkonten;0));[@Amount];-1*[@Amount])

  • für die Zahlen, die den Vorzeichenwechsel auslösen, habe ich einen benannten Bereich ‘unterkonten’ festgelegt
  • VERGLEICH() schaut, ob ein Wert (der erste Parameter) in einer Liste (zweiter Parameter) vorhanden ist. Wird ein Wert nicht gefunden, wird #NV zurückgeliefert. Der zweite Parameter kann auch ein benannter Bereich sein.
  • Um die #NV Werte zu behandeln, prüfen wir mit ISTNV() die Rückgabe der VERGLEICH() Funktion
  • Die Rückgabe von ISTNV() wird dann per WENN() geprüft. Wenn ISTNV() WAHR zurückliefert, dann hat VERGLEICH() das Konto nicht in der Liste gefunden, sonst ist der Werte aus Spalte “Amount” mit -1 zu multiplizieren.

Download der Excel-Datei

Excel Vergleich ISTNV

Committing to Subversion Repo directly from TeXworks

The following is a rather dirty trick to commit to Subversion directly from TeXworks. A clean implementation would make use of the scripting APIs in TeXworks, I am also working on that. Until then here’s the trick.

Just create a new tool entry, which calls svn (assuming that the path to svn is included in the PATH variable) and add the tree options: ci, -m and “”

svn_artikel_20140611

Does anyone know how to write a corresponding script? I gave it a try but haven’t come far…

Creating menus with Autohotkey

Here’s a simple example how to create a menu with Autohotkey, in this case it allows the user to select one of the LaTeX standard environments itemize, enumerate or description when Alt-y is pressed.

!y::
Gui, 1:Destroy
Gui, Add, Text,, Please enter the environment:
Gui, Add, DDL, vList, itemize||enumerate|description
Gui, Add, Button, Default, Input
Gui, Show
return

ButtonInput:
Gui, Submit, NoHide
Gui, 1:Destroy
Send %List%
return

Testing TeX Live’s Aurial font

A few days ago I checked the LaTeX Font Catalogue and found a nice font, Aurial.

\documentclass[12pt,ngerman]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{aurical}
 
\begin{document}
 
\section{Fontlukas}\Fontlukas
 
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\section{Fontamici}\Fontamici
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
\section{Fontlukas-bfseries} \Fontlukas\bfseries
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\section{Fontlukas-slshape} \Fontlukas\slshape
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\section{Fontlukas-bfseries-slshape} \Fontlukas\bfseries\slshape
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. 
 
\end{document}

fonti

Installing & using the nonfreefonts in TeX Live 2013

Since there was a question on TSX how to use Arial in a LaTeX document I had a closer look on the nonfreefonts stuff and want to share this knowledge.

What’s it all about?

There are various fonts available on CTAN which — due to copyright/licensing stuff — can’t make it to the TeX Live DVD. These fonts are:

  • Arial by URW
  • Classico by URW
  • DayRoman by Apostrophiclabs
  • Euro symbols by Adobe
  • GaramondNo8 by URW
  • GaramondNo8 Expert by Michael Sharpe
  • LetterGothic by URW
  • LuxiMono by Bigelow & Holmes
  • VnTeX nonfree by Hàn Thế Thành
  • Webomints by Galapagos Design Group

How to install them

Since they’re not on the DVD these fonts need to be installed separately. Font installation for TeX is always tidious (copy these files there, some other files there, update this file) so Reinhard Kotucha created a script which does these nasty things for us. The good thing is, this script works on all TeX Live platforms.

Step 1: Getting the script

If you’re on any Linux/Unix platform run:


wget http://tug.org/fonts/getnonfreefonts/install-getnonfreefonts
texlua install-getnonfreefonts

If you’re on Windows, either install wget (always a good idea) or visit http://www.tug.org/fonts/getnonfreefonts/ with your browser and download the installer linked there. Afterwards just run texlua on the file, it will take care of the script-installation.


J:\>texlua install-getnonfreefonts
Detected System: win32
Detected Installation: C:/texlive/2013
mkdir C:/texlive/2013/texmf-dist/scripts/getnonfreefonts ...             [done]
Installing texmf-dist/scripts/getnonfreefonts/getnonfreefonts.pl ...     [done]
Installing texmf-dist/doc/man/man1/getnonfreefonts.1 ...                 [done]
Installing texmf-dist/doc/man/man1/getnonfreefonts-sys.1 ...             [done]
Installing texmf-dist/doc/man/man1/getnonfreefonts.man1.pdf ...          [done]
Installing texmf-dist/doc/man/man1/getnonfreefonts-sys.man1.pdf ...      [done]
md5sum: eb97b3fe32b28ead5183275ad32699b8 getnonfreefonts.pl ...            [ok]
md5sum: f850d910dd96ee27cecdb3772047d247 getnonfreefonts.1 ...             [ok]
md5sum: fb2b0f7699db8e627d4e26b730e94928 getnonfreefonts-sys.1 ...         [ok]
md5sum: 415b51f7c80a4abe8d0a667a04c9d525 getnonfreefonts.man1.pdf ...      [ok]
Creating wrappers in 'bin/win32' ...                                           1
 Datei(en) kopiert.
        1 Datei(en) kopiert.
  [done]
texhash: Updating C:/texlive/2013/texmf-dist/ls-R...
texhash: Updated C:/texlive/2013/texmf-dist/ls-R.
texhash: Done.

J:\>

Step 2: Installing the fonts

Just run getnonfreefonts --all to install all the fonts in your user texmf directory ($TEXMFHOME) or
getnonfreefonts-sys --all to install to the system directory ($TEXMFLOCAL).

J:\>getnonfreefonts --all
--2014-03-30 09:51:38--  http://tug.org/~kotucha/getnonfreefonts/getfont2013
Resolving tug.org... 130.225.2.178
Connecting to tug.org|130.225.2.178|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23858 (23K)
Saving to: `getfont2013'

100%[======================================>] 23,858      --.-K/s   in 0.1s

2014-03-30 09:51:38 (223 KB/s) - `getfont2013' saved [23858/23858]

------------------------------------------
Installation directory: C:/Users/Uwe/texmf
------------------------------------------

Package 'arial-urw':
====================

--2014-03-30 09:51:39--  http://ctan.org/tex-archive/fonts/urw/arial.zip
Resolving ctan.org... 176.28.54.184
Connecting to ctan.org|176.28.54.184|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://mirrors.ctan.org/fonts/urw/arial.zip [following]
--2014-03-30 09:51:39--  http://mirrors.ctan.org/fonts/urw/arial.zip
Resolving mirrors.ctan.org... 176.28.54.184
Reusing existing connection to ctan.org:80.
HTTP request sent, awaiting response... 302 Found
Location: ftp://ftp.tu-chemnitz.de/pub/tex/fonts/urw/arial.zip [following]
--2014-03-30 09:51:39--  ftp://ftp.tu-chemnitz.de/pub/tex/fonts/urw/arial.zip
           => `arial.zip'
Resolving ftp.tu-chemnitz.de... 134.109.228.1
Connecting to ftp.tu-chemnitz.de|134.109.228.1|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /pub/tex/fonts/urw ... done.
==> SIZE arial.zip ... 249649
==> PASV ... done.    ==> RETR arial.zip ... done.
Length: 249649 (244K)

100%[======================================>] 249,649      656K/s   in 0.4s

2014-03-30 09:51:40 (656 KB/s) - `arial.zip' saved [249649]

4ad05e902e727fecc4f55f8d737e10a5  arial.zip                 [MD5sum ok]

Extracting 'arial.zip'...                                   [done]
Installing 'ua1.map'...                                     Creating new config
file c:/users/uwe/.texlive2013/texmf-config/web2c/updmap.cfg
[done]

Step 3: Using the fonts

Under http://www.tug.dk/FontCatalogue/lettergothic/
you will find an example how to use for example the lettergothic font.

\documentclass[12pt,ngerman]{scrartcl}
 
\usepackage[scaled]{ulgothic}
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
\usepackage[T1]{fontenc}
 
\begin{document}
 
\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum felis a nibh, eu condimentum lectus auctor. Cras quis euismod lorem. Aliquam in nisi felis. Etiam sit amet mauris at magna rhoncus commodo. Nulla neque ipsum, condimentum in nibh sed, eleifend consectetur est. Suspendisse ac laoreet urna. Vivamus sit amet tempor nunc, ac porta mi. Pha\-sellus et ligula ullamcorper, congue ligula non, porta purus. Etiam cursus eros ante, sit amet porta enim adipiscing sed. Vestibulum hendrerit erat a tellus dignissim, sit amet lao\-reet est suscipit. 
 
\end{document}

gothic

Step 4: Overview of all examples

Arial

\usepackage[scaled]{uarial}
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}

Classico

\renewcommand*\sfdefault{uop}
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}

DayRoman

\renewcommand*\rmdefault{dayrom}
\usepackage[T1]{fontenc}

Garamond

\usepackage[urw-garamond]{mathdesign}
\usepackage[T1]{fontenc}

Garamond Expert

\usepackage[T1]{fontenc}
\usepackage[urw-garamond]{mathdesign}
\usepackage{garamondx}

Letter Gothic

\usepackage[scaled]{ulgothic}
\renewcommand*\familydefault{\ttdefault}
\usepackage[T1]{fontenc}

Luxi Mono

\usepackage{luximono}
\renewcommand*\familydefault{\ttdefault}
\usepackage[T1]{fontenc}

webomints

See http://www.ctan.org/tex-archive/fonts/webomints