Skip to content

Commit e03ece9

Browse files
committed
Show subheadings in TOC
1 parent 1cb755b commit e03ece9

File tree

2 files changed

+104
-52
lines changed

2 files changed

+104
-52
lines changed

src/components/blog/TOCHeading.astro

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ interface Props {
66
}
77
88
const {
9-
heading: { depth, slug, text },
10-
} = Astro.props;
9+
heading: { depth, slug, subheadings, text }
10+
} = Astro.props
1111
---
1212

13-
<li class={`${depth > 2 ? "ms-2" : ""}`}>
14-
<a
15-
aria-label={`Scroll to section: ${text}`}
16-
class={`block line-clamp-2 ${depth <= 2 ? "mt-2" : "mt-1 text-sm"} text-foreground/75 transition-all hover:text-foreground`}
17-
href={`#${slug}`}>{text}</a
18-
>
13+
<li class={`${depth > 2 ? 'ms-2' : ''}`}>
14+
<a
15+
aria-label={`Scroll to section: ${text}`}
16+
class={`block line-clamp-2 ${depth <= 2 ? 'mt-2' : 'mt-1 text-sm'} text-xs text-foreground/75 transition-all hover:text-foreground`}
17+
href={`#${slug}`}>{text}</a
18+
>
19+
{
20+
!!subheadings.length && (
21+
<ul class="list-decimal">
22+
{subheadings.map((subheading) => (
23+
<Astro.self heading={subheading} />
24+
))}
25+
</ul>
26+
)
27+
}
1928
</li>

src/content/post/writing-advice.mdx

Lines changed: 87 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,111 @@ publishDate: 2024-08-30 00:00
66

77
import BlogImage from "@/components/BlogImage.astro";
88

9-
## General protips
9+
## General writing protips
1010

1111
- **DO:** Write before you even do any experiment.
12+
- Your initial draft = hypothesis
13+
- Experiments = observations
14+
- Update your draft based on your experiments = posterior
15+
- Rinse lather repeat
1216
- **_DON’T_:** Leave everything to the last minute, esp. writing.
13-
- **DO:** _Obsess_ over styling (see below).
17+
- **_DON'T_:** Wait until the last minute to submit your paper.
18+
- Server overload is a thing.
1419
- **DO:** Read _widely_ and _a lot_ (in English!): novels, nonfictions,
1520
popular science, etc.
21+
- **DO:** Take pride of your work and paper. It's your life's work.
22+
- Haphazard, low-effort, inconsistent-styling paper signals to the reader that you
23+
yourself don't care.
24+
- Why should they care about your work then?
25+
- **DO:** See paper-writing as a **_craft_**. Always hone your **_craftmanship_**.
26+
- **DO:** _Obsess_ over styling (see below).
1627
- **DO:** Read math books and appreciate the typography & styling.
28+
- **DO:** Have a blog site. Publish several in-depth blog posts per year.
29+
- **_DON'T:_** Be afraid of people think you're dumb based on your blog posts.
30+
- See my blog post archive from 2016 --- they're so simple and embarassing.
1731

1832
## LaTeX protips
1933

34+
### General
35+
2036
- **One line = one sentence**
2137
- This will make debugging easier, due to how LaTeX shows errors
2238
- **Quotation marks:** Instead of `"something"`, write ` ``something'' `
2339
(2 backtics & 2 standard ticks)
40+
41+
### Styles
42+
43+
#### Figures
44+
45+
- Must always fill the full paper width (or column width).
46+
- Use [my library](https://github.com/wiseodd/pub-ready-plots).
47+
- For figures with multiple subplots, avoid creating a single pdf file
48+
for each subplot. Instead, [follow this](https://github.com/wiseodd/pub-ready-plots?tab=readme-ov-file#creating-a-figure-with-multiple-subplots)
49+
- If you think they are not appropriate for full width, use [wrapfig](https://www.overleaf.com/learn/latex/Positioning_images_and_tables).
50+
- See also [how to do this with my plotting library](https://github.com/wiseodd/pub-ready-plots?tab=readme-ov-file#creating-plots-for-wrapfigure).
51+
52+
#### Tables
53+
54+
- Always use booktabs instead of standard table. [See this](https://nhigham.com/2019/11/19/better-latex-tables-with-booktabs/).
55+
- Like figures, must also always fill the full width.
56+
[See how](https://tex.stackexchange.com/questions/240154/setting-table-width-exactly-to-linewidth).
57+
- Also, like figures, use [wraptable](https://www.overleaf.com/learn/latex/Positioning_images_and_tables)
58+
if your table is not appropriate for full width.
59+
60+
### Maths
61+
2462
- **Math macros:** [Use this](https://github.com/goodfeli/dlbook_notation/blob/master/math_commands.tex)
2563
and add your own often-used math definitions
2664
- So, gone are the days where you need to write `\mathbf{x}` again and again.
2765
Instead you could just write `\vx`.
28-
- **Citation:** Always use `natbib`! Two ways of citing:
66+
67+
### Bibliography
68+
69+
#### Citations
70+
71+
- Always use `natbib`! Two ways of citing:
2972
- "... has been done before [4]." --- in this case, you use `\citep`
3073
and write `... has been done before \citep{someone2024}`.
3174
- "Someone et al, 2024 has done ..." --- in this case, you use `\citet`
3275
and write `\citet{someone2024} has done ...`
33-
- **Table:** Always use booktabs instead of standard table. [See this](https://nhigham.com/2019/11/19/better-latex-tables-with-booktabs/).
34-
- **Style tips:**
35-
- Figures must always fill the full paper width (or column width).
36-
- Use [my library](https://github.com/wiseodd/pub-ready-plots).
37-
- For figures with multiple subplots, avoid creating a single pdf file
38-
for each subplot. Instead, [follow this](https://github.com/wiseodd/pub-ready-plots?tab=readme-ov-file#creating-a-figure-with-multiple-subplots)
39-
- Tables, likewise, must also always fill the full width.
40-
[See how](https://tex.stackexchange.com/questions/240154/setting-table-width-exactly-to-linewidth).
41-
- If you think they are not appropriate for full width, use [wrapfig and wraptable](https://www.overleaf.com/learn/latex/Positioning_images_and_tables).
42-
- **Bibliography:**
43-
44-
- Don't just copy-paste from Google Scholar! Always recheck & edit!
45-
- E.g. make sure the proper capitalization:
46-
- Instead of: `title={Introduction to Bayesian optimization}`
47-
- Write this: `title={Introduction to {B}ayesian optimization}`
48-
- I.e., always surround the character that needs to be capitalized
49-
with `{ }`
50-
- Venue precedence if a publication appears in multiple venues
51-
(top = most prioritized):
52-
1. Journal
53-
2. Conference
54-
3. Workshop/symposium
55-
4. ArXiv/preprint
56-
- For well-known ML conferences, simply use their abbreviations.
57-
- E.g. "Advances in Neural Information Processing Systems 35" -> "NeurIPS".
58-
- For conference, use `@inproceedings`.
59-
- The only fields needed are `title`, `author`, `booktitle`, and `year`.
60-
- No need for other things like `page`, `editor`, etc.
61-
- For journal/ArXiv, use `@article`.
62-
- Use `journal` instead of `booktitle`.
63-
- Additionally, `volume` and `number` must be included.
64-
- **Example:**
65-
66-
```bibtex
67-
@inproceedings{kristiadi2024sober,
68-
title={A Sober Look at {LLMs} for Material Discovery: {A}re They Actually Good for {B}ayesian Optimization Over Molecules?},
69-
author={Kristiadi, Agustinus and Strieth-Kalthoff, Felix and Skreta, Marta and Poupart, Pascal and Aspuru-Guzik, Al\'{a}n and Pleiss, Geoff},
70-
booktitle={ICML},
71-
year={2024}
72-
}
73-
```
76+
77+
#### References / bibtex
78+
79+
- **Rule to live by:** Dirty, inconsistent, low-effort reference list signals
80+
to the reader that you don't care. Why should they care about your work?
81+
- Don't just copy-paste from Google Scholar! Always recheck & edit!
82+
- E.g. make sure the proper capitalization:
83+
- Instead of: `title={Introduction to Bayesian optimization}`
84+
- Write this: `title={Introduction to {B}ayesian optimization}`
85+
- I.e., always surround the character that needs to be capitalized
86+
with `{ }`
87+
- Venue precedence if a publication appears in multiple venues
88+
(top = most prioritized):
89+
1. Journal
90+
2. Conference
91+
3. Workshop/symposium
92+
4. ArXiv/preprint
93+
- For well-known ML conferences, simply use their abbreviations.
94+
- E.g. "Advances in Neural Information Processing Systems 35" -> "NeurIPS".
95+
- For conference, use `@inproceedings`.
96+
- The only fields needed are `title`, `author`, `booktitle`, and `year`.
97+
- No need for other things like `page`, `editor`, etc.
98+
- For journal/ArXiv, use `@article`.
99+
- Use `journal` instead of `booktitle`.
100+
- Additionally, `volume` and `number` must be included.
101+
- **Example:**
102+
103+
```bibtex
104+
@inproceedings{kristiadi2024sober,
105+
title={
106+
A Sober Look at {LLMs} for Material Discovery:
107+
{A}re They Actually Good for {B}ayesian Optimization Over Molecules?
108+
},
109+
author={
110+
Kristiadi, Agustinus and Strieth-Kalthoff, Felix and Skreta, Marta
111+
and Poupart, Pascal and Aspuru-Guzik, Al\'{a}n and Pleiss, Geoff
112+
},
113+
booktitle={ICML},
114+
year={2024}
115+
}
116+
```

0 commit comments

Comments
 (0)