Skip to content

Instantly share code, notes, and snippets.

@dario2994
Last active January 1, 2016 18:38
Show Gist options
  • Save dario2994/8184649 to your computer and use it in GitHub Desktop.
Save dario2994/8184649 to your computer and use it in GitHub Desktop.
How to have Latex in Empathy (using Mathjax).
sudo apt-get install libjs-mathjax libjs-mathjax-doc fonts-mathjax fonts-mathjax-extras
cd /usr/share/adium/message-styles
sudo cp -R Classic.AdiumMessageStyle/ LatexClassic.AdiumMessageStyle/
cd LatexClassic.AdiumMessageStyle/Contents
sudo wget https://gist.githubusercontent.com/dario2994/8184649/raw/f8cd80dcfaabb71587d76bb27eac7220aa1f9171/PATCH_Info.plist -O Info.plist
sudo wget https://gist.githubusercontent.com/dario2994/8184649/raw/e3b5983889022f3fba0f97e4c2704b428d513253/PATCH_Content.html -O Resources/Content.html
gsettings set org.gnome.Empathy.conversation theme 'LatexClassic'
This guide explains how to modify the classic theme of empathy (minimal one... the best one!) in order to have latex in empathy's chat windows.
The two files PATCH_Info.plist, PATCH_Content.html are in this same gist.
First of all install mathjax:
sudo apt-get install libjs-mathjax libjs-mathjax-doc fonts-mathjax fonts-mathjax-extras
Open /usr/share/adium/message-styles
Make a copy of Classic.AdiumMessageStyle in the same folder and rename it LatexClassic.AdiumMessageStyle
Open /LatexClassic.AdiumMessageStyle/Contents
Modify Info.plist substituting its content with the content of PATCH_Info.plist
Open /Resources
Modify Content.html substituting its content with the content of PATCH_Content.html
Then go to:
Empathy->Preferences->Theme
And Choose LatexClassic Theme
Close Empathy (set it offline and close the window).
Now at the restart of Empathy you will have Latex implemented in the chat, usable with \( \) for inline math and $$ $$ for displayed math.
<div class="%messageClasses%">
<span class="sender">%sender%:</span>
<span class="message" id="ToBeMathjaxed">%message%</span>
<script>
var newMsgSpan=document.getElementById("ToBeMathjaxed");
newMsgSpan.removeAttribute("id");
if( typeof MathJax == "undefined" ) {
var MathScript = document.createElement("script");
MathScript.src = "file:///usr/share/javascript/mathjax/MathJax.js?config=default";
MathScript.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(MathScript);
}
else MathJax.Hub.Queue(["Typeset", MathJax.Hub,newMsgSpan]);
</script>
</div>
<div id="insert"></div>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AllowTextColors</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleGetInfoString</key>
<string>LatexClassic Message Style</string>
<key>CFBundleIdentifier</key>
<string>dario2994.LatexClassic.style</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>1.0</string>
<key>CFBundleName</key>
<string>LatexClassic</string>
<key>CFBundlePackageType</key>
<string>AdIM</string>
<key>DefaultBackgroundColor</key>
<string>ffffff</string>
<key>MessageViewVersion</key>
<integer>4</integer>
<key>DisableCombineConsecutive</key>
<false/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment