Skip to main content

Something about LaTeX...

Currently I am writing a paper in LaTeX, using Eclipse as an editor and jura as the document type. The paper is restricted to 20 pages, and both the page format and the tracking, as well as the line spacing, are defined and cannot be played with.

I spent some time fiddling with the jura files to get more space, and I came across some interesting possibilities (at least I think they are). As I found nothing on them on the internet I thought I'd share it with you, even though this might be very specific to the _old_ jura package which still had the alphanum.sty file (just found out that there is a newer version of the jura package which even has comments, the alphanum.sty is included in the jura file - you can obtain it here - the regular jura package is part of the texlive and miktex distributions).

As a result of my research, I found out how to achieve so called runin headings:

old:
A.I.1.b. This heading likes to stay in the text
and this is the content. It used to start only in the next line.


new:

A.I.1.b. This heading likes to stay in the text     and this is the content, starting right after the heading.  

One might ask why one might want to use it like this when there is a way to skip the text of the heading and just use the numbers. But sometimes, papers tend to get complicated, especially when you are forced to take out free lines - it just gets messy. So, a little structure can be created by including heading texts. This is what I think :-D

- Accessing the critical files, alphanum.sty and jura.cls, in the first place
- Editing the short heading format (toc* and sub*)
- Adjusting the space before and after the headings.
- Getting the text to be in line with the long heading


Accessing the files

For all of the other tasks we'll need to edit the alphanum.sty file. Find out where your alphanum.sty file is located by checking out your LaTeX log file, it should point you to the correct directory.

This goes for all of you: Create a backup of the file. Open it with your normal user through your file browser, copy the contents to a new editor window, save it somewhere.

 ... on Linux:

Using texlive on Ubuntu 12.04, you'll probably find it in something like /usr/local/texlive/2012/texmf-dist/tex/latex/jura/alphanum.sty. Remember, to edit it you'll need sudo, your normal user will be able to view it, but cannot edit it.

For GUI users: If you don't know how to handle this -

Open the file in an editor with sudo rights. To do this...
    1. Press ctrl+alt+t - a terminal window should open
    2. Type sudo gedit <path to your file> and hit enter
      (you could use any other editor as well)
    3. You'll be asked to enter your password. Type in your password, don't be confused - you won't see any characters or asterisks while typing. Hit enter
    4. A new text editor window will open. Do not close the terminal. 

... on Mac:

I won't explain this in detail, if you want to know, just leave a comment. It is similar to Linux, probably a different editor. I simply used vi to edit the file.Thus, in a terminal window, enter sudo vi <path to your file> and enter your password.

... on Windows: 

Open the command line as an administrator user. To do this, search for cmd and either hit  ctrl+shift+enter or perform a right click on the menu entry and select "Run as administrator". Confirm the request to run it as an admin. 
I am not very used to using the Windows cmd, but this worked for me - just enter the path to your file. In my case, this was C:\Program Files\MiKTeX 2.9\tex\latex\jura\alphanum.sty. You can use tab to autocomplete the path. Once you entered the path, just hit enter. Windows should open the default editor. 

Editing the short heading format (toc*{} and sub*{})

The jura package provides a short heading format, which will only display the heading number in the main matter, the full heading will be in the table of contents. I found this pretty convenient as it saves a lot of characters. But by default, the numbers are pure text, and I wanted them to at least be bold, so that they can be spotted easily. To achieve this I added \textbf or \bfseries to every heading in my first paper, because I did not know how to edit all of the entries at once. 

But now we found our config files - alphanum.sty! This is where all the magic happens. So, open the file as explained above, and look for a line that says \newcommand*{\J@ShortToc}[1]{\stepcounter{lvl\alph{tiefe}}\J@Number. To get a bold faced heading number for the short format, just add \textbf{} around the number - the line should now look like this: 
\newcommand*{\J@ShortToc}[1]{\stepcounter{lvl\alph{tiefe}}\textbf{\J@Number} 

 Save and enjoy.

Adjusting the space before and after the long headings

By default, long headings leave quite some space before and after them. Not good for papers with a page restriction... But this can be fixed. Open the alphanum.sty again and look for this block of code:

\newcommand*{\J@LongToc}[2][]{%
\@startsection{lvl\alph{tiefe}}{\value{tiefe}}{0pt}
{\ifnum\value{tiefe}=1 -4ex plus-1,5ex minus-0,ex\else
-2,7ex plus-0,8ex minus-0,2ex\fi}
{\ifnum\value{tiefe}>7 -1em plus-0,5em\relax\else
0,6ex plus0,3ex minus0,1ex\fi}


"Tiefe" refers to the level of the heading, thus tiefe = 1 means the first heading level. Tiefe > 7 means all heading levels higher than seven. -4ex or -2,7ex seems to be the space before the heading. Set it to zero if you like - just play around with the numbers until your file looks as you please. 


"Inline" or "runin" headings

In my current paper, I decided not to use the short heading because I did not want to put in any blank lines between the paragraphs, thus the text would not look very structured. I am using the long headings now. But the long headings have a linebreak by default - so the text after the heading will start in a new line. What an aweful waste... Just find the above mentioned paragraph again and have a look at my changes - I adjusted this paragraph (i. e. played with the numbers):

\newcommand*{\J@LongToc}[2][]{%
\@startsection{lvl\alph{tiefe}}{\value{tiefe}}{0pt}

{\ifnum\value{tiefe}=1 -4ex plus-1,5ex minus-0,ex\else-0,7ex plus-0,5em minus-0,2ex\relax\fi}
{\ifnum\value{tiefe}>7 -1em plus-0,5em\relax\else -1em plus-0,5em\relax\fi}



If you feel like now it looks too tight, note that there are ways to insert space between headings you want to make look special - try \medskip or \smallskip in your .tex file (insert it before the heading).
Again, if you have any questions, just leave a comment. Hope this helped at least some of you.

Comments

Popular posts from this blog

Joomla! 2.5: Multiple views, one model

Here goes MVC again: I was a bit confused that every time I created a second or third view for a component, I had to create a separate model for it. Did not make sense to me - I had the necessary algorithms in the model for the first view, did I really need to do copy & paste? I hate it! Redundancy, redundancy, redundancy.

That case occurred in my current project - I created user profiles and needed an "edit" view. The data is the same, but I need to have the data in editable text fields instead of fixed labels, and maybe some other buttons here and there... 

Well, some time later I realized that I just did not quite understand what Joomla! acutally means by "view".  And that there is something called "layout".

Long story short: If you have a model that provides all necessary information and you just want to have a different presentation of it, just add a new .php file to your views/<yourviewname>/tmpl folder - let's call it "layout2&q…

Pi Access Point with RTL9182CU-Adapter

Well, I tried a long time and this is mainly a note to myself:

go here first: http://blog.sip2serve.com/post/38010690418/raspberry-pi-access-point-using-rtl8192cu

then go here: https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software

you do not need to fix the Invalid Argument error, just apply the WPA-Supplicant fix from here: http://forums.adafruit.com/viewtopic.php?f=19&t=47716&start=15

Recover Joomla PhpMyAdmin MySQL Database

This morning I found myself confronted with a new problem:

Our server crashed, we had to set it up again - from scratch. Fortunately, we did have some backups - the Joomla! files, and the mysql folder (on Linux: /var/lib/mysql).

(We are using a Linux server with mysql and phpmyadmin.)

I then tried to recover our database. What I thought: Just copy the contents from the database backup folder (mysql/joomla) to the mysql folder on the server and everything should be fine. That was what they said on the internet, too. Turns out there were only .frm files in that folder, no .myd etc. Turns out that .frm only contains the table structure. But where is my data?

Everything's not lost.

I found a huge file in the mysql backup folder, called ibdata1.

So what you need to do now is (instructions are for Linux):

- Stop your mysql service
  sudo stop mysql
- Copy that ibdata1 file to the /var/lib/mysql folder (consider making a backup of the existing ibdata1 file)
  cd /var/lib/mysql
  sudo mv ib…