Here’s your detailed guide on how to display beautifully rendered math formulas in your Jekyll blog. Whether it’s a simple equation or complex mathematical expressions, this post will cover everything you need to elevate the mathematical aesthetics of your blog.


How to Display Math Formulas in Jekyll

Math can be a tough subject, but displaying math formulas elegantly in your Jekyll blog doesn’t have to be. In this tutorial, we are going to utilize MathJax, a popular JavaScript library that renders LaTeX or MathML-based math equations dynamically in web browsers.

Why Use MathJax?

MathJax is highly compatible with all browsers and produces high-quality output. It supports LaTeX, MathML, and AsciiMath notations. Therefore, it’s perfect for seamlessly integrating math expressions into static sites like those built with Jekyll.

Step-by-Step Setup

1. Add MathJax to Your Jekyll Site

To start using MathJax, you need to include the MathJax script in your Jekyll layout. This is usually done in your _layouts/default.html (or whatever layout you primarily use).

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript"
            src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-mml-chtml.js">
    </script>
    <title>How to Dispaly Math Formulas in Jekyll</title>
</head>
<body>
    <!-- Content -->
    <article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">

  <header class="post-header">
    <h1 class="post-title p-name" itemprop="name headline">Raspberry Pi as a Media Center: Transforming Your TV</h1>
    <p class="post-meta">
      <time class="dt-published" datetime="2024-10-02T00:00:00+00:00" itemprop="datePublished">Oct 2, 2024
      </time></p>
  </header>

  <div class="post-content e-content" itemprop="articleBody">
    <h1 id="raspberry-pi-as-a-media-center-transforming-your-tv">Raspberry Pi as a Media Center: Transforming Your TV</h1>

<p>In the age of digital entertainment, the Raspberry Pi emerges as a powerful, pocket-sized solution to transform any TV into a full-fledged media center. Its versatility, low cost, and ease of use make it an ideal choice for tech enthusiasts and novices alike. This blog post delves into setting up Raspberry Pi as a media center using open-source software.</p>

<h2 id="why-raspberry-pi">Why Raspberry Pi?</h2>

<p>With its compact form factor, affordable price, and extensive community support, the Raspberry Pi is perfect for creating a customized media experience, streaming videos, music, and more on your TV.</p>

<h2 id="getting-started">Getting Started</h2>

<h3 id="what-youll-need">What You’ll Need</h3>
<ul>
  <li><strong>Raspberry Pi 3 or 4</strong>: More powerful versions are recommended for smoother playback.</li>
  <li><strong>MicroSD Card (16GB or more)</strong>: To store the operating system and media files.</li>
  <li><strong>Power Supply</strong>: A 5V micro USB power adapter.</li>
  <li><strong>HDMI Cable</strong>: To connect Raspberry Pi to the TV.</li>
  <li><strong>Internet Connection</strong>: Wi-Fi or Ethernet cable.</li>
  <li><strong>Input Device</strong>: USB keyboard/mouse or remote control.</li>
</ul>

<h3 id="installing-libreelec">Installing LibreELEC</h3>

<p>LibreELEC is a lightweight Linux distribution that transforms Raspberry Pi into a standalone Kodi-based media center.</p>

<ol>
  <li>
    <p><strong>Download LibreELEC:</strong>
Go to the <a href="https://libreelec.tv/downloads/">LibreELEC website</a> and download the appropriate installer for your operating system.</p>
  </li>
  <li>
    <p><strong>Create Installation Media:</strong>
Insert your microSD card into your card reader, and use the LibreELEC USB/SD Card creator tool to write the image to the card.</p>

    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo dd </span><span class="k">if</span><span class="o">=</span>LibreELEC-RPi2.arm-10.x.x.img <span class="nv">of</span><span class="o">=</span>/dev/sdX <span class="nv">bs</span><span class="o">=</span>4M
</code></pre></div>    </div>
    <blockquote>
      <p>Replace <code class="language-plaintext highlighter-rouge">/dev/sdX</code> with your actual microSD card device.</p>
    </blockquote>
  </li>
  <li>
    <p><strong>Boot and Setup Raspberry Pi:</strong>
Insert the microSD card into your Raspberry Pi, connect all necessary cables, and power it on. Follow the on-screen instructions to complete the setup.</p>
  </li>
</ol>

<h2 id="configuring-kodi">Configuring Kodi</h2>

<h3 id="basic-setup">Basic Setup</h3>

<p>Once your Raspberry Pi boots into LibreELEC:</p>
<ul>
  <li><strong>Language Selection:</strong> Set your preferred language.</li>
  <li><strong>Network Configuration:</strong> Connect to Wi-Fi or Ethernet.</li>
</ul>

<h3 id="adding-media">Adding Media</h3>

<ol>
  <li><strong>Add Video Sources:</strong> Navigate to <code class="language-plaintext highlighter-rouge">Videos &gt; Files &gt; Add Videos...</code> and specify your media content directory.</li>
  <li><strong>Content Type:</strong> Define the type of media for accurate content scraping (movies, TV shows).</li>
</ol>

<h3 id="installing-add-ons">Installing Add-ons</h3>

<p>Enhance your media center by installing popular Kodi add-ons:</p>

<ol>
  <li><strong>Access Add-ons Menu:</strong> Go to <code class="language-plaintext highlighter-rouge">Add-ons</code> from the main menu.</li>
  <li><strong>Download Add-ons:</strong> Choose <code class="language-plaintext highlighter-rouge">Install from repository &gt; Kodi Add-on Repository</code> to explore various video, music, and program add-ons.</li>
</ol>

<h2 id="advanced-configuration">Advanced Configuration</h2>

<h3 id="remote-control">Remote Control</h3>

<p>Control your new media center with ease by enabling your smartphone or using a remote app.</p>
<ol>
  <li>Download <code class="language-plaintext highlighter-rouge">Kore, Official Kodi Remote</code> app for your smartphone.</li>
  <li>Connect it to your Raspberry Pi via your home Wi-Fi network.</li>
</ol>

<h3 id="performance-optimization">Performance Optimization</h3>

<ul>
  <li>
    <p><strong>Overclocking (Optional):</strong> Improve performance by editing <code class="language-plaintext highlighter-rouge">/flash/config.txt</code>. Be cautious as overclocking may void warranties or damage the device.</p>

    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Add to /flash/config.txt</span>
<span class="nv">over_voltage</span><span class="o">=</span>2  
<span class="nv">arm_freq</span><span class="o">=</span>1350  
<span class="nv">core_freq</span><span class="o">=</span>500  
</code></pre></div>    </div>
  </li>
  <li>
    <p><strong>Memory Split:</strong> Adjust to allocate more RAM to the GPU for better video playback.</p>

    <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Open /flash/config.txt and set</span>
<span class="nv">gpu_mem</span><span class="o">=</span>256
</code></pre></div>    </div>
  </li>
</ul>

<h2 id="conclusion">Conclusion</h2>

<p>With your Raspberry Pi configured as a media center, enjoy a seamless multimedia experience without the cost of commercial set-top boxes. Dive into your favorite content effortlessly and explore new media frontiers.</p>

<p>Embrace the power of Raspberry Pi and leverage open-source software to craft a personalized media environment, ensuring endless hours of entertainment with mere minimal investments!</p>

  </div><a class="u-url" href="/2024/10/02/Raspberry-Pi-as-a-Media-Center-Transforming-Your-TV.html" hidden></a>
</article>

</body>
</html>

2. Write Math in Your Markdown Files

You can now write LaTeX-style equations directly in your Markdown files using Jekyll. Here’s an example:

For inline math, use single dollar signs $...$:

The Euler's formula is given by $e^{i\pi} + 1 = 0$.

For display math, use double dollar signs $$...$$:

$$
E = mc^2
$$

3. Verifying the Setup

Once you’ve added the script and included math expressions in your posts, generate and serve your Jekyll site locally to verify everything works correctly:

bundle exec jekyll build
bundle exec jekyll serve

Visit http://localhost:4000 in your web browser. All your math equations should be beautifully rendered.

Customizing MathJax (Optional)

MathJax is highly customizable. You can configure settings such as font size, line breaks, and more by including a MathJax configuration script:

<script type="text/x-mathjax-config">
  MathJax = {
    tex: {
      inlineMath: [['$','$'], ['\\(','\\)']],
      displayMath: [['$$','$$'], ['\\[','\\]']]
    }
  };
</script>

Conclusion

Integrating MathJax with your Jekyll blog is a straightforward process that dramatically upgrades the readability of mathematical content. By following these steps, you can share your mathematical insights with clarity and style.

Feel free to explore the MathJax documentation for more in-depth features and customization options.

Happy blogging with beautifully rendered math! 🎓