Is there a package to typeset tweets in a more fancy way than simply quoting?

  • 3
    To close voters: the previous question of OP gave a pretty good result: tex.stackexchange.com/questions/68517/… – Przemysław Scherwentke Aug 6 '16 at 1:27
  • 2
    @PrzemysławScherwentke: Words like "more fancy" is subjective or "primarily opinion-based. – Werner Aug 6 '16 at 2:18
  • 3
    How about adding more informations, like what for a tweet (example) and how should it be displayed? Your question is very, very unclear! – Mensch Aug 6 '16 at 18:58
  • I'd like to see an answer! – JPi Aug 6 '16 at 21:21
  • 1
    So I was experimenting with this because of this question. This is just simple quote but automated! curl 'https://publish.twitter.com/oembed?url=https://twitter.com/Interior/status/463440424141459456' |perl -MJSON -pe 'BEGIN { binmode STDOUT, ":utf8"; } $_ = decode_json $_; $_ = $_->{html}' | pandoc -f html -t latex --latex-engine=xelatex -o tweet.pdf – wilx Aug 6 '16 at 22:55

So I bit the bait and done something: tweet2latex. This is a utility based on twarc that retrieves tweets and necessary images and generates LaTeX fragment to standard output. Run this from command line, e.g., like this:

./tweet2latex.py 762602474293321728 |tee tweet.tex

The tweet.tex file will contain something like this:

\begin{tweet}\tweetUserImage{https://pbs.twimg.com/profile\_images/683232086958993408/rnyugqzL\_normal.jpg}{rnyugqzL-normal.jpg}{701158958}\tweetUserName{701158958}{MedicNow}It could be worse. You could be the lifeguard at the \tweetHashtag{Rio}{\#Rio} swimming pool.... \tweetHashtag{MondayMotivation}{\#MondayMotivation} \tweetPhoto{http://twitter.com/MedicNow/status/762602474293321728/photo/1}{https://pbs.twimg.com/media/CpVOzW7WEAAhMte.jpg}{CpVOzW7WEAAhMte.jpg}{https://t.co/AfoOoV9qQw}\tweetItself{762602474293321728}{Mon Aug 08 10:52:52 +0000 2016}\end{tweet}

This can be then included in your LaTeX document with \input{tweet}. For this to render into something you will have to define tweet environment and some command in it. See example document tweet-document.tex for complete file, here is just the tweet environment:

  \newcommand{\tweetItself}[2]{\flushright \href{https://twitter.com/statuses/##1}{##2}}%

See complete PDF with few tweets, here is just one page:

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.