Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was adding some mark up for a roughdraft of a document I'm working on. But when I eliminated the mark up, the spacing and linebreaks came out differ.

My intention was to create boxes of zero height, depth, and width that I could insert in various places in my document to help in writing during the roughdraft stage of writing. I was under the impression that, since these boxes were zeroed out, they would not have any effect upon the appearance of the underlying text formatting. Generally, these boxes do not appear to effect the appearance of the document whether or not they are present.

However, I recently had a paragraph which was heavily marked up for the rough draft. When I eliminated the mark up, the formatting of the paragraph completely changed.

I tried figuring out what about my commands was causing the problem. My first guess was that because I was placing the mark up at the beginning of each sentence this was effecting the spacing. So, I tried an example, where my mark up followed the initial word of the sentence. This change did not have any effect.

I then tried a number of different scenarios:

  • One where I replaced the mark up with just {}.
  • One where I defined the mark up just as \relax.
  • One where I defined the mark up as an empty command: ie \renewcommand{\aes}{}
  • One where I removed everything related to the mark up.

But whichever of these I used, there was no apparent different in the final document.

What I'm wondering is why the zeroed boxes are creating the effect that they are when there's not apparent effect in any of the other 4 scenarios.

Here is a MWE which illustrated what I'm talking about.

\documentclass{article}
\newcommand{\aes}{\makebox[0pt]{\raisebox{1ex}[0pt][0pt]{\textbf{Q}}}}
\pagestyle{empty}
\begin{document}

 \verb=\aes= defined as \verb=\makebox[0pt]{$+$}=\vspace{1cm}

 {\aes}Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
 {\aes}Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
 {\aes}Curabitur dictum gravida mauris.
 {\aes}Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
 {\aes}Donec vehicula augue eu neque.
 {\aes}Pellentesque habitant morbi tristique senectus et netus et malesuada A fames ac turpis egestas.
 {\aes}Mauris ut leo.
 {\aes}Cras viverra metus rhoncus sem.
 {\aes}Nulla et lectus vestibulum urna fringilla ultrices.
 {\aes}Phasellus eu tellus sit amet tortor gravida placerat.
 {\aes}Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
 {\aes}Praesent eget sem vel leo ultrices bibendum.
 {\aes}Aenean faucibus.
 {\aes}Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
 {\aes}Curabitur auctor semper nulla.
 {\aes}Donec varius orci eget risus.
 {\aes}Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam.
 {\aes}Duis eget orci sit amet orci dignissim rutrum.
 {\aes}Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 {\aes}Morbi auctor lorem non justo.
 {\aes}Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 {\aes}Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
 {\aes}Morbi ac orci et nisl hendrerit mollis.
 {\aes}Suspendisse ut massa.
 {\aes}Cras nec ante.
 {\aes}Pellentesque a nulla.
 {\aes}Cum sociis natoque penatibus et magnis dis parturient montes, 

\pagebreak

 \verb=\aes= still defined as \verb=\makebox[0pt]{$+$}= but not the item in the sentence.\vspace{1cm}

 Lorem{\aes} ipsum dolor sit amet, consectetuer adipiscing elit.
 Ut{\aes} purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
 Curabitur{\aes} dictum gravida mauris.
 Nam{\aes} arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
 Donec{\aes} vehicula augue eu neque.
 Pellentesque{\aes} habitant morbi tristique senectus et netus et malesuada A fames ac turpis egestas.
 Mauris{\aes} ut leo.
 Cras{\aes} viverra metus rhoncus sem.
 Nulla{\aes} et lectus vestibulum urna fringilla ultrices.
 Phasellus{\aes} eu tellus sit amet tortor gravida placerat.
 Integer{\aes} sapien est, iaculis in, pretium quis, viverra ac, nunc.
 Praesent{\aes} eget sem vel leo ultrices bibendum.
 Aenean{\aes} faucibus.
 Morbi{\aes} dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
 Curabitur{\aes} auctor semper nulla.
 Donec{\aes} varius orci eget risus.
 Duis{\aes} nibh mi, congue eu, accumsan eleifend, sagittis quis, diam.
 Duis{\aes} eget orci sit amet orci dignissim rutrum.
 Nam{\aes} dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 Morbi{\aes} auctor lorem non justo.
 Nam{\aes} lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 Donec{\aes} aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
 Morbi{\aes} ac orci et nisl hendrerit mollis.
 Suspendisse{\aes} ut massa.
 Cras{\aes} nec ante.
 Pellentesque{\aes} a nulla.
 Cum{\aes} sociis natoque penatibus et magnis dis parturient montes, 

\pagebreak
 \renewcommand{\aes}{\relax}   

 Is it an issue with the parentheses?\vspace{1cm}

 {}Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
 {}Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
 {}Curabitur dictum gravida mauris.
 {}Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
 {}Donec vehicula augue eu neque.
 {}Pellentesque habitant morbi tristique senectus et netus et malesuada A fames ac turpis egestas.
 {}Mauris ut leo.
 {}Cras viverra metus rhoncus sem.
 {}Nulla et lectus vestibulum urna fringilla ultrices.
 {}Phasellus eu tellus sit amet tortor gravida placerat.
 {}Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
 {}Praesent eget sem vel leo ultrices bibendum.
 {}Aenean faucibus.
 {}Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
 {}Curabitur auctor semper nulla.
 {}Donec varius orci eget risus.
 {}Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam.
 {}Duis eget orci sit amet orci dignissim rutrum.
 {}Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 {}Morbi auctor lorem non justo.
 {}Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 {}Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
 {}Morbi ac orci et nisl hendrerit mollis.
 {}Suspendisse ut massa.
 {}Cras nec ante.
 {}Pellentesque a nulla.
 {}Cum sociis natoque penatibus et magnis dis parturient montes, 

\pagebreak
 \renewcommand{\aes}{\relax}   

 \verb=\aes= defined as \verb={\relax}=\vspace{1cm}

 {\aes}Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
 {\aes}Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
 {\aes}Curabitur dictum gravida mauris.
 {\aes}Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
 {\aes}Donec vehicula augue eu neque.
 {\aes}Pellentesque habitant morbi tristique senectus et netus et malesuada A fames ac turpis egestas.
 {\aes}Mauris ut leo.
 {\aes}Cras viverra metus rhoncus sem.
 {\aes}Nulla et lectus vestibulum urna fringilla ultrices.
 {\aes}Phasellus eu tellus sit amet tortor gravida placerat.
 {\aes}Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
 {\aes}Praesent eget sem vel leo ultrices bibendum.
 {\aes}Aenean faucibus.
 {\aes}Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
 {\aes}Curabitur auctor semper nulla.
 {\aes}Donec varius orci eget risus.
 {\aes}Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam.
 {\aes}Duis eget orci sit amet orci dignissim rutrum.
 {\aes}Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 {\aes}Morbi auctor lorem non justo.
 {\aes}Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 {\aes}Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
 {\aes}Morbi ac orci et nisl hendrerit mollis.
 {\aes}Suspendisse ut massa.
 {\aes}Cras nec ante.
 {\aes}Pellentesque a nulla.
 {\aes}Cum sociis natoque penatibus et magnis dis parturient montes, 

\pagebreak
 \renewcommand{\aes}{}   

 \verb=\aes= defined as \verb={}=\vspace{1cm}

 {\aes}Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
 {\aes}Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
 {\aes}Curabitur dictum gravida mauris.
 {\aes}Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
 {\aes}Donec vehicula augue eu neque.
 {\aes}Pellentesque habitant morbi tristique senectus et netus et malesuada A fames ac turpis egestas.
 {\aes}Mauris ut leo.
 {\aes}Cras viverra metus rhoncus sem.
 {\aes}Nulla et lectus vestibulum urna fringilla ultrices.
 {\aes}Phasellus eu tellus sit amet tortor gravida placerat.
 {\aes}Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
 {\aes}Praesent eget sem vel leo ultrices bibendum.
 {\aes}Aenean faucibus.
 {\aes}Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
 {\aes}Curabitur auctor semper nulla.
 {\aes}Donec varius orci eget risus.
 {\aes}Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam.
 {\aes}Duis eget orci sit amet orci dignissim rutrum.
 {\aes}Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 {\aes}Morbi auctor lorem non justo.
 {\aes}Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 {\aes}Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
 {\aes}Morbi ac orci et nisl hendrerit mollis.
 {\aes}Suspendisse ut massa.
 {\aes}Cras nec ante.
 {\aes}Pellentesque a nulla.
 {\aes}Cum sociis natoque penatibus et magnis dis parturient montes, 

\pagebreak

 \verb=\aes= not used.\vspace{1cm}

 Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
 Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
 Curabitur dictum gravida mauris.
 Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
 Donec vehicula augue eu neque.
 Pellentesque habitant morbi tristique senectus et netus et malesuada A fames ac turpis egestas.
 Mauris ut leo.
 Cras viverra metus rhoncus sem.
 Nulla et lectus vestibulum urna fringilla ultrices.
 Phasellus eu tellus sit amet tortor gravida placerat.
 Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
 Praesent eget sem vel leo ultrices bibendum.
 Aenean faucibus.
 Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
 Curabitur auctor semper nulla.
 Donec varius orci eget risus.
 Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam.
 Duis eget orci sit amet orci dignissim rutrum.
 Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
 Morbi auctor lorem non justo.
 Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
 Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi.
 Morbi ac orci et nisl hendrerit mollis.
 Suspendisse ut massa.
 Cras nec ante.
 Pellentesque a nulla.
 Cum sociis natoque penatibus et magnis dis parturient montes, 

\end{document}
share|improve this question
1  
i haven't time to test this now, but i have a small suggestion for the text -- as a verb, "effect" means to cause to happen; "affect" means to influence or cause an effect (noun). i'm pretty sure you mean "affect" for the verb. –  barbara beeton Jun 24 '13 at 22:32
    
@barbarabeeton. Thank you. I always find this confusing: particularly given the meaning of effect as a noun. –  A.Ellett Jun 24 '13 at 22:55

2 Answers 2

up vote 7 down vote accepted

If you want to prefix your word as in the first example you need

\newcommand{\aes}{%
  \makebox[0pt]{\raisebox{1ex}[0pt][0pt]{\textbf{Q}}}\nolinebreak\hspace{0pt}}

So there is a space word before the following word.

For the second usage, as a suffix you want

\renewcommand{\aes}{%
  \nolinebreak\hspace{0pt}\makebox[0pt]{\raisebox{1ex}[0pt][0pt]{\textbf{Q}}}}

As noted in the other answer, a box prevents hyphenation.

share|improve this answer
    
Couldn't you combine both, as in \nolinebreak\hspace{0pt}\makebox[0pt]{\raisebox{1ex}[0pt][0pt]{\textbf{Q}}}\nol‌​inebreak\hspace{0pt}? –  Xavier Jun 24 '13 at 22:45
    
@A.Ellett the first or second definition? –  David Carlisle Jun 24 '13 at 23:00
1  
@Xavier no as if you use the combined version as a suffix it will end with \nol‌​inebreak\hspace{0pt} which will prevent a break at the following word space as a sequence of discard able items starting with a penalty is controlled by that penalty. (could probably use the latex kernel \@bsphack..\@esphack tomake a combined version. (I +1 your answer by the way:-) –  David Carlisle Jun 24 '13 at 23:04
    
I was pretty sure there was something that made you not combine them :) I saw \bsphack and \esphack once before, but don't know their exact definitions (yet) to use them securely. Either Yoav should define two version of \aes, or you should enlighten us on \bsphack, because otherwise having to \renewcommand every time is not much better than having to define the hyphens manually (which is a pain) :) –  Xavier Jun 24 '13 at 23:41

This looks like a hyphenation issue. With \aes defined to something not empty / \relax, words "attached" to the command don't get hyphenated properly.

More particularly, the issue is with "Curabitur" on the ninth line. Replace in your code

{\aes}Curabitur auctor semper nulla.

by

{\aes}Cur\-abitur auctor semper nulla.

telling TeX how to hyphenate the "word" {\aes}Curabitur, and you will get the expected output.

share|improve this answer
    
Thank you for the suggestion. I'm going with @davidcarlisle 's answer because, since this is a mark up for a rough draft I don't want to have to think about non-hyphenation merely caused by such mark up. But +1pt for pointing out the mechanics of what's going wrong. :) –  A.Ellett Jun 24 '13 at 22:57
    
@A.Ellett Please do! I indeed just pointed out what the issue was, and was busy figuring out the best solution when David posted his answer :) –  Xavier Jun 24 '13 at 23:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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