Text Formatting ⇒ Automatically add white space
-
- Posts: 11
- Joined: Mon Oct 18, 2010 2:14 pm
Automatically add white space
Is there a good application or command line tool that can easily achieve this ?
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
-
- Posts: 87
- Joined: Tue Sep 14, 2010 6:58 pm
Re: Automatically add white space
If I understand, you want to automatically insert a ~ between two words, say "Donald" and "Knuth", so that every instance they appear, they will always be on the same line together.
If that is the case, could you not simply define your own command so that \dk inserts "Donald~Knuth" or do a search and replace? Again, perhaps I'm not understanding the problem.
Automatically add white space
Sure, this can be done in a variety of ways. For example, with sed:
Code: Select all
sed '/\\begin{verbatim}/,/\\end{verbatim}/ !s/Donald Knuth/Donald~Knuth/g' input.tex > output.tex
But if you're not using a unix-based operating system, and don't have access to sed, I think I know how to do something similar with vim. If neither of those are options, certainly it could be done with something like perl. But why don't you tell us what operating system you are using?