行距与行间距离

行距与行间距离

我想制作一篇文章,每行之间有行距,每个空格包含一条水平线。空间需要足够大才能手写笔记。下面的代码可以工作,但显然这种方法非常繁琐。

\documentclass{article}

\begin{document}

\section{introduction}

X-rays first discovered in 1895 are a form of Electromagnetic radiation 
with\\ 
\vspace{10pt} 
\hline 
\vspace{10pt}
\noindent    
wavelengths of the order of $10^{-10}m$ to simplify this an equivalent unit 
of\\ 
\vspace{10pt}
\hline
\vspace{10pt}
\noindent     
angstrom (A) is used. 

\end{document}

答案1

此解决方案用于\vsplit一次提取一行并重新格式化。目的\parbox是限制分页符的出现位置。

注意:\vspace在行尾之前不执行任何操作,而\vskip只能在 vmode 中使用。

\documentclass{article}
\usepackage{environ}

\newsavebox{\myenvbox}

\NewEnviron{myenv}[2]% #1 = distance above line, #2 = distance below line
{\interlinepenalty=-10000
  \setbox\myenvbox=\vbox{\BODY}%
  \noindent
  \loop\ifdim\ht\myenvbox>0pt
    \setbox0=\vsplit\myenvbox to \ht\strutbox
    \parbox[b]{\textwidth}{\unvbox0\vskip#1\hrule}\vspace{#2}
  \repeat}

\begin{document}

\section{introduction}

\begin{myenv}{10pt}{10pt}
X-rays first discovered in 1895 are a form of Electromagnetic radiation 
with  
wavelengths of the order of $10^{-10}m$ to simplify this an equivalent unit 
of   
angstrom (A) is used.
\end{myenv}

\end{document}

演示

答案2

尝试

\documentclass{article}
\usepackage{lipsum}
\makeatletter
\def\mysettings{\bgroup%
\parindent=0pt %
\lineskip0pt %
\parskip0pt %
\def\\{\@@par\vspace{10pt}\hrule\vspace{10pt}}}
\makeatother

\def\endmysettings{\egroup}
\begin{document}

\section{introduction}
\begin{mysettings}
X-rays first discovered in 1895 are a form of Electromagnetic radiation 
with\\ 
wavelengths of the order of $10^{-10}m$ to simplify this an equivalent unit 
of\\ 
angstrom (A) is used.\\ 
\lipsum[1]

{\ttfamily\meaning\\}
\end{mysettings}

X-rays first discovered in 1895 are a form of Electromagnetic radiation 
with\\ 
wavelengths of the order of $10^{-10}m$ to simplify this an equivalent unit 
of\\ 
angstrom (A) is used.
{\ttfamily\meaning\\}
\end{document}

我所做的是将 重新定义\\为更简单的形式。这是在组中完成的,因此它不会干扰原始定义。

答案3

使用包的简单解决方案ulem。您可以定义自己的强调例如,使用以下命令:

\newcommand\buline{\bgroup\markoverwith{\rule[-3ex]{.4pt}{.4pt}}\ULon}

可以根据需要对其进行微调、着色或用不同的线条样式(虚线等)替换。还可以\linespread{2.5}根据需要添加到序言中以增加行距。

\documentclass[12pt,a4paper]{article}
\usepackage{ulem}
\linespread{2.5}
\begin{document}

\newcommand\buline{\bgroup\markoverwith{\rule[-3ex]{.4pt}{.4pt}}\ULon}

\section{introduction}

\buline{%
X-rays first discovered in 1895 are a form of Electromagnetic radiation 
with 
wavelengths of the order of $10^{-10}m$ to simplify this an equivalent unit 
of 
angstrom (A) is used.}

\end{document}

在此处输入图片描述

相关内容