#slack-latex
This is a Slack bot that implements a /latex
slash command.
Example usage from within Slack:
/latex $ E = mc^2 $
This server requires:
- Flask
- Requests
pdflatex
from TeXLiveconvert
from imagemagick
On a Ubuntu server, you can install all of these with the following command:
sudo apt-get install python3-flask python3-requests texlive imagemagick
slack-latex
requires a Slack API token (for uploading/posting the rendered formulae).
It also expects you to provide a Slack slash command verification token, which allows
the server to verify that requests indeed came from Slack.
Start by copying files to new places:
sudo cp slacklatex.py /usr/local/bin/
sudo cp config.ini.example /usr/local/etc/config.ini
sudo cp slacklatex.service /lib/systemd/system/
sudo mkdir -p /srv/slacklatex/
Go to https://my.slack.com/services/new/bot and create a new bot. Ours is named latex-bot
.
Once you've created the bot, copy the API Token
from the Integration Settings
into the bot_user_api_token
field in your config.ini
.
Feel free to configure your bot as you see fit (name, avatar, etc).
Go to https://my.slack.com/services/new/slash-commands and create a new slash
command. We recommend /latex
.
Set the URL to the url you plan to run this server from. Make sure your
port matches the one in main.py
.
Copy the verification token from Integration Settings -> Token into
config.ini
as the slash_command_verification_token
value.
Don't forget to register and enable the slacklatex service with systemd!
sudo systemctl daemon-reload
sudo systemctl enable slacklatex.service
sudo systemctl start slacklatex.service