在页面的左上角画一个梯形

在页面的左上角画一个梯形

我想在页面左上角的适当位置绘制一个梯形(如下图所示)。我该怎么做?

布局

答案1

tikz

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[a4paper,margin=1in]{geometry}
\begin{document}
  \begin{tikzpicture}[remember picture,overlay]
    \fill[gray!50] (current page.north west) -- ($(current page.north west) +(0,-1.1in)$) -- 
        ($(current page.north west) +(1.8in,-1.5in)$) -- ($(current page.north west) +(2.5in,0)$)
          --  cycle;
    \draw[gray!50,line width=3pt] ($(current page.north) +(0,-1.3in)$) --
        ($(current page.north east) +(-1in,-1.3in)$) -- ($(current page.north east)
            +(-1in,-2.5in)$);
  \end{tikzpicture}
  {\Huge\bfseries\sffamily \textcolor{gray}{Name}}
\end{document}

在此处输入图片描述

更简单的版本:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[a4paper,margin=1in]{geometry}
\begin{document}
  \begin{tikzpicture}[remember picture,overlay]
    \fill[gray!50,rotate=-15] ($(current page.north west) +(0,-1in)$) rectangle
        ($(current page.north west) +(2.25in,2.5in)$);
    \draw[gray!50,line width=3pt] ($(current page.north) +(0,-1.3in)$) --
        ($(current page.north east) +(-1in,-1.3in)$) -- ($(current page.north east)
            +(-1in,-2.5in)$);
  \end{tikzpicture}
  {\Huge\bfseries\sffamily \textcolor{gray}{Name}}
\end{document}

在此处输入图片描述

这至少需要 2 次编译才能解决。

以已删除答案的形式回复原帖的质询:

你必须添加tikzpicture内部\begin{letter}

\documentclass{scrlttr2}
\usepackage{tikz}
\usetikzlibrary{calc}
 \begin{document} 

\setkomavar{subject}{Betreff: der Stein ist sehr groß}
\setkomavar{date}{\today}

\begin{letter}{
\begin{tikzpicture}[remember picture,overlay]
    \fill[gray!50,rotate=-15] ($(current page.north west) +(0,-1in)$) rectangle
        ($(current page.north west) +(2.25in,2.5in)$);
    \draw[gray!50,line width=3pt] ($(current page.north) +(0,-1.3in)$) --
        ($(current page.north east) +(-1in,-1.3in)$) -- ($(current page.north east)
            +(-1in,-10.5in)$);
  \end{tikzpicture}
  {\Huge\bfseries\sffamily \textcolor{gray}{Name}}

    Mulle Mullo\\
    Strasse 2\\
    12345 Ort}
\opening{Lieber Mulle,}
Ich mag Deinen Bauernhof nicht und sende Dir einen Staubsauger.
\closing{Mit freundlichen Grüßen}
\end{letter}

\end{document}

在此处输入图片描述

答案2

\documentclass{article}
\usepackage{graphicx,xcolor}
\AtBeginDocument{%
  \makebox(0,0){%
    \put(-200,230){%   change to whatever position you need
      \rotatebox[origin=rb]{-20}{\color{black!20}\rule{6cm}{4cm}}}}}
\begin{document}

foo

\end{document}

在此处输入图片描述

答案3

\makebox和 tikz的组合\put

\documentclass{article}
\usepackage{tikz}

\begin{document}

    \makebox(0,0){
        \put(-190,190){
            \begin{tikzpicture}
                \fill[gray!40] (0,5) -- (6,5) -- (4,0) -- (0,2) -- cycle;
            \end{tikzpicture}
        }
    }

    Name

\end{document}

在此处输入图片描述

相关内容