LaTeX forum ⇒ Comments & Wishes\vphantom bug Topic is solved

General comments, feature, category or forum wishes for this LaTeX community
User avatar
thomasb
Posts: 76
Joined: Thu Aug 03, 2017 10:54 am
Location: france

\vphantom bug  Topic is solved

Postby thomasb » Thu Aug 03, 2017 4:25 pm

Here :
  1. \documentclass{book}
  2. \newcommand{\intervalle}[4]{\mathopen{#1}#2\mathpunct{};#3\mathclose{#4}}
  3. \newcommand{\intervalleoo}[2]{\intervalle
  4. {\left.
  5. {\vphantom{\int_0^1}} % the problem comes from here... comment-uncomment
  6. \right]}
  7. {#1}{#2}
  8. {\left[ \right.}}
  9. \begin{document}
  10. Here it always works : $\intervalleoo{0}{2\pi}$
  11. \subsection{Here it doesn't always work : $\intervalleoo{0}{2\pi}$}
  12. \end{document}


[SOLVED] : add
  1. \protected\def\myphantom#1{\vphantom{#1}}
Last edited by thomasb on Sat Aug 05, 2017 11:45 pm, edited 2 times in total.

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8529
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Fri Aug 04, 2017 6:51 pm

That's because \vphantom is a fragile command.

You could protect it from breaking:

  1. \protected\def\myphantom#1{\vphantom{#1}}
  2.  
  3. \newcommand{\intervalleoo}[2]{\intervalle
  4. {\left.
  5. {\myphantom{\int_0^1}} % the problem comes from here... comment-uncomment
  6. \right]}
  7. {#1}{#2}
  8. {\left[ \right.}}


Stefan
Site admin


Return to “Comments & Wishes”

Who is online

Users browsing this forum: No registered users and 2 guests