A bit of context to help understand what I want to do. I am working with a project that is using Gregorio to typeset chant. The output is not used in a PDF but rather converted to images to be used in other documents. So the idea is to have pages that fit exactly to the size necessary without any extra white space around it. I have been handed 1000+ files that have been collected from various sources to be used like this.
A template for the .tex file used to convert them would look something like this:
% !TEX program = LuaLaTeX+se
% !TEX encoding = UTF-8 Unicode
\documentclass[11pt]{article}
\RequirePackage[paperheight=2.25in,paperwidth=4in,top=0cm,left=0cm,right=0cm,bottom=0cm]{geometry}
\usepackage[autocompile]{gregoriotex}
\usepackage[savepos]{zref}
\usepackage{libertine}
\pagestyle{empty}
\gresetlastline{justified}
\gresetinitiallines{1}
\begin{document}
\gregorioscore{CHANT_FILE_NAME}
\end{document}
Problem is that I have to manually work out what height should be used for each file. I would rather it be able to workout the height automatically. There are other questions that are similar like this one XeLaTeX: how do I make paper to be exactly the size of the content? but I need to some how specify the width that I want, and \documentclass{standalone} does not seem to allow for that. Other options also seem to result the wrong output, with all the chant on a single line.
Is there any possible solution to what I want to do, or am I going to have to do this manually?
