title: How can I change font using ReStructured Text with .. raw:: html?
body: <p>I'm working on a project using Sphinx for the first time and wanted to create a method (I'm not sure if that is what it's called, but similar to programming methods just a body of text to do a specific task) to change the font in my Sphinx project. I have found a useful question that allowed me to change the color of text <a href="https://stackoverflow.com/a/5815382/12339799">here</a>.</p>
  <p>Code used to change color below.</p>
  <pre><code>.. raw:: html
  
      &lt;style&gt; .red {color:red} &lt;/style&gt;
  </code></pre>
  <p>After this, I simply added</p>
  <pre><code>.. role:: red
  </code></pre>
  <p>To my .rst file, allowing me to call this method by simply using</p>
  <pre><code>:red:`Text here is red.`
  </code></pre>
  <p>Similarly, I am trying to do this to change the font of text when needed, not of the entire project. Here is my tweaked version of that.</p>
  <pre><code>.. raw:: html
  
      &lt;p style=&quot;font-family:'Courier New'&quot;&gt; .font &lt;/p&gt;
  
  .. role:: font
  </code></pre>
  <p>This worked, sort of... After I use &quot;make html&quot; to compile, my html page will only show &quot;.font&quot; in the new font, and when I try to call</p>
  <pre><code>:font:`new font here`
  </code></pre>
  <p>as before, it will not change the text.</p>
  <p>Any advice on how to get this working properly would be greatly appreciated. Thanks.</p>