오른쪽 여백에 선 그리기

오른쪽 여백에 선 그리기

LaTeX로 시험지를 준비해야 하고 시트의 오른쪽 여백에 두 개의 선을 그려야 하며 페이지 시작 부분에 "DO NOT WRITE IN THIS MARGIN"이라고 적혀 있습니다. 오른쪽 여백에 쓰는 방법이 있나요? 아니면 긴 테이블을 사용해야 하나요? 최소한의 예제를 게시하지 않으면 죄송하지만 시작하는 방법을 전혀 모릅니다!

행의 예는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

수직선은 시트 전체를 따라 계속되고 다음 페이지에서도 계속됩니다(처음에 동일한 레이블 사용).

건배

답변1

이것은 MWV입니다. 개선할 수 있습니다.

\documentclass[]{article}

\usepackage{geometry}
\usepackage{tikzpagenodes}
\usepackage{tikz}

\usetikzlibrary{backgrounds}
\geometry{left = 2cm, right = 1cm, marginparwidth = 2cm, includemp}

\begin{document}

\begin{tikzpicture}[remember picture, overlay, black]
  \coordinate (mNE) at (current page marginpar area.east |- current page header area.north);
  \coordinate (mNW) at (current page text area.west |- current page header area.north);

  \coordinate (mSE) at (current page marginpar area.east |- current page footer area.south);
  \coordinate (mSW) at (current page text area.west |- current page footer area.south);

  \begin{scope}[line width = 3pt]
    \draw[] (mNE) ++(0, -1cm) -- (mNE) -- ++(-1cm, 0);
    \draw[] (mNW) ++(0, -1cm) -- (mNW) -- ++(1cm, 0);
    \draw[] (mSE) ++(0, 1cm) -- (mSE) -- ++(-1cm, 0);
    \draw[] (mSW) ++(0, 1cm) -- (mSW) -- ++(1cm, 0);
  \end{scope}

  \draw (current page marginpar area.north east) -- (current page marginpar area.south east);
  \draw (current page marginpar area.north west) -- (current page marginpar area.south west);

  \node[left] at (current page marginpar area.north west) {MARKS};
  \node[right, text width = 2cm] at (current page marginpar area.north west) {DO NOT \\ WRITE IN\\ THIS \\ MARGIN};

\end{tikzpicture}

{\bf FORMULAE LIST} \par

The roots of $ax^2 + bx + c = 0$ are $\displaystyle{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}$

\end{document}

여기에 이미지 설명을 입력하세요

편집하다

모든 페이지에 이것을 포함하려면 everypage패키지를 사용하십시오

\AddEverypageHook{
  \begin{tikzpicture}[remember picture, overlay, black]
    \coordinate (mNE) at (current page marginpar area.east |- current page header area.north);
    \coordinate (mNW) at (current page text area.west |- current page header area.north);       
    \coordinate (mSE) at (current page marginpar area.east |- current page footer area.south);
    \coordinate (mSW) at (current page text area.west |- current page footer area.south);       
    \begin{scope}[line width = 3pt]
      \draw[] (mNE) ++(0, -1cm) -- (mNE) -- ++(-1cm, 0);
      \draw[] (mNW) ++(0, -1cm) -- (mNW) -- ++(1cm, 0);
      \draw[] (mSE) ++(0, 1cm) -- (mSE) -- ++(-1cm, 0);
      \draw[] (mSW) ++(0, 1cm) -- (mSW) -- ++(1cm, 0);
    \end{scope}       
    \draw (current page marginpar area.north east) -- (current page marginpar area.south east);
    \draw (current page marginpar area.north west) -- (current page marginpar area.south west);       
    \node[left] at (current page marginpar area.north west) {MARKS};
    \node[right, text width = 2cm] at (current page marginpar area.north west) {DO NOT \\ WRITE IN\\ THIS \\ MARGIN};
  \end{tikzpicture}
}

여기에 이미지 설명을 입력하세요

답변2

모든 페이지에 글쓰기를 원하므로 다음을 사용할 수 있습니다 eso-pic.

\documentclass{exam}
\usepackage[left=.5in, right=2in, marginparwidth=0pt]{geometry}
\usepackage{eso-pic}
\usepackage{ifthen}
\usepackage{tikz}
\usetikzlibrary{positioning}

% for testing purpose only:
\usepackage{mwe}
%\usepackage{showframe}

\begin{document}
    \AddToShipoutPictureBG{%
        \AtPageLowerLeft{% 
            \begin{tikzpicture}[overlay,remember picture]
            % angles
            \coordinate (pagene) at (.98\paperwidth,.98\paperheight);
            \draw[line width=4pt] (pagene) -- +(-1,0) -- (pagene) -- +(0,-1);
            \coordinate (pagenw) at (.02\paperwidth,.98\paperheight);
            \draw[line width=4pt] (pagenw) -- +(1,0) -- (pagenw) -- +(0,-1);
            \coordinate (pagese) at (.98\paperwidth,.02\paperheight);
            \draw[line width=4pt] (pagese) -- +(-1,0) -- (pagese) -- +(0,1);
            \coordinate (pagesw) at (.02\paperwidth,.02\paperheight);
            \draw[line width=4pt] (pagesw) -- +(1,0) -- (pagesw) -- +(0,1);
            \end{tikzpicture}}
        \ifthenelse{\value{page}>2}{% if page > 2 add:
        \AtPageLowerLeft{% 
            \begin{tikzpicture}[overlay,remember picture]
            % Writing at the very top
            \node[anchor=north east, align=center,
            font=\small] (W) 
            at (.95\paperwidth,.95\paperheight) 
            {DO NOT \\ WRITE IN\\ THIS \\ MARGIN};
            \node[anchor=north east, 
            font=\bfseries, align=right] 
            at (W.north west) {MARKS};
            % vertical lines
            \draw[thin] (W.north west) -- +(0,-.9\paperheight);
            \draw[thin] (W.north east) -- +(0,-.9\paperheight);
            % horizontal line
            \draw[thin] (W.south west) -- (W.south east);
            \end{tikzpicture}}%
        }{}%
        }

    % your content here 
    \textbf{FORMULAE LIST}

    The roots of $ax^2 + bx + c = 0$ are $\displaystyle{x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}}$

    % this is for testing purpose only:
    \blindtext[30]
\end{document}

1페이지만 모서리:

여기에 이미지 설명을 입력하세요

2페이지 모서리만:

여기에 이미지 설명을 입력하세요

3페이지부터 모서리, 선 및 글쓰기:

여기에 이미지 설명을 입력하세요

관련 정보