├── LICENSE.md ├── README.md ├── assets ├── step1.jpg └── step2.jpg └── tex2slide.sh /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2016 Google Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tex2Slide 2 | 3 | A convenient minimalistic tool to get latex snippets into your presenter tool. 4 | 5 | ## Install 6 | 7 | 1. Create a MacOs app. From the command line, execute: 8 | 9 | ``` 10 | mkdir -p Tex2Slide.app/Contents/MacOS 11 | cp tex2slide.sh Tex2Slide.app/Contents/MacOS/Tex2Slide 12 | chmod +x Tex2Slide.app/Contents/MacOS/Tex2Slide 13 | ``` 14 | 15 | 2. Drag/drop Tex2Slide app into Finder bar. 16 | 17 | 18 | ## Usage 19 | 20 | 1. Select any valid latex snippet from inside Keynote, e.g., from your Presenter 21 | notes. 22 | 23 | ![Step 1](/assets/step1.jpg?raw=true "Step 1") 24 | 25 | 2. Click Tex2Slide icon. Done. 26 | 27 | ![Step 2](/assets/step2.jpg?raw=true "Step 2") 28 | 29 | ## Requirements 30 | 31 | 1. pdflatex --- set correct path in `tex2slide.sh`. Default: `/Library/TeX/texbin/pdflatex`. 32 | -------------------------------------------------------------------------------- /assets/step1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrtzh/Tex2Slide/4b97b6afe398b30a1c43968f5d0d660f525e51d4/assets/step1.jpg -------------------------------------------------------------------------------- /assets/step2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrtzh/Tex2Slide/4b97b6afe398b30a1c43968f5d0d660f525e51d4/assets/step2.jpg -------------------------------------------------------------------------------- /tex2slide.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright 2016 Google Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | 18 | # tex2slide.sh 19 | # 20 | # A simple shell/Apple script to copy text from Keynote, compile it using 21 | # pdflatex, and paste it back into Keynote as a pdf snippet. As is, the 22 | # script works for Keynote, but it should work for Powerpoint and other 23 | # applications by replacing Keynote below with another name. 24 | # 25 | # To create MacOS app, execute: 26 | # mkdir -p Tex2Slide.app/Contents/MacOS 27 | # cp tex2slide.sh Tex2Slide.app/Contents/MacOS/Tex2Slide 28 | # chmod +x Tex2Slide.app/Contents/MacOS/Tex2Slide 29 | 30 | FONTSIZEPT=32 31 | PDFLATEX=/Library/TeX/texbin/pdflatex 32 | OSASCRIPT=/usr/bin/osascript 33 | WORKDIR=/tmp 34 | FNAME="tex2slide-tmp" 35 | TEXFNAME=$WORKDIR'/'$FNAME'.tex' 36 | PDFFNAME=$WORKDIR'/'$FNAME'.pdf' 37 | 38 | # Activate Keynote and copy to clipboard 39 | $OSASCRIPT -e 'tell application "Keynote" to activate' 40 | $OSASCRIPT -e 'tell application "System Events" to keystroke "c" using {command down}' 41 | 42 | # Write latex file, modify to customize 43 | cat > $TEXFNAME << EOF 44 | \documentclass[preview]{standalone} 45 | \usepackage[usenames]{color} 46 | \usepackage{amssymb} 47 | \usepackage{amsmath} 48 | \usepackage{arev} 49 | \usepackage[T1]{fontenc} 50 | \begin{document} 51 | EOF 52 | echo '\fontsize{'$FONTSIZEPT'}{40}' >> $TEXFNAME 53 | # Alternative if pbpaste not available: 54 | # $OSASCRIPT -e 'do shell script ("echo " & (the clipboard) & " >> $TEXFNAME")' 55 | /usr/bin/pbpaste >> $TEXFNAME 56 | echo '\end{document}' >> $TEXFNAME 57 | 58 | # Compile latex file 59 | cd $WORKDIR 60 | $PDFLATEX $TEXFNAME 61 | 62 | # Copy PDF from Preview to clipboard, paste into Keynote 63 | echo "Opening preview" 64 | /usr/bin/open -a Preview $PDFFNAME 65 | $OSASCRIPT -e 'tell application "Preview" to activate' 66 | $OSASCRIPT -e 'tell application "System Events" to keystroke "c" using {command down}' 67 | $OSASCRIPT -e 'tell application "Keynote" to activate' 68 | $OSASCRIPT -e 'tell application "System Events" to keystroke "v" using {command down}' 69 | --------------------------------------------------------------------------------