TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a lot of


in my text. In my editor I use automatic linebreaking to keep the text readable. Now it sometimes happens that lhe line breaks like this:


which produces a space between Ca and 2+.

Is there a way to write this code that it would ignore the linebreak or do I have to find a way to change the behaviour of my editor?

share|improve this question

migrated from stackoverflow.com Apr 13 '12 at 17:34

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner May 1 '12 at 17:42
up vote 3 down vote accepted

How about using semantic markup. I.e. you write what you mean and use macros to format it. That way if you change how you want the text formatted later you don't need to fix it all over the place.


Now you can write

Blah blah \Ion{Ca}{2+} blah blah.

Hopefully your text editor wont break that anywhere bad.

And if you decide you later want all your ions formatted in bold you can just change the macro

share|improve this answer
That's a good solution, thanks! – Dahaniel Apr 13 '12 at 12:04
As I only need Ca2+ I did it like: \def\ca2{Ca\textsuperscript{2+}} – Dahaniel Apr 13 '12 at 12:15
@Dahaniel: Note that technically you don't need to define it as \ca2, since the 2 does not form part of the command but actually the parameter list (since 2 is not a letter). – Werner Apr 13 '12 at 15:34

While using semantic markup seems preferable, adding a % (comment sign) after "CA" will conceal the line break and hereby get rid of the space.







enter image description here

share|improve this answer

Your Answer


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