Using the tool 'macro' in MS-word we can save any text 'word' or 'sentences'through a short cut key and use them using that key. As for example, I want to create a short cut key of the sentence This is a macro tool.to use later. In MS word we can save this sentence using 'Ctrl+K'(say).If I want to get the sentence ``This is a macro tool'' I have to press 'Ctrl+K'. Is there any such way in Latex ?

  • 2
    The key bindings are a function of the editor, but you have not said which editor you use. In latex of course you can define a macro as \newcommand\myword{This is a macro tool} and use it as \myword, But I think you are asking about an unspecified editor. – David Carlisle May 11 '13 at 18:59
  • I am using 'kile' on the system ubuntu. – Soumitra Sen May 11 '13 at 19:02
  • Have a look at autokey then... There are nice tutorials available, I wrote a German article on the installation once. uweziegenhagen.de/?p=1535, uweziegenhagen.de/?p=1590 – Uwe Ziegenhagen May 11 '13 at 19:02
  • I know nothing of Kile (but some people here use it I think, so you will probably get an answer) but generally since TeX is a macro processor, people use (La)TeX macros for such abbreviations rather than editor shortcuts. – David Carlisle May 11 '13 at 19:04

I use several tools for this purpose, depending on the operating system:

  • Windows: Autohotkey
  • Mac OS X: Textexpander
  • Linux: Autokey

As I do most of my work under Windows I know Autohotkey best. Here are a few of my shortcuts:

:*:desc#::\begin{{}description{}}`r\item[]`r\item[]`r\item[]`r\end{{}description{}}{UP 3}{LEFT}
:*:enum#::\begin{{}enumerate{}}`r\item `r\item `r\item `r\end{{}enumerate{}}{UP 3}
:*:f#::\frac{{}{}}{{}{}}{LEFT 3}
   Gestern = %A_Now%
   EnvAdd, Gestern, -1, Days
   FormatTime, Gestern, %Gestern%, dd.MM.yyyy
   Send, %Gestern%
   Heute = %A_Now%
   FormatTime, Heute, %Heute%, yyyyMMdd
   Send, %Heute%
:*:item#::\begin{{}itemize{}}`r\item `r\item `r\item `r\end{{}itemize{}}{UP 3}

Autohotkey can calculate dates, a feature I really like. So by typing h# I get today's date in YYYYMMDD. I wished I had learnt about this tool when I started TeXing...

Autokey has similar features plus it can run Python-scripts.

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.