# Using KOMA-Script packages with other classes

When speaking of KOMA-Script most people will refer to its classes scrbook, scrreprt, scrartcl and perhaps scrlttr2. But not everyone will know, that part of the bundle are also some packages, that can be used with other classes than the KOMA-Script ones.

Let us give here an overview of these packages. Please one answer per package (except for packages with very similar functions) containing beside the name …

• if it’s meant rather for package respective document class writers or for users dealing with documents (or both).
• where documentation is to be found, i.e. in main KOMA-Script doc scrgiuen.pdf (English)/scrguide.pdf (German) or separate.
• overview of package features.
• a short example if possible.
• perhaps links to some existant answers on TeX.SE using this package.

# scrextend

This package makes basic features of KOMA-Script classes available for other classes, so it extends them. It is mainly meant for document writers, but could also be used by package and class writers. Description is found in main KOMA-Script documentation.

As explicitly stated in documentation this package should not be used together with a KOMA-Script class.

## Feature overview:

• scrbase
• scrdate and scrtime
• scrextend – makes some features of the KOMA-Script classes available for other classes.
• scrjura – contract environment for advocates and scholary persons in law
• scrlayer
• scrlayer-notecolumn
• scrlayer-scrpage as successor of legacy package scrpage2 (which has itself an obsolete predecessor scrpage)
• scrlfile – control of package dependencies
• scrwfile
• tocbasic
• tocstyle
• typearea

See also abstracts in file README (included in TeX distributions, as well).

Just as addition – no KOMA-Script packages, but also written by Markus Kohm (no answer here, please):

• gridset:

Grid setting — also known as strict in-register setting — is something, that should be done for a lot of documents but is not easy using LATEX. Package gridset helps to get the information needed for grid setting. It does not implement auto grid setting, but there is a command \vskipnextgrid, that moves to the next grid position. This may be enough under some circumstances. In other circumstances it may fail. So gridset is only one more step for grid setting not a complete solution.

• GS1:

There are several barcode packages out in the world, but they either need PStricks, or are restricted to EAN-13 barcodes. And most of all, they are all LATEX 2ε. I’ve decided to write a package, that supports several GS1 codes, and at almost the same time, I’ve decided to give L3 a chance. So I’ve started an experimental GS1 package using expl3. Using expl3 was the main reason writing this package.

GS1 does also contain rule-D:

At LATEX 2ε you have command \rule to make horizontal and vertical rules and even boxes. Currently there’s no L3 command for this. This module provides two new L3 functions for rules. The “-D” in the module name indicates, that currently the implementation uses deprecated functions like \tex_vrule:D. Nevertheless, the new rule functions aren’t declared to be deprecated.

• luaindex:

With LuaTEX it would not be a problem to call an index processor like MakeIndex while running LuaTEX. So the user would not longer require to call the index processor on his own. But on the other side Lua hat enough power to process the index itself. Package luaindex was made to do this. It consists primary of a Lua module: luaindex.lua. This provides functions to generate a new index (or several new indexes), add entries to it and print the index. To make the world easier there’s an additional LATEX package: luaindex.sty.

• marginnote:

In LATEX the command \marginpar[⟨left⟩]{⟨right⟩} might be used to create a note in the margin. But there is a problem with this command: it creates a special kind of float. For this it cannot be used e.g. at floats or footnotes. Package marginnote supports another command \marginnote to create notes in the margin. This does not use a kind of float and for this does not have the disadvantage of \marginpar. But there might be other problems ...
[…]
Note: The margin note will be placed at the current vertical line. This means, if you are using two \marginnote commands at the same line, they will be put on the same place. This is not a bug but a feature!

• pfarrei:
Lua script and package aiming to support pastors and priests in setting song and prayer books. Only German documentation available in the moment, but the Lua script/s provide/s a short help: texlua a5toa4.tlu -h (a wrapper script) or directly texlua pfarrei.tlu -h. Note that at time of writing there is a bug in MiKTeX where only execution of pfarrei.tlu works, cf. Lua script from package "pfarrei" not properly executed, probably due to outdated library.

• splitidx/splitindex:

With makeidx there’s a standard package at LATEX to create one index to each document. But some times more than one index is needed. There are different packages with different solutions and different problems to achieve multiple indices. Here is one more.
[…]
Before calling the index processor the one raw index file has to be splitted into multiple raw index files. Each of these contains the index entries of one index. This splitting can be done with the splitindex program.

• titlepage:
Provides extended title pages with several predefined styles.

Creation of title pages is something most authors should not have to do. But reality is not perfect, so a lot of authors have to do it. In 2009 KOMA started the title page project at <http://www.komascript.de/titlepage> to collect real title pages and implement them with a well defined interface. So changing from one title page style to another would be very simple. Nevertheless implementation of a new title page style may be still difficult. But maybe the guys of the title page project would help you. Just ask!

At time of writing not available on CTAN, but only on repository for experimental KOMA-Script versions, cf. Using most current KOMA-Script with TeX Live, MacTeX or MiKTeX on Markus Kohm’s website http://komascript.de. (Note: http://www.komascript.de/titlepage is in German, but package manual is in English.)

# scrlfile

Package scrlfile mostly gives powers to package authors, but a normal user can take advantage of this package as well.
Suppose you want to run some code, but only if a special package is loaded. Or maybe you want to prevent to load this package after all. No problem.

## Feature overview

• scrlfile gives you the possibility to run code BeforePackage{<packageName>}{<instructions>}

\documentclass{article}
\usepackage{scrlfile}
\AfterPackage{hyperref}{\typeout{I am done with hyperref}}
\usepackage{blindtext}
\usepackage{hyperref}
\begin{document}
\blindtext
\end{document}


This can be very helpful, when you want to patch a command provided by a package. You can do the same with classes (\BeforeClass, \AfterClass) and also for input files (\BeforeFile, \AfterFile). More information can be found in the documentation scrguien.pdf (the documentation on texdoc.net).

• Consider your university provides class and/or package files to submit thesis in a corporate design. Package framed is loaded, but for some reasons you want to replace framed with mdframed.

\listfiles
\documentclass{article}
\usepackage{scrlfile}
\ReplacePackage{framed}{mdframed}
\usepackage{framed} % explicitly loaded just for this example
\usepackage{blindtext}
\begin{document}
\blindtext
\end{document}


Please note, that packages and class names are given without the file ending.

Also interesting: Make ltxdoc class use report as underlying class.

• You are working with the classes of your university, which loads the packages fontenc and inputenc. Both with options (That should never be done by a class). Suppose you are working with LuaLaTeX, so you don't need and don't want to load those packages. You can prevent them from loading completely, as the following MWE shows.

\listfiles
\documentclass{article}
\usepackage{blindtext}
\usepackage{scrlfile}
\usepackage{ifluatex}
\ifluatex
\else
\fi
\usepackage[T1]{fontenc}
\begin{document}
\blindtext
\end{document}


There are also command hooks to deal with the main aux-file and macros to store package lists. Examples can be found in the KOMA-script documentation.

# scrjura

The package scrjura is intended for drafting legal documents according to German standards. The design of the package allows in general writing contracts, verdicts and even a special kind of books we call commentary ("Kommentar").

"In general" means that the basic structures have been written, but so far only the branch to write contracts has been filled with all the details for swift work. I can recommend the package to German lawyers who negotiate contracts. The package has its own manual (scrjura.pdf), but this is slightly outdated (lacking the improvements of recent years), a much better documentation has been included in Markus Kohm's book about KOMA-Script written in German (ISBN 978-3-86541-459-5/ old 10 digit ISBN 3-86541-459-1).

If somebody would be interested using it for other purposes than contracts, please drop a message at http://www.komascript.de.

Package tocbasic is another package that defines some useful commands not only for package author.

The most useful feature for the everyday user might be DeclareNewTOC[<options>]{<file etension>}.

  \DeclareNewTOC[%
type=remarkbox,%
types=remarkboxes,%
float,% define a floating environment
floattype=4,%
name=Remark,%
listname={List of Remarks}%
]{lor}
\setuptoc{lor}{chapteratlist}


This defines floating remarkboxes that can be used exactly the same way as figures or tables. Those few lines enable you to set a caption, have a List of Remarks and the little space between chapter when using this KOMA-feature. It works out of the box with hyperrefs autoref mechanism as well.

There is a lot of other handy stuff for package authors.