-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfor-emath-macro-old.el
4314 lines (4313 loc) · 217 KB
/
for-emath-macro-old.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;; emath用の設定
;; funcall YaTeX-emath-setdash
;; \setdashおよびdash=の設定を行なう
;; ただし,dash=[offset]{setting}では[option]のときエラーを起こすので
;; (concat "dash={" (YaTeX-emath-setdash) "}")
;; のように設定すること
;;
;;zahyou環境に includeEPS,EPSfilename,debug,EPSclip,borderwidth
;; haiti=t|b|cで補正可能--> haiti=t|b|c(補正量)
;; skip(\skipCallPerlの有効/無効-->1/0)
;; prezahyou=..即実行?
;;\PutStr* [enkoH=単位付き数値]
;;
;; printf "% f:浮動小数点 d:10進整数 x:16進整数 o:8進整数"
;;
;; delq (elt list 0) list --> list 内の最初のアイテムを取り除く
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \begin{edaenumerate}<option>(indent)[Number form]% ;;;
;;; %useitem=falseの際は\\itemの代わりに\\edaitemを使用する ;;;
;;; \end{edaenumerate} ;;;
;;; option retusuu:横に並べる小問の数(2) ;;;
;;; gyoukan:縦方向の空白() ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-select-key-value "hoge" "[option]" `(("ふが" "fuga") ("あわわ" "awawa")) ;;;
;;; ``[option] 0:設定しない 1:ふが 2:あわわ: '' という選択肢を表示し ;;;
;;; 入力した数字によって 1 --> hoge=fuga 2 -->hoge=awawa という文字列を返す ;;;
;;; "hoge"を""としたときは 1--> fuga 2-->awawa という文字列を返す ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;(defun YaTeX-emath-select-key-value (key title lists &optional guides values)
;; (if (> (length lists) 0)
;; (let* ((guidelist `(,@guides ,(car (car lists))))
;; (valuelist `(,@values ,(nth 1 (car lists)))))
;; (YaTeX-emath-select-key-value key title (cdr lists) guidelist valuelist))
;; (let* ((emtitle (cond ((> (length title) 0)(concat title " "))))
;; (emnum (YaTeX-emath-get-number-from-list title guides)))
;; (if (or (< emnum 1)(> emnum (length guides))) ""
;; (YaTeX-emath-option-combine "=" `(,key ,(nth (- emnum 1) values)))))))
;; mapcar の存在を知ってループさせずに済む
(defun YaTeX-emath-select-key-value (key title lists)
(let* ((guidelist (mapcar 'car lists));;lists内の各々のリストに対してcarを実行して新たなリストを作成
(valuelist (mapcar '(lambda (x) (nth 1 x)) lists));;mapcarの第1引数が引数をとる関数のときの処理
;; この無名関数はリストの引数を1つとりその2番目の要素を返す
;; すなわち valuelist は lists の要素である各々のリストに対して2番目の要素を次々と取り出して並べたリスト
(emnum (YaTeX-emath-get-number-from-list title guidelist)))
(if (or (< emnum 1)(> emnum (length guidelist))) ""
(YaTeX-emath-option-combine "=" `(,key ,(nth (- emnum 1) valuelist))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-get-number-from-list "[option]" `("ほげ" "ふが" "あわわ") "attention" ;;;
;;; YaTeX-emath-select-key-value の下請け関数 ;;;
;;; "[option] 1:ほげ 2:ふが 3:あわわ attention" と表示し数字の入力を促し,入力された数値を返す ;;;
;;; 単独で (cond ((= num 1)(...))((= num 2)(...))(()())) ;;;
;;; などの num の設定にも使える ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-get-number-from-list (title guides &optional addguide)
(message (format "%s%s%s: "
(if (> (length title) 0)(concat title " ")"")
(YaTeX-emath-make-guide 1 guides)
(if (> (length addguide) 0) addguide "")))
(let* ((string (read-char)))
(string-to-number (char-to-string string))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-make-guide 0 `("ほげ" "ふが" "あわわ") ;;;
;;; listから中身を順に取り出し ``0:ほげ 1:ふが 2:あわわ'' ;;;
;;; のように番号付けをした文字列を作り出す ;;;
;;; 第1引数が 1 なら ``1:ほげ 2:ふが 3:あわわ'' となる ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; さらにmapcarとmapconcatをつかってwhileすら必要なくなった
(defun YaTeX-emath-make-guide (num guides)
(let* ((emnum num)
(emlist (mapcar '(lambda (x) (prog1 (format "%s:%s " emnum x)
(setq emnum (+ emnum 1)))) guides)))
(mapconcat 'concat emlist "")))
;; whileを使ってループさせずに済む
;; setqは必ずglobalかと思ったが使い方の問題だったみたい
;; letで値を設定してからwhileのBODYで使用する分には大丈夫なようだ
;;(defun YaTeX-emath-make-guide (num guides)
;; (let* ((emnum num)(emguide ""))
;; (concat (while (< emnum (+ (length guides) num))
;; (setq emguide (concat emguide (format "%s:%s " emnum (nth (- emnum num) guides))))
;; (setq emnum (+ emnum 1)))
;; emguide)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX:fuga () YaTeX-emath-select-key-value の使用例 ;;;
;;; [option] 0:設定しない 1:ほげ 2:ふが 3:あわわ 4:およよ という選択肢を表示し ;;;
;;; 入力した数値によって 1->key=hoge 2->key=fuga 3->key=awawa 4->key=oyoyo を返す ;;;
;;; 1<=num<=4以外の値だと "" を返す ;;;
;;; 第1引数の"key"を""とすると 1->hoge 2->fuga 3->awawa 4->oyoyo を返す ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-list-or-not (lists)
(if (listp lists) (message (format "リストだよ[%s]" lists)) (message (format "リストじゃないよ[%s]" lists))))
(defun YaTeX:fuga ()
;; (YaTeX-list-or-not `(("ほげ" "hoge") ("ふが" "fuga"))))
(YaTeX-emath-select-key-value "key" "[option]" `(("ほげ" "hoge") ("ふが" "fuga") ("あわわ" "awawa") ("およよ" "oyoyo"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-option-combine separator optionlist ;;;
;;; optionlist の中身を separator で繋げる ;;;
;;; そのとき前後の変数のどちらか "" であれば separator はつかない ;;;
;;; YaTeX-emath-option-combine "," `("hoge" "fuga") "awawa,oyoyo" ;;;
;;; という使い方もできるが, ;;;
;;; YaTeX-emath-option-combine "," `("awawa" "oyoyo" "hoge" "fuga") ;;;
;;; と変わらない ;;;
;;; リストに変数 var1,var2,var3 がある場合は `(,var1 ,var2 ,var3) と指定する ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; mapconcat の存在を知ってループさせずに済むようになる
;; split-string の説明に``文字列の先頭や末尾で一致した場合には、リストの先頭や末尾に空文字列は現れない。''
;; と書かれていて,その例が``(split-string "out to moo" "o+") => ("ut t" " m")''だったので
;; ",,hoge,fuga,,awawa,,,,oyoyo,,"という文字列を`,+'で分割したら
;; ("hoge" "fuga" "awawa" "oyoyo")になると思ったら("" "hoge" "fuga" "awawa" "oyoyo" "")だった...orz
;; 仕方がないからoptionが連なった文字列optionsを作成した後,optionsの前後にseparatorを付加し
;; split-string options separator+ を実行してリストを作り先頭と末尾のリストの要素" "を取り除いた
;; split-string の 第3引数の存在を知る
;; split-string string separators omit-nulls において,omit-nulls が`t'ならzero-length substrings
;; をオミットする
;; ヘルプだけじゃなく (defun split-string で検索してみるもんだね
;; `separator'でリストの要素を接合して`空要素'を除くように`separator+'でリストに分解し
;; そのリストの要素を`separator'で接合する
;; 具体的には`separator'が`,'のとき (a "" b "" c d "" "" "" e f "" "") から
;; a,"",b,"",c,d,"","","",e,f,"","" という文字列を作ってから (a b c d e f) というリストを作り
;; そこから a,b,c,d,e,f という文字列を作る
(defun YaTeX-emath-option-combine (separator oplist)
(let* ((emlist (split-string (mapconcat 'concat oplist separator) (concat separator "+") t)))
(mapconcat 'concat emlist separator)))
(defun YaTeX:hogehoge ()
(YaTeX-emath-option-combine "=" `("" "hoge" "" "" "fuga" "awawa" "" "oyoyo" "" "" "" "arere" "" "")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-setoption options str guide leftbrace rightbrace default ;;;
;;; options に guide を表示して str=leftbrace input_words rightbrace ;;;
;;; を加えるleftbrace および rightbrace は省略可能 ;;;
;;; defaultを指定するとミニバッファからの入力時にdefalut初期値になる ;;;
;;; 下の YaTeX:hoge() が使用例 ;;;
;;; ``[option] guide: ''と表示して文字入力を促す ;;;
;;; 入力した文字列([RET]で""を入力することも可)を ``str=input_strings'' ;;;
;;; (""の場合は"")として options の最後に ``,'' を介して接続する ;;;
;;; どちらかが "" の場合は ``,'' は付かない. ;;;
;;; leftbrace rightbrace が指定されていれば ;;;
;;; ``str=leftbrace input_strings rightbrace'' となる ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;(defun YaTeX-emath-setoption (options key guide &optional leftbrace rightbrace default)
;; (let* ((temp (read-string (format "[option] %s: " guide) default))
;; (option (concat options
;; (if (string= temp "") ""
;; (concat (if (string= options "") ""
;; (concat ","))
;; key "=" leftbrace temp rightbrace)))))
;; (concat option)))
(defun YaTeX-emath-setoption (options key guide &optional leftbrace rightbrace default)
(let* ((temp (read-string (format "[option] %s: " guide) default))
(emleft (if leftbrace leftbrace ""))
(emright (if rightbrace rightbrace ""))
(emoption (concat options ","
(if (> (length temp) 0) (format "%s=%s%s%s" key emleft temp emright) "")))
(emlist (split-string emoption "," t)))
(mapconcat 'concat emlist ",")))
(defun YaTeX:hoge ()
(let* ((option (YaTeX-emath-setoption "" "linewidth" "線の太さ" nil nil ".4pt"))
(option (YaTeX-emath-setoption option "iro" "線の色"))
(option (YaTeX-emath-setoption option "houi" "方位" "{" "}" "s")))
(if (string= option "") ""
(concat "[" option "]"))))
(defun emath-set-dash ()
(let* ((emnum (YaTeX-emath-get-number-from-list "[option] 破線の設定" `("hasenLG" "dash" "指定しない")))
(option (cond ((= emnum 1) (concat "hasenLG={"
(YaTeX:read-coordinates "[option] hasenLG :" "描画部(1mm)" "ギャップ部(.9mm)")
"}"))
((= emnum 2) (concat "dash={"
(YaTeX-emath-setdash)
"}"))
(t ""))))
(concat option)))
(defun YaTeX-emath-drawline-option ()
(let* ((option "")
(emnum 0)
(option (YaTeX-emath-setoption "" "color" "色の指定"))
(option (YaTeX-emath-setoption option "linethickness" "線の太さの指定"))
(line ""))
(progn (setq emnum (YaTeX-emath-get-number-from-list "[option] 線種の指定" `("hasenLG" "dash" "ten" "指定しない"))
line (concat (cond ((= emnum 1) (concat "hasenLG={"
(read-string "[option] hasenLGの設定 描画部(1mm): ")
","
(read-string "[option] hasenLGの設定 ギャップ部(.9mm): ")
"}"))
((= emnum 2) (concat "dash={" (YaTeX-emath-setdash) "}"))
((= emnum 3) (concat "ten=" (read-string "点の個数: ")))
(t ""))))
(setq option (YaTeX-emath-option-combine "," `(,option ,line)))
(concat option))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-setdash () ;;;
;;; ``[num0]{num1,num2,num3,num4,...,num2n-1,num2n}'' の入力を促す ;;;
;;; ``num0''は[RET]で省略可.後続の数字の列は必ず2個1組で入力させ,num2k-1のときは ;;;
;;; ``描画部の長さ([RET]で終了): ''と表示する ;;;
;;; \setdash の引数を入力させる\setdash の他にオプション引数の ;;;
;;; dash= の設定にも使えるただし,dash=では"dash={" (YaTeX-emath-setdash) "}" ;;;
;;; のように設定しないとオフセットの[]がTeXでのエラーの原因となる可能性がある ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-setdash ()
(let* ((offset (read-string "[option] オフセットの設定: ")))
(concat (if (string= offset "") ""
(concat "[" offset "]"))
"{" (YaTeX-emath-setdash-loop) "}")))
(defun YaTeX-emath-setdash-loop (&optional setting)
(let* ((line (read-string "描画部の長さ([Enter]で終了): ")))
(if (string= line "")
(concat setting)
(let* ((space (read-string "非描画部の長さ: "))
(lines (YaTeX-emath-option-combine "," `(,setting ,line ,space))))
(YaTeX-emath-setdash-loop lines)))))
;;; YaTeX-emath-setarrow () 引数を省略すると軸の指定はしない
(defun YaTeX-emath-setarrow (&optional ziku-or-not)
(let* ((emop (read-string "[option] 窪みの比率(省略可): ")))
(concat (if (string= emop "") ""
(concat "<" emop ">"))
"{" (if ziku-or-not (read-string "軸の太さ(3): ") "")
"}{" (read-string "鏃の太さ(25): ") "}{"
(read-string "鏃の長さ(50): ") "}")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-tenretu-loop guide separator seq ;;;
;;; "guide: "を表示してseqにseparatorで区切りながら点列を追加し続ける ;;;
;;; seqは省略可能というか最初は設定しない.この関数が利用する ;;;
;;; 使用例 YaTeX-emath-tenretu-loop "線分の端点" ";" ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-tenretu-loop (separator guide &optional seq)
(let* ((empoint (read-string (format "%s: " guide))))
(if (> (length empoint) 0)
(let* ((empoint (YaTeX-emath-option-combine separator `(,seq ,empoint))))
(YaTeX-emath-tenretu-loop separator guide empoint))
(concat seq))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-Put-HouiSitei () ;;;
;;; 直交座標指定 :(xunit,yunit)(0,10pt)[l] ;;;
;;; 極座標指定 :[r](r,θ) [r](2,60)[c] ;;;
;;; 簡易指定 :n,ne,e,se,s,sw,w,nw [ne] ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;(defun YaTeX-emath-Put-HouiShitei ()
;; (let* ((emnum (read-number "[option] 1:簡易指定 2:直交座標指定 3:極座標指定: "))
;; (option (cond ((= emnum 1)(YaTeX:read-position "news"))
;; ((= emnum 2)(YaTeX:read-coordinates "(x,y)単位付き成分を指定: "))
;; ((= emnum 3)(concat "[r]" (YaTeX:read-coordinates "(r,θ)単位付き長さを指定: ")))
;; (()()))))
;; (concat option
;; (if (= emnum 1) ""
;; (YaTeX:read-position "rcltb")))))
(defun YaTeX-emath-Put-HouiShitei ()
(let* ((emnum (YaTeX-emath-get-number-from-list "[option]" `("簡易指定" "直交座標指定" "極座標指定")))
(option (cond ((= emnum 1)(YaTeX:read-position "newsc"))
((= emnum 2)(YaTeX:read-coordinates "(x,y): "))
((= emnum 3)(concat "[r]" (YaTeX:read-coordinates "(r,θ): ")))
(t ""))))
(concat option
(if (= emnum 1) ""
(YaTeX:read-position "rcltb")))))
(fset 'YaTeX:yokoenumerate 'YaTeX:enumerate)
(fset 'YaTeX-intelligent-newline-yokoenumerate 'YaTeX-intelligent-newline-itemize)
(fset 'YaTeX:betaenumerate 'YaTeX:enumerate)
(fset 'YaTeX-intelligent-newline-betaenumerate 'YaTeX-intelligent-newline-itemize)
(fset 'YaTeX-intelligent-newline-edaenumerate 'YaTeX-intelligent-newline-itemize)
;\begin{edaenumerate}<#1>[#2]
; \item .....
; \item .....
; ...........
;\end{edaenumerate}
; #1: *横に並べる項目数
; または key=val
; retusuu:横に並べる項目数の指定
; syokiti:
; gyoukan:行間の指定[\vfillで均等割]
; edaLmargin:左インデントの指定
; edafirstindent:第1項のみに対する左インデント指定
; edatopsep:前段落との行間指定
; edabottomsep:後段落との行間指定
; #2: enumerate環境と同じく,項目番号の書式指定
;t-or-nil=t:edaitemを使用する環境
(defun emath-edaenumerate-option (&optional t-or-nil)
(let* ((emnum 0)
(option (YaTeX-emath-setoption "" "retusuu" "列数の指定(2)"))
(option (YaTeX-emath-setoption option "syokiti" "番号付けの初期値[設定値の次の自然数から始まる](0)"))
(option (YaTeX-emath-setoption option "gyoukan" "行間の指定[\\vfillで均等割]"))
(option (YaTeX-emath-setoption option "edaLmargin" "左インデントの指定"))
(option (YaTeX-emath-setoption option "edafirstindent" "第1項目に対する左インデント"))
(option (YaTeX-emath-setoption option "edatopsep" "前段落との行間指定"))
(option (YaTeX-emath-setoption option "edabottomsep" "後段落との行間指定"))
(emnum (if t-or-nil (YaTeX-emath-get-number-from-list "[option] edaenumerate環境下でのリスト環境" `("使用する" "使用しない")) 0))
(edaitem (cond ((= emnum 1) "useitem=false")
(t "")))
(option (YaTeX-emath-option-combine "," `(,option ,edaitem))))
(list emnum option)))
(defun YaTeX:edaenumerate ()
(let* ((option (emath-edaenumerate-option t))
(emnum (car option))
(option (car (cdr option))))
(concat (if (> (length option) 0)
(concat "<" option ">") "")
(if (y-or-n-p "[option] 項目番号の書式を設定しますか?: ")
(concat "[" (read-string "[option] 番号の書式: ") "]%") "")
"\n%\t広域でedaLmarginを設定するには\\edaLmarginを使用する"
(if (= emnum 1)
"\n%\t\\itemの使用不可\\edaitemを使用する"))))
;\begin{yokoenumerate}<#1>[#2]
; \item .....
; \item .....
; ...........
;\end{yokoenumerate}
; #1: edaenumerate環境に引き継がれるオプション
; #2: enumerate環境と同じく,項目番号の書式指定
(defun YaTeX:yokoenumerate ()
(let* ((option (emath-edaenumerate-option))
(emnum (car option))
(option (car (cdr option))))
(concat (if (> (length option) 0)
(concat "<" option ">") "")
(if (y-or-n-p "[option] 項目番号の書式を設定しますか?: ")
(concat "[" (read-string "[option] 番号の書式: ") "]%") "")
"\n%\t広域でedaLmarginを設定するには\\edaLmarginを使用する")))
;\begin{betaenumerate}<#1>[#2]
; \item .....
; \item .....
; ...........
;\end{betaenumerate}
; #1: key=val
; syokiti:番号付けの初期値を変更します。右辺値に指定した値の次の番号から始まります。
; edaLmargin:左インデントを指定します。
; postedasep:項目間の空きを調整します。
; betaraggedlines:最終行以外の行に対して両端揃えとするか否かのスイッチ
; betaraggedlastline:最終行を両端揃えとするか否かのスイッチ
; #2: enumerate環境と同じく,項目番号の書式指定
(defun YaTeX:betaenumerate ()
(let* ((option (YaTeX-emath-setoption "" "syokiti" "番号付けの初期値[設定値の次の自然数から始まる](0)"))
(option (YaTeX-emath-setoption option "edaLmargin" "左インデントの設定"))
(option (YaTeX-emath-setoption option "postedasep" "項目間の空きの調整"))
(emnum (YaTeX-emath-get-number-from-list "[option] 最終行以外の行の両端揃え" `("する" "しない")))
(lines (cond ((= emnum 1) "betaraggedlines=true")
(t "")))
(emnum (YaTeX-emath-get-number-from-list "[option] 最終行の両端揃え" `("する" "しない")))
(lastline (cond ((= emnum 1) "betaraggedlastline=true")
(t "")))
(option (YaTeX-emath-option-combine "," `(,option ,lines ,lastline))))
(concat (if (> (length option) 0)
(concat "<" option ">") "")
(if (y-or-n-p "[option] 項目番号の書式を設定しますか?: ")
(concat "[" (read-string "[option] 番号の書式: ") "]%"))
"\n%\t広域でpostedasepを設定するときは\\setpostedasepコマンドを使用する"
"\n%\t広域で両端揃え・左揃えを設定するときは\\betaraggedlinesfalse,\\betaraggedlastlinefalse"
"\n%\t\\betaraggedlinestrue,\\betaraggedlastlinetrueを使用する")))
(defun YaTeX-emath-lineto-func (guide &optional polar-or-not)
(concat (if polar-or-not (concat "[r]" (YaTeX:read-coordinates (format "%s(r,θ): " guide)))
(YaTeX:read-coordinates (format "%s(x,y): " guide)))
"%\\emCurPにカレントポイントが格納されている"))
(defun YaTeX:emlineto ()
(YaTeX-emath-lineto-func "移動先の指定"))
(defun YaTeX:emrlineto ()
(YaTeX-emath-lineto-func "移動先の指定" t))
(defun YaTeX:emmoveto ()
(YaTeX-emath-lineto-func "移動量の指定"))
(defun YaTeX:emrmoveto ()
(YaTeX-emath-lineto-func "移動量の指定" t))
(defun YaTeX:setdash ()
(YaTeX-emath-setdash))
;\hasenLG#1#2
; #1:実線部分の長さ(デフォルト値:1mm)
; #2:実線部分の間隔(デフォルト値:0.9mm)
(defun YaTeX:hasenLG ()
(insert (concat "{" (read-string "描画部の長さ(1mm): ") "}"
"{" (read-string "ギャップ部の長さ(.9mm)") "}%")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; YaTeX-emath-psovalbox-option ;;;
;;; \psovalbox のオプションの設定 ;;;
;;; linewidth=枠線の太さ ;;;
;;; dash=枠線の線種 ;;;
;;; ovalsep=枠線とテキストの間隔 ;;;
;;; ovalradius=コーナーの半径 ;;;
;;; iro=枠線の色 ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-psovalbox-option ()
(let* ((option (YaTeX-emath-setoption "" "linewidth" "枠線の太さ"))
(option (YaTeX-emath-setoption option "ovalsep" "枠線とテキストの間隔(\\fboxsep)"))
(option (YaTeX-emath-setoption option "ovalradius" "コーナーの半径(2pt)"))
(option (YaTeX-emath-setoption option "iro" "枠線の色"))
(temp (if (y-or-n-p "[option] 線種の設定をしますか?")
(concat "dash={" (YaTeX-emath-setdash) "}") ""))
(option (YaTeX-emath-option-combine "," `(,option ,temp))))
(concat option)))
;;; \psovalbox[option]{strings}
;;; \psovalbox*[option]{strings}
;;; section型
(defun YaTeX:psovalbox ()
(let ((option (YaTeX-emath-psovalbox-option)))
(if (string= option "") ""
(concat "<" option ">"))))
(defun YaTeX:psovalbox* ()
(let ((option1 (if (y-or-n-p "[option] 背景色を設定しますか?")
(YaTeX-emath-setoption "" "paintcolor" "背景色")
(if (y-or-n-p "[option] 濃度を設定しますか?")
(YaTeX-emath-setoption "" "noudo" "濃度(.5)") ())))
(option2 (YaTeX-emath-psovalbox-option)))
(concat (if (string= option1 "") ""
(concat "[" option1 "]"))
(if (string= option2 "") ""
(concat "<" option2 ">")))))
(fset 'YaTeX:EMpsovalbox 'YaTeX:psovalbox)
(fset 'YaTeX:EMpsovalbox* 'YaTeX:psovalbox*)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \pskasen<option>[space between 2lines]'put item in pszahyo env'{strings} ;;;
;;; option linewidth:線の太さ(4) ;;;
;;; dash:破線の設定{} ;;;
;;; iro:下線の色の設定 ;;;
;;; kasenUehosei:文字列と下線との間隔(unit) ;;;
;;; kasenSitahosei:下線とその下の行との間隔(unit) ;;;
;;; kasenFunc:\psnamikasenのみ ;;;
;;; 広域でkasenUehoseiを設定するときは\\kasenUehosei{unit}% ;;;
;;; kasenSitahoseiを設定するときは\\kasenSitahosei{unit}% ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-pskasen-option (&optional nami-or-not)
(let* ((option (YaTeX-emath-setoption "" "linewidth" "線の太さ(4)"))
(option (YaTeX-emath-setoption option "iro" "下線の色"))
(option (YaTeX-emath-setoption option "kasenUehosei" "文字列と下線との間隔(要単位)"))
(option (YaTeX-emath-setoption option "kasenSitahosei" "下線とその下の行との間隔(要単位)"))
(option (concat option
(if (y-or-n-p "[option] 破線にしますか?")
(concat (if (string= option "") ""
(concat ","))
"dash="
(YaTeX-emath-setdash))
(if nami-or-not
(if (y-or-n-p "[option] 関数を設定しますか?")
(concat (if (string= option "") ""
(concat ","))
(YaTeX-emath-setoption option "kasenFunc" "関数" "{" "}")) "") ())))))
(concat (if (string= option "") ""
(concat "<" option ">"))
(if nami-or-not ""
(if (y-or-n-p "2重下線にしますか?")
(concat "[" (read-string "[option] 下線間の間隔(無名数で単位にはptが付く): ") "]") ""))
(if (y-or-n-p "[option] 下線にアイテムを置きますか?")
(concat "'\\Put" (YaTeX:emathPut) "\n'"))
"%\n%\t広域でkasenUehoseiやkasenSitahoseiを設定するときは\n"
"%\t\\kasenUehosei{unit}や\\kasenSitahosei{unit}を使用する\n")))
(defun YaTeX:pskasen ()
(YaTeX-emath-pskasen-option))
(defun YaTeX:psnamikasen ()
(YaTeX-emath-pskasen-option t))
(defun YaTeX:defineEMpscolor ()
(concat "{" (read-string "R(0-1): ") "}"
"{" (read-string "G(0-1): ") "}"
"{" (read-string "B(0-1): ") "}"))
(defun YaTeX:EMpscolor ()
(concat "{" (read-string "色: ") "}"))
(defun YaTeX:EPSkaiten ()
(concat "{" (read-string "回転の中心: ") "}"
"{" (read-string "回転角: ") "}"
"%\n{" (read-string "回転の対象") "}%"))
(defun YaTeX-emath-useperllib-func (ext)
(concat (read-string (format "[ファイル名の指定] *.%s(拡張子除く): " ext))
(if (y-or-n-p "続けますか?")
(concat ","
(YaTeX-emath-useperllib-func ext)) ())))
(defun YaTeX:useperllib ()
(concat "{" (YaTeX-emath-useperllib-func "pl") "}"))
(defun YaTeX:useperlpm ()
(concat "{" (YaTeX-emath-useperllib-func "pm") "}"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \kubunkyuusekizu:短冊のみ ;;;
;;; \kubunkyuusekizu*[濃度]:ベタ塗り ;;;
;;; \kubunkyuusekizu**[斜線の方向角]<斜線の間隔>:斜線塗り ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-kubunkyuuseki-body ()
(concat "{" (read-string "関数式: ")
"}{" (read-string "区間の左端: ")
"}{" (read-string "区間の右端: ")
"}{" (read-string "分割数: ")
"}{" (if (y-or-n-p "短冊の右辺を高さにしますか?")
(concat "r")
(concat "l"))
"}"))
(defun YaTeX:kubunkyuusekizu ()
(YaTeX-emath-kubunkyuuseki-body))
(defun YaTeX:kubunkyuusekizu* ()
(let* ((option (read-string "濃度(.5): ")))
(concat (if (string= option "") ""
(concat "[" option "]"))
(YaTeX-emath-kubunkyuuseki-body))))
(defun YaTeX:kubunkyuusekizu** ()
(let* ((angle (read-string "[option] 斜線の方向角: "))
(space (read-string "[option] 斜線の間隔(無名数): ")))
(concat (if (string= angle "") ""
(concat "[" angle "]"))
(if (string= space "") ""
(concat "<" space ">"))
(YaTeX-emath-kubunkyuuseki-body))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \YNuri[濃度]<xの刻み値>{f(x)}{xmin}{xmax} ;;;
;;; \YNurii[濃度]<xの刻み値>{f(x)}{g(x)}{xmin}{xmax} ;;;
;;; \XNuri[濃度]<yの刻み値>{f(y)}{ymin}{ymax} ;;;
;;; \XNurii[濃度]<yの刻み値>{f(y)}{g(y)}{ymin}{ymax} ;;;
;;; \BNuri[濃度]<tの刻み値>{f(t)}{g(t)}{tmin}{tmax} ;;;
;;; \RNuri[濃度]<θの刻み値>{f(θ){θmin}{θmax} ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-YNuri-body (var func1 &optional func2)
(concat "{" (read-string (format "%sの指定: " func1))
(if func2 (concat "}{" (read-string (format "%sの指定: " func2))) "")
"}{" (read-string (format "%sの最小値: " var))
"}{" (read-string (format "%sの最大値: " var))
"}"))
(defun YaTeX-emath-YNuri-option (var)
(let* ((temp (read-string "[option] 濃度(.5): "))
(option (concat (if (string= temp "") ""
(concat "[" temp "]"))))
(temp (read-string (format "[option] %sの刻み値: " var)))
(option (concat option
(if (string= temp "") ""
(concat "<" temp ">")))))
(concat option)))
(defun YaTeX:YNuri ()
(concat (YaTeX-emath-YNuri-option "x")
(YaTeX-emath-YNuri-body "x" "f(x)")))
(defun YaTeX:YNurii ()
(concat (YaTeX-emath-YNuri-option "x")
(YaTeX-emath-YNuri-body "x" "f(x)" "g(x)")))
(defun YaTeX:XNuri ()
(concat (YaTeX-emath-YNuri-option "y")
(YaTeX-emath-YNuri-body "y" "f(y)")))
(defun YaTeX:XNurii ()
(concat (YaTeX-emath-YNuri-option "y")
(YaTeX-emath-YNuri-body "y" "f(y)" "g(y)")))
(defun YaTeX:BNuri ()
(concat (YaTeX-emath-YNuri-option "t")
(YaTeX-emath-YNuri-body "t" "f(t)" "g(t)")))
(defun YaTeX:RNuri ()
(concat (YaTeX-emath-YNuri-option "θ")
(YaTeX-emath-YNuri-body "θ" "f(θ)")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \YNuri*[斜線の方向角]<斜線の間隔>(xの刻み値){f(x)}{xmin}{xmax} ;;;
;;; \YNurii*[斜線の方向角]<斜線の間隔>(xの刻み値){f(x)}{g(x)}{xmin}{xmax} ;;;
;;; \XNuri*[斜線の方向角]<斜線の間隔>(yの刻み値){f(y)}{ymin}{ymax} ;;;
;;; \XNurii*[斜線の方向角]<斜線の間隔>(yの刻み値){f(y)}{g(y)}{ymin}{ymax} ;;;
;;; \BNuri*[斜線の方向角]<斜線の間隔>(tの刻み値){f(t)}{g(t)}{tmin}{tmax} ;;;
;;; \RNuri*[斜線の方向角]<斜線の間隔>(θの刻み値){f(θ)}{θmin}{θmax} ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-YNuri*-option (var)
(let* ((temp (read-string "[option] 斜線の方向角(45): "))
(option (if (string= temp "") ""
(concat "[" temp "]")))
(temp (read-string "[option] 斜線の間隔(.125): "))
(option (concat option
(if (string= temp "") ""
(concat "<" temp ">"))))
(temp (read-string (format "[option] %sの刻み値: " var)))
(option (concat option
(if (string= temp "") ""
(concat "(" temp ")")))))
(concat option)))
(defun YaTeX-emath-YNuri*-body (var func1 &optional func2)
(concat "{" (read-string (format "%sの設定: " func1)) "}{"
(if func2 (concat (read-string (format "%sの設定: " func2)) "}{") "")
(read-string (format "%sの最小値: " var))
"}{" (read-string (format "%sの最大値: " var)) "}"))
(defun YaTeX:YNuri* ()
(concat (YaTeX-emath-YNuri*-option "x")
(YaTeX-emath-YNuri*-body "x" "f(x)")))
(defun YaTeX:YNurii* ()
(concat (YaTeX-emath-YNuri*-option "x")
(YaTeX-emath-YNuri*-body "x" "f(x)" "g(x)")))
(defun YaTeX:XNuri* ()
(concat (YaTeX-emath-YNuri*-option "y")
(YaTeX-emath-YNuri*-body "y" "f(y)")))
(defun YaTeX:XNurii* ()
(concat (YaTeX-emath-YNuri*-option "y")
(YaTeX-emath-YNuri*-body "y" "f(y)" "g(y)")))
(defun YaTeX:BNuri* ()
(concat (YaTeX-emath-YNuri*-option "t")
(YaTeX-emath-YNuri*-body "t" "f(t)" "g(t)")))
(defun YaTeX:RNuri* ()
(concat (YaTeX-emath-YNuri*-option "θ")
(YaTeX-emath-YNuri*-body "θ" "f(θ)")))
;\YandY<#1>#2#3#4
;二つの関数 f(x), g(x) を与えて,交点の座標を取得します。
; #1: key=val 形式のオプション引数で,有効なキーは
; infx:交点を探索する x の下限値(デフォルトは \xmin)
; supx:交点を探索する x の上限値(デフォルトは \xmax)
; xval:交点の x座標を受け取る制御綴名
; yval:交点の y座標を受け取る制御綴名
; #2: f(x)
; #3: g(x)
; #4: 交点の座標を格納する制御綴
(defun YaTeX:YandY ()
(let* ((option (YaTeX-emath-setoption "" "infx" "xの下限値(\\xmin)"))
(option (YaTeX-emath-setoption option "supx" "xの上限値(\\xmax)"))
(option (YaTeX-emath-setoption option "xval" "x座標を受け取る制御綴り"))
(option (YaTeX-emath-setoption option "yval" "y座標を受け取る制御綴り")))
(insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "関数1: ") "}"
"{" (read-string "関数2: ") "}"
(read-string "交点の座標を受け取る制御綴り: ")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \YTen[option]{f(x)}{xの値}{座標を受け取る制御綴り} ;;;
;;; option xformat=x座標のフォーマット指定(s) ;;;
;;; yformat=y座標のフォーマット指定(s) ;;;
;;; \XTen[option]{f(y)}{yの値}{座標を受け取る制御綴り} ;;;
;;; \BTen[option]{f(t)}{g(t)}{tの値}{座標を受け取る制御綴り} ;;;
;;; \RTen[option]{f(θ)}{θの値}{座標を受け取る制御綴り} ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-YTen-body (var func1 &optional func2)
(let* ((option (YaTeX-emath-setoption "" "xformat" "x座標のフォーマット(s)"))
(option (YaTeX-emath-setoption option "yformat" "y座標のフォーマット(s)")))
(concat (if (string= option "") ""
(concat "[" option "]"))
"{" (read-string (format "%sの指定: " func1)) "}{"
(if func2 (concat (read-string (format "%sの指定: " func2)) "}{") "")
(read-string (format "%sの値: " var)) "}"
(read-string "座標を受け取る制御綴り: "))))
(defun YaTeX:YTen ()
(YaTeX-emath-YTen-body "x" "f(x)"))
(defun YaTeX:XTen ()
(YaTeX-emath-YTen-body "y" "f(y)"))
(defun YaTeX:BTen ()
(YaTeX-emath-YTen-body "t" "f(t)" "g(t)"))
(fset `YaTeX:ParamP `YaTeX:BTen)
(defun YaTeX:RTen ()
(YaTeX-emath-YTen-body "θ" "f(θ)"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \namisen[option]\A\B ;;;
;;; \A\B間を高さ0.25の5周期分の正弦曲線を描く ;;;
;;; option namisuu=\A\B間の周期数(5) ;;;
;;; namitakasa=波の高さ(.25) ;;;
;;; \namisen*\A\B ;;;
;;; \A\B間を2つの正弦曲線で結び間を白塗りする ;;;
;;; option namikankaku=波の間隔(.1) ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun YaTeX-emath-namisen-option (&optional ast-or-not)
(let* ((option (YaTeX-emath-setoption "" "namisuu" "波の数(5)"))
(option (YaTeX-emath-setoption option "namitakasa" "波の高さ(.25)"))
(temp (concat
(if ast-or-not
(YaTeX-emath-setoption "" "namikankaku" "波の間隔(.1)") "")))
(option (YaTeX-emath-option-combine "," `(,option ,temp))))
(if (string= option "") ""
(concat "[" option "]"))))
(defun YaTeX:namisen ()
(concat (YaTeX-emath-namisen-option)
"{" (read-string "始点: ") "}{"
(read-string "終点: ") "}%"))
(defun YaTeX:namisen* ()
(concat (YaTeX-emath-namisen-option t)
"{" (read-string "始点: ") "}{"
(read-string "終点: ") "}%"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; \YGurafu(xの刻み値[0.05]){f(x)}{xmin}{xmax} ;;;
;;; \XGurafu(yの刻み値[0.05]){f(y)}{ymin}{ymax} ;;;
;;; \BGurafu(tの刻み値[0.05]){f(t)}{g(t)}{tmin}{tmax} ;;;
;;; \RGurafu(θの刻み値[0.05]){f(θ)}{θmin}{θmax} ;;;
;;; \YGurafu*[option](xの刻み値[0.05]){f(x)} ;;;
;;; 右端点が\migiTに左端点が\hidariTに保存される ;;;
;;; option hidarix=定義域の指定 ;;;
;;; migix=定義域の指定 ;;;
;;; \XGurafu*[option](yの刻み値){f(y)} ;;;
;;; 上端点が\ueTに下端点が\sitaTに保存される ;;;
;;; option uey=定義域の指定 ;;;
;;; sitay=定義域の指定 ;;;
;;; \BGurafu*[option](tの刻み値[0.05]){f(t)}{g(t)} ;;;
;;; 開始点が\hazimeTに終了点が\owariTに保存される ;;;
;;; option hazimet=定義域の指定 ;;;
;;; owarit=定義域の指定 ;;;
;;; \RGurafu*(θの刻み値[0.05]){f(θ)} ;;;
;;; 開始点が\hazimeTに終了点が\owariTに保存される ;;;
;;; option hazimet=定義域の指定 ;;;
;;; owarit=定義域の指定 ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;(defun YaTeX-emath-YGurafu*-option (var begin bpoint end epoint)
;;; (let* ((option (YaTeX-emath-setoption "" begin (concat var "の" bpoint "点" )))
;;; (option (YaTeX-emath-setoption option end (concat var "の" epoint "点"))))
;;; (if (string= option "") ""
;;; (concat "[" option "]"))))
;;;(defun YaTeX-emath-YGurafu-body (var func1 &optional func2 ast-or-not)
;;; (let* ((cut (read-string (format "[option] %sの刻み値(.05): " var))))
;;; (concat (if (string= cut "") ""
;;; (concat "(" cut ")"))
;;; "{" (read-string (format "%sの設定: " func1)) "}"
;;; (if func2 (concat "{" (read-string (format "%sの設定: " func2)) "}") "")
;;; (if ast-or-not ""
;;; (concat "{" (read-string (format "%sの最小値: " var))
;;; "}{" (read-string (format "%sの最大値: " var)) "}")))))
;;;(defun YaTeX:YGurafu ()
;;; (YaTeX-emath-YGurafu-body "x" "f(x)"))
;;;(defun YaTeX:XGurafu ()
;;; (YaTeX-emath-YGurafu-body "y" "f(y)"))
;;;(defun YaTeX:RGurafu ()
;;; (YaTeX-emath-YGurafu-body "θ" "f(θ)"))
;;;(defun YaTeX:BGurafu ()
;;; (YaTeX-emath-YGurafu-body "t" "f(t)" "g(t)"))
;;;(defun YaTeX:YGurafu* ()
;;; (concat (YaTeX-emath-YGurafu*-option "x" "hidarix" "左端" "migix" "右端")
;;; (YaTeX-emath-YGurafu-body "x" "f(x)" nil t)
;;; "%\n%\t\\hidariTに左端点,\\migiTに右端点が保存される\n"))
;;;(defun YaTeX:XGurafu* ()
;;; (concat (YaTeX-emath-YGurafu*-option "y" "sitay" "下端" "uey" "上端")
;;; (YaTeX-emath-YGurafu-body "y" "f(y)" nil t)
;;; "%\n%\t\\sitaTに下端点,\\ueTに上端点が保存される\n"))
;;;(defun YaTeX:RGurafu* ()
;;; (concat (YaTeX-emath-YGurafu*-option "θ" "hazimet" "開始" "owarit" "終了")
;;; (YaTeX-emath-YGurafu-body "θ" "f(θ)" nil t)
;;; "%\n%\t\\hazimeTに開始点,\\owariTに終了点が保存される\n"))
;;;(defun YaTeX:BGurafu* ()
;;; (concat (YaTeX-emath-YGurafu*-option "t" "hazimet" "開始" "owarit" "終了")
;;; (YaTeX-emath-YGurafu-body "t" "f(t)" "g(t)" t)
;;; "%\n%\t\\hazimeTに開始点,\\owariTに終了点が保存される\n"))
;;\YGraph<#1>'#2'^#3#4
;;#1: key=val
;; color,linethickness,dash,dx,minx,maxx,infx,supx,leftP,rightP
;;#2: 定義域の指定
;; [x1,x2] 閉区間指定
;; (x1,x2) 開区間指定
;; (,x2) [x1,] など端点省略
;; (x1,x2] 半開区間
;; それらを | でつなげた複数区間
;;#3: 不連続点/分割点
;; 不連続点/分割点をコンマ区切 csv列で与えます(分割点の場合は * を前置)
;;#4: 関数式
;; #2 と #3 は併用不可
(defun emath-Graph-Common (xory min max)
(let* ((option "")
(dash "")
(leftP "")
(rightP ""))
(progn (if (y-or-n-p "オプションを指定しますか?")
(progn (setq option (YaTeX-emath-setoption option "color" "色の指定")
option (YaTeX-emath-setoption option "linethickness" "太さの指定")
option (YaTeX-emath-setoption option "dx" "刻み値の指定")
option (YaTeX-emath-setoption option (format "min%s" xory) "最小値の指定[閉区間]")
option (YaTeX-emath-setoption option (format "inf%s" xory) "最小値の指定[開区間]")
option (YaTeX-emath-setoption option (format "max%s" xory) "最大値の指定[閉区間]")
option (YaTeX-emath-setoption option (format "sup%s" xory) "最大値の指定[開区間]"))
(if (y-or-n-p "破線の設定をしますか?")
(setq dash (concat "dash={" (YaTeX-emath-setdash) "}"))
())
(if (y-or-n-p (format "%s端点を取得しますか?" min))
(if (y-or-n-p (format "%s端点名を指定しますか?" min))
(setq leftP (concat "leftP=" (read-string (format "%s端点名: " min))))
(setq leftP "leftP"))
())
(if (y-or-n-p (format "%s端点を取得しますか?" max))
(if (y-or-n-p (format "%s端点名を指定しますか?" max))
(setq rightP (concat "rightP=" (read-string (format "%s端点名: " max))))
(setq rightP "rightP")) ())) ())
(setq option (YaTeX-emath-option-combine "," `(,option ,dash ,leftP ,rightP)))
(if (> (length option) 0)
(insert (concat "<" option ">")) ()))))
(defun emath-Graph-divide-option ()
(let* ((option "")
(flag (YaTeX-emath-get-number-from-list "[option]" `("区間で指定する" "不連続点で指定する" "指定しない"))))
(progn (setq option (cond ((= flag 1)(concat "'" (read-string "[option] 区間の設定: ") "'"))
((= flag 2)(concat "^{" (read-string "[option] 不連続点の設定: ") "}"))
(t "")))
(if (> (length option) 0)
(insert option) ()))))
(defun YaTeX:YGraph ()
(progn (emath-Graph-Common "x" "左" "右")
(emath-Graph-divide-option)
(insert (read-string "描画関数: "))))
(defun YaTeX:XGraph ()
(progn (emath-Graph-Common "y" "下" "上")
(emath-Graph-divide-option)
(insert (read-string "描画関数: "))))
;\ParamC<#1>#2#3
; #1: key=val
; color:曲線に色をつけます。
; dash:曲線を破線で描画します。
; linethickness:線の太さを指定します。
; mint:媒介変数 t の動く最小値を指定します。デフォルトは 0 です。
; maxt:媒介変数 t の動く最大値を指定します。デフォルトは 2π です。
; inft:媒介変数 t の動く下限値を指定します。
; supt:媒介変数 t の動く上限値を指定します。
; #2: x=f(t) 媒介変数は T で表します。
; #3: y=g(t)
(defun YaTeX:ParamC ()
(progn (emath-Graph-Common "t" "始" "終")
(insert (concat (read-string "描画関数(x): ")
(read-string "描画関数(y): ")))))
;\PolarC<#1>#2
; #1: key=val
; dash:曲線を破線で描画します。
; mint, maxt
; θの範囲は,デフォルトでは 0~2π となっています。
; これを変更する key です。
; #2: R=f(θ) 媒介変数は T で表します。
(defun YaTeX:PolarC ()
(progn (emath-Graph-Common "t" "始" "終")
(insert (read-string "描画関数: "))))
;\YDiff<#1>#2#3#4
; #1: key=val
; setten:指定した点の座標を受け取ります。
; yval:指定した点の y座標を受け取ります。
; sessen:指定した点における接線を表す一次関数式を受け取ります。
; sessencsv:指定した点における接線を表す一次関数式の係数列(降順)を受け取ります。
; housen:指定した点における法線を表す一次関数式を受け取ります。
; housencsv:指定した点における法線を表す一次関数式の係数列(降順)を受け取ります。
; #2: 関数式(f(x))
; #3: xの値(a)
; #4: 微分係数(f'(a))を受け取る制御綴
(defun YaTeX:YDiff ()
(let* ((option (YaTeX-emath-setoption "" "setten" "接点の座標を受け取る制御綴り"))
(option (YaTeX-emath-setoption option "yval" "接点のy座標を受け取る制御綴り"))
(option (YaTeX-emath-setoption option "sessen" "接線の式を受け取る制御綴り"))
(option (YaTeX-emath-setoption option "sessencsv" "接線の式の係数列を受け取る制御綴り"))
(option (YaTeX-emath-setoption option "housen" "法線の式を受け取る制御綴り"))
(option (YaTeX-emath-setoption option "housencsv" "法線の式の係数列を受け取る制御綴り")))
(insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "関数式: ") "}"
"{" (read-string "接点のx座標: ") "}"
(read-string "微分係数を受け取る制御綴り: ")))))
;\ParamDiff<#1>#2#3#4#5
; #1: key=val
; setten:右辺値は,指定した点の座標を受け取る制御綴名
; #2: x=f(t)
; #3: y=f(t)
; #4: tの値(a) ( perl の計算式を与えることが出来ます)
; #5: 接ベクトル (f'(a),g'(a))を受け取る制御綴
(defun YaTeX:ParamDiff ()
(let* ((option (YaTeX-emath-setoption "" "setten" "接点の座標を受け取る制御綴り名")))
(insert (concat (if (string= option "")
"" (concat "<" option ">"))
"{" (read-string "x座標を表す関数: ") "}"
"{" (read-string "y座標を表す関数: ") "}"
"{" (read-string "接点を指定するパラメータの値: ") "}"
(read-string "接ベクトルを受け取る制御綴り: ")))))
;\YPaint<#1>#2
; #1: key=val
; minx:弦の左端端点の x座標を指定します。
; maxx:弦の右端端点の x座標を指定します。
; nuriiro:塗りの色を指定します。
; paintcolor:塗りの色を指定します。
; thickness:塗りつぶしの濃度を指定します。
; 0~1 の無名数で,0 は白,1は黒で,デフォルト値は 0.5 となっています。
; #2: 関数式
(defun YaTeX:YPaint ()
(let* ((option (emath-emPaint-paintonly-option))
(option (YaTeX-emath-setoption option "minx" "左端点のx座標の指定"))
(option (YaTeX-emath-setoption option "maxx" "右端点のx座標の指定")))
(insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "関数式: ") "}%"))))
(defun YaTeX:YPaint* ()
(let* ((option (emath-emPaint*-slashonly-option))
(option (YaTeX-emath-setoption option "minx" "左端点のx座標の指定"))
(option (YaTeX-emath-setoption option "maxx" "右端点のx座標の指定")))
(insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "関数式: ") "}%"))))
;\YPaintii<#1>#2#3
; #1: key=val:\YPaintと同じ
; #2: 関数式1
; #3: 関数式2
(defun YaTeX:YPaintii ()
(let* ((option (emath-emPaint-paintonly-option))
(option (YaTeX-emath-setoption option "minx" "左端点のx座標の指定"))
(option (YaTeX-emath-setoption option "maxx" "右端点のx座標の指定")))
(insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "関数式1: ") "}"
"{" (read-string "関数式2: ") "}%"))))
;\YPaintii*<#1>#2#3
; #1: key=val
; minx:x の範囲について,最小値を指定します。
; maxx:x の範囲について,最大値を指定します。
; borderthickness:境界線の太さを指定します。
; slashangle:斜線の角度を指定します。
; slashspace:斜線の間隔を指定します。
; slashthickness:斜線の太さを指定します。(デフォルトは 0.3pt)
; #2: 関数式1
; #3: 関数式2
(defun YaTeX:YPaintii* ()
(let* ((option (emath-emPaint*-slashonly-option))
(option (YaTeX-emath-setoption option "minx" "左端点のx座標の指定"))
(option (YaTeX-emath-setoption option "maxx" "右端点のx座標の指定")))
(insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "関数式1: ") "}"
"{" (read-string "関数式2: ") "}%"))))
;\Soukyokusen<#1>#2#3#4
; 主軸が x軸に平行な双曲線を描画します。
;\ySoukyokusen<#1>#2#3#4
; 主軸が y軸に平行な双曲線を描画します。
; #1: key=val 形式をコンマ区切りで並べます。
; linethickness:双曲線の太さを変更
; dash双曲線を破線で描画
; iro:双曲線に色を付与(color も同義のキーです)
; lbP:双曲線の左下端点に名前をつけて保存
; ltP:双曲線の左上端点に名前をつけて保存
; rbP:双曲線の右下端点に名前をつけて保存
; rtP:双曲線の右上端点に名前をつけて保存
; zenkinsen:双曲線の漸近線を付加
; zenkinseniro:漸近線に色を付与
; *zenkinsensyu:漸近線の線種を変更
; zenkinsenthickness:漸近線の太さを変更
; #2: 中心
; #3: a
; #4: b
; コマンドを実行後,4つの端点(右上,右下,左上,左下)をそれぞれ
; \rtP, \rbP, \ltP, \lbP に保存しています。
(defun emath-Soukyokusen-common ()
(let* ((emnum 0)
(option (YaTeX-emath-setoption "" "linethickness" "太さの設定"))
(dash (if (y-or-n-p "破線にしますか?: ")
(concat "dash={" (YaTeX-emath-setdash) "}") ""))
(option (YaTeX-emath-setoption option "color" "色の指定"))
(zenkinsen ""))
(progn (if (y-or-n-p "[option] 描画端点の名前を指定しますか?: ")
(setq option (YaTeX-emath-setoption option "ltP" "左上の端点")
option (YaTeX-emath-setoption option "lbP" "左下の端点")
option (YaTeX-emath-setoption option "rtP" "右上の端点")
option (YaTeX-emath-setoption option "rbP" "右下の端点")))
(if (y-or-n-p "[option] 漸近線を描画しますか?: ")
(setq zenkinsen "zenkinsen"
option (YaTeX-emath-setoption option "zenkinsenthickness" "漸近線の太さの指定")
option (YaTeX-emath-setoption option "zenkinseniro" "漸近線の色の指定")))
(setq option (YaTeX-emath-option-combine "," `(,option ,dash ,zenkinsen)))
(concat option))))
(defun YaTeX:Soukyokusen ()
(let* ((option (emath-Soukyokusen-common)))
(progn (insert (concat (if (> (length option) 0)
(concat "<" option ">") "")
"{" (read-string "中心の座標: ") "}"
"{" (read-string "a: ") "}"
"{" (read-string "b: ") "}%\\ltP,\\lbP,\\rtP,\\rbPに描画端点が保存されている")))))
(fset `YaTeX:ySoukyokusen `YaTeX:Soukyokusen)
; 近似折線の共通設定
(defun emath-Kinzi-Common (var dx &optional min max)
(let* ((option (YaTeX-emath-setoption "" (format "d%s" var) (format "%sの刻み値(%s)" var dx)))
(option (YaTeX-emath-setoption option (format "min%s" var) (format "%sの最小値(%s)" var min)))
(option (YaTeX-emath-setoption option (format "max%s" var) (format "%sの最大値(%s)" var max))))
(if (> (length option) 0)
(insert (concat "<" option ">")) ())))
;\YLGraph<#1>#2#3
; #1: key=val 形式のオプション引数
; dx:x の刻み値を指定します。デフォルトは 0.05 です。
; maxx:x の範囲について,最大値を指定します。
; minx:x の範囲について,最小値を指定します。
; #2: 式 (f(x))
; #3: 折れ線を受け取る制御綴
(defun YaTeX:YLGraph ()
(progn (emath-Kinzi-Common "x" ".05")
(insert (concat (read-string "関数: ")
(read-string "折線を受け取る制御綴り: ")))))
;\ParamLC<#1>#2#3#4
; #1: key=val
; dt:媒介変数の刻み値を指定します。デフォルトは 0.02 です。
; maxt:媒介変数 t の動く最大値を指定します。デフォルトは 2π です。
; mint:媒介変数 t の動く最小値を指定します。デフォルトは 0 です。
; #2: x=f(t)
; #3: y=g(t)
; #4: 近似折れ線を受け取る制御綴
(defun YaTeX:ParamLC ()
(progn (emath-Kinzi-Common "t" ".02" "0" "2\\pi")
(insert (concat (read-string "関数(x): ")
(read-string "関数(y): ")
(read-string "折線を受け取る制御綴り: ")))))
;;;;\Hantyokusen<#1>#2#3
;;;; 端点と通過点(1点)を指定して半直線を描画します。
;;;; #1: key=val (\Drawline に引き継がれる)
;;;; #2: 端点
;;;; #3: 半直線が通過する1点
;;;(defun YaTeX:Hantyokusen ()
;;; (let* ((option (YaTeX-emath-Drawline-option)))
;;; (insert (concat (if (> (length option) 0)
;;; (concat "<" option ">") "")
;;; "{" (read-string "端点の指定: ") "}"
;;; "{" (read-string "半直線が通過する点の指定: ") "}"
;;; "% \\HtyokuT=描画領域の端点\n"))))
;;;;\mHantyokusen<#1>#2#3
;;;; 端点と方向ベクトルを指定して半直線を描画します。
;;;; #1: key=val (\Drawline に引き継がれる)
;;;; #2: 端点
;;;; #3: 半直線の方向ベクトル
;;;(defun YaTeX:mHantyokusen ()
;;; (let* ((option (YaTeX-emath-Drawline-option)))
;;; (insert (concat (if (> (length option) 0)
;;; (concat "<" option ">") "")
;;; "{" (read-string "端点の指定: ") "}"
;;; "{" (read-string "方向ベクトルの指定: ") "}"
;;; "% \\HtyokuT=描画領域の端点\n"))))
;;;;\kHantyokusen<#1>#2#3
;;;; 端点と方向角を指定して半直線を描画します。
;;;; #1: key=val (\Drawline に引き継がれる)
;;;; #2: 端点
;;;; #3: 半直線の方向角
;;;(defun YaTeX:Hantyokusen ()
;;; (let* ((option (YaTeX-emath-Drawline-option)))
;;; (insert (concat (if (> (length option) 0)
;;; (concat "<" option ">") "")
;;; "{" (read-string "端点の指定: ") "}"
;;; "{" (read-string "方向角の指定: ") "}"
;;; "% \\HtyokuT=描画領域の端点\n"))))
;;;(defun YaTeX:Hantyokusen ()
;;; (concat "{" (read-string "端点: ") "}"
;;; "{" (read-string "通過点: ") "}%\\HtyokuTに描画領域の端点が保存される"))
;;;(defun YaTeX:mHantyokusen ()
;;; (concat "{" (read-string "端点: ") "}"