jTeX

Sneek-Peek:

TeXClassImpl tc = new TeXClassImpl(TeXClassEnum.ARTICLE);
tc.addOption(OptionsClassArticle.PRINT_SIDE.withValue("twopage"));
    
TeXPackageCollectionImpl tpc = new TeXPackageCollectionImpl();
tpc.addPackage(new TeXPackageImpl(TeXPackageEnum.BABEL).addOption(TeXPackageOptionsEnum.OptionsPackageBabel.SI));
    
TeXDocument td = new TeXDocument(
    "/home/foo/jtex.tex", 
    tc,
    tpc);
td.createPreamble();
td.close();
    

Or the short version:

TeXDocument td = new TeXDocument(
    "/home/foo/jtex.tex", 
    new TeXClassImpl(TeXClassEnum.ARTICLE).addOption(OptionsClassArticle.PRINT_SIDE.withValue("twopage")),
    new TeXPackageCollectionImpl().addPackage(new TeXPackageImpl(TeXPackageEnum.BABEL).addOption(TeXPackageOptionsEnum.OptionsPackageBabel.SI)));
td.createPreamble();
td.close();
    

And the result is:

\documentclass[twopage]{article}
\usepackage[slovene]{babel}
    

To be continued...

Meanwhile, you're wellcome to browse the Project Home.