# Inserting text automatically with macros in Kile

In WinEdt you can insert text automatically with internal programmable macros. You can do this in Kile or other frontend editor? Can be direct in file.tex via shell or bash on Ubuntu. I need insert:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{amssymb,amsfonts,indentfirst}
\usepackage[centertags]{amsmath}
\usepackage[normalem]{ulem}
\usepackage{enumerate,multicol,subfig}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\everymath{\displaystyle}
\graphicspath{{figuras/}}

\begin{document}

\end{document}

-

Since you want to insert what looks like a complete document, you should use a template as described in the online documentation which provides the instructions below. Once you have a template you can select that when you start a new document.

The easiest way to create a new template is to start the wizard, and then add commands in the editor. Once you have your document set up the way you like:

Go to File;

Choose Create Template from Document;

Make any corrections necessary to the template;

Enter a name for your new template;

-
Thank you Peter. Still, it is possible that this is done via the bash shell or script? –  Regis da Silva Sep 16 '11 at 19:47
You just need to find the directory where the templates are stored and save the template there. –  Peter Grill Sep 16 '11 at 22:13

In Kile's menu there is LaTeX->User Tags. You can easily insert your text there and in Setup->Hot Keys select the Hotkey (by default Ctrl+Shift+1 for first text, Ctrl+Shift+2 for second ...).

-

I use vim to edit my files and it has plugins that would allow what you want to do. Latex-suite is one. I also use a general code snippets plugin called SnipMate.

-
and sed commands on linux? –  Regis da Silva Sep 17 '11 at 2:50
sed seems like a very difficult way of editing a Tex file. I have tried Kile, TexMaker and vim, and I like vim the best. And I mostly use the SnipMate plugin for vim because I can define my own snippets of Tex code to insert as I type my documents. –  ravl1084 Sep 18 '11 at 21:41
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6950225234031677, "perplexity": 2925.720532096478}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-42/segments/1413510834349.43/warc/CC-MAIN-20141017015354-00011-ip-10-16-133-185.ec2.internal.warc.gz"}