2

I'm relatively new to Latex and I'd like to know if there is the possibility to include in the .tex document instructions to the compiler to make the compiling process a bit cleaver.

For example, I'd like to italicize all instances of the word 'software'. I'm writing in portuguese and that word it foreign and should go in italic. More, italicizing all instances include italicizing 'Software', 'softwares' and 'Softwares'. Subtle variations of the same word. If there were such thing as scripting I could write a code that could search for 'oftware', the common part, and make the corresponding word italic.

Of course I could write my own scrit in some language that operates on the .tex file, but it would be neat to have it inside the .tex file to write it once and forget about it during the writing of the document and subsequente compilations.

Thank you

  • 3
    you could do this fairly easily in luatex or with more complications and restrictions in classic tex (there are some answers on site) but I would not do that if your document is at all complicated. Such a filter would be very invasive and almost bound to break some package code loaded. Compared to just running a simple external filter or regexp-replace in your editor which is much safer. – David Carlisle Jun 21 '16 at 10:10
  • I tend to use some kind of markup, say \markup[options]{word} and then let options decide what to do with word, for example make it italic and index it under terminology, then the formatting is controlled from the preamble. – daleif Jun 21 '16 at 10:24
  • Here is a related question that may help. Answers there offer several strategies. Which is best for you depends on how many words, how often each occurs, and whether you know them in advance: tex.stackexchange.com/questions/271633/… – Ethan Bolker Jun 21 '16 at 12:22
  • @daleif Is there a question or answer on this site where I can see that approach in action? – Dr. Manuel Kuehner Jul 23 '17 at 21:58
  • @DrManuelKuehner not in my case, it is a private package. Though it is a basic use of the xkeyval package – daleif Jul 23 '17 at 22:04
4

Using csplain and encTeX:

\mubytein=0

\mubyte\Sw  Software\endmubyte
\mubyte\Sws Softwares\endmubyte
\mubyte\sw  software\endmubyte
\mubyte\sws softwares\endmubyte

\def\Sw{{\it Software}} \def\Sws{{\it Softwares}}
\def\sw{{\it software}} \def\sws{{\it softwares}}

\mubytein=1


Aha, here is software and so softwares.

\bye

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.