Skip to content
puripuri2100 edited this page Dec 15, 2018 · 2 revisions

表組みのためのコマンドは以下のパッケージによって提供されます。

  • table.satyh
    • \tabular
  • tabular.satyh
    • \tabular
  • tabularx.satyh
    • \tabular

使い方

※table.satyhで提供される\tabularを想定しています。

\tabularコマンドの第一引数には表の中身を、第二引数には線の情報を与えます。

詳しくはThe SATySFibookの117ページを読んでください。

\tabular(fun t -> (
let (c, l, r) = (t#c, t#l, t#r) in
[
    [l {左揃え}; c {中央揃え}; r {右揃え} ];
    [l {左揃え} ; c {中央揃え}; c {ここは中央揃えです}];
]
))(fun xs ys -> (
  let thin = stroke 0.5pt Color.black in
  let thick = stroke 1pt Color.black in
  match (ys, List.reverse ys) with
  | (y0 :: y1 :: y2 :: _, ylast :: _) ->
    ( match (xs, List.reverse xs) with
      | (x0 :: x1 :: _ :: x3 :: _, xlast :: _) ->
        let gsY1 =
          [y1] |> List.map (fun y ->
            thin (Gr.line (x0, y) (xlast, y))) in
        let gsY2 =
          [y0; ylast] |> List.map (fun y ->
            thick (Gr.line (x0, y) (xlast, y))) in
        let gsX =
          [x1] |> List.map (fun x ->
            thin (Gr.line (x, y0) (x, ylast))) in
        List.concat [
          gsX; gsY1; gsY2;
        ]
      | _ -> []
      )
  | _ -> []
));
Clone this wiki locally