File size: 1,890 Bytes
aa8b9d7
 
75d3b58
aa8b9d7
75d3b58
aa8b9d7
75d3b58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa8b9d7
 
 
 
 
75d3b58
 
 
 
 
aa8b9d7
75d3b58
aa8b9d7
 
 
 
 
75d3b58
aa8b9d7
 
75d3b58
aa8b9d7
 
75d3b58
aa8b9d7
 
75d3b58
aa8b9d7
 
 
 
75d3b58
aa8b9d7
75d3b58
 
 
 
aa8b9d7
 
 
75d3b58
aa8b9d7
 
 
75d3b58
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# πŸ“š LaTeX to MDX Integration

This space allows the automatic conversion of any latex content to MDX for Astro, with real time monitoring!

## πŸš€ Usage

## πŸ“ LaTeX Structure to follow

Place your LaTeX sources as such :
```
app/scripts/latex-to-mdx/input/
β”œβ”€β”€ main.tex              # Main doc
β”œβ”€β”€ main.bib              # Bibliography  
β”œβ”€β”€ sections/             # Sections or chapters
β”‚   β”œβ”€β”€ 01_introduction.tex
β”‚   β”œβ”€β”€ 02_methods.tex
β”‚   └── ...
β”œβ”€β”€ figures/              # Images
└── ...                   # Other LaTeX files
```

Now you can start the development server!

### Development mode with LaTeX Watch

```bash
npm run dev:with-latex
```

This commands :
1. βœ… Converts LaTeX β†’ MDX
2. πŸ”„ Monitors the contents of `scripts/latex-to-mdx/input/` for any change
3. 🌐 Launches an Astro server on http://localhost:4321
4. πŸ“ Regerenates `article.mdx` automatically when you do changes to the latex files!

### Production Mode

```bash
npm run build
```

### Other individual scripts

```bash
# Converts LaTeX β†’ MDX once
npm run latex:convert

# Monitors the LaTeX repo only
npm run latex:watch

# Runs Astro without looking on latex (to edit the markdown files directly for example)
npm run dev
```


## βš™οΈ Features

- πŸ”„ **Automated conversion** : 2 seconds per conversion
- πŸ“Š **Monitoring** : Of everything in `input/`
- 🌐 **Hot reload** : Astro reloads after each conversion
- πŸ“ **Colored logs** : To differenciate LaTeX/Astro

## 🐳 Docker

Everything runs in a Dockerfile, which includes the automatic installation of pandox, the conversion of Latex to MDX before the build, and supports the latex env!

## πŸ› οΈ Debugging

If the conversion fails:
1. Check the LaTeX logs (blue ones)
2. Check if Pandoc is installed properly
3. Check the manual conversion with `npm run latex:convert`