0

I have created a LaTeX document. I have used the following setting:

\documentclass[11pt,a4paper, oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[free-standing-units]{siunitx}

\DeclareSIUnit{\belmilliwatt}{Bm}
\DeclareSIUnit{\dBm}{\deci\belmilliwatt}

\usepackage{listings}
\lstset{basicstyle=\footnotesize, keywordstyle=\color{blue}}

\usepackage{gensymb}

\usepackage{caption}
\usepackage{subcaption}

\usepackage{color}
\usepackage[format=hang]{caption}
\usepackage{placeins}              

%TikZ package
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usetikzlibrary{plotmarks}

\author{name }
\title{title}

\setlength{\parindent}{0cm}
\setlength{\parskip}{0.2cm}

Now I am trying to transfer my document into a Template. The Template uses the following settings:

\documentclass[11pt,a4paper,oneside,bibstyle_IEEE,printversion,bibbackend_bibtex]{template} 
\usepackage{template}       
\usepackage{subfig}
\widowpenalty=1000 
\clubpenalty=1000 

Now, I have simply transferred my chapters to this new Template and added my packages. But there are a couple of errors that occur.

As far as I understand some of these errors occur, because my packages don't go along with packages used in the Template. For example subcation doesn't seem to go along with subfig. Also in the ihf-package, there are a couple of packages ... I don't know defined? The siunitx for example seems to be included in the ihf package and a TikZ package as well.

I think I am using the siunitx package wrong, I simply write the units like this: \GHz, \dBm, for example. I have tried \si{GHz} as well.

4
  • 1
    just showing your preamble makes it hard for anyone to help, you do not show your document nor show what errors you get. Try to make a small document that generates an error and fix your example above so that it generates the error that you are asking for help with. Feb 28 '17 at 9:23
  • Why do you want/need to use that template?
    – Johannes_B
    Feb 28 '17 at 9:45
  • 1
    Not an answer, but you loaded the caption package twice. Also, do you need both subcaption and subfig at the same time?
    – Troy
    Feb 28 '17 at 9:45
  • Yes, you're using siunitx considerably wrong. See Manuel Weinkauf's answer below, please!
    – user31729
    Feb 28 '17 at 12:40
1

As far as the siunitx use is concerned. You should always use macros instead of handwritten abbreviations, because in this way you always get the spacing right even for more complex constructions, can globally change abbreviations, and can also globally change how "x per y" is formatted (i.e. "x/y" or "x y^(-1)").

Many units are predefined, see the siunitx documentation for this. You can also define your own units using the \DeclareSIUnit command. Here is an example:

\documentclass{article}
\usepackage{siunitx}
\DeclareSIUnit\DecibelMilliwatts{dBm}

\begin{document}

Test no.~1 is \SI{10}{\giga\hertz} in the unit \si{\giga\hertz}.

Test no.~2 is \SI{10}{\DecibelMilliwatts} in the unit \si{\DecibelMilliwatts}.

You can then easily work with your own units like (nonsensical) \SI{10}{\giga\DecibelMilliwatts\per\metre\squared}.

\end{document}

EDIT: Made the spacing statement more clear. Thanks to samcarter for pointing that out.

4
  • The spacing is equally right for handwritten units, compare e.g. \SI{10}{\giga\hertz} \SI{10}{GHz} Feb 28 '17 at 12:58
  • @samcarter But the spacing is only correct if instead of using macros you stick to other input requirements, which are another error source. Compare the results of \SI{10}{km s^{-1}} vs. \SI{10}{km.s^{-1}} vs. \SI{10}{\kilo\metre\per\second}. Further, as I said, using hand-written units prevents you from globally switching from "km s^(-1)" to "km/s". Additionally, using macros you can quickly and globally redefine abbreviations. You want to abbreviate "litre" with "L" instead of "l" without searching for every occasion you used it in the entire document. Just \DeclareSIUnit\litre{L}. Feb 28 '17 at 13:33
  • 1
    I totally agree with you that macros makes it easier to do global changes and of course one has to use . for the inter-unit spacing in handwritten units, but handwritten units don't lead to wrong spacing per se -- this is how your answer sounded to me. Feb 28 '17 at 13:49
  • thx Manuel, this definitely helps!
    – user123551
    Mar 2 '17 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy