Browse Source

Rectangle rewrite, added bib to makefile

master
Jonathan Spratte 2 years ago
parent
commit
afe914925a
5 changed files with 94 additions and 12 deletions
  1. 2
    0
      .gitignore
  2. 7
    2
      Doc/Makefile
  3. BIN
      Doc/doc_DSALaTeX.pdf
  4. 3
    3
      Doc/doc_DSALaTeX.tex
  5. 82
    7
      Doc/preamble/macros.tex

+ 2
- 0
.gitignore View File

@@ -1,5 +1,7 @@
1 1
 *.aux
2
+*.bbl
2 3
 *.bcf
4
+*.blg
3 5
 *.fmt
4 6
 *.glo
5 7
 *.hd

+ 7
- 2
Doc/Makefile View File

@@ -15,25 +15,30 @@ SFILES = $(wildcard $(TEXF)/*.tex)
15 15
 PREAMB = $(wildcard $(PREF)/*.tex)
16 16
 PREAMB += $(wildcard $(PREF)/*.sty)
17 17
 PREAMB += $(wildcard ./*.sty)
18
+BIBS   = $(wildcard ./*.bib)
18 19
 NAME   = $(FILE:%.tex=%)
19 20
 OUT    = $(NAME).pdf
20 21
 FMT    = $(NAME).fmt
22
+BIB    = $(NAME).bbl
23
+BCF    = $(NAME).bcf
21 24
 ##########################################
22 25
 # }}}
23 26
 # default target {{{
24 27
 ## the name 'quick' maybe misleading! 'all' might be faster if $(FILE) hasn't
25 28
 ## changed. 'quick' is for quickly running TeX assuming that you know what
26 29
 ## you're doing
27
-quick: $(FMT)
30
+quick: $(FMT) $(BIB)
28 31
 	$(TEX) $(FLAGS) -fmt="$(NAME)" $(FILE)
29 32
 	#$(TEX) $(FLAGS) $(FILE);
30 33
 # }}}
31
-all: $(OUT) #bib
34
+all: $(OUT) $(BIB)
32 35
 $(OUT): $(FILE) $(SFILES) $(PREAMB)# {{{
33 36
 	$(TEX) $(FLAGS) $(FILE);
34 37
 	$(TEX) $(FLAGS) $(NAME).tex > /dev/null;
35 38
 	$(TEX) $(FLAGS) $(NAME).tex > /dev/null;
36 39
 # }}}
40
+bib:
41
+	biber $(NAME)
37 42
 $(FMT): $(FILE) $(PREAMB)# {{{
38 43
 	$(TEX) -ini -enc -jobname="$(NAME)" "&$(TEX)" mylatexformat.ltx """$(FILE)"""
39 44
 # }}}

BIN
Doc/doc_DSALaTeX.pdf View File


+ 3
- 3
Doc/doc_DSALaTeX.tex View File

@@ -35,13 +35,13 @@
35 35
 \begingroup
36 36
 \begingroup
37 37
 \centering
38
-\Rectangle{4}
38
+\Rectangle[5]
39 39
   {
40
-    \selectlanguage{british}
40
+    \selectlanguage{british}%
41 41
     This documentation is available only in German language as ``Das Schwarze
42 42
     Auge'' (DSA) is a German pen\&paper fantasy role-playing game. If this
43 43
     bothers you, you might translate this documentation or try to convince me to
44
-    do it.
44
+    do it, in which case I wish you good luck.
45 45
   }
46 46
 \par
47 47
 \endgroup

+ 82
- 7
Doc/preamble/macros.tex View File

@@ -87,15 +87,90 @@
87 87
   }%<<<
88 88
 \tl_set:Nn \l_DSAchar_key_tl { default }
89 89
 \DSAchar_set_default_values:
90
-\newcommand\Rectangle[2]%>>>
90
+\ExplSyntaxOff
91
+% Over engineered Rectangle macro/environment
92
+\newsavebox\Rectangle@box
93
+\newlength\Rectangle@length
94
+\newenvironment*{Rectangle}{}%>>>
95
+  {%>>>
96
+    \egroup
97
+    \expandafter\Rectangle@Parse@Arg\expandafter{\Rectangle@Arg}%
98
+  }%<<<
99
+%<<<
100
+\renewcommand*\Rectangle[1][]%>>>
101
+  {%
102
+    \begingroup
103
+    \def\Rectangle@Arg{#1}%
104
+    \begingroup
105
+    \def\Rectangle@TestString{Rectangle}
106
+    \ifx\@currenvir\Rectangle@TestString
107
+      % used as environment
108
+      \endgroup
109
+      \expandafter\Rectangle@Environment
110
+    \else
111
+      % used as command
112
+      \endgroup
113
+      \expandafter\Rectangle@Command
114
+    \fi
115
+  }%<<<
116
+\newcommand*\Rectangle@Command%>>>
91 117
   {%
92 118
     \begingroup
93
-      \setbox0\hbox{\ignorespaces #2\ifhmode\unskip\fi}%
94
-      \begin{minipage}[t]{\dimexpr\wd0/#1\relax}%
95
-        \parfillskip=0pt
96
-        \ignorespaces #2\ifhmode\unskip\fi%
97
-      \end{minipage}%
119
+    \afterassignment\Rectangle@Command@grab
120
+    \let\future
121
+  }%<<<
122
+\newcommand*\Rectangle@Command@grab%>>>
123
+  {%
98 124
     \endgroup
125
+    \setbox\Rectangle@box\hbox\bgroup
126
+    \aftergroup\Rectangle@Command@shipout
127
+    \ignorespaces
128
+  }%<<<
129
+\newcommand*\Rectangle@Command@shipout%>>>
130
+  {%
131
+    \expandafter\Rectangle@Parse@Arg\expandafter{\Rectangle@Arg}%
132
+  }%<<<
133
+\newcommand*\Rectangle@Environment%>>>
134
+  {%
135
+    \setbox\Rectangle@box\hbox\bgroup
136
+    \ignorespaces
137
+  }%<<<
138
+\newcommand*\Rectangle@Parse@Arg[1]%>>>
139
+  {%
140
+    % remove trailing space after the contents of \Rectangle@box
141
+    \setbox\Rectangle@box\hbox{\unhbox\Rectangle@box\ifhmode\unskip\fi}%
142
+    \if\relax\detokenize{#1}\relax
143
+      \Rectangle@length\linewidth
144
+    \else
145
+      \ifLenTF{#1}
146
+        {\Rectangle@length=#1}
147
+        {%
148
+          \Rectangle@length=\dimexpr\wd\Rectangle@box/#1\relax
149
+          \ifdim\Rectangle@length>\linewidth
150
+            \GenericWarning{}
151
+              {Warning: Rectangle paragraph's width bigger linewidth}%
152
+          \fi
153
+        }%
154
+    \fi
155
+    \begin{minipage}[t]{\Rectangle@length}
156
+      \parfillskip=0pt
157
+      \unhbox\Rectangle@box
158
+    \end{minipage}%
159
+    \endgroup
160
+  }%<<<
161
+\def\ifLenTF@inner#1\relax#2\endifLenTF@inner%>>>
162
+  {%
163
+    \if\relax\detokenize{#1}\relax
164
+  }%<<<
165
+\newcommand\ifLenTF[1]%>>>
166
+  {%
167
+    \begingroup
168
+    \afterassignment\ifLenTF@inner\skip0=#1pt\relax\endifLenTF@inner
169
+      \endgroup
170
+      \expandafter\@secondoftwo
171
+    \else
172
+      \endgroup
173
+      \expandafter\@firstoftwo
174
+    \fi
99 175
   }%<<<
100
-\ExplSyntaxOff
101 176
 \makeatother

Loading…
Cancel
Save