Skip to content

Instantly share code, notes, and snippets.

@santhoshtr
Created February 13, 2026 10:04
Show Gist options
  • Select an option

  • Save santhoshtr/935c0b0f9ca78edbd9cbbc69f845237d to your computer and use it in GitHub Desktop.

Select an option

Save santhoshtr/935c0b0f9ca78edbd9cbbc69f845237d to your computer and use it in GitHub Desktop.
Untitled Metapost Sample #metapost-sandbox
verbatimtex
\documentclass{minimal}
\begin{document}
etex
beginfig(2);
% Store the text in a picture variable
picture p;
p := thelabel("Another example", origin);
% Draw the text picture
draw p;
% Get the text's dimensions
w := xpart urcorner p - xpart llcorner p;
h := ypart urcorner p - ypart llcorner p;
% Draw a line across the center of the text
draw (llcorner p + (0, 0.5h)) -- (urcorner p - (0, 0.5h));
endfig;
verbatimtex
\end{document}
etex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment