TransWikia.com

Crop all pdf file pictures created with asymptote

TeX - LaTeX Asked on August 17, 2021

In my educational work I often need to create documents containing a lot of pictures created separately with asymptote package then included when needed with includegraphics.

Often I find more appropriate to create with asymptote a single pdf file containing some related pictures each one being on in its own page.

Most of the time this works fine except when the pictures are of very different sizes because then I am obliged to manually trim the smaller ones to avoid wide whites spaces. This is due to the fact that in the pdf file all the pages are of the same size.

Ideally the solution would be to get a pdf file whose pages are of different sizes. Each page fits its content. But I don’t know if it is doable with asymptote.

// asymptote file example.asy
   unitsize(cm);
   path p1=unitsquare;
   path p2=circle((-5,0),1);
   draw(scale(1,5)*p1);
   newpage();
   draw(p2);
// end of example.asy
   % latex file
   documentclass[10pt]{article}
   usepackage{lipsum}
   usepackage{graphicx}

   begin{document}
      lipsum[11]
      begin{center}
        includegraphics[page=1]{example.pdf}
      end{center}
      lipsum[11]
      begin{center}
         includegraphics[page=2]{example.pdf}
      end{center}
      lipsum[11]
   end{document}

enter image description here

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP