commit 9d1293eab0f4530f40d04c33ac0f80234b0ac8ef
parent 55253368d51752b53f32f5ad4ed16f01d2ac6aee
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Fri, 11 Jul 2025 21:08:38 -0300
updated PDF style
Diffstat:
4 files changed, 29 insertions(+), 36 deletions(-)
diff --git a/guias/complejidad_algoritmica/fix-math.lua b/guias/complejidad_algoritmica/fix-math.lua
@@ -1,4 +1,17 @@
--- removes all `$$` surrounding align contexts
+-- removes all `$$` surrounding \begin{align} and \begin{align*} contexts; also
+-- modifies the space after and before equations by adding \vspace{...}
+--
+-- \begin{align} .. \end{align} adds more vertical space before and after than
+-- $$ .. $$ (or \[ \] in latex notation)
+
+local eq_before_space = "-1em"
+local eq_after_space = "0em"
+local eq_align_before_space "-0.75em"
+local eq_align_after_space "-0.75em"
+
+local function vspace(amount)
+ return pandoc.RawBlock('latex', '\\vspace{' .. amount .. '}')
+end
function walk_blocks(blocks)
local new_blocks = {}
@@ -8,12 +21,16 @@ function walk_blocks(blocks)
local new_inlines = {}
for _, inline in ipairs(blk.content) do
if inline.t == 'Math' and inline.mathtype == 'DisplayMath' then
+ table.insert(new_blocks, vspace(eq_before_space))
if inline.text:match('^\\begin{align%*?}') then
- -- Replace inline Math with RawBlock (convert Para to RawBlock)
+ -- replace inline Math with RawBlock (convert Para to RawBlock)
+ table.insert(new_blocks, vspace(eq_align_before_space))
table.insert(new_blocks, pandoc.RawBlock('latex', inline.text))
+ table.insert(new_blocks, vspace(eq_align_after_space))
else
- table.insert(new_inlines, inline)
+ table.insert(new_blocks, pandoc.RawBlock('latex', '\\[' .. inline.text .. '\\]'))
end
+ table.insert(new_blocks, vspace(eq_after_space))
else
table.insert(new_inlines, inline)
end
@@ -23,35 +40,17 @@ function walk_blocks(blocks)
table.insert(new_blocks, pandoc.Para(new_inlines))
end
- elseif blk.t == 'Plain' then
- -- Similar handling for Plain blocks
- local new_inlines = {}
- for _, inline in ipairs(blk.content) do
- if inline.t == 'Math' and inline.mathtype == 'DisplayMath' then
- if inline.text:match('^\\begin{align%*?}') then
- table.insert(new_blocks, pandoc.RawBlock('latex', inline.text))
- else
- table.insert(new_inlines, inline)
- end
- else
- table.insert(new_inlines, inline)
- end
- end
- if #new_inlines > 0 then
- table.insert(new_blocks, pandoc.Plain(new_inlines))
- end
-
elseif blk.t == 'CodeBlock' or blk.t == 'RawBlock' then
-- Just keep them as is
table.insert(new_blocks, blk)
elseif blk.t == 'BlockQuote' or blk.t == 'Div' then
-- Recurse on nested blocks
+ table.insert(new_blocks, vspace("0.5em"))
blk.content = walk_blocks(blk.content)
table.insert(new_blocks, blk)
-
+ table.insert(new_blocks, vspace("0.5em"))
else
- -- Other block types just pass through
table.insert(new_blocks, blk)
end
end
diff --git a/guias/complejidad_algoritmica/respuestas.md b/guias/complejidad_algoritmica/respuestas.md
@@ -218,7 +218,7 @@ Entonces de $(18)$ en $(17)$
$$\begin{align}
T(n) &= 2\cdotp \left[2 T\left(\frac{n}{4}\right) + \Omicron\left(\frac{n}{2}\right)\right] + \Omicron(n) \nonumber \\
- &= 4\cdotp T\left(\frac{n}{4}\right) + 2\cdotp \Omicron\left(\frac{n}{2}\right) + \Omicron(n) \\
+ &= 4\cdotp T\left(\frac{n}{4}\right) + 2\cdotp \Omicron\left(\frac{n}{2}\right) + \Omicron(n)
\end{align}$$
Realizando una iteración más $T\left(\frac{n}{4}\right)$ resulta de reemplazar $n =
@@ -236,16 +236,16 @@ T(n) &= 4\cdotp \left[ 2T\left(\frac{n}{8}\right) +
\Omicron\left(\frac{n}{2}\right) + \Omicron(n) \nonumber \\
&= 8\cdotp T\left(\frac{n}{8}\right) +
4\cdotp \Omicron\left(\frac{n}{4}\right) +
- 2\cdotp \Omicron\left(\frac{n}{2}\right) + \Omicron(n)\\
+ 2\cdotp \Omicron\left(\frac{n}{2}\right) + \Omicron(n)
\end{align}$$
Es decir, luego de $k$ iteraciones se llega a:
$$\begin{align}
T(n) &= 2^{k}\cdotp T\left(\frac{n}{2^{k}}\right) +
- \sum^{k-1}_{i=0} 2^{i} \cdotp \Omicron\left(\frac{n}{2^{i}}\right) \nonumber\\
+ \sum^{k-1}_{i=0} 2^{i} \cdotp \Omicron\left(\frac{n}{2^{i}}\right) \nonumber \\
&= 2^{k}\cdotp T\left(\frac{n}{2^{k}}\right) +
- \sum^{k-1}_{i=0} \Omicron(n) \\
+ \sum^{k-1}_{i=0} \Omicron(n)
\end{align}$$
Pero cuando se llega al caso base se cumple:
diff --git a/guias/complejidad_algoritmica/respuestas.pdf b/guias/complejidad_algoritmica/respuestas.pdf
Binary files differ.
diff --git a/guias/complejidad_algoritmica/style.tex b/guias/complejidad_algoritmica/style.tex
@@ -45,7 +45,7 @@
\newfontfamily\titlefont{Inter}[
UprightFont = *-Regular,
BoldFont = *-ExtraBold,
-Scale = 1.0
+Scale = 0.90
]
\newfontfamily\sectionsfont{Inter}[
@@ -53,8 +53,7 @@ UprightFont = *-Regular,
BoldFont = *-Bold,
]
-% \setmathfont{Fira Math}
-\setmathfont[Scale=1.0]{Fira Math}
+\setmathfont[Scale=1.05]{Fira Math}
\usepackage{xcolor}
\definecolor{ugrey}{HTML}{333333}
@@ -248,10 +247,5 @@ BoldFont = *-Bold,
% Reduce space around displayed equations safely
\makeatletter
-\setlength{\abovedisplayskip}{6pt} % space above display math
-\setlength{\belowdisplayskip}{6pt} % space below display math
-\setlength{\abovedisplayshortskip}{4pt} % space above short display math
-\setlength{\belowdisplayshortskip}{4pt} % space below short display math
-
-\setlength{\jot}{4pt} % space between lines in align environments (default ~6pt)
+\setlength{\jot}{8pt} % valor por defecto es 3pt aproximadamente
\makeatother