ItemStyle
詳細
- ItemStyle->s は,全項目にスタイル指定 s を使うように指定する.
- 項目のスタイル指定には,Itemの全オプションに加え,Styleのオプションも使うことができる.Directive[opt1,opt2,…]で複数のオプションが指定できる.
- 項目のスタイル指定は,その項目の内容だけでなく,項目のすべての範囲に適用されるので,例えば背景はその項目の端にまで及ぶ.
- ItemStyleの設定は次のように与えることで,個々の項目に別々に適用できる.
-
spec 全項目に spec を適用する {specx} 連続する水平位置に specxを適用する {specx,specy} 連続する水平および垂直位置に speckを適用する 
個々の i,j 要素への明示的な規則も許容する - speckの可能な形
-
{s1,s2,…,sn} s1から snまでを使い,次にデフォルトを使う {{c}} すべての場合に c を使う {{c1,c2}} c1と c2を交互に使う {{c1,c2,…}} すべての ciを循環的に使う {s,{c}} s を使い,次に c を繰り返し使う {s1,{c},sn} s1を使い,次に c を繰り返し使い,最後に snを使う {s1,s2,…,{c1,c2,…},sm,…,sn} 最初に siの最初のシーケンスを使い,次に ciを循環的に使い,最後に siの最後のシーケンスを使う {s1,s2,…,{},sm,…,sn} 最初に siの最初のシーケンスを使い,最後に最後のシーケンスを使う {i1->v1,i2->v2,…} 位置 ikで何を使うかを指定する {spec,rules} spec における指定を無効にするために rules を使う - ある特定の要素のスタイル指定に複数の speciまたは rules を使った場合,そのスタイルは指定順に組み合されたものとなる.
例題
すべて開く すべて閉じる例 (3)
Grid[Table[x, {4}, {7}], ItemStyle -> Red]Grid[Table[x, {4}, {7}], ItemStyle -> {Automatic, {Red}}]Grid[{{"h1", "h2", "h3"}, {x, x, x}, {x, x, x}}, ItemStyle -> {Automatic, {"Subsection"}}]スコープ (6)
Grid[Table[x, {4}, {7}], ItemStyle -> {{Blue, Red}, None}]Grid[Table[x, {4}, {7}], ItemStyle -> {{Blue, {}, Red}, None}]Grid[Table[x, {4}, {7}], ItemStyle -> {Automatic, {Blue, Red}}]Grid[Table[x, {4}, {7}], ItemStyle -> {{{Blue, Red}}, None}]フォントの色を交互にし,第1列と最終列にオレンジ色を重ねる:
Grid[Table[x, {4}, {7}], ItemStyle -> {{{{Blue, Red}}, {1 -> Orange, -1 -> Orange}}, Automatic}]Grid[Table[x, {4}, {7}], ItemStyle -> {Automatic, Automatic, {{1, 1} -> Red, {3, 3} -> Red}}]Grid[Table[x, {4}, {7}], ItemStyle -> {Automatic, Automatic, {{{1, 3}, {2, 4}} -> Red}}]Grid[Table[x, {4}, {7}], ItemStyle -> {1 -> Red, 1 -> 16}]一般化と拡張 (1)
Dataset中の負の数に赤で彩色する:
Dataset[Table[RandomReal[{-1, 1}], {5}, {3}], ItemStyle -> (If[# < 0, Red, Automatic]&)]特性と関係 (1)
BaseStyleを使って格子全体のスタイルが指定できる:
Grid[Table[x, {4}, {7}], BaseStyle -> Red]考えられる問題 (2)
Grid[Table[x, {4}, {7}], ItemStyle -> {1 -> Directive[Red, 14], 1 -> 16}]Directiveを使って複数のスタイル指示子を包み込む:
Grid[Table[x, {4}, {7}], ItemStyle -> Directive[FontSize -> 16, Red, Italic]]関連項目
テクニカルノート
-
▪
- 表と行列
関連するガイド
-
▪
- 格子と表
テキスト
Wolfram Research (2007), ItemStyle, Wolfram言語関数, https://reference.wolfram.com/language/ref/ItemStyle.html.
CMS
Wolfram Language. 2007. "ItemStyle." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ItemStyle.html.
APA
Wolfram Language. (2007). ItemStyle. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ItemStyle.html
BibTeX
@misc{reference.wolfram_2026_itemstyle, author="Wolfram Research", title="{ItemStyle}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/ItemStyle.html}", note=[Accessed: 31-October-2026]}
BibLaTeX
@online{reference.wolfram_2026_itemstyle, organization={Wolfram Research}, title={ItemStyle}, year={2007}, url={https://reference.wolfram.com/language/ref/ItemStyle.html}, note=[Accessed: 31-October-2026]}