Skip to content

Commit 993c978

Browse files
committed
Fit code blocks on the same page
1 parent c67ab7f commit 993c978

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

docs/TinyExpr++ReferenceManual.pdf

-337 Bytes
Binary file not shown.

docs/manual/22-Examples.Rmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ int main(int argc, char *argv[])
1919
}
2020
```
2121
22+
\newpage
23+
2224
## Example 2: Binding Custom Variables
2325
2426
```cpp
@@ -66,6 +68,8 @@ int main(int argc, char* argv[])
6668
}
6769
```
6870

71+
\newpage
72+
6973
## Example 3: Calling a Free Function
7074

7175
```cpp
@@ -106,6 +110,8 @@ int main(int argc, char *argv[])
106110
}
107111
```
108112
113+
\newpage
114+
109115
## Example 4: Non-US Formatted Formulas
110116
111117
```cpp
@@ -152,6 +158,8 @@ int main(int argc, char *argv[])
152158
}
153159
```
154160

161+
\newpage
162+
155163
## Example 5: Binding to Custom Classes
156164

157165
A class derived from `te_expr` can be bound to custom functions. This enables you to
@@ -192,6 +200,7 @@ double cell_max(const te_expr* context)
192200
Finally, create an instance of the class and connect the custom functions to it,
193201
while also adding them to the parser:
194202

203+
::: {.minipage data-latex="{\textwidth}"}
195204
```cpp
196205
te_expr_array teArray{ TE_DEFAULT };
197206

@@ -211,3 +220,4 @@ auto result = tep.evaluate("SUM(CELL 0, CELL 1, CELL 2, CELL 3, CELL 4)");
211220
// (will be 8).
212221
res = tep.evaluate("CellMax()");
213222
```
223+
:::

docs/manual/24-NonUSFormulas.Rmd

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,21 @@ int main(int argc, char *argv[])
2020
/* After setting your locale to German, functions like strtod() will fail
2121
with values like "3.14" because it expects "3,14" instead.
2222
To fix this, we will tell the parser to use "," as the decimal separator
23-
and ";" as list argument separator.*/
24-
25-
const char *expression = "pow(2,2; 2)"; // instead of "pow(2.2, 2)"
23+
and ";" as the list argument separator.*/
24+
const char* expression = "pow(2,2; 2)"; // instead of "pow(2.2, 2)"
2625
std::cout << "Evaluating:\n\t" << expression << "\n";
2726

2827
te_parser tep;
2928
tep.set_decimal_separator(',');
3029
tep.set_list_separator(';');
31-
32-
/* This will compile the expression and check for errors. */
33-
auto r = tep.evaluate(expression);
30+
const auto result = tep.evaluate(expression);
3431

3532
if (tep.success())
33+
{ std::cout << "Result:\n\t" << result << "\n"; }
34+
else /* Show the user where the error is at. */
3635
{
37-
const double r = tep.evaluate(expression);
38-
std::cout << "Result:\n\t" << r << "\n";
39-
}
40-
else
41-
{
42-
/* Show the user where the error is at. */
4336
std::cout << "\t " << std::setfill(' ') <<
44-
std::setw(tep.get_last_error_position()) << '^' <<
45-
"\tError near here\n";
37+
std::setw(tep.get_last_error_position()) << "^\tError here\n";
4638
}
4739

4840
return EXIT_SUCCESS;
@@ -54,4 +46,4 @@ This produces the output:
5446
$ Evaluating:
5547
pow(2,2; 2)
5648
Result:
57-
4,840000
49+
4,840000

0 commit comments

Comments
 (0)