我正在写一封求职信,模板上已经有了所有内容,除了我想添加 2 条边框线:
从左上角到 2/3 纸张高度
从右下到纸张长度的 2/3
在代码中我已经成功添加了垂直边框。如何添加水平边框?
\documentclass{article}
\usepackage{charter,graphicx}
\usepackage[margin=1in]{geometry}
\usepackage{blindtext}
\geometry{
total={200mm,297mm},
top={20mm},
tmargin={-3.5mm}
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{.4pt}% Default header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyhf{}% Clear header/footer
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{.4pt}% Default footer rule
\fancyhf{}% Clear header/footer
}
\AtBeginDocument{\thispagestyle{plain}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{.5\baselineskip plus 1pt minus 1pt}
\usepackage[scale=1,angle=0,opacity=1]{background}
\definecolor{myblue}{RGB}{30,100,200}
\backgroundsetup{
position=current page.north west,
color=myblue,
nodeanchor=north west,
contents={\rule{10pt}{198mm}}
}
\begin{document}
\includegraphics[width=1.5in,trim={7mm 7mm 0 0},clip]{example-image-a}% Your logo here
\hrulefill
\hfill
\begin{tabular}[b]{@{} l @{}}
\today\\[12pt] % Date
Email: julian.@
\end{tabular}
\vspace{\baselineskip}
Dear Admissions Committee% greeting
\bigskip
\blindtext[5]
\vspace{\baselineskip}
Yours faithfully% Closing text
\vspace{2\baselineskip}
Julian
\end{document}
答案1
您\rule
也可以将其用于水平规则。
我建议您,不要手动设置198mm
,而是使用.66\paperheight
,以及宽度的类似值.66\paperwidth
。
\documentclass{article}
\usepackage{charter,graphicx}
\usepackage[margin=1in]{geometry}
\usepackage{blindtext}
\geometry{
total={200mm,297mm},
top={20mm},
tmargin={-3.5mm}
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{.4pt}% Default header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyhf{}% Clear header/footer
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{.4pt}% Default footer rule
\fancyhf{}% Clear header/footer
}
\AtBeginDocument{\thispagestyle{plain}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{.5\baselineskip plus 1pt minus 1pt}
\usepackage[scale=1,angle=0,opacity=1]{background}
\definecolor{myblue}{RGB}{30,100,200}
\backgroundsetup{
position=current page.north west,
color=myblue,
nodeanchor=north west,
contents={\rule{10pt}{.66\paperheight}\raisebox{-10pt}{\raisebox{.66\paperheight}{\rule{.66\paperwidth}{10pt}}}
}
}
\begin{document}
\includegraphics[width=1.5in,trim={7mm 7mm 0 0},clip]{example-image-a}% Your logo here
\hrulefill
\hfill
\begin{tabular}[b]{@{} l @{}}
\today\\[12pt] % Date
Email: julian.@
\end{tabular}
\vspace{\baselineskip}
Dear Admissions Committee% greeting
\bigskip
\blindtext[5]
\vspace{\baselineskip}
Yours faithfully% Closing text
\vspace{2\baselineskip}
Julian
\end{document}