0

I am thinking of writing a class file for this, but a basic problem is stumping me.

I have a document with numbered sections in which a particular section (say section 23) always contains a certain content (which may be dynamically generated from data provided by the user - say a histogram).

To make it concrete (this is for a grant proposal class - its not all code):


23. Deliverables and timelines

\begin{figure}[!h]
\includegraphics[width=\textwidth]{ganttchart.pdf}
\caption{Gantt chart for the proposal.}
\label{fig:gantt}
\end{figure}

< A table summarizing some fixed information regarding the proposal. >

One user supplied sentence relating requested financial support to the deliverables.

I want to write a class file that automatically generates such sections (there are several) for the user. How does one go about something like this? I have written classes before, so I am not entirely unschooled in this, but how does LaTeX handle something like this? ("This" being creating a section at the correct location in the document and placing predefined elements in it.).

  • 1
    How does LaTeX handle something like this? I think I still haven't understood what exactly is this. – Manuel Jun 30 '14 at 8:09
  • 2
    @Manuel I hope that the following will help. It is IT, not THIS, but seems to be simillar. ;-) ,,"Edwin and Morcar, the earls of Mercia and Northumbria, declared for him: and even Stigand, the patriotic archbishop of Canterbury, found it advisable—"' 'Found WHAT?' said the Duck. 'Found IT,' the Mouse replied rather crossly: 'of course you know what "it" means.' 'I know what "it" means well enough, when I find a thing,' said the Duck: 'it's generally a frog or a worm. The question is, what did the archbishop find?' '' – Przemysław Scherwentke Jun 30 '14 at 8:41
  • Edited the post. – user2751530 Jun 30 '14 at 9:20
  • @user2751530 Mmm… not enough (for me at least). That little explanation you added, I think I need more than that (I already understood that by “this” you referred to that :P). “Correct location”? You mean that regardless of the rest of the sections, section 23 must be that one you already predefined somewhere? “Predefined elements”? Where and how should you define those? My first comment was more like I think it's a bit unclear what you want, could you expand? By the way, how does the “creation of the class for this” influence this question and your objective? Is it necessary? – Manuel Jun 30 '14 at 9:53
  • I think, the OP rather wants a LaTeX code generator instead of a class? – user31729 Jun 30 '14 at 13:58
1

Tis is just an example of how can you do that (it's not clean, not really checked if it works in other different cases, and has no “proper interface” for you, but just to give you an idea).

\documentclass{scrartcl}

\makeatletter
\let\svsection\section
\def\section{\ifnum\c@section=6
        \expandafter\sectionseven
    \fi\svsection}
\def\sectionseven{\svsection{Section seven (7)}
    And the contents. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
\makeatother

\begin{document}

\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}

\end{document}

But I can't offer more, since I don't fully understand what (and why) you want.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.