调用 \begin{letter} 时在新页面上开始一个字母

调用 \begin{letter} 时在新页面上开始一个字母

这是我的乳胶代码。

\newenvironment{namesection}[3]{
    \centering
    {
        \sffamily
        \fontspec[Path = fonts/lato/]{Lato-Hai}\fontsize{40pt}{10cm}\selectfont #1 
        \fontspec[Path = fonts/lato/]{Lato-Lig}\selectfont #2
        \par
    }
    \vspace{5pt}
    \centering
    { 
        \color{headings}\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{14pt}\selectfont #3
        \par
    }
}

妇女权利委员会:

\documentclass[a4paper]{letter}
\usepackage[hmargin=1.25cm, vmargin=0.0cm]{geometry}
\usepackage{fontspec,xltxtra,xunicode,hyperref}
\setmainfont[Color=primary, Path = fonts/lato/]{Lato-Reg}
\signature{James A. Abrahamson}
\address{}
\begin{document}
\begin{namesection}{James A.}{Abrahamson}
{
        \href{mailto:[email protected]}{[email protected]} 
        | +44 90078601  \\ 
        Teletubby Land
}
\end{namesection}
\bigskip
\hrule
\begin{letter}{Recruitment \\ Morgan Stanley \\ 25 Cabot Square \\ Canary Wharf \\ London, UK }
\opening{Dear Sir or Madam:}
Hello, Letter Content.
\closing{Yours Faithfully,}
\end{letter}
%\end{minipage}
\end{document}

信件总是从新的一页开始,但我希望它从同一页开始。

答案1

tikz救命!我刚刚在顶部添加了一个背景图像。您可以根据需要将其移动到其他地方。我更改了字体,因为我没有字体。

% !TeX program = xelatex
\documentclass[a4paper]{letter}
\usepackage[hmargin=1.25cm, vmargin=0.0cm]{geometry}
\usepackage{fontspec,hyperref}
\signature{James A. Abrahamson}
\newenvironment{namesection}[3]{
    \centering
    {
        \sffamily
        \fontspec{Linux Libertine O}\fontsize{40pt}{10cm}\selectfont #1 
        \fontspec{Linux Libertine O}\selectfont #2
        \par
    }
    \vspace{5pt}
    \centering
    { 
        \color{blue}\fontspec{Linux Libertine O}\fontsize{11pt}{14pt}\selectfont #3
        \par
    }
}

\usepackage{tikzpagenodes}
\usepackage{lipsum}


\begin{document}
    

\begin{letter}{Recruitment \\ Morgan Stanley \\ 25 Cabot Square \\ Canary Wharf \\ London, UK } 
    \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}]
\node[align=center,anchor=north]{\parbox{\textwidth}{\begin{namesection}{James A.}{Abrahamson}
        {
            \href{mailto:[email protected]}{[email protected]} 
            | +44 900 78601  \\ 
            Teletubby Land
        }
        \end{namesection}
        \bigskip
        \hrule}
};
\end{tikzpicture}

\opening{Dear Sir or Madam:}


Hello, Letter Content.
\closing{Yours Faithfully,}
\end{letter}
%\end{minipage}
\end{document}

答案2

好的,如你所愿......

我所做的就是从中复制字母环境的代码letter.cls并删除\newpage命令。

这很可能会产生不良的副作用:买者自慎。

在此处输入图片描述

\documentclass{letter}




\makeatletter
\renewenvironment{letter}[1]
  {
    \if@twoside \ifodd\c@page
                \else\thispagestyle{empty}\null\newpage\fi
    \fi
    \c@page \@ne
    \c@footnote \z@
    \interlinepenalty=200 % smaller than the TeXbook value
    \@processto{\leavevmode\ignorespaces #1}}
  {\stopletter\@@par\pagebreak\@@par
    \if@filesw
      \begingroup
        \let\\=\relax
        \let\protect\@unexpandable@protect
        \immediate\write\@auxout{%
          \string\@mlabel{\returnaddress}{\toname\\\toaddress}}%
      \endgroup
    \fi}
\makeatother
\usepackage{lipsum}


\begin{document}

\lipsum[1]

\signature{Me}
\address{}
\begin{letter}{My mom}
    \opening{Dear Mom,}

\closing{See ya!}
\end{letter}
\end{document}

相关内容