Last active
January 4, 2016 15:59
-
-
Save dohyunkim/8644216 to your computer and use it in GitHub Desktop.
zref + mplib: a proof of concept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \documentclass[a4paper]{article} | |
| \usepackage{luamplib, zref-savepos, atbegshi, picture} | |
| \begin{document} | |
| \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{% | |
| \put(0,-\paperheight){% | |
| \begin{mplibcode} | |
| beginfig(0); | |
| x0 := \mpdim{\zposx{z0x} sp}; | |
| y0 := \mpdim{\zposy{z0y} sp}; | |
| x1 := \mpdim{\zposx{z1x} sp}; | |
| y1 := \mpdim{\zposy{z1y} sp}; | |
| drawarrow z0{dir 45} .. {dir 45}z1 withcolor red; | |
| setbounds currentpicture to | |
| origin--(0,\mpdim{\paperwidth})-- | |
| (\mpdim{\paperwidth},\mpdim{\paperheight})-- | |
| (\mpdim{\paperheight},0)--cycle; | |
| endfig; | |
| \end{mplibcode}}}} | |
| \fbox{This}\zsavepos{z0x}\vadjust pre{\zsavepos{z0y}} is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test line. | |
| This is a test \zsavepos{z1x}\vadjust{\zsavepos{z1y}}\fbox{line}. | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment