summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/fancytooltips/examples/fancy-preview/fancy-preview
blob: f9386225dc2623fa48ab92281a1819ff6389136b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#

FILENAME=$1

COLOR="0.8,0.8,0.8"
PREVIEW="\PreviewEnvironment{definice} \PreviewEnvironment{veta} \PreviewEnvironment{definition} \PreviewEnvironment{figure} \PreviewEnvironment{theorem} \setlength\PreviewBorder{5pt}"

FBOXLENGTHS="\fboxrule=5pt\fboxsep=10pt"

FANCYOPTIONS="mouseover,movetips"

echo "--------------------------"
echo "------ pdflatex ----------"
echo "--------------------------"
pdflatex $FILENAME.tex 
echo "-------------------------------------------"
echo "------ pdflatex with preview.sty ----------"
echo "-------------------------------------------"
pdflatex "\AtBeginDocument{\usepackage[pdftex,active,tightpage,floats,displaymath]{preview} $PREVIEW \definecolor{backgroundcolor}{rgb}{$COLOR}\pagecolor{backgroundcolor}\definecolor{shadethmcolor}{rgb}{$COLOR} \definecolor{shaderulecolor}{rgb}{$COLOR}} \input $FILENAME.tex"

grep '\\newlabel{' $FILENAME.aux | sed 's/newlabel/maplabelstoall/g' > $FILENAME.tmp
mv $FILENAME.pdf $FILENAME-tmp.pdf

echo "----------------------------------------------"
echo "------ pdflatex genearting tooltips ----------"
echo "----------------------------------------------"
pdflatex "\documentclass{minimal}\usepackage[papersize={5in,5in},margin=1pt]{geometry}\usepackage[createtips]{fancytooltips}\usepackage{color,graphicx}\begin{document} $FBOXLENGTHS\relax \definecolor{backgroundcolor}{rgb}{$COLOR}\gdef\savemaplabels#1#2#3#4{\xdef\temp{#2}} \def\maplabelstoall#1#2{\savemaplabels#2 \setbox0=\hbox{\colorbox{backgroundcolor}{\includegraphics[page=\temp]{$FILENAME-tmp.pdf}}}\pdfpagewidth=\wd0 \pdfpageheight=\ht0 \advance \pdfpageheight by \dp0 \copy0 \keytip{#1}\newpage} \input $FILENAME.tmp\end{document}"
mv $FILENAME.tips minimal.tip

echo "----------------------------------------------"
echo "------ pdflatex final compilation 1 ----------"
echo "----------------------------------------------"
pdflatex "\PassOptionsToPackage{active,filename=minimal,$FANCYOPTIONS}{fancytooltips}\input $FILENAME.tex"
echo "----------------------------------------------"
echo "------ pdflatex final compilation 2 ----------"
echo "----------------------------------------------"
pdflatex "\PassOptionsToPackage{active,filename=minimal,$FANCYOPTIONS}{fancytooltips}\input $FILENAME.tex"
echo "----------------------------------------------"
echo "------ pdflatex final compilation 3 ----------"
echo "----------------------------------------------"
pdflatex "\PassOptionsToPackage{active,filename=minimal,$FANCYOPTIONS}{fancytooltips}\input $FILENAME.tex"
echo "----------------------------------------------"
echo "------ pdflatex final compilation 4 ----------"
echo "----------------------------------------------"
pdflatex "\PassOptionsToPackage{active,filename=minimal,$FANCYOPTIONS}{fancytooltips}\input $FILENAME.tex"