Hi Ben, On Thu, May 22, 2014 at 6:09 PM, Ben Coman <btc@openinworld.com> wrote: > Now is there any important function missing, or is there a better way to do > this? thank you for your contribution. I would try to generate this instead: \begin{note} foo bar baz \end{note} This environment is meant for this. To output the \begin and \end parts, use canvas environment (look at the senders of #environment in the PRLaTeXWriter class for examples) To output the text, you can just write super visitAnnotatedParagraph: aParagraph > I also want add an annotation type, which I'll describe in a following post. I should we should think a bit how these should be handled. In the meantime, you can just hack around :-). And please add unit tests. -- Damien Cassou
So I determined that the following works well...
PRLaTeXWriter>>visitAnnotatedParagraph: anAnnotatedParagraph
"Pier seams to lack consistency here ..."
'todo' = anAnnotatedParagraph annotation asLowercase
ifTrue: [ ^ self visitCommentedLine: anAnnotatedParagraph ].
canvas environment
name: 'note' ;
with: [ super visitAnnotatedParagraph: anAnnotatedParagraph ].
to process Pillar markup...
@@note Pay attention to the class definition for your new ""==BlankCellTest=="". It must be a subclass of the class ""==TestCase=="". This is easy to overlook. If you did it wrong already, no problem, just go back and correct it now and then save the code again.
Within a class, methods are organised into "protocols" that are shown in the third browser pane from the left of Figure *testCellStateShouldBeOffEmpty*. We will group our "tests" inside a protocol of the same name.
to produce this nice looking PDF showing the note indented with dividing lines...
Now that was real easy to do!! Thanks for making Pillar accessible. I can't imagine making a similar change as easy in a Markdown processor in some other language.
---------------
Next, in common.tex [1] I found...
{
\newcommand{\dothisicon}{\raisebox{-.5ex}{\includegraphics[height=1.2em]{pharo}}}
\newcommand{\dothis}[1]{%
\medskip
\noindent\dothisicon
\ifx#1\empty\else\quad\emph{#1}\fi
\par\smallskip\nopagebreak}
}
and discovered I could do this in the Pillar markup...
Before defining a class we should define a package to contain our classes. When we save a package all the classes will be saved together. It is a good practice to group together classes that work together.
{{{latex:
\dothis{Right-click on the background and open a System Browser.}
\dothis{In the package list of the System Browser, choose "add package" to add a new package. Use the name "LaserG
}}}
to produce in the PDF two Pharo icons on separate lines...
![]()
But that is awkward and verbose to do each time, and I though it would be nice for Pillar to handle this as an annotation like this...
Before defining a class we should define a package to contain our classes. When we save a package all the classes will be saved together. It is a good practice to group together classes that work together.
@@dothis Right-click on the background and open a System Browser.
@@dothis In the package list of the System Browser, choose "add package" to add a new package. Use the name "LaserGame-Model".
so I found I could do that by added the following hack to PRLaTeXWriter>>visitAnnotatedParagraph: ...
'dothis' = anAnnotatedParagraph annotation asLowercase
ifTrue:
[ ^ self writeRawDuring:
[ stream newLine.
stream << '\dothis{' .
stream << anAnnotatedParagraph text trimBoth .
stream << '} ' .
].
].
However changing this to be less of a hack like this...
'dothis' = anAnnotatedParagraph annotation asLowercase
ifTrue:
[ ^ canvas command
name: 'dothis' ;
parameter: [ super visitAnnotatedParagraph: anAnnotatedParagraph ]
].
doesn't quite work, since the first Pharo icon runs onto the previous line...
That can be fixed as follows....
PRLaTeXCommand>>name: aString
stream newLine. "<---THIS LINE ADDED"
stream
<< $\
<< aString
but I don't know if that is the right thing to do. Maybe there are times when you want commands to run on from a line. What would be the right thing?
Also, is it reasonable to add this new annotation type? i.e. might it be integrated soon ? :) :) . This would really help with the Laser Game tutorial.
[1] https://github.com/bencoman/PharoLaserGameTutorial/blob/master/common.tex
cheers -ben