Skip to content

Commit 4f9cdb1

Browse files
authored
Minor fixes of the dark mode + automatic equation numbering (alshedivat#160)
* Add an option for showing selected publications * Improve publication styles * Update README.md * Clearfix * Fix minor issues with dark mode * Add automatic equation numbering (alshedivat#158) * Fix a typo
1 parent b36304a commit 4f9cdb1

File tree

8 files changed

+58
-29
lines changed

8 files changed

+58
-29
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ _site
33
.jekyll-metadata
44
.DS_store
55
.ruby-version
6-
Gemfile.lock
76
.tweet-cache/
7+
Gemfile.lock

_config.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
title: blank # the website title (if blank, full name will be used instead)
66
first_name: You
77
middle_name: R.
8-
last_name: (Long Last) Name
8+
last_name: Name
99
email: you@example.com
1010
description: > # the ">" symbol means to ignore newlines until "footer_text:"
1111
A simple, whitespace theme for academics. Based on [*folio](https://github.com/bogoli/-folio) design.
@@ -26,16 +26,14 @@ navbar_fixed: true
2626
footer_fixed: true
2727

2828
# Dimensions
29-
max_width: 800px
29+
max_width: 800px
3030

3131
# TODO: add layout settings (single page vs. multi-page)
3232

3333
# -----------------------------------------------------------------------------
3434
# Open Graph
3535
# -----------------------------------------------------------------------------
3636
# Display links to the page with a preview object on social media.
37-
# To achieve this, change serve_og_meta to true and then provide the URL of the
38-
# preview image as the value of og_image.
3937
serve_og_meta: false # Include Open Graph meta tags in the HTML head
4038
og_image: # The site-wide (default for all links) Open Graph preview image
4139

@@ -157,7 +155,7 @@ enable_google_analytics: false
157155
enable_mansory: true
158156
enable_math: true
159157
enable_tooltips: false
160-
enable_darkmode: false
158+
enable_darkmode: true
161159
show_social_icons: false
162160

163161
# -----------------------------------------------------------------------------

_includes/scripts/mathjax.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{% if site.enable_math %}
22
<!-- MathJax -->
3+
<script type="text/javascript">
4+
window.MathJax = {
5+
tex: {
6+
tags: 'ams'
7+
}
8+
};
9+
</script>
310
<script defer type="text/javascript" id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@{{ site.mathjax.version }}/es5/tex-mml-chtml.js"></script>
411
<script defer src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
512
{% endif %}

_posts/2015-10-20-math.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@ This theme supports rendering beautiful math in inline and display modes using [
99
To use display mode, again surround your expression with `$$` and place it as a separate paragraph. Here is an example:
1010

1111
$$
12-
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
12+
\sum_{k=1}^\infty |\langle x, e_k \rangle|^2 \leq \|x\|^2
1313
$$
1414

15+
You can also use `\begin{equation}...\end{equation}` instead of `$$` for display mode math.
16+
MathJax will automatically number equations:
17+
18+
\begin{equation}
19+
\label{eq:caushy-shwarz}
20+
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
21+
\end{equation}
22+
23+
and by adding `\label{...}` inside the equation environment, we can now refer to the equation using `\eqref`.
24+
1525
Note that MathJax 3 is [a major re-write of MathJax](https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html){:target="\_blank"} that brought a significant improvement to the loading and rendering speed, which is now [on par with KaTeX](http://www.intmath.com/cg5/katex-mathjax-comparison.php){:target="\_blank"}.

_sass/_base.scss

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
// Typography
66

7+
p, h1, h2, h3, h4, h5, h6, em, div, span, strong {
8+
color: var(--global-text-color);
9+
}
10+
711
a, table.table a {
812
color: var(--global-theme-color);
913
&:hover {
@@ -182,10 +186,10 @@ a, table.table a {
182186

183187
// Footer
184188
footer.fixed-bottom {
185-
color: var(--global-footer-text-color);
186189
background-color: var(--global-footer-bg-color);
187190
font-size: 0.75rem;
188191
.container {
192+
color: var(--global-footer-text-color);
189193
padding-top: 9px;
190194
padding-bottom: 8px;
191195
}
@@ -243,10 +247,20 @@ footer.sticky-bottom {
243247
}
244248
}
245249

246-
.pagination .page-item.active .page-link {
247-
background-color: var(--global-theme-color);
248-
&:hover {
249-
background-color: var(--global-theme-color);
250+
.pagination {
251+
.page-item {
252+
.page-link {
253+
color: var(--global-text-color);
254+
&:hover {
255+
color: $black-color;
256+
}
257+
}
258+
&.active .page-link {
259+
background-color: var(--global-theme-color);
260+
&:hover {
261+
background-color: var(--global-theme-color);
262+
}
263+
}
250264
}
251265
}
252266

@@ -393,10 +407,10 @@ footer.sticky-bottom {
393407
transition: all 0.15s ease;
394408
}
395409
div.abstract.hidden {
396-
border: dashed 1px white;
410+
border: dashed 1px var(--global-bg-color);
397411
}
398412
div.abstract.hidden.open {
399-
border-color: $grey-color;
413+
border-color: var(--global-text-color);
400414
}
401415
}
402416
}

assets/js/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ $(document).ready(function() {
55
$('a.bibtex').click(function() {
66
$(this).parent().parent().find(".bibtex.hidden").toggleClass('open');
77
});
8+
$('.navbar-nav').find('a').removeClass('waves-effect waves-light');
89
});

assets/js/dark_mode.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
$(document).ready(function() {
22
const mode_toggle = document.getElementById("light-toggle");
3-
3+
44
mode_toggle.addEventListener("click", function() {
5-
const temp = localStorage.getItem('theme');
5+
const temp = localStorage.getItem("theme");
66
toggleTheme(temp);
77
});
8-
8+
99
let toggleTheme = (theme) => {
1010
if (theme == "dark") {
11-
setTheme(null);
11+
setTheme("light");
1212
} else {
13-
setTheme('dark');
13+
setTheme("dark");
1414
}
1515
}
16-
16+
1717
let setTheme = (theme) => {
1818
trans();
1919
if (theme) {
20-
document.documentElement.setAttribute('data-theme', theme)
20+
document.documentElement.setAttribute("data-theme", theme)
2121
}
2222
else {
23-
document.documentElement.removeAttribute('data-theme');
23+
document.documentElement.removeAttribute("data-theme");
2424
}
25-
localStorage.setItem('theme', theme);
25+
localStorage.setItem("theme", theme);
2626
};
27-
27+
2828
let trans = () => {
29-
document.documentElement.classList.add('transition');
29+
document.documentElement.classList.add("transition");
3030
window.setTimeout(() => {
31-
document.documentElement.classList.remove('transition')
32-
}, 1000)
31+
document.documentElement.classList.remove("transition")
32+
}, 500)
3333
}
3434
});
35-

assets/js/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Has to be in the head tag, otherwise a flicker effect will occur.
1+
// Has to be in the head tag, otherwise a flicker effect will occur.
22
let initTheme = (theme) => {
33
if (theme == null) {
44
const userPref = window.matchMedia;

0 commit comments

Comments
 (0)