15

I want to create a document which I can annotate by hand (that is, write above each word in pencil), but, unfortunately, the word length isn't a good indicator of how long the annotation is. I would like to have each word treated as if they were all of the same length so that the space between the end of one word and the start of the word after the next is the same. I hope I can make this clear:

Before:

Some sample text to indicate what I mean.

After:

     Some    sample    text      to       indicate       what         I          mean.

Note that shorter words, such as to and I have much larger spaces between the words to compensate for their shorter length. Thanks for any help.

  • 2
    You say "Note that shorter words, such as to and I have much larger spaces between the words to compensate for their shorter length." and before said "o that the space between the end of one word and the start of the next, next word is the same."... You have to be more clear of what you want... – koleygr Jun 22 '17 at 20:46
  • Those statements aren't meant to contradict each other. The spacing between the end of Some and the start of text, the end of sample and the start of to, the end of text and the start of indicate, and so on are meant to be equal (that is the amount of space between the word and the next, next word). This is accomplish by increasing the spacing between the words. I hope this clarifies. – Almacomet Jun 22 '17 at 20:51
  • Ok... the problem was "the end of one and the start of the next"... it was "and the start of the very next"... You have an answer... I think it is ok... – koleygr Jun 22 '17 at 21:04
  • 1
    I edited the question to make that point clearer -- please take a look and see if it's what you mean. – ShreevatsaR Jun 22 '17 at 21:08
  • @ShreevatsaR Yes, thanks for making the description clearer. – Almacomet Jun 22 '17 at 22:46
12

Because the words are equally spaced, they line up like an array, unless I turn on \parindent or \centering. I also added \doublespacing from setspace, since the whole idea is to have room for annotation.

Works across paragraphs. Don't try this in math mode. An optional argument allows the desired word width to be set.

With this solution, \fixlen calls on the recursion routine \fixlenpar, which will filter through the data a paragraph at a time as #1 until it runs out of paragraphs. It passes each paragraph to \fixlenword, which is also a recursion routine that filters through each successive paragraph a word at a time as #1. With each word, it places it in a fixed-width, center-aligned \makebox.

\documentclass{article}
\newcommand\fixlen[2][10ex]{\def\fixwidth{#1}\fixlenpar#2\par\relax}
\long\def\fixlenpar#1\par#2\relax{%
  \fixlenword#1 \relax%
  \ifx\relax#2\relax\def\next{}\else\par\def\next{\fixlenpar#2\relax}\fi\next}
\def\fixlenword#1 #2\relax{%
  \makebox[\fixwidth][c]{#1}%
  \ifx\relax#2\relax\def\next{}\else\ \def\next{\fixlenword#2\relax}\fi\next}

\parindent0pt\relax
\parskip 1em\relax
\usepackage{setspace}
\doublespacing
\begin{document}
\fixlen{%
I want to create a document which I can annotate by hand (that is, write above each word in pencil), but, unfortunately, the word length isn't a good indicator of how long the annotation is. I would like to have each word treated as if they were all of the same length so that the space between the end of one word and the start of the next, next word is the same. I hope I can make this clear

Before:

Some sample text to indicate what I mean.

Note that shorter words, such as to and I have much larger spaces between the words to compensate for their shorter length. Thanks for any help.}

\end{document}

enter image description here

  • Could you please explain your solution? What do the individual macros do? – Bananguin Jun 22 '17 at 21:58
  • @Bananguin I have updated the answer to do so. – Steven B. Segletes Jun 22 '17 at 22:21
  • 2
    if i were working with a text like this, i would like the left-hand edges of the words to line up. i think this can be done with the provided code simply by changing the optional [c] after \makebox[fixwidth] to [l]. granted, that would leave a very small space between "compensate for", but that's a subjective choice. – barbara beeton Jun 23 '17 at 0:05
  • 1
    @barbarabeeton I had, at first, it set with l alignment, but it looked even more tabular than ever, so I reverted to c. But indeed, the change is a simple one to make. – Steven B. Segletes Jun 23 '17 at 0:13
9

The inter-word spacing is controlled by three parameters; \fontdimen2 (the normal inter-word space), \fontdimen3 (the amount of stretch of the inter-word space), and \fontdimen4 (the amount of shrink). So, one possibility is to change these parameters as required.

\documentclass{article}
\begin{document}

\spaceskip=8\fontdimen2\font plus 1.5\fontdimen3\font
minus 1.5\fontdimen4\font

Some sample text to indicate what I mean.

\end{document}

enter image description here

  • This doesn't do exactly what the question asks for: it simply adds additional interword space of (26.66663pt plus 2.49998pt minus 1.66667pt) between words. For example even in your screenshot, the space between "sample" and "text" is pretty much the same as between "I" and "mean", even though "I" is much shorter than "sample". – ShreevatsaR Jun 22 '17 at 22:37
  • i.stack.imgur.com/pULJh.png -- this is what I get for the paragraph in the question. It doesn't match the description of "I would like to have each word treated as if they were all of the same length ". – ShreevatsaR Jun 22 '17 at 22:44
  • Thanks! This is another approach that would depend on personal preferences. As pointed out, it doesn't do quite what is asked and, in my view, instead assumes the annotation length is directly related to the word length. – Almacomet Jun 22 '17 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.