要素の移動や回転
ある要素を移動させたい場合以下のような関数が利用できます。他の要素の位置に注意して使用してください。
特定位置への要素の表示
Section titled “特定位置への要素の表示”#place
関数を使用することでページ上の特定位置に要素を表示することができます。要素の中ならばその要素の相対位置になります。
#block
関数でブロック領域を作りその中で#place
関数を使ってみます。灰色の部分がブロック領域です。
#let mybox(body, color: white)={ box(stroke: 1pt, fill: color, inset: 0.5em, body)}#block(height: 3cm, width: 100%, fill: gray)[#place(top+right)[#mybox([右上です], color: aqua)]#place(top+center, dy: 2em)[#mybox([中央上から2文字下です], color: yellow)]#place(bottom+right, dx: -0.5cm, dy: -0.5cm)[#mybox([右下から左に0.5cm上に0.5cmの位置です], color: green)]]
現在位置から指定位置への要素の移動
Section titled “現在位置から指定位置への要素の移動”#move
関数を使用すると要素の現在位置から指定された位置に要素を移動できます。
#let mybox(body, color: white)={ box(stroke: 1pt, fill: color, inset: 0.5em, body)}#move(dx: 3cm)[#mybox([移動した要素], color: teal)]#rect(inset: 0pt, move( dx: 6pt, dy: 6pt, rect( inset: 8pt, fill: white, stroke: black, [`#rect`の中で入れ子になって移動しています] )))
要素を回転させる
Section titled “要素を回転させる”#rotate
関数を利用して要素を指定した角度に回転させることができます。
#set text(fill: white)#align(center,block(fill: black, width: 100%, [ #place(left + horizon, dx: 6em)[ #rotate(-70deg)[*ローテート!*]] #rotate(-10deg)[ #rotate(45deg)[#block(radius: 100%, clip: true)[ #image("../img/nyan4.jpg", width: 3cm) ] ] このように要素が #rotate(30deg)[すべて] 指定された角度`deg`に回転します。 #rotate(25deg)[ #move(dx: 7em, dy: -8em)[入れ子になっていても大丈夫です。] ] ] ]))