You may view the source code of this blog to see the source files.
Goal
To provide an introduction to the formal definition of functions for arts
stream students.
I aim to
minimize the calculations
use daily-life examples
favor pictures over text.
IT skills used
Inkscape
C-S-a for alignment.
C-S-f for boundary and colors, and line patterns (i.e. arrows).
C-S-d for document size.
clipping process:
prepare the object to be clipped.
prepare the clip, which is on top of the previous object.
select Object โ Clip and then the first option from the top menu.
dvisvgm
Use the TEX โ DVI โ SVG route with latex and this tool with options
--font-format=woff and -b 5 -R -d 2 to save file size and to ensure
that the SVG can be correctly opened on Inkscape.
I had issues in getting a SVG from a TikZ picture containing a pattern filling:
https://github.com/mgieseki/dvisvgm/issues/158. The reported issue was
created last year, and it’s marked as fixed. Nonetheless, I had this issue even
though my MikTeX was up-to-date.
Discussion
I wanted to confirm whether my dvisvgm.exe, which had been shipped with
MikTeX, was latest.
I am not sure about the technical explanation from the owner of dvisvgm at
https://github.com/MiKTeX/miktex/issues/1112. It seemed that I was
already using the latest stable version of this tool.
I gave a MWE illustrating the problem with the graph of y = (x + 1)ยฒ with
region under the curve filled with a pattern in the above issue. I knew that’s
probably off-topic, but the package owner might have some insights about the
problem. It turned out that PDF โ SVG was partly supported by dvisvgm. Using
DVI โ SVG, I managed to get the filling pattern, but I lost the beautiful
Computer Modern Roman fontsโthat’s another issue.
Hoping for a response from the owner for the previous problem, I started
https://github.com/mgieseki/dvisvgm/issues/186. He suggested the use of
--no-fonts or --font-format=woff. I observed no difference in the local
filesystem. I uploaded everything I got through GitHub so that he could see
what my dvisvgm.exe had output. I didn’t expected that the Computer Modern
Roman fonts disappeared on GitHub side. If I hadn’t asked there, I would have
never known that it’s the web browser’s security measure not to load the
embedded font data in a SVG loaded from a server.
Skills learned
Meaning of some commonly used parameters of dvisvgm:
A secondary school student posted a coordinate geometry question on a Discord
homework help server. A helper replied to that question with an illustration of
the Perpendicular Distance Formula
Posted on June 17, 2022
(Last modified on June 19, 2022)
| 2 minutes
|
|
0 comment
I firsted tried with foreach, but that would create so much paths. I found
them difficult to operate on later, for example, with PGF plots library
fillbetween. const plot is a better solution.
\documentclass{standalone}\usepackage{pgfplots}\pgfplotsset{compat=1.18}\usetikzlibrary{patterns}\usepgfplotslibrary{fillbetween}\begin{document}\newcommand\myN{8}\pgfplotsset{ axis lines=center,
legend style={at={(1,1)},anchor=north east,fill=none},
title style={at={(0.5,1.05)}},
every axis x label/.style={ at={(ticklabel* cs:1)},
anchor=west,
},
every axis y label/.style={ at={(ticklabel* cs:1)},
anchor=south,
},
}\begin{tikzpicture}\begin{axis}[
title={sum of hatched region converges to Euler's constant},
xlabel={$x$},
ylabel={$y$},
xmin=0,
xmax={\the\numexpr\myN+2},
ymin=0,
ymax=1.3,
xtick=\empty,
ytick=\empty,
extra x ticks={1, \myN},
extra x tick labels={$1$, $n$},
extra y ticks={1},
]
\addplot[name path=A,domain=1:\myN,samples=501,smooth]{1/x}\closedcycle;
\addlegendentry{$y =\frac{1}{x}$};
\addplot+[domain=1:\myN+1,samples=\myN+1,jump mark left,blue,mark=*,mark options={draw=blue,fill=blue}] {1/x};
\addlegendentry{$y =\frac{1}{\lfloor x \rfloor}$};
\addplot+[name path=B,domain=1:\myN+1,samples=\myN+1,jump mark left,mark=none, draw=none] {1/x}\closedcycle;
\addplot[pattern=north east lines] fill between [of=A and B];
\end{axis}\end{tikzpicture}\end{document}
In my previous post about LaTeX tables, I used \cellcolor{white} to
override the \rowcolor{cyan} in a cell in the leftmost column, which was the
column type name.
On Discord, that cell became black because TeXit inverted black and white.
Discussion
I first tried blending black and white, and I found that black!27 and
black!28 give a good approximation to Discord’s background color.
Thanks to this Discord Color Palette and a bot command
channel on a server, I’ve observed that the desired color is RGB(54,57,62).