Skip to content

Commit

Permalink
language im provements on overleaf with gramarly and build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
homberghp committed May 21, 2024
1 parent af8d7a3 commit e498dc8
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 99 deletions.
46 changes: 21 additions & 25 deletions chapters/ch02_motivation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,56 @@
\vspace{-30mm}
\raggedleft
\sffamily
What moves, motivates.
What moves, motivates
\qauthor{Ancient wisdom of technical teachers}
\end{savequote}
\chapter{Motivation}
To write a simple document, like a letter, a word processing package
is just fine.
To automate the creation of a document this is a bit harder.
Using a word processor to automatically create documents out of
Using a word processor to automatically create a consistent document from
unrelated sources is difficult at best, if doable at all.

However, as long as the only thing that those unrelated sources should
produce are simple ASCII documents, things get much more
doable. It compares like HTML to Microsoft Word documents. The power
doable. It is like comparing HTML to Microsoft Word documents. The power
you have in defining the layout of a document in HTML (combined with
css) with ``simple'' ASCII document is almost as powerful as what you
can do with Word. But now try writing the same thing with a (self
written) program. You know it is easy in HTML (certainly if you ever
did some programming in e.g. PHP), but producing a Word document with
a program is hard work\footnote{It becomes easier in modern version of
word processing packages, they tend to use xml as their internal document format}.
css) with a ``simple'' ASCII document is almost as powerful as what you
can do with Word. But now try writing the same thing with a (self-written) program. You know it is easy in HTML (certainly if you ever
did some programming with e.g. PHP), but producing a Word document with
a program is hard work\footnote{It becomes easier in a modern version of
word processing packages, they tend to use XML as their internal document format}.

If the document should include complex things like mathematical
formulas that are layed out properly, it becomes difficult in HTML too.
formulas that are laid out properly, it becomes difficult in HTML too.

Enter \LaTeX.

\section{Multiperson literal work}
One of the much overlooked advantages of \LaTeX (and of any multi-file
source code application like java projects) is that the fact that you
\section{Multi-person literal work}
One of the much-overlooked advantages of \LaTeX (and of any multi-file
source code application like Java projects) is that the fact that you
can split up the document into multiple but still coherent parts.
This fact allows you to work on one final document with multiple
persons as in team members. This is exactly what the informatics teachers do when they have
to write a report for external evaluation.
persons as team members. This is exactly what the informatics teachers do when writing a report for external evaluation.

This make \LaTeX\ almost ideal for project work in which several
authors have to contribute in the final product and where source files
are shared by means of a repository. Even more so in
This makes \LaTeX\ almost ideal for project work in which several
authors have to contribute to the final product and where source files
are shared using a repository. Even more so in
cases where you want to include (part of) program source code
into the document to explain or show certain implementation
aspects. Such source code is not copied and pasted but in stead read
aspects. Such source code is not copied and pasted but instead read
on the fly from the original file(s) during text processing. This
allows you to always have the most up to date version.
allows you to always have the most up-to-date version.

As this sample is a multipart document, it can be used as a reference
or a start for your own document.
or a start for your document.


\section{Good documentation and online support}
%% this paragraph to show dual use of citations.
Most documentation can be found on line. Overleaf has a very good set of documentation> Overleaf has as mainproduct a build service for \LaTeX\ documents and may students are using and have used it succesfully.

The original sources of documentation are Lesly Lamports Latex Book \textcite{latexbook}, and expanded on that is the \LaTeX\ Companion \parencite{latexcompanion}.

Most documentation can be found online. Overleaf has very good documentation. Overleaf has as its main product a build service for \LaTeX\ documents and many students are using and have used it successfully.

The original sources of the \LaTeX\ documentation are Lesly Lamports \LaTeX\ Book \textcite{latexbook}, and expanded on that is the \LaTeX\ Companion \parencite{latexcompanion}.

%%% Local Variables:
%%% mode: latex
Expand Down
12 changes: 6 additions & 6 deletions chapters/ch03_mathematics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
\qauthor{Mantra of \TeX-ies}
\end{savequote}
\chapter{Mathematics to show off}
% first som definitions
% first some definitions
% some personal command definitions as examples:
\newcommand{\half}{\frac{1}{2}}
\newcommand{\eps}{\varepsilon}
Expand All @@ -26,13 +26,13 @@ \chapter{Mathematics to show off}
\newcommand{\der}[2]{\frac{\partial {#1}}{\partial {#2}}}

Here, you see how a mathematical equation can be generated in line, for
instance $f(x) = \frac{1}{1+25 x^2}$.
instance, $f(x) = \frac{1}{1+25 x^2}$.
The \verb+$+-symbols enclose the formula.
As a so-called displayed formula, it would look like\premathpar
\begin{displaymath}
f(x) = \frac{1}{1+25 x^2}.
\end{displaymath}
It is customary that mathematical functions are \emph{not} set in math-italics,
It is customary that mathematical functions are \emph{not} set in math italics,
so \LaTeX\ has the basic ones pre-defined; you should use the commands
\verb+\cos+, \verb+\exp+, etc.\ to get $f_1(x) = \cos x$,
$f_2(x) = - e^{-xt} \sin^2 x$, etc.
Expand Down Expand Up @@ -72,7 +72,7 @@ \section{Matrices in \LaTeX}
\end{array} \right)
\end{displaymath}
Here, the word \verb+dots+ in the commands stands for an ellipsis
(i.e., three dots) placed horizontally in the centre (\verb+\cdots+),
(i.e., three dots) placed horizontally in the center (\verb+\cdots+),
vertically (\verb+\vdots+), or diagonally (\verb+\ddots+); what is
not mentioned is \verb+\ldots+ for horizontal dots at the baseline.
Use the baseline or central version as appropriate, for instance\premathpar
Expand All @@ -85,8 +85,8 @@ \section{Matrices in \LaTeX}
The \verb+\left(+ and \verb+\right)+ create the variable-sized parentheses
around the actual array of terms. You can also use \verb+\left[+ and
\verb+\right]+, or \verb+\left\{+ and \verb+\right\}+ in other situations.
The actual array arrangement is organised by the \verb+array+ environment;
you need the arguments \verb+ccccc+ to indicate that there are five columns
The actual array arrangement is accomplished by the \verb+array+ environment.
The argument \verb+ccccc+ indicates that there are five columns
and you want the entries centered (``c''), other options are left (``l'')
and right (``r''). Notice how \verb+&+ separate columns and \verb+\\+
the rows.
Expand Down
57 changes: 26 additions & 31 deletions chapters/ch04_graphics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ \chapter{Graphics as easy as pie}
preference. Using the vector format pdf gives the added benefit that
the graphic file can be scaled up and down without loss of quality.
If you want to include bitmaps, try to get them in \define{\gls{png}} format which
is open and patent free. It has the advantage over jpeg or jpg that is is
loss-less, so you do not see any artifact if you blow them up in your
inclusion. Converting back from jpg to png is useless, because the
is open and patent-free. It has the advantage over jpeg or jpg that is is
loss-less, so you do not see any artifacts if you blow them up in your
inclusion. Converting back from jpg to png is useless because the
damage is already done in the jpeg format. \define{\gls{jpeg}} is excellent for
photographs. That is also what it's name says. For all the bitmap formats: try to get them at the
intended size with a resolution of 300dpi for printouts. 75 dpi is
photographs. That is also what its name says. For all the bitmap formats: try to get them at the
intended size with a resolution of 300~dpi for printouts. 75~dpi is
acceptable for screen reading.

\begin{figure}[thbp]
Expand All @@ -32,28 +32,25 @@ \chapter{Graphics as easy as pie}
Embedded postscript (file extension .eps) are also a good candidate,
after converting them to pdf with the epstopdf tool. By the way: the
native format of Adobe Illustrator (ai) is similar enough to eps, so
that too can be processed with ps2pdf. Programs like {\em Visual
Paradigm} are able to produce pdf files too. And sometimes open-office can
lend a helping hand, for by cutting and pasting Windows graphics into
a single page oodraw drawing, you can produce an very usable pdf file.
that too can be processed with \texttt{ps2pdf}. Programs like {\em Visual
Paradigm} can produce pdf files too. Sometimes open-office can
lend a helping hand. For instance, by cutting and pasting a Windows graphics into a single page OOdraw drawing, you can produce a very usable pdf file.

Bitmap file types like png and jpeg take up a lot of space in your
final pdf document.
Bitmap files take even more space if encoded into a pdf file.
If at all possible, stick to a vector format like eps or pdf (if
necessary derived from eps files).
As much as possible, stick to pdf (if necessary derived from svg or eps files).

%\clearpage%to show headers

\section{A png example}
\label{page:pngexample}
If latex cannot fit the diagram on this page
(page~\pageref{page:pngexample}),
If latex cannot fit the diagram on this page (page~\pageref{page:pngexample}),
then you may find the diagram as figure~\vref{fig:pie}. And as you
can see, you can easily reference pages and images.

%\clearpage%to show headers
\section{PDF from an UML package}
\section{PDF from a UML package}
\label{sec:pdffromuml}
% Note how this varioref expands to
% something like on the next page.
Expand All @@ -72,15 +69,13 @@ \section{PDF from an UML package}

The diagram is not very sophisticated but shows an example of a vector
format file included via an eps$\rightarrow$ pdf conversion by
epstopdf.
\texttt{epstopdf}.

Open source programs like umlet, but also commercial ones like Visual Pradigm are also able to produce
vector format graphics files. And sometimes it is helpful to add a box
that is a bit bigger then the picture you want to include.
This ensures that the so called bounding box does not cut of any lines
Open source programs like Umlet, but also commercial ones like Visual Paradigm are also able to produce vector format graphics files. And sometimes it is helpful to add a box that is a bit bigger than the picture you want to include.
This ensures that the \define{\gls{boundingbox}} does not cut off any lines
you want in your picture. Sometimes it is necessary to give these
tools a helping hand with inkscape, that is do a bit of tinkering to
get all details right. Or with \Code{pdfcrop} which typically comes with your \LaTeX installion.
tools a helping hand with Inkscape, that is, do some tinkering to
get all the details right. Or with \Code{pdfcrop} which typically comes with your \LaTeX installation.

\begin{figure}[htbp]
\includegraphics[width=\linewidth]{images/ClassDiagram1.png}
Expand All @@ -89,10 +84,10 @@ \section{PDF from an UML package}

The picture above is wrong on many fronts.
\begin{Itemize}
\item it uses png as image format, where a vector format is provided by the modeling application Visual Paradigm.
However when you like a pixelated world such as in the game \gls{minecraft}, you might feel at home if you zoom in a bit.
\item it uses PNG as the image format, whereas a vector format is provided by Visual Paradigm.
However, when you like a pixellated world such as in the game \gls{minecraft}, you will feel right at home if you zoom in a bit.
\item The arrows point in all directions, which is bad style. A proper UML class diagram should be stylish to improve comprehensibility, as it is recognizable at a glance. Think of Da Vinci's Vitruvian man.
\item It has the VPP blues, that is the colours used are completely non-functional, and also impair readability because the used colour lowers the contract.
\item It has the VPP blues, that is the colors used are completely non-functional, and also impair readability because the used color lowers the contract.
\end{Itemize}

Look on the next page how it is done properly.
Expand All @@ -104,18 +99,18 @@ \section{PDF from an UML package}
%\clearpage
\begin{figure}
\includegraphics[width=\linewidth]{images/HWIO.pdf}
\caption{UML made with Visual Paradigm, export to svg and then adapted with inkscape and end exported to pdf}
\caption{UML made with Visual Paradigm, exported to SVG and then adapted with Inkscape and in the end exported to pdf}
\end{figure}

\begin{figure}[htbp]
\includegraphics[width=\linewidth]{images/perishablesales.pdf}
\caption{\label{fig:cashregistertest}Vector format (exported as pdf), with functional colour and a legend}
\caption{\label{fig:cashregistertest}Vector format (exported as pdf), with functional color and a legend}
\end{figure}


\subsection{Stylish UML Class diagram}
\label{sec:stylish}
In the diagram of figure~\vref{fig:cashregistertest} above has style and uses functional colours which are simply explained in a legend.
Figure~\vref{fig:cashregistertest} above has style and uses functional colors which are easily explained with a legend.

Good style in a class diagram means:
\begin{Itemize}
Expand All @@ -129,15 +124,15 @@ \subsection{Stylish UML Class diagram}
\item All other relationships enter or leave at the left or right edge of the box, so you know things are used
or this class is used/known.
\begin{Itemize}
\item If the local name is relevant, then that name is at the side of the using class, like barcode at the PhysicalProduct which identifies a Product in the system. Internally barcode is a simple number like an \Code{int} or \Code{long}.
\item If the local name is relevant, then that name is at the side of the using class, like the barcode at the PhysicalProduct which identifies a Product in the system. Internally the barcode is a simple number like an \Code{int} or a \Code{long}.
\end{Itemize}
\end{Itemize}

Other than style there are other advantages in this kind of diagrams.
Other than style there are other advantages to this kind of diagram.
\begin{Itemize}
\item You can zoom in as much as your viewer allows without getting a MineCraft world or worse.
\item You can zoom in as much as your viewer allows without getting a \define{\gls{minecraft}} world or worse.
\item A reviewer (the examiner, your coach or someone working with your documents) can select the texts in the diagram and can mark it. You too could do that to embellish the diagram.
\item There is no way that you can do that nicely with a pixel format like png or jpeg.
\item There is no way you can do that nicely with a pixel based format like PNG or JPEG.
\end{Itemize}

%%% Local Variables:
Expand Down
60 changes: 26 additions & 34 deletions chapters/ch05_codelisting.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
\begin{savequote}[15cm]
\vspace{-30mm}
\sffamily\raggedleft
Use the source Luke.
Use the source, Luke.
\qauthor{The most accurate documentation is in the source.}
\end{savequote}

Expand All @@ -15,75 +15,67 @@ \chapter{Listings and Code Documentation}
\item {\color{red!60!black}\Huge{}NEVER} use screenshots from your IDE and even less so, screenshots with a dark theme.
Typically your report is read on a white background and the contrast with dark themes is really really bad.
\item In the times you had to print your report I would ask the student who soaked the page with black ink.
\item Big diagrams tend to produce big files and hence also humongous pdf files.
\item Big diagrams tend to produce big files and thus humongous PDF files.
\end{Itemize}

\begin{figure}
\caption{Bad, Bad way to show quality code}
\includegraphics[width=\textwidth]{images/dao.png}
\end{figure}

For these functions to work you need to use the \texttt{package} listings.
To make this work, you use the \texttt{package} listings.

\lstset{%first some settings
numbers=right, % number the lines
numberstyle={\tiny\color{gray}},frameround=tttt,framerule=1pt,rulesepcolor=\color{gray},
framexrightmargin=5mm
}

Note that the line numbers in the right hand border are the line
Note that the line numbers on the right hand border are the line
numbers in the included sources.

%% A good advice is to start using \define{doxygen} for your code documentation.
%% It can produce nicely formatted HTML and latex documents and can be
%% tuned in various ways with the
%% help of doxywizard. The way of working is a lot like using javadoc,
%% but also works for C and C++ files.
%% See e.g. the documentation on the zthreads package at
%% \url{http://zthread.sourceforge.net} or Qt at
%% \url{http://doc.trolltech.com/3.3/index.html}

\section{Source code}
The most simple case: include the whole thing with a command like \\
\verb#\lstinputlisting[language=java]{code/Hi.java}#
\lstinputlisting[language=java,caption={Mandatory first program}]{code/Hi.java}

Sometimes it is useful to include just a part of a file, for instance
when you want to explain things. Like what line 11 is all about.\\
when explaining things. Like what line 11 is all about.\\
\verb#\lstinputlisting[language=java, firstline=11,lastline=11]{Hi.java}#
\lstinputlisting[language=java, firstline=11,firstnumber=11,frame=none,
lastline=11,numbers=right,basicstyle={\small\ttfamily},
caption={this is the start of a Java program.}
]{code/Hi.java}


The snippet below shows similar code as the snippet above.
And again, you can zoom in and select text.
The snippet below shows a similar code as the snippet above.
Again, you can zoom in and select text.

\lstinputlisting[language=java, firstline=1,firstnumber=1,
lastline=39,numbers=right,basicstyle={\tiny\ttfamily},
caption={The proper way to show your code.\label{lst:proper}}
]{code/DAO.java}


%% \section{Makefiles}
%% You can also include make files.
%% Note that makefiles have a peculiar syntax. \define{Spaces and tabs in
%% Makefiles}\ are meaningful.
%% That's why I made them show up in the next listing with the command\\
%% \lstinputlisting[firstline=65,lastline=67]{chapters/ch05_codelisting.tex}
%% \lstset{showspaces=true,showtabs=true}
%% Spaces show up as \lstinline| |, tab characters as an extended version
%% of the same thing (\lstinline| |).
%% As can be expected, spaces and tabs have no special meaning in
%% makefile comments, the lines starting with a hash (\#) sign.
%% If you want to know more on makefiles try google or info:make in
%% konqueror on a decently installed Linux box.

%% The make file for this entire document looks like this:
%% \lstinputlisting[language=make,showtabs=true,
%% showspaces=true,basicstyle={\ttfamily\scriptsize},
%% numbers=right,language=make]{Makefile}
\section{Makefiles}
You can also include make files.
Note that makefiles have a peculiar syntax. \define{Spaces and tabs in
Makefiles}\ are meaningful.
That's why I made them show up in the next listing with the command\\
\lstinputlisting[firstline=65,lastline=67]{chapters/ch05_codelisting.tex}
\lstset{showspaces=true,showtabs=true}
Spaces show up as \lstinline| |, tab characters as an extended version
of the same thing (\lstinline| |).

As can be expected, spaces and tabs have no special meaning in
makefile comments, the lines starting with a hash (\#) sign.
If you want to know more about Makefiles try google
\texttt{man make} on a decently installed Linux box.

The make file for this entire document looks like this:
\lstinputlisting[language=make,showtabs=true,
showspaces=true,basicstyle={\ttfamily\scriptsize},
numbers=right,language=make]{Makefile}


%%% Local Variables:
Expand Down
6 changes: 3 additions & 3 deletions chapters/ch06_programmedgraphics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
\end{savequote}
\chapter{Drawing in \LaTeX}

There are quite a few developers who add usefull packages to
the \TeX world. One of them is Till Tantau of the ``Technische
Üniversität'' in Berlin Germany. He produced the package called pgf,
There are quite a few developers who add useful packages to
the \TeX\ world. One of them is Till Tantau of the ``Technische
Üniversität'' in Berlin Germany. He produced the package called \gls{PGF},
which stands for portable graphics format.


Expand Down
Binary file modified docs/main.pdf
Binary file not shown.
Loading

0 comments on commit e498dc8

Please sign in to comment.