% \iffalse\begin{macrocode}
%<*driver>

\documentclass{ltxdoc}

% Set up the bibliography.
\usepackage{filecontents}
\begin{filecontents}{muletter.bib}
@MANUAL{lamport16,
  author        =   {Leslie Lamport and Frank Mittelbach and Rainer Schöpf},
  year          =   {2016},
  title         =   {Standard Letter Document Class for \LaTeX{} version 2e},
  urldate       =   {2016-10-08},
  url           =   {http://mirrors.ctan.org/macros/latex/base/letter.pdf},
  langid        =   {english}}
\end{filecontents}
\usepackage[
  backend=biber,
  style=iso-numeric,
  sorting=none,
  autolang=other,
  sortlocale=auto]{biblatex}
\addbibresource{muletter.bib}


% Boilerplate
\usepackage[utf8]{inputenc} % this file uses UTF-8
\usepackage[english]{babel}
\usepackage{tgpagella}
\usepackage{hologo}
\usepackage{booktabs}
\usepackage[scaled=0.86]{berasans}
\usepackage[scaled=1.03]{inconsolata}
\usepackage[resetfonts]{cmap}
\usepackage[T1]{fontenc} % use 8bit fonts
\emergencystretch 2dd
\usepackage{hypdoc}
\usepackage{microtype}
\usepackage{ragged2e}

% Making paragraphs numbered
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
            {-2.5ex\@plus -1ex \@minus -.25ex}%
            {1.25ex \@plus .25ex}%
            {\normalfont\normalsize\bfseries}}
\makeatother
\setcounter{secnumdepth}{4} % how many sectioning levels to assign
\setcounter{tocdepth}{4}    % how many sectioning levels to show

% ltxdoc class options
\CodelineIndex
\MakeShortVerb{|}
\EnableCrossrefs
\DoNotIndex{}
\makeatletter
\c@IndexColumns=2
\makeatother

\begin{document}
  \RecordChanges
  \DocInput{muletter.dtx}
  \printbibliography
  \PrintIndex
  \RaggedRight
  \PrintChanges
\end{document}

%</driver>
%    \end{macrocode}
%<*class>
% \fi
%
% \title{A document class for the typesetting of letters at the Masaryk
%   University in Brno}
% \author{Vít Novotný}
% \date{\today}
% \maketitle
%
% \begin{abstract}
% \noindent This document details the design and the implementation
% of the \textsf{muletter} document class, which extends the base
% \Hologo{LaTeX2e} \textsf{letter} class. Included is technical documentation
% for anyone who wishes to extend and modify the class as well as
% information on the basic usage for the ordinary user.
% \end{abstract}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}%
\ProvidesClass{muletter}[2021/08/30]%
%    \end{macrocode}
%
% \tableofcontents
% \listoftables
%
% \section{Requirements}
% \subsection{Required \TeX{} Engine}
% \textsf{Muletter} requires an \hologo{eTeX}-based engine that supports
% the \DescribeMacro\dimexpr|\dimexpr| command. This includes
% \hologo{pdfTeX}, \hologo{XeTeX}, and \hologo{LuaTeX}, but excludes any
% version of Knuth's \TeX.
%
% \subsection{Required Document Classes}
% \textsf{Muletter} requires the \LaTeX{} \textsf{letter}
% class~\cite{lamport16}, which it loads and extends.
%    \begin{macrocode}
\LoadClass[a4paper,10pt,oneside,onecolumn,final]{letter}%
%    \end{macrocode}
%
% \subsection{Required Packages}
% The \textsf{graphicx} package is used to insert logos, labels, and
% signatures into documents.
%    \begin{macrocode}
\RequirePackage{graphicx}%
%    \end{macrocode}
% The \textsf{xcolor} package is used for the coloring of text.
%    \begin{macrocode}
\RequirePackage{xcolor}%
%    \end{macrocode}
% The \textsf{etoolbox} package is used for patching the
% |\includegraphics| command.
%    \begin{macrocode}
\RequirePackage{etoolbox}%
%    \end{macrocode}
% The \textsf{array} package is used for specifying the format of
% table columns.
%    \begin{macrocode}
\RequirePackage{array}%
%    \end{macrocode}
% The \textsf{ragged2e} package is used to typeset ragged-right text.
%    \begin{macrocode}
\RequirePackage{ragged2e}%
%    \end{macrocode}
% Based on the class options, we may also require the \textsf{cmap},
% \textsf{fontenc}, \textsf{tgheros}, and \textsf{microtype} packages.
%
% \section{Basic Usage}
% To use \textsf{muletter}, specify
% |\documentclass|\oarg{options}|{muletter}| at the beginning of your
% \LaTeX{} document; the available \meta{options} are documented in
% section \ref{sec:clsoptions}. Inside your document, you can use the
% standard markup provided by the \LaTeX{} \textsf{letter}
% class~\cite{lamport16} as well as the additional \textsf{muletter}
% markup specified in section \ref{sec:markup:extra}. To get started
% quickly, inspect the example files distributed alongside
% \textsf{muletter}.
% 
% \section{Class Options}\label{sec:clsoptions}
% \subsection{Defining the Options}
% \begin{macro}{\muletter@option@heros}
% The |heros| class option defines |\muletter@option@heros| and the
% |nofonts| class option undefines it.
%    \begin{macrocode}
\DeclareOption{heros}{%
  \let\muletter@option@heros\relax
}%
\DeclareOption{nofonts}{%
  \let\muletter@option@heros\undefined
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@option@monochrome}
% The |monochrome| class option defines |\muletter@option@monochrome|
% and the |color| class option undefines it.
%    \begin{macrocode}
\DeclareOption{monochrome}{%
  \let\muletter@option@monochrome\relax
}%
\DeclareOption{color}{%
  \let\muletter@option@monochrome\undefined
}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Processing the Options}
% We will use the |heros| and |color| options by default.
%    \begin{macrocode}
\ExecuteOptions{heros, color}%
%    \end{macrocode}
% We process the options.
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% If the |heros| option has been specified, we load the \textsf{cmap},
% \textsf{fontenc}, \textsf{tgheros} packages to set the default font
% face to \TeX{} Gyre Heros. We also load the \textsf{microtype} package
% to enable the microtypographical extensions, if the \TeX{} engine
% provides any.
%    \begin{macrocode}
\ifx\undefined\muletter@option@heros\else
  \RequirePackage[resetfonts]{cmap}%
  \RequirePackage[T1]{fontenc}%
  \RequirePackage{tgheros}%
  \renewcommand{\familydefault}{\sfdefault}
  \RequirePackage{microtype}%
\fi
%    \end{macrocode}
%
% If the |monochrome| option has been specified, we will do nothing in
% particular. We will use the information to place monochrome logos and
% labels into the header and footer of the first page in a letter. The
% \textsf{xcolor} package will react to the |monochrome| option by
% removing all text coloring.
%
% \section{Document Layout}
% \subsection{Paragraphs}
% \begin{macro}{\parskip}
% |\parskip| specifies the extraneous vertical space between paragraphs.
%    \begin{macrocode}
\parskip=14pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\normalsize}
% |\normalsize| specifies that the font size should be 10\,pt with
% 14\,pt of leading.
%    \begin{macrocode}
\renewcommand\normalsize{%
  \@setfontsize\normalsize\@xpt\@xivpt
  \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
  \abovedisplayshortskip \z@ \@plus3\p@
  \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
  \belowdisplayskip \abovedisplayskip
  \let\@listi\@listI}
\normalsize
%    \end{macrocode}
% \end{macro}
% \subsection{Page Layout}
% \subsubsection{Vertical Spacing}
% \begin{macro}{\voffset}
% |\voffset| is the vertical distance between the top of the paper and
% the bottom of the top margin minus one inch.
%    \begin{macrocode}
\voffset=\dimexpr(-1in + 1.1cm)
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\topmargin}
% |\topmargin| is the vertical distance between the bottom of the top
% margin and the top of the header.
%    \begin{macrocode}
\topmargin=0pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\headheight}
% |\headheight| is the height of the box that will contain the header.
%    \begin{macrocode}
\headheight=2cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\headsep}
% |\headsep| is the vertical distance between the bottom of the header
% and the top of the text block.
%    \begin{macrocode}
\headsep=0pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@length@address@top@padding}
% |\muletter@length@address@top@padding| is the vertical distance between
% the label and the address.
%    \begin{macrocode}
\newlength\muletter@length@address@top@padding
\muletter@length@address@top@padding=-1.7cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@length@metadata@top@padding}
% |\muletter@length@metadata@top@padding| is the vertical distance between
% the address and the metadata of a letter.
%    \begin{macrocode}
\newlength\muletter@length@metadata@top@padding
\muletter@length@metadata@top@padding=42pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@length@opening@top@padding}
% |\muletter@length@opening@top@padding| is the vertical distance between
% the metadata and the opening of a letter.
%    \begin{macrocode}
\newlength\muletter@length@opening@top@padding
\muletter@length@opening@top@padding=36pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\textheight}
% |\textheight| is the height of text block (including footnotes and
% figures, excluding header and footer).
%    \begin{macrocode}
\textheight=21.8cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\footskip}
% |\footskip| is the vertical distance between the baseline of the last
% line in the text block and the baseline of the box that contains the
% footer.
%    \begin{macrocode}
\footskip=2.5cm
%    \end{macrocode}
% \end{macro}
% \subsubsection{Horizontal Spacing}
% \begin{macro}{\hoffset}
% |\hoffset| is the horizontal distance between the left side of the
% paper and the left side of the text block.
%    \begin{macrocode}
\hoffset=\dimexpr(-1in + 2.4cm)
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\oddsidemargin}
% |\oddsidemargin| is the extra space added to the left of the text
% block.
%    \begin{macrocode}
\oddsidemargin=0pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\textwidth}
% |\textwidth| is the width of the text block.
%    \begin{macrocode}
\textwidth=16.2cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\marginparsep}
% |\marginparsep| is the horizontal distance between the left side of the
% text block and the right side of the margin notes.
%    \begin{macrocode}
\marginparsep=0pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\marginparwidth}
% |\marginparwidth| is the width margin notes.
%    \begin{macrocode}
\marginparwidth=0pt
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@length@label@overhang}
% |\muletter@length@label@overhang| is the horizontal distance between the
% left side of the label in the head of the first page in a letter and
% the left side of the text block.
%    \begin{macrocode}
\newlength\muletter@length@label@overhang
\muletter@length@label@overhang=1.2cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@length@label@left@margin}
% |\muletter@length@label@left@margin| is the horizontal distance between
% the left side of the label and the left side of the image containing
% the label.
%    \begin{macrocode}
\newlength\muletter@length@label@left@margin
\muletter@length@label@left@margin=0.5cm
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\longindentation}
% |\longindentation| is the horizontal distance between the the left
% side of the text block and the left side of the closing of a letter as
% typeset using the |\closing| command.
%    \begin{macrocode}
\longindentation=0pt
%    \end{macrocode}
% \end{macro}
% \subsubsection{Miscellaneous}
% \begin{macro}{\muletter@temp@length}
% |\muletter@temp@length| is a helper length register for
% computing box sizes.
%    \begin{macrocode}
\newlength\muletter@temp@length
%    \end{macrocode}
% \end{macro}
% \subsection{Page Styles}
% \begin{macro}{\ps@firstpage}
% |\ps@firstpage| enables the |firstpage| page style, which corresponds
% to the first page of a letter.
%    \begin{macrocode}
\renewcommand\ps@firstpage{%
%    \end{macrocode}
% \begin{macro}{\@oddhead}
% |\@oddhead| is the document header. It contains a label in the
% |firstpage| page style.
%    \begin{macrocode}
  \def\@oddhead{%
    \hspace{-\muletter@length@label@overhang}%
    \hspace{-\muletter@length@label@left@margin}%
    \muletter@subroutine@includegraphics
      {\muletter@filename@label}%
      {\muletter@filename@label@fallback}%
  }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@oddfoot}
% |\@oddfoot| is the document footer. In the |firstpage| page style, it
% contains page numbers along with sender information and a logo if
% \cs{ifmuletterlogo} is true.
%    \begin{macrocode}
  \def\@oddfoot{%
    \sffamily\fontsize{8}{12}\selectfont
    \vspace{1.75cm}%
    \begin{minipage}[b][\dimexpr(\footskip-1.75cm)][c]\textwidth
      \hspace{-\muletter@length@label@overhang}%
%    \end{macrocode}
% We typeset sender information.
%    \begin{macrocode}
      \settowidth\muletter@temp@length{%
        \ifmuletterlogo
          \muletter@subroutine@includegraphics
            {\muletter@filename@logo}%
            {\muletter@filename@logo@fallback}%
        \fi
      }%
      \begin{tabular}{%
        @{}>{\RaggedRight\arraybackslash}p{\muletter@length@label@overhang}%
        @{}>{\RaggedRight\arraybackslash}%
        p{\dimexpr(\textwidth - \muletter@temp@length)}@{}}
          & \textcolor{muletter@color@secondary}{%
              \textbf{%
                \ignorespaces\muletter@data@name
              }%
            }\\
          & \\
          & \textcolor{muletter@color@secondary}{%
              \muletter@data@address
            }\\
          & \textcolor{muletter@color@secondary}{%
              \muletter@string{telephone}: \muletter@data@telephone,
              \penalty -5000
              \muletter@string{email}: \muletter@data@email,
              \penalty -5000
              \muletter@string{webpage}: \muletter@data@webpage
            }\\
          & \textcolor{muletter@color@secondary}{%
              \muletter@string{bank}: \muletter@data@bank,
              \muletter@string{account}: \muletter@data@account,
              \muletter@string{tin}: \muletter@data@tin,
              \muletter@string{vatin}: \muletter@data@vatin
            }\\
%    \end{macrocode}
% We typeset the current page number and the number of pages of the
% current letter.
%    \begin{macrocode}
        \thepage/\pageref{muletter@lastpage@letter%
          \themuletter@counter@letterno} & 
          \textcolor{muletter@color@secondary}{%
            \muletter@string{afterfooter}%
          }
      \end{tabular}%
%    \end{macrocode}
% If \cs{ifmuletterlogo} is true, we typeset a logo.
%    \begin{macrocode}
      \ifmuletterlogo
        \hfill\begin{minipage}[c]\muletter@temp@length
          \muletter@subroutine@includegraphics
            {\muletter@filename@logo}%
            {\muletter@filename@logo@fallback}%
        \end{minipage}%
      \fi
    \end{minipage}
  }%
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ps@plain}
% |\ps@plain| enables the |plain| page style, which corresponds to the
% all pages of a letter other than the first one.
%    \begin{macrocode}
\renewcommand\ps@plain{%
%    \end{macrocode}
% \begin{macro}{\@oddhead}
% |\@oddhead| is the document header. It is empty in the |plain| page
% style.
%    \begin{macrocode}
  \let\@oddhead\@empty
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@oddfoot}
% |\@oddfoot| is the document footer. It contains page numbers in the
% |plain| page style.
%    \begin{macrocode}
  \def\@oddfoot{\sffamily\fontsize{7}{9}\selectfont
    \color{muletter@color@secondary}%
    \hspace{-\muletter@length@label@overhang}%
    \thepage/\pageref{muletter@lastpage@letter%
      \themuletter@counter@letterno}%
  }%
}%
%    \end{macrocode}
% |plain| is the default page style.
%    \begin{macrocode}
\pagestyle{plain}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% Page styles other than |firstpage| and |plain| are unsupported in
% \textsf{muletter} by default.
% 
% \section{Available Commands}
% \subsection{Document Markup}
% \begin{environment}{letter}
% |\begin{letter}|\marg{destination address} \ldots|\end{letter}| is a
% letter addressed to \meta{destination address}. The page numbering is
% reset at the beginning of the |letter| environment. 
% 
% \begin{macro}{\muletter@original@letter}
% We increment the |muletter@counter@letterno| counter at the beginning
% of the |letter| environment.
%    \begin{macrocode}
\let\muletter@original@letter\letter
\renewcommand\letter[1]{%
  \muletter@original@letter{#1}%
  \stepcounter{muletter@counter@letterno}%
}%
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\muletter@original@endletter}
% We define a |muletter@lastpage@letter|\meta{letter number} label
% at the end of the |letter| environment and at the end of the document,
% where \meta{letter number} corresponds to the value of the
% |muletter@counter@letterno| counter.  This reference will be used to
% display the number of pages in a letter in the footer.
%    \begin{macrocode}
\let\muletter@original@endletter\endletter
\renewcommand\endletter{%
  \label{muletter@lastpage@letter\themuletter@counter@letterno}%
  \muletter@original@endletter
}%
\AtEndDocument{%
  \label{muletter@lastpage@letter\themuletter@counter@letterno}%
}%
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \begin{macro}{\opening}
% |\opening|\marg{salutation} typesets the opening of a letter along
% with the opening matter.
%    \begin{macrocode}
\renewcommand*{\opening}[1]{%
%    \end{macrocode}
% The page containing the opening is set in the |firstpage| style.
%    \begin{macrocode}
  \thispagestyle{firstpage}%
%    \end{macrocode}
% We typeset the destination address.
%    \begin{macrocode}
  \vspace*\muletter@length@address@top@padding
  \leavevmode\hfill
  {%
    \bfseries\fontsize{11}{14.5}\selectfont
    \begin{minipage}{.45\textwidth}%
      \toname \\ \toaddress
    \end{minipage}%
  }%
  \\[\muletter@length@metadata@top@padding]
%    \end{macrocode}
% We typeset a row of additional metadata.
%    \begin{macrocode}
  {\sffamily\fontsize{8}{14}\selectfont
  \begin{tabular}{%
      @{}p{.265\textwidth}%
      @{}p{.335\textwidth}%
      @{}p{.22\textwidth}%
      @{}p{.15\textwidth}@{}}%
    \textcolor{muletter@color@secondary}{%
      \muletter@string{yourletter}:} &
      \textcolor{muletter@color@secondary}{%
        \muletter@string{refno}} &
      \textcolor{muletter@color@secondary}{%
        \muletter@string{contactinfo}:} &
      \textcolor{muletter@color@secondary}{%
        \muletter@string{placedate}} \\
    \mbox{\muletter@data@refno@received}\newline
    \mbox{\muletter@data@date@received} &
    \mbox{\muletter@data@refno} &
    \mbox{\muletter@data@name@contact}\newline
    \mbox{\muletter@data@email@contact} &
    \mbox{\muletter@data@place}\newline
    \mbox{\muletter@data@date}
  \end{tabular}}%
  \\[\muletter@length@opening@top@padding]
%    \end{macrocode}
% We typeset the subject of the letter.
%    \begin{macrocode}
  {%
    \bfseries\fontsize{11}{14.5}\selectfont
    \muletter@data@subject
    \par
  }%
%    \end{macrocode}
% We typeset the \meta{salutation}.
%    \begin{macrocode}
  #1\par\nobreak
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\closing}
% |\closing|\marg{farewell} typesets the closing of a letter along
% with the closing matter.
%    \begin{macrocode}
\renewcommand{\closing}[1]{%
  \par\stopbreaks\noindent\raggedright
  \hspace*{\longindentation}%
  \parbox{\indentedwidth}{%
%    \end{macrocode}
% We typeset the \marg{farewell}.
%    \begin{macrocode}
    \ignorespaces #1%
    \\[.5\medskipamount]%
%    \end{macrocode}
% We typeset either
% |\muletter@data@signature@image| if it has been defined, or a strut.
%    \begin{macrocode}
    \ifx\undefined\muletter@data@signature@image@defined
      \rule{0pt}{4\medskipamount}\\
    \else
      \includegraphics[height=4\medskipamount]%
        \muletter@data@signature@image\\
    \fi
%    \end{macrocode}
% We typeset the sender's name.
%    \begin{macrocode}
    \textbf{\muletter@data@signature}\\
%    \end{macrocode}
% We typeset the sender's designation.
%    \begin{macrocode}
    \muletter@data@designation\strut
    \par
  }%
}%
%    \end{macrocode}
% \end{macro}
% \subsection{Data Specification}
% \begin{macro}{\muletter@def}
% \begin{macro}{\muletter@def@command}
% |\muletter@def|\oarg{getter}\marg{setter} defines the commands
% |\|\meta{setter}\marg{value} and |\muletter@data@|\meta{getter}. If
% \meta{getter} is undefined, then we define \meta{getter} as
% \meta{setter}. When |\|\meta{setter}\marg{value} is invoked, it
% defines |\muletter@data@|\meta{getter} as \meta{value} and
% defines |\muletter@data@|\meta{getter}|@defined|. Before 
% definition, |\muletter@data@|\meta{getter} produces
% ``\textcolor{red}{\texttt{\textbackslash}\meta{setter}}'' to make it
% clear to the user which command to use. The command used to define
% |\|\meta{setter} is |\muletter@def@command|.
%    \begin{macrocode}
\newcommand\muletter@def[2][]{%
  \expandafter\muletter@def@command\expandafter*\csname#2\endcsname[1]{%
    \expandafter\renewcommand\expandafter*\csname
      muletter@data@\ifx\@empty#1\@empty#2\else#1\fi\endcsname{##1}%
    \expandafter\let\csname muletter@data@\ifx\@empty#1\@empty#2\else#1\fi
      @defined\endcsname\relax
  }%
  \expandafter\newcommand\expandafter*\csname
    muletter@data@\ifx\@empty#1\@empty#2\else#1\fi\endcsname
    {\textcolor{red}{\textbackslash #2}}
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% 
% \subsubsection{Inherited Commands}
% The following commands are redefinitions of identically named commands
% from the \LaTeX{} \textsf{letter} class. We will define them using
% |\muletter@def| with |\muletter@def@command| defined as |\renewcommand|.
%    \begin{macrocode}
\let\muletter@def@command\renewcommand
%    \end{macrocode}
% \begin{macro}{\name}
% \begin{macro}{\muletter@data@name}
% |\name|\marg{sender name} defines |\muletter@data@name| as
% \meta{sender name}, where \meta{sender name} corresponds to the
% sender's name that will be displayed along with the sender address.
% in the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{name}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\signature}
% \begin{macro}{\muletter@data@signature}
% |\signature|\marg{signature} defines |\muletter@data@signature| as
% \meta{signature}, where \meta{signature} corresponds to the signature
% that will be displayed in the closing matter.
%    \begin{macrocode}
\muletter@def{signature}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\address}
% \begin{macro}{\muletter@data@address}
% |\signature|\marg{sender address} defines |\muletter@data@address| as
% \meta{sender address}, where \meta{sender address} corresponds to the
% sender address that will be displayed along with the sender name in
% the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{address}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\telephone}
% \begin{macro}{\muletter@data@telephone}
% |\telephone|\marg{number} defines |\muletter@data@telephone| as
% \meta{number}, where \meta{number} corresponds to the sender's phone
% number that will be displayed in the footer of the first page in a
% letter.
%    \begin{macrocode}
\muletter@def{telephone}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\date}
% \begin{macro}{\muletter@data@date}
% |\telephone|\marg{date} defines |\muletter@data@date| as \meta{date},
% where \meta{date} corresponds to the sending date that will be
% displayed in the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{date}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% 
% \subsubsection{Additional Commands}\label{sec:markup:extra}
% The following commands are new \textsf{muletter} additions. We will
% define them using |\muletter@def| with |\muletter@def@command| defined
% as |\newcommand|.
%    \begin{macrocode}
\let\muletter@def@command\newcommand
%    \end{macrocode}
% \begin{macro}{\contactname}
% \begin{macro}{\muletter@data@name@contact}
% |\contactname|\marg{sender name} defines |\muletter@data@name@contact|
% as \meta{sender name}, where \meta{sender name} corresponds to the
% contact person's name that will be displayed in the opening matter.
%    \begin{macrocode}
\muletter@def[name@contact]{contactname}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\subject}
% \begin{macro}{\muletter@data@subject}
% |\subject|\marg{subject} defines |\muletter@data@subject| as
% \meta{subject}, where \meta{subject} corresponds to the letter subject
% that will be displayed in the opening matter.
%    \begin{macrocode}
\muletter@def{subject}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\email}
% \begin{macro}{\muletter@data@email}
% |\email|\marg{e-mail address} defines |\muletter@data@email| as
% \meta{e-mail address}, where \meta{e-mail address} corresponds to the
% sender's e-mail address that will be displayed in the footer of the
% first page in a letter.
%    \begin{macrocode}
\muletter@def{email}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\contactemail}
% \begin{macro}{\muletter@data@email@contact}
% |\contactemail|\marg{e-mail address} defines
% |\muletter@data@email@contact| as \meta{e-mail address}, where
% \meta{e-mail address} corresponds to the contact person's e-mail
% address that will be displayed in the opening matter.
%    \begin{macrocode}
\muletter@def[email@contact]{contactemail}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\webpage}
% \begin{macro}{\muletter@data@webpage}
% |\webpage|\marg{\textsc{url}} defines |\muletter@data@webpage| as
% \meta{\textsc{url}}, where \meta{\textsc{url}} corresponds to the
% \textsc{url} of the sender's webpage that will be displayed in the
% footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{webpage}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\bank}
% \begin{macro}{\muletter@data@bank}
% |\bank|\marg{bank name} defines |\muletter@data@bank| as \meta{bank
% name}, where \meta{bank name} corresponds to the name of the sender's
% bank that will be displayed along with the sender's bank account
% number in the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{bank}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\account}
% \begin{macro}{\muletter@data@account}
% |\account|\marg{account number} defines |\muletter@data@account| as
% \meta{account number}, where \meta{account number} corresponds to the
% sender's bank account number that will be displayed along with the
% name of the sender's bank in the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{account}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\tin}
% \begin{macro}{\muletter@data@tin}
% |\tin|\marg{identification number} defines |\muletter@data@tin| as
% \meta{identification number}, where \meta{identification number}
% corresponds to the sender's taxpayer identification number that will
% be displayed along with the sender's \textsc{vat} identification
% number in the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{tin}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\vatin}
% \begin{macro}{\muletter@data@vatin}
% |\vatin|\marg{identification number} defines |\muletter@data@vatin| as
% \meta{identification number}, where \meta{identification number}
% corresponds to the sender's \textsc{vat} identification number that
% will be displayed along with the sender's taxpayer identification
% number in the footer of the first page in a letter.
%    \begin{macrocode}
\muletter@def{vatin}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\place}
% \begin{macro}{\muletter@data@place}
% |\place|\marg{place} defines |\muletter@data@place| as
% \meta{place}, where \meta{place}
% corresponds to the place from which a letter is being sent, which
% will be displayed along with the sending date in the opening matter.
%    \begin{macrocode}
\muletter@def{place}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\receiveddate}
% \begin{macro}{\muletter@data@date@received}
% |\receiveddate|\marg{date} defines |\muletter@data@date@received| as
% \meta{date}, where \meta{date} corresponds to the sending date of the
% previous letter in a conversation, which will be displayed along with
% the reference number of the previous letter in a conversation in the
% opening matter.
%    \begin{macrocode}
\muletter@def[date@received]{receiveddate}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\refno}
% \begin{macro}{\muletter@data@refno}
% |\refno|\marg{number} defines
% |\muletter@data@refno| as \meta{number}, where \meta{number}
% corresponds to the reference number of a letter, which will be
% displayed in the opening matter.
%    \begin{macrocode}
\muletter@def{refno}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\receivedrefno}
% \begin{macro}{\muletter@data@refno@received}
% |\receivedrefno|\marg{number} defines
% |\muletter@data@refno@received| as \meta{number}, where \meta{number}
% corresponds to the reference number of the previous letter in a
% conversation, which will be displayed along with the sending date of
% the previous letter in a conversation in the opening matter.
%    \begin{macrocode}
\muletter@def[refno@received]{receivedrefno}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\designation}
% \begin{macro}{\muletter@data@designation}
% |\designation|\marg{designation} defines |\muletter@data@designation|
% as \meta{designation}, where \meta{designation} corresponds to the
% sender's designation or department, which will be displayed in the
% closing matter.
%    \begin{macrocode}
\muletter@def{designation}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\signatureimage}
% \begin{macro}{\muletter@data@signature@image}
% |\signatureimage|\marg{file name} defines
% |\muletter@data@signature@image| as \meta{file name}, where \meta{file
% name} corresponds to the file name of the signature image that will be
% displayed in the closing matter.
%    \begin{macrocode}
\muletter@def[signature@image]{signatureimage}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\letterlocale}
% \changes{2017/08/23}{2017/08/23}{\cs{locale} was changed to \cs{localename},
%   since the \textsf{babel} package reserves \cs{locale} now.}
% \changes{2021/07/19}{2021/07/19}{\cs{letterlocale} was changed to \cs{letterlocale},
%   since the \LaTeXe{} kernel reserves \cs{letterlocale} now.}
% \begin{macro}{\muletter@data@locale}
% |\letterlocale|\marg{locale name} defines
% |\muletter@data@locale| as \meta{locale name}, where \meta{locale name}
% corresponds to the locale of a letter. The default value is
% either |\languagename| defined by the packages of \textsf{babel} and
% \textsf{polyglossia}, or |english|, when |\languagename| is undefined.
%    \begin{macrocode}
\muletter@def[locale]{letterlocale}%
\letterlocale{%
  \ifx\languagename\undefined
    english%
  \else
    \languagename
  \fi
}%
%    \end{macrocode}
% We define |\muletter@data@locale@logo| as the locale for logos and
% |\muletter|\texttt{\discretionary{@}{@}{@}}|data@locale@label| as the
% locale for labels. Both will inherit the value of
% |\muletter@data@locale|.
%    \begin{macrocode}
\newcommand*\muletter@data@locale@logo{%
  \muletter@data@locale
}%
\newcommand*\muletter@data@locale@label{%
  \muletter@data@locale
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\workplace}
% \begin{macro}{\muletter@data@workplace}
% |\workplace|\marg{workplace} defines
% |\muletter@data@workplace| as \meta{work place}, where \meta{work
% place} corresponds to the work place whose logo and label will be
% displayed in the header and footer of the first page in a letter.
% The \meta{work place}s recognized at the Masaryk University in Brno
% are outlined in table \ref{table:workplaces}. The default \meta{work
% place} is |mu|.
% \begin{table}
% \begin{center}
% \begin{tabular}{lc}
%   \toprule
%   Work place & \meta{work place} \\
%   \midrule
%   Accomodation and Catering Services & |skm| \\
%   Career Centre & |kariera| \\
%   Central European Institute of Technology & |ceitec| \\
%   Centre for International Cooperation & |czs| \\
%   Faculty of Arts & |phil| \\
%   Faculty of Economics and Administration & |econ| \\
%   Faculty of Education & |ped| \\
%   Faculty of Informatics & |fi| \\
%   Faculty of Law & |law| \\
%   Faculty of Medicine & |med| \\
% \changes{2021/08/30}{2021/08/30}{Add Faculty of Pharmacy.}
%   Faculty of Pharmacy & |pharm| \\
%   Faculty of Science & |sci| \\
%   Faculty of Social Studies & |fss| \\
%   Faculty of Sports Studies & |fsps| \\
%   Information System of Masaryk University & |is| \\
%   Institute for Biostatistics and Analyses & |iba| \\
%   Institute of Computer Science & |ics| \\
%   Language Centre & |lang| \\
%   Management of the University Campus at Bohunice & |ucb| \\
%   Masaryk University & |mu| \\
%   Masaryk University Press & |press| \\
%   Mendel Museum & |muzeu| \\
%   Rector & |rect| \\
%   Rector's Office & |rect-office| \\
%   Support Centre for Students with Special Needs & |teiresias| \\
%   Technology Transfer Office & |ctt| \\
%   University Archives & |arch| \\
%   University Center Telč & |uct| \\
%   \bottomrule
% \end{tabular}
% \caption{The \meta{work place}s recognized at the Masaryk University
%   in Brno}
% \label{table:workplaces}
% \end{center}
% \end{table}
%    \begin{macrocode}
\muletter@def{workplace}%
\workplace{mu}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Filenames and Pathnames}
% \begin{macro}{\muletter@pathname@base}
% |\muletter@pathname@base| is the pathname of the base directory
% containing logo, label either directly or in subdirectories.
%    \begin{macrocode}
\newcommand*\muletter@pathname@base{%
  muletter/%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@pathname@logo}
% |\muletter@pathname@logo| is the pathname of the base directory
% directly containing logo files.
%    \begin{macrocode}
\newcommand*\muletter@pathname@logo{%
  \muletter@pathname@base logo/%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@pathname@label}
% |\muletter@pathname@label| is the pathname of the base directory
% directly containing label files.
%    \begin{macrocode}
\newcommand*\muletter@pathname@label{%
  \muletter@pathname@base label/%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@pathname@locale}
% |\muletter@pathname@locale| is the pathname of the base directory
% containing locale files.
%    \begin{macrocode}
\newcommand*\muletter@pathname@locale{%
  \muletter@pathname@base locale/%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@filename@logo}
% |\muletter@filename@logo| is the filename of logo that will be
% included in the header of the first page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@filename@logo{%
  \muletter@pathname@logo muletter-\muletter@data@workplace-%
    \muletter@data@locale@logo
    \ifx\undefined\muletter@option@monochrome
      -color%
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@filename@logo@fallback}
% |\muletter@filename@logo@fallback| is the filename of logo that will
% be included in the header of the first page in a letter if
% |\muletter@filename@logo| is not found.
%    \begin{macrocode}
\newcommand*\muletter@filename@logo@fallback{%
  \muletter@pathname@logo muletter-\muletter@data@workplace-english%
    \ifx\undefined\muletter@option@monochrome
      -color%
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@filename@label}
% |\muletter@filename@label| is the filename of label that will be
% included in the header of the first page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@filename@label{%
  \muletter@pathname@label muletter-\muletter@data@workplace-%
    \muletter@data@locale@label
    \ifx\undefined\muletter@option@monochrome
      -color%
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@filename@label@fallback}
% |\muletter@filename@label@fallback| is the filename of label that will
% be included in the header of the first page in a letter if
% |\muletter@filename@label| is not found.
%    \begin{macrocode}
\newcommand*\muletter@filename@label@fallback{%
  \muletter@pathname@label muletter-\muletter@data@workplace-english%
    \ifx\undefined\muletter@option@monochrome
      -color%
    \fi
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\muletter@subroutine@includegraphics}
% |\muletter@subroutine@includegraphics|\oarg{\texttt{\textbackslash
% includegraphics} options}\marg{primary file name}\marg{fallback file
% name} tries to include the graphics files \meta{primary file name} and
% \meta{fallback file name} if \meta{primary file name} is not found. If
% neither graphics file is found, nothing will be included.
% \changes{2017/08/25}{2017/08/25}{\cs{filetter@temp@yield} was renamed to
%   \cs{muletter@temp@yield} for naming consistency.}
%    \begin{macrocode}
\newcommand*\muletter@subroutine@includegraphics[3][]{%
  \begingroup
  \patchcmd{\Gin@ii}{\begingroup}{%
    \begingroup
    \renewcommand{\@latex@error}[2]{%
      \ifx\undefined\muletter@temp@yield
        \let\muletter@temp@yield\relax
        \includegraphics[#1]{#3}%
      \fi
    }%
  }{}{}%
  \includegraphics[#1]{#2}%
  \endgroup
}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Conditionals}
% \begin{macro}{\ifmuletterlogo}
% \cs{ifmuletterlogo} controls whether a logo is displayed in the
% footer of a page in the |firstpage| style.
%    \begin{macrocode}
\newif\ifmuletterlogo
\muletterlogofalse
%    \end{macrocode}
% \end{macro}
%
% \subsection{Counters}
% |muletter@counter@letterno| is the number of the current letter.
%    \begin{macrocode}
\newcounter{muletter@counter@letterno}%
%    \end{macrocode}
%
% \subsection{Colors}
% |muletter@color@secondary| is the secondary text color.
%    \begin{macrocode}
\definecolor{muletter@color@secondary}{cmyk}{1,0.75,0,0}%
%    \end{macrocode}
%
% \subsection{Locale Strings}
% \begin{macro}{\muletter@string}
% |\muletter@string|\marg{key} expands to
% |\muletter@string@|\meta{locale}|@|\meta{key}, where \meta{locale} is
% the value of the |\muletter@data@locale| macro.
%    \begin{macrocode}
\newcommand\muletter@string[1]{%
%    \end{macrocode}
% If |\muletter@locale@|\meta{locale}|@loaded| is undefined, load
% the locale file
% |\muletter|\texttt{\discretionary{@}{@}{@}}|pathname@locale|
% |muletter-|\meta{locale}|.def| and define
% |\muletterlocale@|\meta{locale}\texttt{\discretionary{@}{@}{@}}^^A
% |loaded|.
%    \begin{macrocode}
  \expandafter\ifx\expandafter\relax\csname muletter@locale@%
    \muletter@data@locale @loaded\endcsname
      \expandafter\global\expandafter\let\csname muletter@locale@%
        \muletter@data@locale @loaded\endcsname\@empty
      \makeatletter
      \input\muletter@pathname@locale
        muletter-\muletter@data@locale .def\relax
      \makeatother
  \fi
%    \end{macrocode}
% If |\muletter@string@|\meta{locale}|@|\meta{key} is undefined, then
% expand to |\muletter|\texttt{\discretionary{@}{@}{@}}^^A
% |string@english@|\meta{key} instead.
%    \begin{macrocode}
  \expandafter\ifx\expandafter\relax\csname muletter@string@%
    \muletter@data@locale @#1\endcsname\relax
      \csname muletter@string@english@#1\endcsname
  \else
    \csname muletter@string@\muletter@data@locale @#1\endcsname
  \fi}%
%    \end{macrocode}
% \end{macro}
% \textsf{Muletter} hardwires the English locale strings directly into
% the document class file.
%    \begin{macrocode}
\let\muletter@locale@english@loaded\@empty
%    \end{macrocode}
%
% \begin{macro}{\muletter@string@english@telephone}
% |\muletter@string@|\meta{locale}|@telephone| is the label displayed
% prior to the sender's telephone number in the footer of the first page
% in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@telephone{T}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@email}
% |\muletter@string@|\meta{locale}|@email| is the label displayed
% prior to the sender's e-mail address in the footer of the first page
% in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@email{E}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@webpage}
% |\muletter@string@|\meta{locale}|@webpage| is the label displayed
% prior to the address of the sender's web page in the footer of the
% first page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@webpage{W}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@bank}
% |\muletter@string@|\meta{locale}|@bank| is the label displayed
% prior to the name of the sender's bank in the footer of the first page
% in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@bank{Bank account}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@account}
% |\muletter@string@|\meta{locale}|@account| is the label displayed
% prior to the sender's bank account number in the footer of the first
% page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@account{AN}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@tin}
% |\muletter@string@|\meta{locale}|@tin| is the label displayed
% prior to the sender's taxpayer's identification number in the footer
% of the first page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@tin{ID}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@vatin}
% |\muletter@string@|\meta{locale}|@vatin| is the label displayed
% prior to the sender's \textsc{vat} identification number in the footer
% of the first page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@vatin{Tax ID}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@afterfooter}
% |\muletter@string@|\meta{locale}|@afterfooter| is the text displayed
% after the footer of the first page in a letter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@afterfooter{%
  Please quote the Reference Number in your reply.}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@yourletter}
% |\muletter@string@|\meta{locale}|@yourletter| is the label displayed
% prior to the reference number and the sending date of the previous
% letter in a conversation in the opening matter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@yourletter{%
  Your Letter (Ref. No. / Date)}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@refno}
% |\muletter@string@|\meta{locale}|@refno| is the label displayed prior
% to the reference number of a letter in the opening matter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@refno{Reference Number}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@contactinfo}
% |\muletter@string@|\meta{locale}|@contactinfo| is the label displayed prior
% to the sender's signature and personal e-mail in the opening matter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@contactinfo{Contact / E-mail}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\muletter@string@english@placedate}
% |\muletter@string@|\meta{locale}|@placedate| is the label displayed prior
% to the sending date and the place from which a letter is being sent in
% the opening matter.
%    \begin{macrocode}
\newcommand*\muletter@string@english@placedate{Place / Date}%
%    \end{macrocode}
% \end{macro}
% \iffalse
%</class>
% \fi
