\documentclass[a4paper,12pt]{article}
\usepackage{scalebar}
\usepackage{tabularx}
\usepackage{moreverb}
\begin{document}
\thispagestyle{empty}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0.4\baselineskip}

{\huge \centering Examples for the \texttt{scalebars} Package

}
\vspace{2\baselineskip}

{\raggedleft Michael Lake\\
\small http://www.speleonics.com.au/mikes/\\
\makeatletter mikeL@speleonics.com.au \makeatother

}
\vspace{2\baselineskip}

Usage:\\
\verb+\scalebar[inverse]{length}{minordivs}{majordivs}+\\
\verb+                  {starting No.}{ending No.}{units}+

where:\\
\begin{tabularx}{\textwidth}{lX}
\texttt{length}    &the desired length of the scalebar e.g.\ 10cm or 4in\\
\texttt{minordivs} &number of minor divisions within the first major
           division e.g.\ 4 (the first major division will always be
           subdivided unless this value is set to 1)\\
\texttt{majordivs} &number of major divisions e.g.\ 5 \\
\texttt{starting No.}&the number that the scalebar text will start from 
                      e.g.\ 0 or -0.5\\
\texttt{ending No.}&the number that the scalebar text will end with 
                    e.g.\ 2.5 or 25\\
\texttt{units}&the units for the scalebar text e.g.\ $\mu$m or km
\end{tabularx}


\section*{Examples}


\verb+\scalebar{10cm}{4}{5}{0}{10}{m}+\\
      \scalebar{10cm}{4}{5}{0}{10}{m}
\vspace{\baselineskip}


This is how to indent a scalebar:\\
\verb+\hspace*{2cm}\scalebar{10cm}{4}{5}{0}{10}{m}+\\
      \hspace*{2cm}\scalebar{10cm}{4}{5}{0}{10}{m}
\vspace{\baselineskip}


Change the length of the scalebar:\\
\verb+\scalebar{12cm}{4}{5}{0}{10}{m}+\\
      \scalebar{12cm}{4}{5}{0}{10}{m}

\newpage

In the following three examples notice how I have scaled the total 
length of the scalebar by roughly the same scale as the font change 
to maintain a nice aspect ratio.

Make a larger scalebar:\\
I have scaled the length of the scalebar up (10cm to 12cm) by the same 
scale as the font change (\verb+\normal+ to \verb+\large+) to maintain 
a nice ratio of the length to its height.\\
\verb+\large\scalebar{12cm}{4}{5}{0}{10}{m}\normalsize+\\
      \large\scalebar{12cm}{4}{5}{0}{10}{m}\normalsize
\vspace{\baselineskip}


Make a smaller scalebar:\\
Here I scale down the length by an amount similar to the font change.\\
\verb+\small\scalebar{8cm}{4}{5}{0}{10}{m}\normalsize+\\
      \small\scalebar{8cm}{4}{5}{0}{10}{m}\normalsize
\vspace{\baselineskip}


Make a tiny scalebar:\\
Here I have to really reduce the length so I don't get a long, skinny and 
ugly looking scalebar.\\
\verb+\tiny\scalebar{4cm}{4}{5}{0}{10}{m}\normalsize+\\
      \tiny\scalebar{4cm}{4}{5}{0}{10}{m}\normalsize
\vspace{\baselineskip}


Change the number of minor and major divisions in the scalebar:\\
\verb+\scalebar{10cm}{3}{4}{0}{10}{m}+\\
      \scalebar{10cm}{3}{4}{0}{12}{m}
\vspace{\baselineskip}


Change the starting and ending numbers:\\
\verb+\scalebar{10cm}{4}{5}{-2}{8}{m}+\\
      \scalebar{10cm}{4}{5}{-2}{8}{m} 
\vspace{\baselineskip}

Change the units of the scalebar:\\
\verb+\scalebar{10cm}{4}{5}{0}{10}{$\mu$m}+\\
      \scalebar{10cm}{4}{5}{0}{10}{$\mu$m}
\vspace{\baselineskip}

\newpage
Use fractional values for starting and ending numbers:\\
\verb+\scalebar{10cm}{4}{6}{-0.5}{2.5}{m}+\\
      \scalebar{10cm}{4}{6}{-0.5}{2.5}{m} 
\vspace{\baselineskip}


Supress the minor divisions:\\
\verb+\scalebar{10cm}{1}{5}{0}{10}{m}+\\
      \scalebar{10cm}{1}{5}{0}{10}{m} 
\vspace{\baselineskip}


Invert the black/white bars:\\
\verb+\scalebar[inverse]{10cm}{4}{5}{0}{10}{m}+\\
      \scalebar[inverse]{10cm}{4}{5}{0}{10}{m} 
\vspace{\baselineskip}


Position a scalebar within a picture environment:
\begin{verbatim}
\setlength{\unitlength}{1mm}
\fbox{\begin{picture}(120,50)% create picture 120mm x 50mm
\put(2,11){Scale 1:200}
\put(2,7){\small\scalebar{5cm}{2}{5}{0}{10}{m}}
\end{picture}}
\end{verbatim}
\setlength{\unitlength}{1mm}
\fbox{\begin{picture}(120,50)% create picture 120mm x 50mm
\put(2,11){Scale 1:200}
\put(2,7){\small\scalebar{5cm}{2}{5}{0}{10}{m}}
\end{picture}}

\newpage
\section*{Problems}

If the length of the scalebar is longer than the page width it will break:\\
(the page width here is: \the\textwidth)\\
\verb+\scalebar{15cm}{4}{5}{0}{10}{m}+\\
\scalebar{15cm}{4}{5}{0}{10}{m}
\vspace{\baselineskip}

Several mathematical operations are performed and silly use of zero in 
some parameters will result in a mathematical error. Consult the package 
documentation for what is happening. 

Also these math calculations do seem to take 
\TeX\ quite a while to perform -- perhaps there is a way to do 
these calculations faster.

If you discover any serious problems please let me know.


\vfill

Michael Lake\\ 
\today

\end{document}