# A dose of logic

## Sunday, 10 January 2010

### Using LaTeX for homework exercises

Last period I had a course about development of knowledge systems for which I had to do weekly (and quite large) assignments. The assignments were more suited for information science majors and therefore easier on the technical side. So I found this a good opportunity to invest some time in learning some more LaTeX by doing (most of) the exercises in LaTeX.

Anyway, one of the problems I had while working with LaTeX was the lack of larger examples. The documentation for LaTeX and the packages I used was pretty good most of the times, but larger examples still help a lot when you're just starting out. So hoping some people will get use out of it, I've uploaded the sources of my solutions to the exercises. (Of course these solutions are not 100% correct.)

Some of the packages I used were amsmath and amssymb. These really helped a lot to do the proofs. (Some documentation can be found here and here.)

For Assignment 2 I also learned to use graphviz to draw my graphs. So some example DOT files are included in the extras. (The guide I used was here.)

I split the assignments into the original problem description (the part I had to deliver was the hand-in part), the LaTeX source and other sources such as pictures, the final outputted PDF and possibly additional sources such as the solutions in the tools.

Assignment 1 (Logic):
Problem description | LaTeX + other source files | Outputted PDF | Extra files
(Extra files include the python files I used and edited to generate the truth tables in LaTeX, thanks to midorikid)

Assignment 2 (CLIPS):
Problem description | LaTeX + other source files | Outputted PDF | Extra files | CLIPS
(Extra files include the DOT files I used for graphviz, Microsoft Visio Drawing of the family tree and the CLIPS files I made.)

Assignment 3 (Protégé):
This was not done in LaTeX because I did not have access to my own computer. If you're interested, tell me, and I'll find the sources from Protégé and Microsoft Word anyway.

Assignment 4 (Hugin/Probability Theory):
Problem description | LaTeX + other source files | Outputted PDF | Extra files | Hugin
(Extra files include the multiple probabilistic networks.)

Assignment 5 (Fuzzy Logic/Systems):
Problem description | LaTeX + other source files | Outputted PDF | Extra files
(Extra files include the Maple 13 file to model the functions.)

1. If you know any grad students, ask them for paper or thesis sources. Also often your department or other departments have sample latex theses.

2. I remember using LaTeX to write up homework exercises in physics and maths courses (typeset derivations are much easier to read than my scrawling hand writing) and logic courses (where I found it easier to typeset a proof and draw it by hand).

For Dot (and, I think GNUplot), I used some environment macros which feed the contents of the environment (the Dot code, for example) through an external program (like `dot` or one of the other layouts). This lets you have everything in a single source file and rebuilt the document with a single `pdflatex`

3. Hmm using macros like that sounds quite a bit nicer :). I'll remember it for the next time.

@latex
Well most grad students I know aren't doing anything in LaTeX anyway. But at least some people will now be able to use some sources without having to ask around.

4. try using pgftikz, it is a very nice graphics package for latex