6

I would like to make an article that has a line spacing between each line and each space contains a horizontal line. The space needs to be large enough for writing notes by hand. The code below works but obviously this method is very tedious.

\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}
0

3 Answers 3

2

This solution uses \vsplit to pull off one line at a time and reformat it. The \parbox is to restrict where pagebreaks can occur.

Note: \vspace doesn't do anything until the end of a line, whereas \vskip can only be used in 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}

demo

2

Try

\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}

What I have done is to redefine the \\ to a simpler form. This is done in a group, so it that it does not interfere with the original definition.

2
  • Excellent solution. But I have some suggestions: (a) Why not use \newenvironment; (b) Why not use \begingroup...\endgroup (see this answer)? Jul 19, 2018 at 3:22
  • It is simpler and I wrote it this way to make it simpler to understand. Jul 19, 2018 at 4:01
2

A simple solution using the ulem package. You can define your own underline style using, for example, the following command:

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

which can be fine tuned, colored, or replaced by a different line style (dashes, etc.) as required. Also add \linespread{2.5} to the preamble to increase line-spacing as needed.

\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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .