# Replace all spaces with hyphens

It is good practice for legal documents to have hyphens instead of spaces so nobody can add anything to a contract after signing it.

E.g.

------------------------------------------
------------Contract----------------------
------------------------------------------
The-parties-of-this-contract-agree-to-----
lorem-ipsum-dolor-sit-amet----------------
------------------------------------------


Could this be possible to achieve in LaTeX without the verbatim package?

-
I suspect the main problem with this is that in a justified layout (the LaTeX default) a space has a variable length, so replacing all spaces with a dash would not give the same layout. In fact if I remember correctly the output of latex doesn't actually use the space character to display an actual space, but I may be wrong on that one – ArTourter Aug 7 '12 at 22:21
Which jurisdiction are you operating in? I saw this in Poland in the 1990, but only used by real, old lawyers (60+) that didn't have a computer, and secretary to type on a typewriter. I have never seen it used since, and it was a leftover from the time with typewriters. Using justified text and a proportional font, nobody can add text to a contract today. An such layout make the contract unreadable. – Sveinung Aug 8 '12 at 7:31
@Sveinung: Line killing (matar líneas in Spanish, I couldn't find a translation) is used in notary documents, at least in Spain. Not between words, but at the end of the paragraph. Normally notaries use macros for Word, which the poor result of following hyphens (--------). Of course, this is a much more elegant solution! – user23286 Dec 13 '12 at 17:52
@Sveinung: well, sometimes the goal is to make the contract unreadable;). An on topic: what about chickenize? Wouldn't it help? – mbork Dec 13 '12 at 18:08
@Jamb: I converted your answer to two comments now. You can't post comments to other posts than your own until you got 50rep. – Martin Scharrer Dec 14 '12 at 10:32

This is probably incompatible with everything, but....

\documentclass{article}

\def\space{\leavevmode\leaders\hrule\hskip 0.5em plus .2em minus .2em\kern0pt }
{\obeyspaces\global\let =\space}
\def\center{%
\parindent0pt %
\everypar{\hrulefill}%
\def\par{\hrulefill\endgraf}%
\obeylines\obeyspaces
}
\def\endcenter{\par}

\def\flushleft{%
\parindent0pt %
\def\par{\hrulefill\endgraf}%
\obeylines\obeyspaces
}
\def\endflushleft{\par}

\begin{document}

\begin{center}
Contract
\end{center}
\begin{flushleft}
The parties of this contract agree to
lorem ipsum dolor sit amet
\end{flushleft}

\end{document}

-

Here's an option that uses the SOUL package. It seems to work reasonably well for basic input. Since SOUL commands can't be nested, it (to my knowledge) requires a separate macro for centering (\midl) and for struck spaces (\strikespace). Most font commands should be ok with this, but if you run into a macro that breaks things, you could try to "register" it with soul as I've done for the \fbox command: see the SOUL documentation for further details as well as for other possible sticking points. As always, the implementation could likely be improved and yes, this is also probably incompatible with almost everything.

Code:

\documentclass{article}
\usepackage{xparse}
\usepackage{soul}

\parindent0pt
\soulregister{\fbox}{1}
\makeatletter

\DeclareRobustCommand*\strikespaceaux{
\SOUL@ulsetup
\SOUL@stpreamble
\def\SOUL@everyspace##1{%
##1%
\hskip\spaceskip
\null
}
\def\SOUL@everysyllable{%
\the\SOUL@syllable
\SOUL@setkern\SOUL@charkern
}
\def\SOUL@postamble{%
\fillit
}
\SOUL@
}

\DeclareRobustCommand*\midlaux{
\def\SOUL@preamble{%
\dimen@\SOUL@ulthickness
\dimen@i=-.5ex
\edef\SOUL@uldepth{\the\dimen@i}%
\let\SOUL@ulcolor\SOUL@stcolor
\SOUL@uldp=\SOUL@uldepth
\SOUL@ulht=-\SOUL@uldp
\spaceskip\SOUL@spaceskip
\noindent\fillit}
\def\SOUL@everyspace##1{%
##1%
\hskip\spaceskip
\null
}
\def\SOUL@everysyllable{%
\the\SOUL@syllable
\SOUL@setkern\SOUL@charkern
}
\def\SOUL@postamble{%
\fillit
}
\SOUL@
}

\makeatother

\ExplSyntaxOn

\NewDocumentCommand {\strikespace}
{>{ \SplitList {\par}} +m}
{\tl_map_inline:nn {#1} {\strikespaceaux{##1}\par}}

\NewDocumentCommand{\midl}
{>{ \SplitList {\par}} +m}
{\tl_map_inline:nn {#1} {\midlaux{##1}\par}}

\ExplSyntaxOff

\begin{document}
\midl{\fbox{\large A title}}
\midl{\textbf{ Below you will find two paragraphs}\par \textbf{of lorem ipsum}\par}

\strikespace{
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras interdum, massa sit amet convallis vehicula, diam quam commodo lorem, placerat vehicula nulla lacus eu quam. Nunc et nulla libero, in bibendum felis. Nulla rutrum hendrerit nulla ac fringilla. In ultrices rutrum leo, non gravida elit porttitor eu. Quisque suscipit sapien a nunc tristique at blandit eros sagittis. Suspendisse potenti. Nulla enim nisi, pellentesque a suscipit nec, condimentum vel lacus. Mauris a elementum justo. Integer fermentum tempor ligula, ut ullamcorper nunc pretium ac.

Sed tempus mattis elit, nec faucibus nisl sagittis id. Nulla at neque libero. Donec fringilla, felis nec commodo porta, nibh quam mollis augue, et interdum lectus lectus ut ipsum. Donec ac tortor velit, quis mollis arcu. In dapibus laoreet accumsan. Nullam sed purus orci, ac porttitor velit. Pellentesque auctor nisl at odio pharetra mattis. Vestibulum purus ante, lacinia sit amet aliquet eleifend, blandit eget risus. Phasellus et erat augue, a commodo risus. Vestibulum semper enim in neque semper malesuada ut a magna. Praesent tellus odio, blandit ut interdum eu, tincidunt ac leo.
}

\end{document}

-
Great! What if one doesn't want the hyphens for spaces, but only to kill (?) the lines? I answer myself. I just commented both: %\SOUL@ulleaders – user23286 Dec 13 '12 at 17:52
I'm using Scott H's template in a file using utf8, but I can't introduce non ASCII characters. How could I solve it? (I'm sorry to publish it as an answer, I just wanted to add a comment to Scott's answer but I can't, and I'm not sure if I'll be able to some day...) – user37861 Oct 7 '13 at 12:41