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.

I'm wondering, say I have this definition

\newcommand\restrictedTo{\vert\sb}

to be used as $f \restrictedTo A$.

This works fine, but

$f \big \restrictedTo A$

fails, whereas

$\left. f \right \restrictedTo A$

work just fine.

Any suggestions for a better definition for \restrictedTo?

Edit: here is a full MWE:

\documentclass[a4paper]{article}
\newcommand\restrictedTo{\vert\sb}
\begin{document}
\[
  f \big\restrictedTo A
\]
\end{document}
share|improve this question

2 Answers 2

up vote 5 down vote accepted

David has already explained, that \big takes an argument, what breaks the original definition after \big. An alternative for redefining \big (and \Big, …) is to give \restrictedTo an optional argument:

\documentclass[a4paper]{article}
\newcommand*\restrictedTo[1][]{#1\vert\sb}
\begin{document}
\[
  f \restrictedTo A,
  f \restrictedTo[\big] A,
  f \restrictedTo[\Big] A
\]
\end{document}

Result

If you only want to have a lower position of A, then you would not need \big and the definition and usage can be simplified:

\documentclass[a4paper]{article}
\newcommand*\restrictedTo{{{}\vert}\sb}

\begin{document}
\[
  f \vert_A,
  f \restrictedTo A,
  f \big\vert_A
\]
\end{document}

Result with lower subscript

share|improve this answer
    
That was what I did, just hoped there was a better solution –  daleif Sep 19 '12 at 12:39

\right is a TeX primitive which expands tokens ahead of itself until it finds a non-expandable delimiter.

\big is a normal macro command that reads the next token as #1

\def\big#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}

so you could go

\expandafter\big \restrictedTo

But that isn't really very convenient.

It is probably safe in practice (although could break some things) to go

\let\oldbig\big
\def\big{\expandafter\oldbig}

then your initial example would work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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