Skip to content

Commit

Permalink
Release 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yasuo-ozu committed May 27, 2022
1 parent edb329a commit 8b47a52
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
doc/*.satysfi-aux
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 0.1.1

## Add

- \sumT
- \strut
- \mstrut
- \rule
- \mrule
4 changes: 2 additions & 2 deletions Satyristes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

(library
(name "latexcmds")
(version "0.1.0")
(version "0.1.1")
(sources
(
(package "latexcmds.satyh" "./src/latexcmds.satyh")
Expand All @@ -18,7 +18,7 @@

(libraryDoc
(name "latexcmds-doc")
(version "0.1.0")
(version "0.1.1")
(workingDirectory "./doc/")
(build
(
Expand Down
Binary file modified doc/latexcmds-doc.pdf
Binary file not shown.
17 changes: 17 additions & 0 deletions doc/latexcmds-doc.saty
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ document (|
+p { 万年筆の良いところは、筆跡を見ただけで一瞬でそれと分かるところ。 }
+p { ボールペンの微妙なところは、筆跡を見ただけで一瞬でそれとバレるところ。 }
>
+p {
\code(`\strut`);や\code(`\mstrut`);を使うと、インラインテキスト及び数式中で高さが\code(`0.7\baselineskip`);, 深さが\code(`0.3\baselineskip`);の透明な箱を置くことができる。また、\code(`\rule ?:r w h`);を用いると、幅\code(`w`);, 高さ\code(`h`);で\code(`r`);だけ持ち上げた黒塗りの箱を置くことができる。
}
+p {
たとえば \code(`\rule ?:(1mm)(5mm)(2cm);`);とすると\rule ?:(1mm)(5mm)(2cm);となる。
}
>
+chapter{レイアウト} <
+p {
Expand Down Expand Up @@ -350,4 +356,15 @@ document (|
とすれば、${x' = \paren{x-vt}\paren{\math-middle{\frac{1}{1-\paren{\frac{v}{c}}^2}}}}となり、縦位置がバランスされる。
}
>
+chapter{シンボル} <
+p {
\SATySFi;で数式を扱う時は\code(`satysfi-azmath`);等のパッケージを使うことが推奨されるが、こういった有名パッケージに含まれない特殊文字を使いたくなることがある。\SATySFi;-LatexCmds では以下のシンボルをサポートしている。
}
+listing {
* \code(`\hbar`); ${\cdots \hbar}
* \code(`\varphi`); ${\cdots \varphi}
* \code(`\normalphi`); ${\cdots \normalphi}
* \code(`\sumT`); ${\cdots \sumT} (displaystyle版の和記号。\code(`\sumT_a^b`);と書くと${\sumT_a^b}となる。一方\code(`\sum_a^b`);と書くと${\sum_a^b}となる。)
}
>
>
4 changes: 2 additions & 2 deletions satysfi-latexcmds-doc.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "satysfi-latexcmds-doc"
version: "0.1.0"
version: "0.1.1"
synopsis: "LaTeX-like commands in SATySFi"
description: """LaTeX-like commands in SATySFi"""

Expand All @@ -12,7 +12,7 @@ bug-reports: "https://github.com/yasuo-ozu/satysfi-latexcmds/issues"
dev-repo: "git+https://github.com/yasuo-ozu/satysfi-latexcmds.git"

depends: [
"satysfi" {>= "0.0.5" & < "0.0.7"}
"satysfi" {>= "0.0.5" & < "0.1.0"}
"satysfi-dist"
"satyrographos" {>= "0.0.2.6" & < "0.0.3"}
]
Expand Down
4 changes: 2 additions & 2 deletions satysfi-latexcmds.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "satysfi-latexcmds"
version: "0.1.0"
version: "0.1.1"
synopsis: "LaTeX-like commands in SATySFi"
description: """LaTeX-like commands in SATySFi"""

Expand All @@ -12,7 +12,7 @@ bug-reports: "https://github.com/yasuo-ozu/satysfi-latexcmds/issues"
dev-repo: "git+https://github.com/yasuo-ozu/satysfi-latexcmds.git"

depends: [
"satysfi" {>= "0.0.5" & < "0.0.7"}
"satysfi" {>= "0.0.5" & < "0.1.0"}
"satysfi-dist"
"satyrographos" {>= "0.0.2.6" & < "0.0.3"}
]
Expand Down
50 changes: 49 additions & 1 deletion src/latexcmds.satyh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
%@require: fss/fss
%@require: fss/style
@require: list
@require: color

type vertical-align = Top | Bottom | Middle | Ratio of float
type horizontal-align = HLeft | HCenter | HRight | HRatio of float
Expand Down Expand Up @@ -45,6 +46,7 @@ module LatexCmds : sig
direct \hbar : [] math-cmd
direct \normalphi : [] math-cmd
direct \varphi : [] math-cmd
direct \sumT : [] math-cmd

% box
direct \mbox : [inline-text] inline-cmd
Expand All @@ -61,6 +63,10 @@ module LatexCmds : sig
direct \movebox : [length; length; inline-text] inline-cmd
direct \phantom : [inline-text] inline-cmd
direct \rotatebox : [float; inline-text] inline-cmd
direct \strut : [] inline-cmd
direct \mstrut : [] math-cmd
direct \rule : [length?; length; length] inline-cmd
direct \mrule : [length?; length; length] math-cmd

% direct \uline : [inline-text] inline-cmd
% direct \muline : [math] math-cmd
Expand Down Expand Up @@ -122,7 +128,6 @@ end = struct
let wid = w *' 0.5 in
let ib1 = embed-block-top ctx wid (fun ctx -> line-break false false ctx ib) in
let (_, h1, d1) = get-natural-metrics ib1 in
let () = display-message (show-float ((h1 +' d1 -' h -' d) /' 1pt)) in
h1 +' d1 -' h -' d

let get-min-gap-of-lines ctx =
Expand Down Expand Up @@ -174,6 +179,39 @@ end = struct
let-math \mquad = ${\mrquad!(1.0)}
let-math \mhquad = ${\mrquad!(0.5)}
let-math \mqquad = ${\mrquad!(2.0)}

let-inline ctx \rule ?:raiseopt w h =
let r = match raiseopt with
| Some(r) -> r
| None -> 0pt
in
inline-graphics w (h +' r) (length-max (0pt -' r) 0pt) (fun (x, y) -> (
if w >' 0.001pt then
[
start-path (x, y +' r) |> line-to (x +' w, y +' r)
|> line-to (x +' w, y +' r +' h) |> line-to (x, y +' r +' h)
|> close-with-line |> fill (Color.black)
]
else []
))

let-math \mrule ?:raiseopt w h = text-in-math MathOrd (fun ctx -> (
let r = match raiseopt with
| Some(r) -> r
| None -> 0pt
in
read-inline ctx {\rule ?:(r)(w)(h);}
))

let-inline ctx \strut =
let baselineskip = get-leading ctx in
read-inline ctx {\rule ?:(0pt -' (baselineskip *' 0.3)) (0pt) (baselineskip);}

let-math \mstrut =
text-in-math MathOrd (fun ctx -> (
let baselineskip = get-leading ctx in
read-inline ctx {\rule ?:(0pt -' (baselineskip *' 0.3)) (0pt) (baselineskip);}
))

let-math \mathopen it = text-in-math MathOpen (fun ctx -> read-inline ctx it)
let-math \mathclose it = text-in-math MathClose (fun ctx -> read-inline ctx it)
Expand Down Expand Up @@ -900,6 +938,16 @@ end = struct
))
))
let-math \varphi = ${\phi}
let-math \sumT = text-in-math MathOp (fun ctx -> (
let size = get-font-size ctx in
let ib = read-inline (set-font-size (size *' 1.3) ctx) (embed-string `∑`) in
let (iw, ih, id) = get-natural-metrics ib in
let ih = size *' 0.7 in
let id = size *' 0.05 in
inline-graphics iw ih 0pt (fun (x, y) -> [
draw-text (x, y -' (size *' 0.15)) ib
])
))

let-inline ctx \colorbox ?:popt color it =
let ib = read-inline ctx it in
Expand Down

0 comments on commit 8b47a52

Please sign in to comment.