Using Morsecode with LaTeX This is a short example how to use Morsecode within LaTeX documents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
11 KiB

\documentclass[11pt,a4paper,twoside,parskip=full-]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{subfig}
\usepackage{texlogos}
\usepackage{floatflt,epsfig}
\usepackage{float}
\usepackage{listings}
\usepackage{MnSymbol}
\usepackage{textcomp}
\usepackage{pslatex}
\usepackage{makeidx}
\usepackage[outdir=./]{epstopdf}
\usepackage{tabu}
\usepackage{relsize}
\usepackage[top=2cm, bottom=2cm, outer=1cm, inner=2.1cm, headsep=14pt]{geometry}
%% PDF Meta Information und Links
\usepackage[
colorlinks=true,urlcolor=blue,linkcolor=black,
pdftitle={QRP Logger},
pdfsubject={Using Morsecode in LaTeX documents},
pdfauthor={Thomas 'Tom' Malkus, DL7BJ},
pdfkeywords={Software, Linux, Windows, Amateur Radio},
pdfcreator={TeX Maker 4.5 (Linux)},
pdfproducer={LaTeX}]
{hyperref}
%% Basics
\author{Tom, DL7BJ}
\definecolor{lightgray}{rgb}{0.50,0.50,0.50}
\renewcommand{\rmdefault}{ppl} % Palatino
\makeindex
\addcontentsline{toc}{section}{Index}
\renewcommand{\indexname}{Index}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\lstset{numbers=left, numberstyle=\tiny, numbersep=5pt}
\lstset{basicstyle=\ttfamily} % fixed-width font
\lstset{tabsize=2}
%% \lstset{gobble=4} % remove 4 leading characters (should be the indentation tab)
\lstset{frame=tb} % lines above and below
\lstset{rulecolor=\color{lightgray}} % colored in a slightly darker gray
\lstset{keywordstyle=} % keywords are not bold
%% \lstset{emphstyle=\itshape\color{green!30!black}} % emphasize style: italic, dark green
\lstset{prebreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\rhookswarrow}}} % requires \usepackage{MnSymbol}
\lstset{postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}} % requires
\lstset{framexleftmargin=5pt}
\lstset{xleftmargin=10pt}
\lstset{breaklines=true, breakatwhitespace=true}
\lstset{numberstyle=\scriptsize}
\lstset{language=[LaTeX]TeX} % by default listings are LaTeX code
\lstset{texcsstyle=*\lst@keywordstyle} % emphasize backslash as part of the command but keep style as defined in \lstset{keywordstyle=...}
\lstset{moretexcs={lstset, rhookswarrow, rcurvearrowse, Righttorque, Lefttorque}} % add LaTeX commands which listings doesn't know
\lstset{emph={prebreak, postbreak, breaklines, breakatwhitespace, numbers, numberstyle, breakindent}} % emphasize parameters of listings package
\lstset{commentstyle=\color{mygreen}}
\lstset{language=bash}
\lstset{showstringspaces=true}
\lstset{stringstyle=\color{mymauve}}
\DeclareRobustCommand{\cpp}{\hbox{C\hspace{-0.5ex}
\protect\raisebox{0.5ex}
{\protect\scalebox{0.67}{++}}}\hspace{4pt}}
%%
%% Only copy this part to your own file and add \usepackage{listings}
%%
%% Morsecode with package listings
%%
%% All commands begin with a 'M' for morse
%% Settings for lengths of chars
%%
\newcommand{\Mdotlength}{3pt} % length of a dot
\newcommand{\Mdahlength}{9pt} % length of a dash
\newcommand{\Mcharseplength}{9pt} % length between two chars
\newcommand{\Mwordseplength}{21pt} % length between two words
\newcommand{\Mdiditlength}{6pt} % length of dit-dit
\newcommand{\Mbold}{1.5pt} % bold
\newcommand{\Mcharsep}{\hspace{9pt}}
\newcommand{\Mwordsep}{\hspace{21pt}}
\newcommand{\dit}{\raisebox{0.5ex}{$\rule{\Mdotlength}{\Mbold}\hspace{\Mdotlength}$}}
\newcommand{\dah}{\raisebox{0.5ex}{$\rule{\Mdahlength}{\Mbold}\hspace{\Mdotlength}$}}
% Chars A-Z
\newcommand{\MAlpha}{\dit\dah \Mcharsep}
\newcommand{\MBravo}{\dah\dit\dit\dit \Mcharsep}
\newcommand{\MCharly}{\dah\dit\dah\dit \Mcharsep}
\newcommand{\MDelta}{\dah\dit\dit \Mcharsep}
\newcommand{\MEcho}{\dit \Mcharsep}
\newcommand{\MFoxtrott}{\dit\dit\dah\dit \Mcharsep}
\newcommand{\MGolf}{\dah\dah\dit \Mcharsep}
\newcommand{\MHotel}{\dit\dit\dit\dit \Mcharsep}
\newcommand{\MIndia}{\dit\dit \Mcharsep}
\newcommand{\MJuliett}{\dit\dah\dah\dah \Mcharsep}
\newcommand{\MKilo}{\dah\dit\dah \Mcharsep}
\newcommand{\MLima}{\dit\dah\dit\dit \Mcharsep}
\newcommand{\MMike}{\dah\dah \Mcharsep}
\newcommand{\MNovember}{\dah\dit \Mcharsep}
\newcommand{\MOscar}{\dah\dah\dah \Mcharsep}
\newcommand{\MPapa}{\dit\dah\dah\dit \Mcharsep}
\newcommand{\MQuebec}{\dah\dah\dit\dah \Mcharsep}
\newcommand{\MRomeo}{\dit\dah\dit \Mcharsep}
\newcommand{\MSierra}{\dit\dit\dit \Mcharsep}
\newcommand{\MTango}{\dah \Mcharsep}
\newcommand{\MUniform}{\dit\dit\dah \Mcharsep}
\newcommand{\MVictor}{\dit\dit\dit\dah \Mcharsep}
\newcommand{\MWhisky}{\dit\dah\dah \Mcharsep}
\newcommand{\MXray}{\dah\dit\dit\dah \Mcharsep}
\newcommand{\MYankee}{\dah\dit\dah\dah \Mcharsep}
\newcommand{\MZulu}{\dah\dah\dit\dit \Mcharsep}
% German Umlauts and continental code
\newcommand{\Muuml}{\dit\dit\dah\dah \Mcharsep} % German Ü
\newcommand{\Mauml}{\dit\dah\dit\dah \Mcharsep} % German Ä
\newcommand{\Mouml}{\dah\dah\dah\dit \Mcharsep} % German Ö
\newcommand{\Mchuml}{\dah\dah\dah\dah \Mcharsep} % German CH
% Special chars
\newcommand{\MDot}{\dit\dah\dit\dah\dit\dah \Mcharsep} % .
\newcommand{\MComma}{\dah\dah\dit\dit\dah\dah \Mcharsep} % ,
\newcommand{\MQuestionmark}{\dit\dit\dah\dah\dit\dit \Mcharsep} % ?
\newcommand{\MSlash}{\dah\dit\dit\dah\dit \Mcharsep} % /
\newcommand{\MHyphen}{\dah\dit\dit\dit\dit\dah \Mcharsep} % -
\newcommand{\MDoubleHyphen}{\dah\dit\dit\dit\dah \Mcharsep} % =
\newcommand{\MPlus}{\dit\dah\dit\dah\dit \Mcharsep} % +
\newcommand{\Mat}{\dit\dah\dah\dit\dah\dit} % @
% Prosigns
\newcommand{\MLerror}{\dit\dit\hspace{\Mdiditlength}\dit\dit \Mcharsep} % Lazy error
\newcommand{\MError}{\dit\dit\dit\dit\dit\dit\dit\dit \Mcharsep} % Error
\newcommand{\MWait}{\dit\dah\dit\dit\dit \Mcharsep} % Got a beer!
\newcommand{\Maa}{\dit\dah\hspace{\Mdiditlength}\dit\dah \Mcharsep} % AA
\newcommand{\Mar}{\dit\dah\hspace{\Mdiditlength}\dit\dah\dit \Mcharsep} % AR
\newcommand{\Mas}{\dit\dah\hspace{\Mdiditlength}\dit\dit\dit \Mcharsep} % AS
\newcommand{\Mbt}{\dah\dit\dit\hspace{\Mdiditlength}\dah \Mcharsep} % BT
\newcommand{\Mct}{\dah\dit\dah\dah\hspace{\Mdiditlength}\dah \Mcharsep} % CT
\newcommand{\Mkn}{\dah\dit\dah\hspace{\Mdiditlength}\dah\dit \Mcharsep} % KN
\newcommand{\Msk}{\dit\dit\dit\hspace{\Mdiditlength}\dah\dit\dah \Mcharsep} % SK
\newcommand{\Msn}{\dit\dit\dit\hspace{\Mdiditlength}\dah\dit \Mcharsep} % SN
% Numbers
\newcommand{\MOne}{\dit\dah\dah\dah\dah \Mcharsep}
\newcommand{\MTwo}{\dit\dit\dah\dah\dah \Mcharsep}
\newcommand{\MThree}{\dit\dit\dit\dah\dah \Mcharsep}
\newcommand{\MFour}{\dit\dit\dit\dit\dah \Mcharsep}
\newcommand{\MFive}{\dit\dit\dit\dit\dit \Mcharsep}
\newcommand{\MSix}{\dah\dit\dit\dit\dit \Mcharsep}
\newcommand{\MSeven}{\dah\dah\dit\dit\dit \Mcharsep}
\newcommand{\MEight}{\dah\dah\dah\dit\dit \Mcharsep}
\newcommand{\MNine}{\dah\dah\dah\dah\dit \Mcharsep}
\newcommand{\MZero}{\dah\dah\dah\dah\dah \Mcharsep}
% Prosigns as text with line above chars
\newcommand{\MAA}{$\overline{AA}$}
\newcommand{\MAR}{$\overline{AR}$}
\newcommand{\MAS}{$\overline{AS}$}
\newcommand{\MBT}{$\overline{BT}$}
\newcommand{\MCT}{$\overline{CT}$}
\newcommand{\MKN}{$\overline{KN}$}
\newcommand{\MSK}{$\overline{SK}$}
\newcommand{\MSN}{$\overline{SN}$}
\lstset{%
literate={a}{\MAlpha}1
{b}{\MBravo}1
{c}{\MCharly}1
{d}{\MDelta}1
{e}{\MEcho}1
{f}{\MFoxtrott}1
{g}{\MGolf}1
{h}{\MHotel}1
{i}{\MIndia}1
{j}{\MJuliett}1
{k}{\MKilo}1
{l}{\MLima}1
{m}{\MMike}1
{n}{\MNiklas}1
{o}{\MNovember}1
{p}{\MPapa}1
{q}{\MQuebec}1
{r}{\MRomeo}1
{s}{\MSierra}1
{t}{\MTango}1
{u}{\MUniform}1
{v}{\MVictor}1
{w}{\MWhisky}1
{x}{\MXrax}1
{y}{\MYankee}1
{z}{\MZulu}1
{\ }{\Mwordsep}1
{.}{\MDot}1
{,}{\MComma}1
{?}{\MQuestionmark}1
{/}{\MSlash}1
{-}{\MHyphen}1
{=}{\MDoubleHyphen}1
{+}{\MPlus}1
{@}{\Mat}1
{0}{\MNull}1
{1}{\MOne}1
{2}{\MTwo}1
{3}{\MThree}1
{4}{\MFour}1
{5}{\MFive}1
{6}{\MSix}1
{7}{\MSeven}1
{8}{\MEight}1
{9}{\MNine}1
}
\newcommand{\morse}[1]{\lstinline{#1}}
% Stop here with copy
\begin{document}
\fontfamily{ppl}
%\titleformat{\paragraph}[hang]{\normalfont\bfseries}{}{0pt}{}
\begin{titlepage}
\raggedright
\begin{figure}[h]
\centering
\hfill %
\subfloat{\includegraphics[scale=0.4]{/home/tom/Office/LaTeX/Images/dl7bj.eps}}
\hfill %
\subfloat{\includegraphics[scale=0.7]{/home/tom/Office/LaTeX/Images/dl7bj-logo.eps}}
\hfill %
\end{figure}
\vspace*{1cm}
\huge
Using Morsecode with LaTeX\\
\large
Documentation\\
\vspace*{1cm}
\frqq How to use the texlive-science package to use Morsecode within documents\flqq \\
%% \includegraphics[scale=0.6]{<irgendeine Grafik>}
\small
Version 1.00 \today \\
Tom, DL7BJ, tom@dl7bj.de, \url{https://isnix.de}
\vspace{2cm}
\normalsize
\end{titlepage}
\tableofcontents
\chapter*{Preface}
\begin{large}
\end{large}
\textsl{This document exists only in English. Sorry for wrong grammars, but I am not a native speaker. I hope you understand most of my text, corrections are very welcome. You can find the LaTeX sources of this text in my GitHub repository\footnote{\url{https://github.com/DL7BJ/LaTex-Morsecode}} . Feel free to make changes and send them to me, preffered with E-Mail.}
\vspace{0.5cm}
73, Tom\\
\morse{dl7bj}\\
\newpage
\chapter{Using Morsecode with package listings}
\section{Known characters}
You need only the marked block out of the source for this LaTeX file. I use TeXMaker with Linux, it could be, that you have todo some changes if you use another OS.
This is a table of all know characters:
\begin{tabular}{|l|ll|l|ll|l|}
A & Alpha & \MAlpha & 0 & Zero & \MZero \\
B & Bravo & \MBravo & 1 & One & \MOne \\
C & Charly & \MCharly & 2 & Two & \MTwo \\
D & Delta & \MDelta & 3 & Three & \MThree \\
E & Echo & \MEcho & 4 & Four & \MFour \\
F & Foxtrott & \MFoxtrott & 5 & Five & \MFive \\
G & Golf & \MGolf & 6 & Six & \MSix \\
H & Hotel & \MHotel & 7 & Seven & \MSeven \\
I & India & \MIndia & 8 & Eight & \MEight \\
J & Juliett & \MJuliett & 9 & Nine & \MNine \\
K & Kilo & \MKilo & . & Dot & \MDot \\
L & Lima & \MLima & , & Comma & \MComma \\
M & Mike & \MMike & ? & Questionmark & \MQuestionmark \\
N & November & \MNovember & / & Slash & \MSlash \\
O & Oscar & \MOscar & - & Hyphen & \MHyphen \\
P & Papa & \MPapa & = & DoubleHyphen & \MDoubleHyphen \\
Q & Quebec & \MQuebec & + & Plus & \MPlus \\
R & Romeo & \MRomeo & @ & at & \Mat \\
S & Sierra & \MSierra & .. & Lazy error & \MLerror \\
T & Tango & \MTango & .. & Error & \MError \\
U & Uniform & \MUniform & & Got a beer! & \MWait \\
V & Victor & \MVictor & & & \\
W & Whisky & \MWhisky & & & \\
X & X-Ray & \MXray & & & \\
Y & Yankee & \MYankee & & & \\
Z & Zulu & \MZulu & & & \\
\MAA & & \Maa & & & \\
\MAR & & \Mar & & & \\
\MAS & & \Mas & & & \\
\MBT & & \Mbt & & & \\
\MCT & & \Mct & & & \\
\MKN & & \Mkn & & & \\
\MSK & & \Msk & & & \\
\MSN & & \Msn & & & \\
\end{tabular}
\section{Example}
\printindex
\listoffigures
\listoftables
\end{document}