1

With help from egreg, I have the following collection of packages and macros in the file standardopsaetning.sty:

\NeedsTeXFormat{LaTeX2e}[2014/05/01]
\ProvidesPackage{standardopsaetning}[2015/01/04 Standardopsætning]


\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage{babel}
\RequirePackage[
  hmargin = 2.4cm,
  vmargin = 3cm
]{geometry}
\RequirePackage{mathtools}
\RequirePackage[
  bottom,
  hang,
  stable
]{footmisc}
\RequirePackage{fancyhdr}
\RequirePackage{caption}
\RequirePackage{siunitx}
\RequirePackage{pstricks-add}
\RequirePackage{booktabs}
\RequirePackage{enumitem}
\RequirePackage{upgreek}
\RequirePackage[
  lastpage
]{zref}
\RequirePackage{microtype}


\mathtoolsset{
  showonlyrefs
}
\DeclareCaptionLabelSeparator{tilpasning}{:\quad}
\captionsetup{
  labelsep = tilpasning,
  figureposition = bottom,
  tableposition = top,
  font = small,
  labelfont = sc
}
\sisetup{
  locale = DE,
  per-mode = symbol-or-fraction,
  range-phrase = --
}
\psset{
  dimen = m
}

\newif\ifprint
\newif\ifsubscript

\addto\extrasdanish{
  \renewcommand*\pageautorefname{side}
  \renewcommand*\figureautorefname{\textsc{Figur}}
  \renewcommand*\tableautorefname{\textsc{Tabel}}
}

\providecommand*\setfloatlocations[2]{\@namedef{fps@#1}{#2}}
\setfloatlocations{figure}{htbp}
\setfloatlocations{table}{htbp}

\DisableLigatures[f]{encoding = T1}

\setlength\footnotemargin{6pt}

\pagestyle{fancy}
\renewcommand*\headrulewidth{0pt}
\setlength\headheight{14.5pt}
\zref@newprop*{numpage}{\the\value{page}}
\zref@addprop{main}{numpage}
\fancyhf{}
\fancyfoot[C]{%
  \ifnum \zref@extractdefault{LastPage}{numpage}{0} > 1
    \thepage
  \fi
}

\begingroup\lccode`\~=`\_
\lowercase{\endgroup
  \protected\def~{\@ifnextchar|\subtextup\sb}%
}
\def\subtextup|#1|{\sb{\textup{#1}}}%
\AtBeginDocument{\catcode`\_=12 \mathcode`\_=\string"8000 }

\ExplSyntaxOn
\cs_new_eq:NN \calc \fp_eval:n

\NewDocumentCommand\SIexpr{ O{,} m m }
 {
  \SIextension_siexpr:nnn { #1 } { #2 } { #3 }
 }

\cs_new_protected:Npn \SIextension_siexpr:nnn #1 #2 #3
 {
  \seq_set_split:Nnn \l_SIextension_siexpr_input_seq { #1 } { #2 }
  \seq_pop_left:NN \l_SIextension_siexpr_input_seq \l_SIextension_siexpr_first_tl
  \seq_clear:N \l_SIextension_siexpr_output_seq
  \seq_put_right:Nx \l_SIextension_siexpr_output_seq
   {
    \fp_compare:nTF { \l_SIextension_siexpr_first_tl > 0 }
      { \num { \l_SIextension_siexpr_first_tl } }
      { - \num { \tl_tail:V \l_SIextension_siexpr_first_tl } }
   }
  \seq_map_inline:Nn \l_SIextension_siexpr_input_seq
   {
    \seq_put_right:Nx \l_SIextension_siexpr_output_seq
     {
      \fp_compare:nTF { ##1 > 0 }
        { + \num { ##1 } }
        { - \num { \tl_tail:n { ##1 } } }
     }
   }

  \SI[
    parse-numbers = false,
    quotient-mode = fraction,
    input-product = *,
    output-product = \cdot
  ]
   {
    \sisetup{parse-numbers}
    \left( \seq_use:Nn \l_SIextension_siexpr_output_seq { } \right)
   }
   { #3 }
}
\ExplSyntaxOff


\endinput

I then start a .tex file with the following:

\RequirePackage{fixltx2e}

\documentclass[
  a4paper,
  12pt,
  danish
]{article}

\usepackage{standardopsaetning}

...

Question: Is this 'correct' or is there a better loading order or should I change something else? (As an example, I'm not sure if lmodern is loaded in the best place.)

  • 3
    To answer some of your questions, it would be helpful to know what kinds of documents you intend write with this package. Separately, rather than ask if lmodern is loaded at some optimal stage, I'd be tempted to ask if lmodern is the most suitable font family and if 12pt is the optimal font size for your typesetting needs. Finally, I strongly recommend inserting loads more comments into the file. You may know right now why certain packages are being loaded and why others are not, but I can guarantee you that in six months you'll be much less sure about these things. – Mico Jan 04 '15 at 21:22
  • 1
    @Mico Latin Modern and a font size of 12pt is what I use for the documents I'm loading standardopsaetning.sty in. I have a lot of notes/comments in the 'real' style file but they are in Danish so I removed them here. – Svend Tveskæg Jan 04 '15 at 21:28
  • 1
    One practical suggestion about the package: I think it's good practice to keep together instructions that load various packages and macros that make use of the packages to achieve certain things. For instance, I'd place the instruction \DisableLigatures[f]{encoding = T1} immediately after \RequirePackage{microtype}. Similarly, it might make sense to place the instruction \setlength\footnotemargin{6pt} immediately after the loading of the footmisc package. – Mico Jan 04 '15 at 21:29
  • Thanks for mentioning that you do have lots of comments. (It hadn't occurred to me that they might be in Danish, but that of course makes perfect sense!) – Mico Jan 04 '15 at 21:30
  • Thanks for the comments, Mico! Others are more than welcome to give their inputs, too. :) – Svend Tveskæg Jan 04 '15 at 21:32
  • It is, of course, a mistake to load lmodern rather than the alternative at all... ;). But if you insist, I would also load textcomp. – cfr Jan 04 '15 at 23:22
  • @cfr What is the alternative? :) – Svend Tveskæg Jan 04 '15 at 23:23
  • 2
    cfr-lm. [I'm joking about loading lmodern being a mistake. cfr-lm is an alternative, though.] I think there's another one, but cfr-lm is better or I wouldn't have bothered to write it. – cfr Jan 04 '15 at 23:24
  • \RequirePackage{pkgloader} :-) – Martin Schröder Jan 05 '15 at 10:22
  • 1
    I suspect this should be closed as "too broad" (or "unclear") there is no general right answer for package loading, however the order does not matter unless two packages (re) define the same command. This is rather unlikely for the packages that you list, you are not loading multiple font commands or multiple table packages or multipe cross-ref packages even hyperref (which has to redefine more or less everything so interacts with many packages) – David Carlisle Jan 05 '15 at 13:35
  • @DavidCarlisle I decided to not load hyperref in this .sty file because I sometimes have packages which should be loaded after hyperref. Sometimes I have a few more table packages in my documents (together with booktabs but I've never experienced any problems in this regard). – Svend Tveskæg Jan 05 '15 at 18:28
  • @SvendTveskæg yes but that doesn't leave anything that anyone can really comment on, I voted to close, sorry:-) – David Carlisle Jan 05 '15 at 19:13
  • To all who voted for closing the question because it is unclear what I'm asking: How and why is it unclear? I think it's perfectly clear. :( – Svend Tveskæg Jan 05 '15 at 21:41

0 Answers0