2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TeXで集合を内包表記で綺麗に書く

Posted at

よくあるがあまりマクロを見かけない, 集合の内包表記.

set.sty
\def\defset#1#2{%
  \settoheight\@tempdima{$#1$}
  \settoheight\@tempdimb{$#2$}
  \ifdim \@tempdima<\@tempdimb
    \@tempdimc=\@tempdimb
  \else
    \@tempdimc=\@tempdima
  \fi
  \left\{ \> #1 \left\vert \rule{0pt}{1.1\@tempdimc} \right. #2 \> \right\}
}
\def\extdefset#1{%
  \settoheight\@tempdima{$#1$}
  \left\{ #1\rule{0pt}{2\@tempdima} \right\}
}
\let\set\extdefset
set.tex
$ f^{-1}(y) = \defset{ x \in X }{ f(x) = y } $
$ \defset{ (f,g) \in (X^Y)^2 }{ f(x) = g(x) } $

などの様に使う. どちらかが大きくなるとそれに伴って { | } が大きくなってくれる.
然し同じ様に\setを定義しようとすると上手くいかない. 何故...

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?