如果可能的话,我想使用下面的代码来改变连续线之间的距离(此处的高度距离为 1 厘米)以及线条的粗细。
我需要像我的 MWE 中一样缩进页眉的参考编号和页面。我可以更改颜色和不透明度。如果可能的话,我想要一页行,我可以用简单的代码更改行高距离、行不透明度、行粗细和行颜色
% !TeX program = xelatex
% !TeX spellcheck = en_GB
\documentclass[11pt,addpoints]{exam}
\usepackage{amsmath} % need for fractions
\usepackage{amssymb}%need this for square boxes
\usepackage{mathptmx}% this for heavy font also charter
\usepackage{graphicx}
\usepackage{float}
\pagestyle{head}
\usepackage{parskip}% this stops indent of first line in paragraph
\headrule % puts a line under the header
\header{ Reference number
}{ }{Page}
\usepackage{geometry}
\newgeometry{left=0.4in ,right=1.5cm, top=0.6in, bottom=0.75in}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
%\pagestyle{empty}
\begin{tikzpicture}[remember picture,overlay ]
\foreach \i in {1,2,...,27}{
\draw[lightgray,opacity=1 ] ($(current page.north west)+(0,-\i)$) -- ($(current page.north east)+(0,-\i)$) ;}
\end{tikzpicture}
\end{document}
答案1
改编
- 我添加了两个可以设置的新长度:
\ymin
定义第一行应该在哪里,以及\lineheight
定义两条线之间的距离。
\ymax
经过计算就可以知道必须画多少条线。- 可以使用选项设置线条粗细
line width=<length>
。
代码
% !TeX program = xelatex
% !TeX spellcheck = en_GB
\documentclass[11pt,addpoints]{exam}
\usepackage{amsmath} % need for fractions
\usepackage{amssymb}%need this for square boxes
\usepackage{mathptmx}% this for heavy font also charter
\usepackage{graphicx}
\usepackage{float}
\pagestyle{head}
\usepackage{parskip}% this stops indent of first line in paragraph
\headrule % puts a line under the header
\header{ Reference number
}{ }{Page}
\usepackage{geometry}
\newgeometry{left=0.4in ,right=1.5cm, top=0.6in, bottom=0.75in}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\newlength{\ymin}
\newlength{\lineheight}
\setlength{\lineheight}{7mm}
\setlength{\ymin}{15mm}
\pgfmathsetmacro{\ymax}{int((299mm - \ymin) / \lineheight)}
\begin{tikzpicture}[remember picture, overlay]
\foreach \i in {0, ..., \ymax}{
\draw[lightgray, opacity=1, line width=.4pt] ($(current page.north west)+(0,-\ymin-\i*\lineheight)$) -- ($(current page.north east)+(0,-\ymin-\i*\lineheight)$);
}
\end{tikzpicture}
\end{document}