# How to print the content of a macro to the terminal

I am writing letters of application to various companies and to speed up the process I have few macros defined in my .tex file i.e.

\def\company{ Company name ABCDEF }


I know that one can do

\typeout{\company}


and this will echo the macro to the .log file and to the console output, but somehow this didn't produce any output to the terminal.

For "compiling" the .tex file I use pdflatex

Since it is much easier I would like to see the output in my compile console. I usually use kile (linux) and TeXnicCenter (windows). Both of them produce output on the screen and it would be very helpful to see the content of the macros. It would be even greater if those messages are in red color.

• Did you try \show\mymacroname? – GuM Mar 11 '16 at 19:55
• What does not work mean? Is your \def\... in a group and are you trying to access \typeout{\company} outside of the group? – user31729 Mar 11 '16 at 19:56
• @GustavoMezzetti: The backdraw of \show is that it stops the compilation – user31729 Mar 11 '16 at 19:56
• @ChristianHupfer I am not getting any output to the terminal. – Alexander Cska Mar 11 '16 at 19:57
• @ChristianHupfer: yes indeed. It’s not very clear what the question is asking for, actually. – GuM Mar 11 '16 at 19:58

This works for me:

\documentclass{article}

\gdef\company{ Company name ABCDEF }

\begin{document}
\typeout{\company}

\end{document}


• Danke Christian. I just tried your example in Kile and I didn't get the output. Only executing pdflatex inp.txt on the Linux terminal would do this, but I would like to use the text editor fro compiling. It is much neater. – Alexander Cska Mar 11 '16 at 20:05
• @AlexanderCska: I've never needed such an 'editor' for almost 20 years and I have done some theses and papers and my everydays work with an ordinary editor like 'emacs'. Most likely Kile has a weird setting that prevents this – user31729 Mar 11 '16 at 20:07
• @AlexanderCska: The output is only seen in the terminal or logfile, not in the pdf! – user2478 Mar 11 '16 at 20:09
• @Herbert: Isn't the console output already clear from the question? – user31729 Mar 11 '16 at 20:11
• Well I also program in vi etc. but find it easier to use. Actually I used to generate such messages, but this was quite some time ago. – Alexander Cska Mar 11 '16 at 20:11
\documentclass{article}
\gdef\company{ Company name ABCDEF }
\begin{document}

\show\company

\typeout{Makroinhalt: \company}

\end{document}


Then run the document with pdflatex -interaction=nonstopmode <file> and you'll get on the terminal:

voss@shania:~> pdflatex -interaction=nonstopmode zz
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./zz.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo)) (./zz.aux)
> \company=macro:
-> Company name ABCDEF .
l.5     \show\company

Makroinhalt:  Company name ABCDEF
(./zz.aux) )
(see the transcript file for additional information)
No pages of output.
Transcript written on zz.log.

• There is a method to do the same with Kile – Alexander Cska Mar 11 '16 at 20:17
• you can run the document in terminal mode and, of course, all GUIs have already -interaction=nonstopmode set, otherwise it is not possible to handle the compilations. However, run the document from within kile and then view the logfile. – user2478 Mar 11 '16 at 20:23
• Some time ago I found here a method to produce on purpose warning messages on the terminal. Unfortunately, I can't find the thread now. – Alexander Cska Mar 11 '16 at 21:10