% \iffalse meta-comment
%
% Copyright (C) 2010 by Dag Langmyhr
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, see
% http://www.latex-project.org/lppl.txt
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{elbioimp.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{elbioimp}
%<*class>
    [2010/02/08 v1.0 Document class for Journal of Electrical Bioimpedance]
%</class>
%
%<*driver>
\documentclass{elbioimp}
\usepackage[T1]{fontenc}
\usepackage{doc,textcomp,varioref}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\keywords{\LaTeX{} document class, journal document style}

\begin{document}
\DocInput{elbioimp.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% % \CheckSum{222}
%
% \changes{v1.0}{2010/01/20}{Initial version}
%
% \GetFileInfo{elbioimp.dtx}
%
% \DoNotIndex{\,}
% \DoNotIndex{\abstractname,\arabic,\AtBeginDocument,\@author}
% \DoNotIndex{\baselineskip,\begin,\bf}
% \DoNotIndex{\captionsetup,\ClassWarningNoLine,\CurrentOption}
% \DoNotIndex{\DeclareCaptionLabelFormat,\DeclareMathSizes,\DeclareOption,\def}
% \DoNotIndex{\end,\equal}
% \DoNotIndex{\footnote,\footnoterule}
% \DoNotIndex{\ifthenelse,\@ifundefined,\ignorespaces,\it,\itemsep}
% \DoNotIndex{\leftmargin,\leftmargini,\let,\@listi,\@listI,\LoadClass}
% \DoNotIndex{\@makefntext}
% \DoNotIndex{\newcommand,\newenvironment,\noindent,\normalfont}
% \DoNotIndex{\par,\parindent,\parsep,\ProcessOptions}
% \DoNotIndex{\relax,\renewcommand,\renewenvironment,\RequirePackage,\rule}
% \DoNotIndex{\setcounter,\@setfontsize,\setlength,\space,\@startsection}
% \DoNotIndex{\textbf,\textwidth,\@thefnmark,%
%  \thempfootnote,\@title,\topsep,\twocolumn}
% \DoNotIndex{\vspace}
%
% \newcommand{\Cname}{\textsf{elbioimp}}
% \newcommand{\Jname}{\emph{Journal of Electrical Bioimpedance}}
%
% \title{The \Cname{} class\thanks{This document
%   corresponds to \Cname{}~\fileversion,
%   dated \filedate.}}
% \author{Dag Langmyhr\thanks{Department of Informatics,
%   University of Oslo, \textsf{dag@ifi.uio.no}}}
%
% \maketitle
%
% \begin{abstract}
%   \noindent
%   This paper describes the implementation of the document class
%   \Cname{} which is intended for writing articles in the \Jname.
% \end{abstract}
%
% 
% \section{Introduction}
% The \Jname{} (see its web page at
% \url{https://www.journals.uio.no/index.php/bioimpedance}) has
% defined a typographic style for its publication, to some extent
% based on recommendations from the \emph{US National institute of
% health}\cite{NIH}. The \LaTeX{} document class \Cname{} implements
% this style.
%
% This \LaTeX{} code is published with a \textbf{\LaTeX{} project
% public license} as described in
% \url{http://www.latex-project.org/lppl/}. 
%
% As an example, this documentation uses the \Cname{} class.
%
%
% \section{Usage}
% To use this document class, you must first put the
% \url{elbioimp.cls} file somewhere that \LaTeX{} can find
% it.\footnote{If you are not very familiar with your \LaTeX{}
%   installation or your system administrator, you can put the
%   \url{elbioimp.cls} file in the same folder as your \LaTeX{} source
%   files.} 
% Then you can write your \LaTeX{} document starting with
% \begin{verbatim}
%\documentclass{elbioimp}
% \end{verbatim}
% The document class is based on the standard \emph{article} class and
% is used just like that class, with three exceptions:
% \begin{enumerate}
% \item The authors' affiliations are given with the \verb:\thanks:
%   command, as in
%   \begin{verbatim}
%\author{My name\thanks{My univerisity, 
%    My country}}
%   \end{verbatim}
%
% \item The author may indicate any keywords by empoying the
% \verb:\keyword: command.
%
% \item The document class will function poorly unless there is an
% \verb:abstract: environment.
% \end{enumerate}
%
% \StopEventually{\newpage\bibliography{elbioimp}\onecolumn\PrintIndex}
%
%
% \section{Class headers}
% All \LaTeXe{} class files contain a header with a set of standard
% specifications. 
%
% \subsection{Class options}
% The document class has no options.
%    \begin{macrocode}
\DeclareOption*{\ClassWarningNoLine
  {elbioimp}{Class option \CurrentOption
    \space is illegal in this document class}}
\ProcessOptions \relax
%    \end{macrocode}
%
% \subsection{Base class}
% This document class is based on the standard \emph{article} class.
%
%    \begin{macrocode}
\LoadClass[twocolumn]{article}
%    \end{macrocode}
%
% \section{Required packages}
% A couple of standard packages are necessary to implement this class.
%
% \subsection{The \textsf{ifthen} package}
% The \textsf{ifthen} package makes testing easier.
%    \begin{macrocode}
\RequirePackage{ifthen}
%    \end{macrocode}
%
% \subsection{The \textsf{url} package}
% URLs should be typeset in a \textsf{Sans serif font} rather than a
% \texttt{Teletype font}.
%    \begin{macrocode}
\RequirePackage[T1]{url}  
\urlstyle{sf}
%    \end{macrocode}
%
%
% \section{Document title area}
% The title area has its own particular design.
%    \begin{macrocode}
\AtBeginDocument{\renewcommand{\maketitle}{%
  \twocolumn[\begin{minipage}{\textwidth}
    \renewcommand{\and}{, }
    \let \thanks = \footnote
    \renewcommand{\footnoterule}{}
    \def \@makefntext ##1{\noindent
      \small \@thefnmark. \it ##1}
    \renewcommand{\thempfootnote}%
      {\arabic{mpfootnote}}
    \parindent = 0pt
    {\huge \@title}\par\vspace{16pt}
    {\large \@author}
  \end{minipage}\par\vspace{14pt}\noindent
  \elb@rule{\textwidth}\vspace{11pt}]}}
\newcommand{\elb@rule}[1]{\rule{#1}{0.6pt}}
%    \end{macrocode}
%
% \subsection{Keywords}
% An additional command \verb:\keywords: makes it possible to specify
% keywords that apply to the document.
%    \begin{macrocode}
\newcommand{\keywords}[1]{\def\elb@keywords{#1}}
%    \end{macrocode}
%
% \subsection{Abstract}
% The abstract is typeset in \verb:\small:, and includes the keywords (if
% any).
%    \begin{macrocode}
\renewenvironment{abstract}
  {\small\noindent
    \textbf{\abstractname}\par\vspace{1pt}
    \noindent\ignorespaces}
  {\par
   \@ifundefined{elb@keywords}{}{%
     \vspace{\baselineskip}\noindent
     \textbf{Keywords:} \elb@keywords\par}
   \vspace{\baselineskip}\noindent
   \elb@rule{\columnwidth}}
%    \end{macrocode}
%
%
% \section{Body text}
%
% \subsection{Text area}
% The text area should be in two columns and fill an A4 paper with
% margins 1.5\,cm (except the top margin, which should be 2.5\,cm). 
% The gutter space should be 1\,cm.
%    \begin{macrocode}
\RequirePackage[a4paper,
  margin=1.5cm,top=2.5cm]{geometry}
\setlength{\columnsep}{1cm}
%    \end{macrocode}
% Since the layout uses double columns, I will increase the tolerance
% for line-breaking.
%    \begin{macrocode}
\pretolerance = 1000
\tolerance = 2000   \hbadness = \tolerance
%    \end{macrocode}
%
%
% \subsection{Headers and footers}
% This document class has neither headers nor footers, presumably
% because the publisher will add them later.
%    \begin{macrocode}
\AtBeginDocument{\pagestyle{empty}}
%    \end{macrocode}
%
%
% \subsection{Text font}
% The specified journal font is \emph{Times Roman}. The
% \emph{mathptmx} packages is one of several packages that can handle this,
% but this particular package has the advantage that it also uses
% \emph{Times Roman} for the math fonts (as much as possible).
%    \begin{macrocode}
\RequirePackage{mathptmx}
%    \end{macrocode}
% The \emph{mathptmx} package retains the \textsf{Computer Modern Sans
% Serif} and \texttt{Computer Modern Teletype} fonts, but they blend reasonably
% well with \emph{Times Roman} (at least in my opinion) so I will keep
% them. 
%
% \subsection{Text sizes}
% The specified text sizes are shown in Table\vref{tab:sizes}.
% The leading should be 10\%.
% \begin{table}
%   \centering
%   \begin{tabular}{cr}
%     \Huge         \strut\verb:\Huge:&         20\,pt\\
%     \huge         \strut\verb:\huge:&         16\,pt\\
%     \LARGE        \strut\verb:\LARGE:&        14\,pt\\
%     \Large        \strut\verb:\Large:&        12\,pt\\
%     \large        \strut\verb:\large:&        11\,pt\\
%     \normalsize   \strut\verb:\normalsize:&   10\,pt\\
%     \small        \strut\verb:\small:&         9\,pt\\
%     \footnotesize \strut\verb:\footnotesize:&  8\,pt\\
%     \scriptsize   \strut\verb:\scriptsize:&    7\,pt\\
%     \tiny         \strut\verb:\tiny:&          5\,pt\\
%   \end{tabular}
%   \caption{Text sizes in \Cname\label{tab:sizes}}
% \end{table}
%    \begin{macrocode}
\renewcommand{\Huge}{\@setfontsize%
  \Huge {20}{22}}
\renewcommand{\huge}{\@setfontsize
  \huge {16}{17.6}}
\renewcommand{\LARGE}{\@setfontsize
  \LARGE {14}{15.4}}
\renewcommand{\Large}{\@setfontsize
  \Large {12}{13.2}}
\renewcommand{\large}{\@setfontsize
  \large {11}{12.1}}
\renewcommand{\normalsize}{%
   \@setfontsize \normalsize {10}{11}
   \abovedisplayskip =
     10pt plus 2pt minus 5pt
   \abovedisplayshortskip =
     0pt plus 3pt
   \belowdisplayshortskip =
     6pt plus 3pt minus 3pt
   \belowdisplayskip = \abovedisplayskip
   \def\@listi{\leftmargin = \leftmargini
     \topsep = 5pt plus 2pt minus 2pt
     \parsep = 3pt plus 1pt minus 1pt
     \itemsep = \topsep}}
\renewcommand{\small}{%
   \@setfontsize \small {9}{9.9}%
   \abovedisplayskip =
     8.5pt plus 3pt minus 4pt
   \abovedisplayshortskip =
     0pt plus 2pt
   \belowdisplayshortskip = 
     4pt plus 2pt minus 2pt
   \def\@listi{\leftmargin = \leftmargini
     \topsep = 4pt plus 2pt minus 2pt
     \parsep = 2pt plus 1pt minus 1pt
     \itemsep = \topsep}%
   \belowdisplayskip = \abovedisplayskip}
\renewcommand{\footnotesize}{%
   \@setfontsize \footnotesize {8}{8.8}%
   \abovedisplayskip =
     6pt plus 2pt minus 4pt
   \abovedisplayshortskip =
     0pt plus 1pt
   \belowdisplayshortskip =
     3pt plus 1pt minus 2pt
   \def\@listi{\leftmargin = \leftmargini
     \topsep = 3pt plus 1pt minus 1pt
     \parsep = 1.5pt plus 1pt minus 1pt
     \itemsep = \topsep}%
   \belowdisplayskip = \abovedisplayskip}
\renewcommand{\scriptsize}{\@setfontsize
  \scriptsize {7}{7.7}}
\renewcommand{\tiny}{\@setfontsize
  \tiny {5}{5.5}}
%    \end{macrocode}
% As expected, \verb:\normalsize: is the default.
%    \begin{macrocode}
\normalsize
%    \end{macrocode}
% Since the class uses some non-standard sizes (i.e., not in the
% $1{.}2^n$-series) it must signal \LaTeX{} that font
% scaling may be used.\footnote{These days, all decent \LaTeX{} installations
% should provide scalable fonts.}
%    \begin{macrocode}
\RequirePackage{type1cm,type1ec}
%    \end{macrocode}
% The class must also define some math sizes.
%    \begin{macrocode}
\DeclareMathSizes{11}{11}{8}{6}
\DeclareMathSizes{14}{14}{11}{8}
\DeclareMathSizes{16}{16}{12}{10}
\DeclareMathSizes{20}{20}{14}{12}
%    \end{macrocode}
%
%
% \section{Sectioning}
% The section headers in this class have a different look from the
% standard \LaTeX{} classes.
%    \begin{macrocode}
\renewcommand{\section}{\@startsection
  {section}{1}{0pt}%
  {-11pt plus -6pt minus -2pt}%
  {11pt plus 6pt minus 2pt}%
  {\normalfont\normalsize\bf}}
\renewcommand{\subsection}{\@startsection
  {subsection}{2}{0pt}%
  {-11pt plus -6pt minus -2pt}%
  {11pt plus 6pt minus 2pt}%
  {\normalfont\normalsize\it}}
%    \end{macrocode}
% More detailed levels than \verb:\subsection: are not defined for
% this style, so I define them to have the same appearance as
% \verb:\subsection:. 
%    \begin{macrocode}
\renewcommand{\subsubsection}{\@startsection
  {subsubsection}{3}{0pt}%
  {-11pt plus -6pt minus -2pt}%
  {11pt plus 6pt minus 2pt}%
  {\normalfont\normalsize\it}}
\renewcommand{\paragraph}{\@startsection
  {paragraph}{4}{0pt}%
  {-11pt plus -6pt minus -2pt}%
  {11pt plus 6pt minus 2pt}%
  {\normalfont\normalsize\it}}
\renewcommand{\subparagraph}{\@startsection
  {subparagraph}{5}{0pt}%
  {-11pt plus -6pt minus -2pt}%
  {11pt plus 6pt minus 2pt}%
  {\normalfont\normalsize\it}}
%    \end{macrocode}
%
% \subsection{Section numbering}
% No sections should be numbered.
%    \begin{macrocode}
\setcounter{secnumdepth}{-2}
%    \end{macrocode}
%
%
% \section{Floats}
% Formating of float captions is best handled using the
% \textsf{caption} package. This style wants them
% \begin{itemize}
% \item indentend 0.5\,cm on each side
% \item 8\,pt type size
% \item numbering should use ``Fig.~1'' or ``Tab.~1''.
% \end{itemize}
%    \begin{macrocode}
\RequirePackage[margin=0.5cm,font=footnotesize,
  aboveskip=5pt]{caption}
\DeclareCaptionLabelFormat{fig}
  {\ifthenelse{\equal{#1}%
    {Figure}}{Fig}{Tab}.\,#2}
\captionsetup{labelformat=fig}
\setlength{\floatsep}{6pt plus 3pt}
\setlength{\textfloatsep}{\floatsep}
%    \end{macrocode}
%
%
% \section{Document reference list}
% The reference list should be according to the Vancouver style:
%    \begin{macrocode}
\bibliographystyle{vancouver}
%    \end{macrocode}
% but the bibliography should be set in 9\,pt type size with 3\,pt vertical
% space. 
%    \begin{macrocode}
\renewcommand{\@openbib@code}{\small
  \setlength{\itemsep}{3pt}%
  \setlength{\parsep}{1pt plus 1pt}}
%    \end{macrocode}
% In the bibliography, citations will be indicated as ``1.''
% rather than as ``[1]''.
%    \begin{macrocode}
\renewcommand\@biblabel[1]{#1.}
%    \end{macrocode}
%
% \Finale
\endinput