Wednesday 31 October 2012

Getting rid of page numbers in LaTeX

To join the many other people and sites that contain this useful information:

\thispagestyle{empty}

Make the page numbers on a given page disappear. You'll have to look into it if you want the page counters to also not increment.

\pagestyle{empty}

Also does the trick, and also applies this style to every subsequent page too.

Friday 7 September 2012

Coloured box test

At the request of a colleague I've put together a quick html which creates a screen full of randomly coloured boxes, together with the totals of how many of each colour are displayed. If you're not sure of the purpose have a look here ...Joel's blog.

I've tried to create a local page with the html on, we'll see how it goes. You can see the demo here: click for the demo page (note you can use fullscreen F11 to see more, and also Ctrl+Minus or Ctrl+Plus to zoom in and out)

I'll put the html below so that it's easy to copy and paste, I'll just make it super small. If you want to personalize it feel free, just look for the text "NumberOfBoxes" and you'll see that you can personalize the colours and the probabilities. Lazily I've not set it up for more than 4 colours, if you want to change it then you'll have to modify the counter and output.


<html>
<head>
<style type="text/css">
.randomcolourbox {display:inline-block;margin:10px; padding:25px 30px;}
p {display:block;padding:0px;}
</style>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
function addElements(Num)
{

var NumberOfBoxes=225;
var probabilities = [0.25,0.25,0.25,0.25];
var colors = ["red","yellow","green","blue"];

for(i=0;i<NumberOfBoxes;i ){
var divTag = document.createElement("div");
divTag.className = "randomcolourbox";
divTag.innerHTML = "&nbsp;";
document.body.insertBefore(divTag,document.body.firstChild);
}

var cls = [0,0,0,0];
$(".randomcolourbox").each(function() {
var rand2 = Math.random();
var i=0;
while(rand2>0){rand2-=probabilities[i];i ;}i--;rand=i;
cls[rand]=cls[rand] 1;
$(this).css("background-color", colors[rand]);
});
$('#cols').text(colors[0] " " colors[1] " " colors[2] " " colors[3]);
$('#nums').text(cls[0] " " cls[1] " " cls[2] " " cls[3]);
}
</script>

</head>
<body onload="addElements()">
<br/>
<p id="cols"/>
<br/>
<p id="nums"/>
</body>
</html>


Thursday 6 September 2012

Lecture notes with beamer

This post is mainly to promote the Beamerlecture setup created by a guy called Don Eisenstein. You can currently find the details at this address. Or with a quick search for "Beamerlecture".

A quick summary of what he provides:
  • A file called BeamerLecture.tex which contains lots of header information for latex files of various different 'document classes'.
  • Some scripts for taking a prepared set of lecture note slides (written in beamer) saved as a tex file, but without a documentclass at the top, and creating a variety of different outputs by compiling the file and sequentially appending different document class information and different extra commands.
The output is a variety of different files (pdfs):
  • Beamer slides to handout (flattened pages with reveals)
  • Beamer slides for the lecture (more pages than the latter)
  • Beamer slides for post-lecture (gaps can be filled)
  • Beamer slides formatted as an 'article', so no slides, much like normal printed notes with sections, chapters etc..
  • Beamer slides for the lecturer with extra notes added
There's also code, which I've changed to fit my Linux installation, for creating 2-upped versions of all of these (I use pdfjam, see the code at the bottom of this post).

Here are the bonus scripts I've added to .bashrc in Linux to have the compilation at my fingertips...

Tuesday 4 September 2012

Removing default Moodle News Forum

New Moodle users will have found that a new course/module often has a rather difficult to remove "News Forum" in the first post of the course/module.

You can edit that first and remove the forum and think you've removed it.... only for it later to magically reappear.

What you need to do is go to the "Module Administration" menu, then "Edit settings" menu item to edit the global module settings. Then it's the "News items to show" menu item you need to edit, make it read "0".

This disables the "Latest News" block on the module from promoting news items, but also removes the News Forum resource item entirely from the first post block. You can easily add your own forum later if you like.

Friday 17 August 2012

Using LaTeX on Blogspot / Blogger.


In a slightly meta fashion the first post is about how to use Latex in blogs on Blogspot/Blogger. I got the answer from http://tex.stackexchange.com/questions/13865/how-to-use-latex-on-blogspot

Here's the key part: just copy this script into the raw template html for your blog (go to template designer and ignore the warnings to edit the raw html, you can put it just after the </head> closing tag and before the <body> opening tag)

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"> MathJax.Hub.Config({
 extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
 jax: ["input/TeX", "output/HTML-CSS"],
 tex2jax: { 
  inlineMath: [ ['$','$'], ["\\(","\\)"] ],
  displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
},
 "HTML-CSS": { availableFonts: ["TeX"] }
});
</script>

The nice thing about MathJax appears to be that it's now hosted online for all to use, no need to have local files. Note in the address line CDN stands for Content Delivery Network (i.e. it's not going to go away soon!

Just to prove it works, you can do inline stuff $\Pi_{i,j}^{\alpha}f(x,y,z)^3$ as well as display style stuff, $$\Pi_{i,j}^{\alpha}f(x,y,z)^3,$$ by using single and double dollars respectively.

Sunday 12 August 2012

Welcome!

So I've created this blog as a resource for myself, and anyone else who stumbles across it while searching, giving information and answers to how to solve various problems I've come across.

Hopefully others out there will find these posts useful at some point too, but I can always just use them as my own resource to look back on when I come across the same problems to solve again to see if I've found ways to deal with them already in the past and just forgotten. :)