Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using: Latex -> pdfLatex, and also loading another tex file written by me with:

\input{\myPath anotherDocument.tex}
%% there is a "private" macro:
\def\foo#1{$\backslash$def$\backslash$#1$\{$the name$\}$}
%% doesn't compile without $

%% all happens before

1) Why can't I define the macro JUST like others ? Because all other macros are defined without $ but also contain commands like\foo{}.
2) What does $ do ?
3) What does * do ?
4) Why do some packages influence each other ?
5) Why is the Latex syntax inconsistent ?
6) What is wrong with Latex ?

share|improve this question

closed as not constructive by lockstep, Claudio Fiandrino, Stefan Kottwitz Nov 27 '12 at 13:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! I'm afraid ranting about LaTeX in a LaTeX community won't raise the probability of you getting helpful answers. As it stands, neither your example nor the formulation of your questions allows to understand what the problem really is. Please try to pose one question at a time and describe precisely what is happening and what you want to happen. If you really don't know what $ does, it is adviseable to read a basic introduction to LaTeX. –  Stephan Lehmke Nov 27 '12 at 13:16
The StackeExchange model works best with one query per question. As @StephanLehmke says, a rant about (La)TeX (however justified) will not help you get answers. –  Joseph Wright Nov 27 '12 at 13:23

1 Answer 1

  • Nothing is wrong with LaTeX.

  • The syntax of LaTeX may not be the best, but it is consistent.

  • Packages influence each other because it's the way software works.

  • * prints an asterisk; but in some cases, put after a command modifies its behavior.

  • $ enters math mode, for typesetting math formulas

  • You can define your \foo macro in a safe way. Just don't try typesetting backslashes.

You want that



\def\xyz{the name}

Thus you have to add a backslash to the argument or, better, to form a symbolic token with that name. This is available by \csname...\endcsname or, in the LaTeX kernel, by \@namedef:

\def\foo#1{\@namedef{#1}{the name}}

This is quite easy, isn't it?

What you did was to define


to produce

$\backslash$def$\backslash$xyz$\{$the name$\}$

which is good for printing something, not for definitions.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.