A LaTeX-inspired Hugo theme for elegant technical writing and academic content
Transform your Hugo site into a beautifully typeset document with the classic aesthetics of LaTeX. Perfect for researchers, mathematicians, and anyone who appreciates excellent typography.
- π LaTeX-style Typography - Classic, elegant document styling inspired by LaTeX
- β‘ Server-Side Math Rendering - KaTeX with zero JavaScript overhead, instant page loads
- π Automatic Dark Mode - Respects system preferences with seamless theme switching
- π± Mobile Optimized - Fast and responsive on all devices
- π Lightning Fast - No client-side JavaScript required for math rendering
- π SEO-Friendly - Built-in OpenGraph and Twitter Card support
- π Sidenotes Support - Elegant margin notes for supplementary content
- π Article Abstracts - Automatically displays content before
<!--more-->as an academic-style abstract - π¨ Customizable - Easy theming with simple configuration
- βΏ Accessible - Works perfectly even with JavaScript disabled
- Researchers & Academics - Write papers and notes with LaTeX-quality output
- Technical Bloggers - Share tutorials and documentation with beautiful code and math
- Mathematics Content - Display complex equations with proper typesetting
- Science Communicators - Present technical content in an elegant, readable format
- Anyone - Who appreciates clean, professional typography
- Hugo >= 0.146.0 (Download Hugo)
- Git
# Clone the repository
git clone https://github.com/kaisugi/HugoTeX
cd HugoTeX/exampleSite
# Start the development server
hugo server -t ../..
# Open http://localhost:1313/ in your browser# Add the theme as a submodule to your Hugo site
cd your-hugo-site
git submodule add https://github.com/kaisugi/HugoTeX.git themes/HugoTeX
# Update your config
echo 'theme = "HugoTeX"' >> hugo.toml# Initialize your site as a Hugo module
hugo mod init github.com/yourusername/yoursite
# Add to your hugo.toml
cat >> hugo.toml << EOF
[module]
[[module.imports]]
path = "github.com/kaisugi/HugoTeX"
EOF
# Get the theme
hugo mod get# Clone directly into themes directory
cd your-hugo-site/themes
git clone https://github.com/kaisugi/HugoTeX.gitCreate or update your hugo.toml:
baseURL = "https://example.com/"
title = "My Hugo Site"
theme = "HugoTeX"
languageCode = "en"
DefaultContentLanguage = "en"
enableInlineShortcodes = true
footnoteReturnLinkContents = "^"
[pagination]
pagerSize = 10
[Params]
darkmode = true # Set to true to enforce dark mode
# lightmode = true # Set to true to enforce light mode
[Params.Author]
name = "Your Name"
abstract = """
Your bio goes here. This appears on the homepage.
"""
[taxonomies]
category = "categories"
tag = "tags"
series = "series"
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
[markup.goldmark.extensions]
[markup.goldmark.extensions.passthrough]
enable = true
[markup.goldmark.extensions.passthrough.delimiters]
inline = [['$', '$']]
block = [['$$', '$$']]
[markup.highlight]
style = "paraiso-dark" # Syntax highlighting styleDark Mode Control
By default, dark mode automatically activates based on the user's system prefers-color-scheme setting.
- Set
darkmode = trueto enforce dark mode - Set
lightmode = trueto enforce light mode - Omit both for automatic switching
Enable rich previews on social platforms:
[Params]
twittercard = true
opengraph = trueSee Hugo's Internal Templates for advanced configuration.
HugoTeX uses KaTeX with server-side rendering for mathematical notation.
- β‘ Zero JavaScript overhead - Math renders instantly, no client-side processing
- π± Better mobile performance - Especially on slower devices
- βΏ Works without JavaScript - Accessible by default
- π Faster page loads - No render blocking
Simply write math expressions in your Markdown:
Inline math: $E = mc^2$ β
Display math:
$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$Math is automatically processed using Hugo's built-in transform.ToMath function. The passthrough extension (shown in config above) enables this functionality.
Reference: Hugo Math in Markdown | KaTeX Supported Functions
Create elegant margin notes with the sidenote shortcode:
Here's some text with a sidenote.{{%/* sidenote */%}}This appears in the margin.{{%/* /sidenote */%}}Behavior:
- Desktop: Displays in the right margin
- Mobile: Hidden by default, revealed by clicking the reference number
This feature is powered by LaTeX.css.
Change the code highlighting theme in your config:
[markup.highlight]
style = "monokai" # Try: github, dracula, nord, etc.Browse available styles: Chroma Style Gallery
Add custom styles by creating assets/css/custom.css in your site directory.
Using HugoTeX? We'd love to feature your site! Open an issue or PR to add it here.
Contributions are welcome! Here's how you can help:
- π Report bugs - Open an issue describing the problem
- β¨ Suggest features - Share your ideas for improvements
- π Improve documentation - Help make the docs clearer
- π§ Submit pull requests - Fix bugs or add features
Before contributing:
- Check existing issues and PRs
- Test your changes thoroughly
- Follow the existing code style
- Update documentation as needed
MIT License - see LICENSE for details
This theme is heavily inspired by:
Looking for alternatives? Check out:
- hugo-theme-texify - Another excellent LaTeX-inspired theme
Made with β€οΈ by Kaito Sugimoto
If you find HugoTeX useful, please consider giving it a β on GitHub!
