创建简单模板

创建简单模板

我被要求为我的一个朋友制作一个简单的 LaTeX 模板。这是我的尝试:

\documentclass[
  danish,
  a4paper,
  12pt
]{article}


\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[
  hmargin=2.4cm,
  vmargin=3cm
]{geometry}
\usepackage{fancyhdr}
\usepackage{graphicx}
%\usepackage{enumitem} Maybe include.
\usepackage{microtype}


\DisableLigatures[f]{encoding=T1}

\setlength\parindent{1em}

\pagestyle{fancy}
\renewcommand*\headrulewidth{0pt}
\setlength\headheight{42.5pt}
\addtolength{\textheight}{-29pt}
\lhead{}
\rhead{\rule{100pt}{38.1424pt}} % Insert logo here via \includegraphics.
\cfoot{\scriptsize Læreruddannelsen i Århus, Trøjborgvej~$82$, $8200$~Aarhus~N, telefon~$87\,55\,30\,00$}


\begin{document}

\vspace*{\baselineskip}
\begin{center}
  \textbf{%
    {\LARGE\MakeUppercase{bacheloropgave}}\\[\baselineskip]
    Emenvalg og -begrundelse\\
    (2007-uddannelsen)\\
  }
  {\scriptsize Jf. Bekendtgørelse om uddannelsen til professionsbachelor som lærer i folkeskolen, $\S~10$}
\end{center}
\vspace{4ex}

\noindent\textbf{Fag}\\
Something\\[1.2\baselineskip]
\textbf{Emne}\\
Something\\[1.2\baselineskip]
\textbf{Emnebegrundelse}\\
Something
\vspace{4ex}

\noindent\textbf{Navn}\\
Something\\[1.2\baselineskip]
\textbf{Studienummer} \hspace{5em}    \textbf{Stamhold}\\
$123\,456$            \hspace{9.01em} $12.34$\\[1.2\baselineskip]
\textbf{Underskrift}

\end{document}

我的主要问题是,当我\hspace{5em}在文档底部使用时,我不知道如何自动垂直对齐“Stamhold”和“12.34”;这9.01em是通过目测找到的。

如果对该模板还有其他意见,请告诉我。

PS 标题的宽度\rule经过精确设置,与徽标的标题高度相同。

答案1

为了对齐。

\begin{tabular}{@{}l @{\hspace{5em}}   l}
\textbf{Studienummer}  &   \textbf{Stamhold}\\
$123\,456$            & $12.34$
\end{tabular}

通过非常快速地完成它,不包括徽标。我还想让标题更好,但今天没有时间了。

\documentclass[
  danish,
  a4paper,
  12pt
]{memoir}


\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\setlrmarginsandblock{2.4cm}*1
\setulmarginsandblock{3.5cm}{4cm}* 

\checkandfixthelayout

\usepackage{graphicx}
\usepackage{eso-pic,picture,calc}
\usepackage{microtype}

\AddToShipoutPicture{
  \put(\paperwidth-\foremargin,\paperheight-2.5cm){\llap{\rule{100pt}{38.1424pt}}}
}

\usepackage{environ,etoolbox}

\newcommand\Generator[1]{
  \NewEnviron{#1}{\subsubsection*{#1}\BODY}}

\Generator{Fag}
\Generator{Emne}
\Generator{Emnebegrundelse}
\Generator{Navn}
\Generator{Underskrift}

\setlength\aftersubsubsecskip{1sp}

\newenvironment{Studieinfo}{
  \par\vskip-\beforesubsubsecskip % negative length
  \noindent
  \begin{tabular}{@{}l @{\hspace{5em}}   l}
    \textbf{Studienummer}  &   \textbf{Stamhold}\\
  }{
  \end{tabular}
}

\DisableLigatures[f]{encoding=T1}

\makepagestyle{st} 
\makeoddfoot{st}{}{\scriptsize Læreruddannelsen i Århus,
  Trøjborgvej~82, 8200~Aarhus~N, telefon~87\,55\,30\,00}{}

\pagestyle{st}

\raggedbottom

\begin{document}

\begin{center}
  \bfseries
  {\LARGE\MakeUppercase{bacheloropgave}} % don't want \LARGE to mess
                                % with line spacing

  \vspace{1em}

  \normalsize
  Emenvalg og -begrundelse

  (2007-uddannelsen)

  \medskip

  \normalfont \scriptsize 
  Jf. Bekendtgørelse om uddannelsen til professionsbachelor som lærer
  i folkeskolen, \S~10
\end{center}

\vspace{3em}


\begin{Fag}
  Skrev noget her
\end{Fag}

\begin{Emne}
  Skrev noget her
\end{Emne}

\begin{Emnebegrundelse}
  Skriv noget her
\end{Emnebegrundelse}

\begin{Navn}
  Skriv dit navn her
\end{Navn}

\begin{Studieinfo}
  % Studienummer & Stamhold
  123\,456    & 12.34
\end{Studieinfo}

\begin{Underskrift}
  % just used to add a headline
\end{Underskrift}
\end{document}

补充:添加picutecalc。我希望不要关心 gfx 的宽度,所以我们将它包装进去\llap,这样只需要确定 gfx 的右下角应该放在哪里,这取决于 OP。

\paperwidth-\foremargin是文本块的右边缘

\paperheight-3cm是从纸张顶部开始的任意长度。

\usepackage{eso-pic,picture,calc}

\AddToShipoutPicture{
  \put(\paperwidth-\foremargin,\paperheight-3cm){\llap{\rule{100pt}{38.1424pt}}}
}

相关内容