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

7 months ago
  1. \documentclass[11pt,a4paper,twoside,parskip=full-]{scrbook}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[english]{babel}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage{color}
  6. \usepackage{graphicx}
  7. \usepackage{longtable}
  8. \usepackage{subfig}
  9. \usepackage{texlogos}
  10. \usepackage{floatflt,epsfig}
  11. \usepackage{float}
  12. \usepackage{listings}
  13. \usepackage{MnSymbol}
  14. \usepackage{textcomp}
  15. \usepackage{pslatex}
  16. \usepackage{makeidx}
  17. \usepackage[outdir=./]{epstopdf}
  18. \usepackage{tabu}
  19. \usepackage{relsize}
  20. \usepackage[top=2cm, bottom=2cm, outer=1cm, inner=2.1cm, headsep=14pt]{geometry}
  21. %% PDF Meta Information und Links
  22. \usepackage[
  23. colorlinks=true,urlcolor=blue,linkcolor=black,
  24. pdftitle={QRP Logger},
  25. pdfsubject={Using Morsecode in LaTeX documents},
  26. pdfauthor={Thomas 'Tom' Malkus, DL7BJ},
  27. pdfkeywords={Software, Linux, Windows, Amateur Radio},
  28. pdfcreator={TeX Maker 4.5 (Linux)},
  29. pdfproducer={LaTeX}]
  30. {hyperref}
  31. %% Basics
  32. \author{Tom, DL7BJ}
  33. \definecolor{lightgray}{rgb}{0.50,0.50,0.50}
  34. \renewcommand{\rmdefault}{ppl} % Palatino
  35. \makeindex
  36. \addcontentsline{toc}{section}{Index}
  37. \renewcommand{\indexname}{Index}
  38. \definecolor{mygreen}{rgb}{0,0.6,0}
  39. \definecolor{mygray}{rgb}{0.5,0.5,0.5}
  40. \definecolor{mymauve}{rgb}{0.58,0,0.82}
  41. \lstset{numbers=left, numberstyle=\tiny, numbersep=5pt}
  42. \lstset{basicstyle=\ttfamily} % fixed-width font
  43. \lstset{tabsize=2}
  44. %% \lstset{gobble=4} % remove 4 leading characters (should be the indentation tab)
  45. \lstset{frame=tb} % lines above and below
  46. \lstset{rulecolor=\color{lightgray}} % colored in a slightly darker gray
  47. \lstset{keywordstyle=} % keywords are not bold
  48. %% \lstset{emphstyle=\itshape\color{green!30!black}} % emphasize style: italic, dark green
  49. \lstset{prebreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\rhookswarrow}}} % requires \usepackage{MnSymbol}
  50. \lstset{postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}} % requires
  51. \lstset{framexleftmargin=5pt}
  52. \lstset{xleftmargin=10pt}
  53. \lstset{breaklines=true, breakatwhitespace=true}
  54. \lstset{numberstyle=\scriptsize}
  55. \lstset{language=[LaTeX]TeX} % by default listings are LaTeX code
  56. \lstset{texcsstyle=*\lst@keywordstyle} % emphasize backslash as part of the command but keep style as defined in \lstset{keywordstyle=...}
  57. \lstset{moretexcs={lstset, rhookswarrow, rcurvearrowse, Righttorque, Lefttorque}} % add LaTeX commands which listings doesn't know
  58. \lstset{emph={prebreak, postbreak, breaklines, breakatwhitespace, numbers, numberstyle, breakindent}} % emphasize parameters of listings package
  59. \lstset{commentstyle=\color{mygreen}}
  60. \lstset{language=bash}
  61. \lstset{showstringspaces=true}
  62. \lstset{stringstyle=\color{mymauve}}
  63. \DeclareRobustCommand{\cpp}{\hbox{C\hspace{-0.5ex}
  64. \protect\raisebox{0.5ex}
  65. {\protect\scalebox{0.67}{++}}}\hspace{4pt}}
  66. %%
  67. %% Only copy this part to your own file and add \usepackage{listings}
  68. %%
  69. %% Morsecode with package listings
  70. %%
  71. %% All commands begin with a 'M' for morse
  72. %% Settings for lengths of chars
  73. %%
  74. \newcommand{\Mdotlength}{3pt} % length of a dot
  75. \newcommand{\Mdahlength}{9pt} % length of a dash
  76. \newcommand{\Mcharseplength}{9pt} % length between two chars
  77. \newcommand{\Mwordseplength}{21pt} % length between two words
  78. \newcommand{\Mdiditlength}{6pt} % length of dit-dit
  79. \newcommand{\Mbold}{1.5pt} % bold
  80. \newcommand{\Mcharsep}{\hspace{9pt}}
  81. \newcommand{\Mwordsep}{\hspace{21pt}}
  82. \newcommand{\dit}{\raisebox{0.5ex}{$\rule{\Mdotlength}{\Mbold}\hspace{\Mdotlength}$}}
  83. \newcommand{\dah}{\raisebox{0.5ex}{$\rule{\Mdahlength}{\Mbold}\hspace{\Mdotlength}$}}
  84. % Chars A-Z
  85. \newcommand{\MAlpha}{\dit\dah \Mcharsep}
  86. \newcommand{\MBravo}{\dah\dit\dit\dit \Mcharsep}
  87. \newcommand{\MCharly}{\dah\dit\dah\dit \Mcharsep}
  88. \newcommand{\MDelta}{\dah\dit\dit \Mcharsep}
  89. \newcommand{\MEcho}{\dit \Mcharsep}
  90. \newcommand{\MFoxtrott}{\dit\dit\dah\dit \Mcharsep}
  91. \newcommand{\MGolf}{\dah\dah\dit \Mcharsep}
  92. \newcommand{\MHotel}{\dit\dit\dit\dit \Mcharsep}
  93. \newcommand{\MIndia}{\dit\dit \Mcharsep}
  94. \newcommand{\MJuliett}{\dit\dah\dah\dah \Mcharsep}
  95. \newcommand{\MKilo}{\dah\dit\dah \Mcharsep}
  96. \newcommand{\MLima}{\dit\dah\dit\dit \Mcharsep}
  97. \newcommand{\MMike}{\dah\dah \Mcharsep}
  98. \newcommand{\MNovember}{\dah\dit \Mcharsep}
  99. \newcommand{\MOscar}{\dah\dah\dah \Mcharsep}
  100. \newcommand{\MPapa}{\dit\dah\dah\dit \Mcharsep}
  101. \newcommand{\MQuebec}{\dah\dah\dit\dah \Mcharsep}
  102. \newcommand{\MRomeo}{\dit\dah\dit \Mcharsep}
  103. \newcommand{\MSierra}{\dit\dit\dit \Mcharsep}
  104. \newcommand{\MTango}{\dah \Mcharsep}
  105. \newcommand{\MUniform}{\dit\dit\dah \Mcharsep}
  106. \newcommand{\MVictor}{\dit\dit\dit\dah \Mcharsep}
  107. \newcommand{\MWhisky}{\dit\dah\dah \Mcharsep}
  108. \newcommand{\MXray}{\dah\dit\dit\dah \Mcharsep}
  109. \newcommand{\MYankee}{\dah\dit\dah\dah \Mcharsep}
  110. \newcommand{\MZulu}{\dah\dah\dit\dit \Mcharsep}
  111. % German Umlauts and continental code
  112. \newcommand{\Muuml}{\dit\dit\dah\dah \Mcharsep} % German Ü
  113. \newcommand{\Mauml}{\dit\dah\dit\dah \Mcharsep} % German Ä
  114. \newcommand{\Mouml}{\dah\dah\dah\dit \Mcharsep} % German Ö
  115. \newcommand{\Mchuml}{\dah\dah\dah\dah \Mcharsep} % German CH
  116. % Special chars
  117. \newcommand{\MDot}{\dit\dah\dit\dah\dit\dah \Mcharsep} % .
  118. \newcommand{\MComma}{\dah\dah\dit\dit\dah\dah \Mcharsep} % ,
  119. \newcommand{\MQuestionmark}{\dit\dit\dah\dah\dit\dit \Mcharsep} % ?
  120. \newcommand{\MSlash}{\dah\dit\dit\dah\dit \Mcharsep} % /
  121. \newcommand{\MHyphen}{\dah\dit\dit\dit\dit\dah \Mcharsep} % -
  122. \newcommand{\MDoubleHyphen}{\dah\dit\dit\dit\dah \Mcharsep} % =
  123. \newcommand{\MPlus}{\dit\dah\dit\dah\dit \Mcharsep} % +
  124. \newcommand{\Mat}{\dit\dah\dah\dit\dah\dit} % @
  125. % Prosigns
  126. \newcommand{\MLerror}{\dit\dit\hspace{\Mdiditlength}\dit\dit \Mcharsep} % Lazy error
  127. \newcommand{\MError}{\dit\dit\dit\dit\dit\dit\dit\dit \Mcharsep} % Error
  128. \newcommand{\MWait}{\dit\dah\dit\dit\dit \Mcharsep} % Got a beer!
  129. \newcommand{\Maa}{\dit\dah\hspace{\Mdiditlength}\dit\dah \Mcharsep} % AA
  130. \newcommand{\Mar}{\dit\dah\hspace{\Mdiditlength}\dit\dah\dit \Mcharsep} % AR
  131. \newcommand{\Mas}{\dit\dah\hspace{\Mdiditlength}\dit\dit\dit \Mcharsep} % AS
  132. \newcommand{\Mbt}{\dah\dit\dit\hspace{\Mdiditlength}\dah \Mcharsep} % BT
  133. \newcommand{\Mct}{\dah\dit\dah\dah\hspace{\Mdiditlength}\dah \Mcharsep} % CT
  134. \newcommand{\Mkn}{\dah\dit\dah\hspace{\Mdiditlength}\dah\dit \Mcharsep} % KN
  135. \newcommand{\Msk}{\dit\dit\dit\hspace{\Mdiditlength}\dah\dit\dah \Mcharsep} % SK
  136. \newcommand{\Msn}{\dit\dit\dit\hspace{\Mdiditlength}\dah\dit \Mcharsep} % SN
  137. % Numbers
  138. \newcommand{\MOne}{\dit\dah\dah\dah\dah \Mcharsep}
  139. \newcommand{\MTwo}{\dit\dit\dah\dah\dah \Mcharsep}
  140. \newcommand{\MThree}{\dit\dit\dit\dah\dah \Mcharsep}
  141. \newcommand{\MFour}{\dit\dit\dit\dit\dah \Mcharsep}
  142. \newcommand{\MFive}{\dit\dit\dit\dit\dit \Mcharsep}
  143. \newcommand{\MSix}{\dah\dit\dit\dit\dit \Mcharsep}
  144. \newcommand{\MSeven}{\dah\dah\dit\dit\dit \Mcharsep}
  145. \newcommand{\MEight}{\dah\dah\dah\dit\dit \Mcharsep}
  146. \newcommand{\MNine}{\dah\dah\dah\dah\dit \Mcharsep}
  147. \newcommand{\MZero}{\dah\dah\dah\dah\dah \Mcharsep}
  148. % Prosigns as text with line above chars
  149. \newcommand{\MAA}{$\overline{AA}$}
  150. \newcommand{\MAR}{$\overline{AR}$}
  151. \newcommand{\MAS}{$\overline{AS}$}
  152. \newcommand{\MBT}{$\overline{BT}$}
  153. \newcommand{\MCT}{$\overline{CT}$}
  154. \newcommand{\MKN}{$\overline{KN}$}
  155. \newcommand{\MSK}{$\overline{SK}$}
  156. \newcommand{\MSN}{$\overline{SN}$}
  157. \lstset{%
  158. literate={a}{\MAlpha}1
  159. {b}{\MBravo}1
  160. {c}{\MCharly}1
  161. {d}{\MDelta}1
  162. {e}{\MEcho}1
  163. {f}{\MFoxtrott}1
  164. {g}{\MGolf}1
  165. {h}{\MHotel}1
  166. {i}{\MIndia}1
  167. {j}{\MJuliett}1
  168. {k}{\MKilo}1
  169. {l}{\MLima}1
  170. {m}{\MMike}1
  171. {n}{\MNiklas}1
  172. {o}{\MNovember}1
  173. {p}{\MPapa}1
  174. {q}{\MQuebec}1
  175. {r}{\MRomeo}1
  176. {s}{\MSierra}1
  177. {t}{\MTango}1
  178. {u}{\MUniform}1
  179. {v}{\MVictor}1
  180. {w}{\MWhisky}1
  181. {x}{\MXrax}1
  182. {y}{\MYankee}1
  183. {z}{\MZulu}1
  184. {\ }{\Mwordsep}1
  185. {.}{\MDot}1
  186. {,}{\MComma}1
  187. {?}{\MQuestionmark}1
  188. {/}{\MSlash}1
  189. {-}{\MHyphen}1
  190. {=}{\MDoubleHyphen}1
  191. {+}{\MPlus}1
  192. {@}{\Mat}1
  193. {0}{\MNull}1
  194. {1}{\MOne}1
  195. {2}{\MTwo}1
  196. {3}{\MThree}1
  197. {4}{\MFour}1
  198. {5}{\MFive}1
  199. {6}{\MSix}1
  200. {7}{\MSeven}1
  201. {8}{\MEight}1
  202. {9}{\MNine}1
  203. }
  204. \newcommand{\morse}[1]{\lstinline{#1}}
  205. % Stop here with copy
  206. \begin{document}
  207. \fontfamily{ppl}
  208. %\titleformat{\paragraph}[hang]{\normalfont\bfseries}{}{0pt}{}
  209. \begin{titlepage}
  210. \raggedright
  211. \begin{figure}[h]
  212. \centering
  213. \hfill %
  214. \subfloat{\includegraphics[scale=0.4]{/home/tom/Office/LaTeX/Images/dl7bj.eps}}
  215. \hfill %
  216. \subfloat{\includegraphics[scale=0.7]{/home/tom/Office/LaTeX/Images/dl7bj-logo.eps}}
  217. \hfill %
  218. \end{figure}
  219. \vspace*{1cm}
  220. \huge
  221. Using Morsecode with LaTeX\\
  222. \large
  223. Documentation\\
  224. \vspace*{1cm}
  225. \frqq How to use the texlive-science package to use Morsecode within documents\flqq \\
  226. %% \includegraphics[scale=0.6]{<irgendeine Grafik>}
  227. \small
  228. Version 1.00 \today \\
  229. Tom, DL7BJ, tom@dl7bj.de, \url{https://isnix.de}
  230. \vspace{2cm}
  231. \normalsize
  232. \end{titlepage}
  233. \tableofcontents
  234. \chapter*{Preface}
  235. \begin{large}
  236. \end{large}
  237. \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.}
  238. \vspace{0.5cm}
  239. 73, Tom\\
  240. \morse{dl7bj}\\
  241. \newpage
  242. \chapter{Using Morsecode with package listings}
  243. \section{Known characters}
  244. 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.
  245. This is a table of all know characters:
  246. \begin{tabular}{|l|ll|l|ll|l|}
  247. A & Alpha & \MAlpha & 0 & Zero & \MZero \\
  248. B & Bravo & \MBravo & 1 & One & \MOne \\
  249. C & Charly & \MCharly & 2 & Two & \MTwo \\
  250. D & Delta & \MDelta & 3 & Three & \MThree \\
  251. E & Echo & \MEcho & 4 & Four & \MFour \\
  252. F & Foxtrott & \MFoxtrott & 5 & Five & \MFive \\
  253. G & Golf & \MGolf & 6 & Six & \MSix \\
  254. H & Hotel & \MHotel & 7 & Seven & \MSeven \\
  255. I & India & \MIndia & 8 & Eight & \MEight \\
  256. J & Juliett & \MJuliett & 9 & Nine & \MNine \\
  257. K & Kilo & \MKilo & . & Dot & \MDot \\
  258. L & Lima & \MLima & , & Comma & \MComma \\
  259. M & Mike & \MMike & ? & Questionmark & \MQuestionmark \\
  260. N & November & \MNovember & / & Slash & \MSlash \\
  261. O & Oscar & \MOscar & - & Hyphen & \MHyphen \\
  262. P & Papa & \MPapa & = & DoubleHyphen & \MDoubleHyphen \\
  263. Q & Quebec & \MQuebec & + & Plus & \MPlus \\
  264. R & Romeo & \MRomeo & @ & at & \Mat \\
  265. S & Sierra & \MSierra & .. & Lazy error & \MLerror \\
  266. T & Tango & \MTango & .. & Error & \MError \\
  267. U & Uniform & \MUniform & & Got a beer! & \MWait \\
  268. V & Victor & \MVictor & & & \\
  269. W & Whisky & \MWhisky & & & \\
  270. X & X-Ray & \MXray & & & \\
  271. Y & Yankee & \MYankee & & & \\
  272. Z & Zulu & \MZulu & & & \\
  273. \MAA & & \Maa & & & \\
  274. \MAR & & \Mar & & & \\
  275. \MAS & & \Mas & & & \\
  276. \MBT & & \Mbt & & & \\
  277. \MCT & & \Mct & & & \\
  278. \MKN & & \Mkn & & & \\
  279. \MSK & & \Msk & & & \\
  280. \MSN & & \Msn & & & \\
  281. \end{tabular}
  282. \section{Example}
  283. \printindex
  284. \listoffigures
  285. \listoftables
  286. \end{document}