0

Are there placeholders in LaTeX of the form:

A horse is \placeholder able to fly.

\placeholdertext{not}

which should produce an output like:

A horse is not able to fly.

So I look for an analogon of \footnotemark and \footnotetext that works with arbitrary content.

I would like to use that for example in combination with marginpar, when I want to explain some simple term in a paragraph with a complex tikz picture on the side:

Some long paragraph in which I mention some term\marginpar{\placeholder} that I want to explain on the side.

\placeholdertext{
    \begin{tikzpicture}
    % Picture for a better understanding of the used term.
    \end{tikzpicture}
}

Another paragraph with some term\marginpar{\placeholder} that I want to explain.

\placeholdertext{
    Some informative text...
}
  • 1
    I don't understand what you want. \newcommand{\placeholder}{not} is fine or not? – Romain Picot Jan 19 '16 at 13:18
  • Well, that's fine for one occurrence. But what if I would like to use this kind of placeholder repeatedly? Like in the example with \footnotemark and \footnotetext, I would like to mark the place where I want to add additional contents and then specify these contents after the paragraph. – user1742364 Jan 19 '16 at 13:21
  • @user1742364 your question is not at all clear, the obvious answer as Romain says is that TeX is a macro expansion language (which is another way of saying placeholder) and so \newcommand\placeholder{...} would appear to be the answer. perhaps you could expand the example in the question to show your requirement. (I do not see any connection to footnote currently) – David Carlisle Jan 19 '16 at 13:39
  • 1
    why do you need the \placeholder macro at all it does not seem to be doing anything useful, why not just put the tikzpicture in the marginpar (if you want to define \placeholder you can of course do that but a macro that is only used once for each definition is never really needed. – David Carlisle Jan 19 '16 at 13:48
  • @DavidCarliste, you are right that I do not really need it. It is only a matter of good looking and better structured LaTeX-code. It's the same thing with footnotes, I could define them at the place of their marker with \footnote but that would somehow destroy the paragraph - I prefer to use \footnotemark and later give the contents with \footnotetext. Of course I can define a command for each explaination, but then I would need to define dozens of commands that are used only once each, as you said, and the code for the tikzpicture/explaination/... would not be next to the paragraph. – user1742364 Jan 19 '16 at 13:55
1

Of course there are 'placeholders' in (La)TeX -- 'every' macro is a place holder that will be expanded to it's meaning (or is a primitive that does something different)

The xspace package is just for the correct spacing after the macro, but some will frown on this.

The question is now: Is it worth to use much of those place holders? Rather not.

In my opinion, it is better use a glossary, e.g. glossaries package.

\documentclass[a4paper]{scrartcl}

\usepackage{xspace}
\newcommand{\placeholder}{not\xspace}
\begin{document}

A horse is \placeholder able to fly.

\end{document}
  • Oh no a \xspace ;-) – Romain Picot Jan 19 '16 at 13:18
  • @RomainPicot: I see a conflict with.... you know whom I mean :D – user31729 Jan 19 '16 at 13:20
  • I added a full example to the original question to clarify what I want to achieve (hopefully :-) ) – user1742364 Jan 19 '16 at 13:29
  • @user1742364: That's a fragment and no full example – user31729 Jan 19 '16 at 13:30
1

You can use the todonotes package to insert not in the margin:

\documentclass{article}
\usepackage{todonotes}

\begin{document}
A horse is \todo{not} able to fly.
\end{document}

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.