in src/main/java/org/apache/maven/doxia/book/services/renderer/LatexBookRenderer.java [125:182]
private void writeBook( BookModel book, BookContext context, PrintWriter writer )
throws IOException, BookDoxiaException
{
// ----------------------------------------------------------------------
// Process all the section documents and collect their names
// ----------------------------------------------------------------------
Map<String, SectionInfo> sectionInfos = new HashMap<String, SectionInfo>();
for ( Chapter chapter : book.getChapters() )
{
for ( Section section : chapter.getSections() )
{
SectionInfo info = writeSection( section, context );
sectionInfos.put( info.id, info );
}
}
// ----------------------------------------------------------------------
// Write the main .tex file
// ----------------------------------------------------------------------
writer.println( "\\documentclass{book}" );
writer.println( "\\title{" + book.getTitle() + "}" );
if ( StringUtils.isNotEmpty( book.getAuthor() ) )
{
writer.println( "\\author{" + book.getAuthor() + "}" );
}
if ( StringUtils.isNotEmpty( book.getDate() ) )
{
writer.println( "\\date{" + book.getDate() + "}" );
}
LatexBookSink sink = new LatexBookSink( writer );
sink.defaultBookPreamble();
writer.println( "\\begin{document}" );
writer.println( "\\maketitle" );
writer.println( "\\tableofcontents" );
// writer.println( "\\listoffigures" );
for ( Chapter chapter : book.getChapters() )
{
writer.println( "\\chapter{" + chapter.getTitle() + "}" );
for ( Section section : chapter.getSections() )
{
SectionInfo info = sectionInfos.get( section.getId() );
writer.println( "\\input{" + info.id + "}" );
}
}
writer.println( "\\end{document}" );
}