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 "layo

Eureka! Intel N 7260 Issue Appears To Be Solved

For a while now I've been having annoying trouble with my wireless adapter (Intel N 7260 - yes, I know it is known to cause trouble...). Not only did it not connect properly, it broke the wifi and the internet connection of the router in a way that no other device in the network could access the internet any more. I might just have discovered another possible cause: And guess what, Windows took me there. I know, right? So, this is what I did (I am on Win 10 right now): - It did not connect properly, as usual (for me this only happens when at home, where I am using a Speedport W 504V router) - so I ran Windows "troubleshooting" (right-click on the wifi icon in the task bar to get there) - It told me that there was an issue with a network protocol missing on my machine (which is rather ridiculous) - BUT at the bottom of the window it offered me a link to detailed information about the issue, which took me to a quite detailed troubleshooting report - This report lists

Joomla! 2.5: Menu Items

Some time ago, I started to create my own components. Everything was working fine, but there was one thing that bugged me (even though it is not really necessary... it just looked strange): When I create a link to my component, I always ended up with something like this in my menu manager: Similar thing for the menu item type: I felt like I somehow missed something, but the tutorials did not say anything about it. After playing around for a little while, I found out that the solution actually is pretty simple: The site > views > viewname > tmpl > default.xml file specifies these texts. Joomla! will look for these keys in the language files. Thus, you just need to add some entries to the language files and voila - everything looks nice and clean, just like this: Step-By-Step: Let's assume you already created the default.xml file with contents similar to these: <?xml version="1.0" encoding="utf-8"?> <metadata>