margin note with tabbing environment in latex - latex

I need to put a margin note next to a tabbing environment. If I try to use \marginpar within the environment I get an error: LaTeX Error: Not in outer par mode.
I've tried putting the \marginpar just before the \begin of the environment but it ends up aligned with the last line of the preceding paragraph instead of with the first line of the tabbing environment.
In the example below the first margin note gets aligned above the tabbing text and the second one below. I tried using \vspace to shift the top note down, and that works okay unless a page break occurs between the tabbing environment and the preceding paragraph -- then the margin note and the tabbing text end up on separate pages.
Any ideas how to get the margin note to line up with the top of the tabbing text?
\documentclass{memoir}
\begin{document}
Now is the time for all good men to come to the aid of their country.
\marginpar{a margin note}\begin{tabbing}
tabbing text a\\
tabbing text b\\
\end{tabbing}\marginpar{another margin note}
Now is the time for all good men to come to the aid of their country.
\end{document}

The marginnote package provides a work-around for this:
\documentclass{memoir}
\usepackage{marginnote}% http://ctan.org/pkg/marginnote
\begin{document}
Now is the time for all good men to come to the aid of their country.
\begin{tabbing}
tabbing text a \marginnote{a margin note} \\
tabbing text b
\end{tabbing}
Now is the time for all good men to come to the aid of their country.
\end{document}

Related

minipage and ref

I have got a multicolumn environment where I put figures into a minipage since the figure environment seems to be incompatible with multicols (at least that is what I read and indeed, putting a \begin{figure} into \begin{multicols} environment makes the illustration disappear.
Now the problem I am facing with the code below is, that, if I click on the \ref link on the bottom, the pdf reader jumps to the caption instead of the minipage resulting in the figure itself not being visible:
Does anyone have an idea how to make sure, \ref jumps to the top of the minipage environment rather than the top of the \captionof?
\begin{multicols}{2}
\begin{minipage}[t]{\columnwidth}
\includegraphics[width=\columnwidth]{sketch}
\vspace*{-7mm}
\captionof{figure}{Iconic Pencil Figure~\cite{mobi_pencil_figure}}
\label{fig:background--iconic-pencil-figure}
\end{minipage}
\end{multicols}
Figure~\ref{fig:background--iconic-pencil-figure}}

paracol and footnote placing in Latex

For my current project I need two text lined up in two column. The idea is that one column shows the original language and the second column its translation, neatly lined up line by line. The package paracol does what I want except for one thing: footnote placement.
If one of the columns has a footnote and the other hasn't, the lines of the original and the translation do not stay together. The footnote disrupts the lining up of lines.
This is an example in which you can see that "some other text that should be next to the line in the left column" is not lined up with the lines of the original. All because of the footnote.
\documentclass[twoside,a4paper,11pt]{book}
\usepackage{paracol}
\usepackage{lipsum}
\begin{document}
\begin{paracol}{2}
\lipsum[1-2]
\switchcolumn
\lipsum[1-2]
\switchcolumn
text with footnote\footnote{the footnote}
and some other text
\switchcolumn
the translation without footnote
some other text that should be next to the line in the left column
\end{paracol}
\end{document}
As you can see, the footnote disrupts the alignment of lines. How to remedy this?
I found the solution to my own problem by adding the following line after loading the paracol package:
\footnotelayout{p}
This ensures that footnotes are layed out for the whole page instead of the default of per column.
(Since I also added footmisc with the perpage parameter, I also had to delete the perpage parameter and add this:
\usepackage{everypage}
\AddEverypageHook{\setcounter{footnote}{0}} % resets footnote counter on every page
)

positions of page numbers, position of chapter headings, chapters AND Table of Contents, References

I am writing my PhD thesis (120+ pages) in latex, the deadline is approaching and I am struggling with layout problems.
I am using the documentstyle book.
I am posting both problems in this one thread because I am not sure if the solution might be related to both problems or not.
Problems are:
1.) The page numbers are mostly located on the top-right of each page (this is correct and where I want them to be).
However, only on the first page of chapters and on the first page of what I call "special chapters", the page number is located bottom-centered.
With "special chapters" I mean: List of Contents, List of Figures, List of Tables, References, Index.
My university will not accept the thesis like this. The page number must ALWAYS be top-right one each page, even if the page is the first page of a chapter or the first page of something like the List of Contents.
How can I fix this?
2.) On the first page of chapters and "special chapters" (List of Contents...), the chapter title is located far too low on the page. This is the standard layout of LaTeX with documentstyle book I think.
However, the chapter title must start at the very top of the page! I.e. the same height as the normal text on the pages that follow.
I mean the chapter title, not the header.
I.e., if there is a chapter called
"Chapter 1
Dynamics of foobar under mechanical stress"
then that text has to start from the top the page, but right now it starts several centimeters below the top.
How can I fix this?
Have tried all kinds of things to no effect, I'd be very thankful for a solution!
Thanks.
A try to answer
problem #1.
Even if you're using the headings pagestyle, or your custom pagestyle, the special pages (chapter beginnings and so on) are formatted with the plain pagestyle.
To avoid this, load the fancyhdr package (as mentioned in the previous answer) with
\usepackage{fancyhdr}
in your preamble. Then, (always in the preamble) define your custom pagestyle.
For normal pages (assuming you're not using twoside as an option of \documentclass[]{}):
\fancypagestyle{phdthesis}{%
\fancyhf %clear all headers and footers fields
\fancyhead[R]{\thepage} %prints the page number on the right side of the header
}
For special pages:
\fancypagestyle{plain}{%redefining plain pagestyle
\fancyhf %clear all headers and footers fields
\fancyhead[R]{\thepage} %prints the page number on the right side of the header
}
After doing this, you can set you page style declaring \pagestyle{phdthesis} right before \begin{document}.
For further details, refer to the fancyhdr package documentation.
Now trying to answer
problem #2
As a first attempt, you can use the titlesec package, using the option compact. In the preamble, type:
\usepackage[compact]{titlesec}
If you're not completely satisfied with this solution, you can specify the spacing above and below the titles with \titlespacing
\usepackage{titlesec}
\titleformat{ command }[ shape ]{ format }{ label }{ sep }{ before }[ after ]
\titlespacing{ command }{ left }{ beforesep }{ aftersep }[ right ]
With \titleformat you can define your own style for chapter titles, and then you can define the spacing with \titlespacing.
I don't know which style of titles you have to use, so it's better for you to have a look to the package documentation (you can recall package documentation typing texdoc NameOfThePackage in a terminal).
Please note that you need to define the chapter title format in order to specify its vertical spacing (page 5 of the documentation). As an example:
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\huge}{\thechapter}{1em}{}
\titlespacing{\chapter}{0pt}{0pt}{1cm}
With these commands you have the chapter title with the number and the chapter name on the same line, a 0 pt space before the title, and a 1 cm space between the title and the follwing text.
To change the page appearance, you can use the fancyhdr package. It's probably a change in the \pagestyle used for the special chapters.
To change the appearance of the chapter title (to have the chapter title printed from the top on the page, you have to use a modified style that change \chapter command rendering.
Here is an example of command I used for my own thesis. It is probably not the appearance you want but gives you an hint about the command you have to redefine.
% modified from book.ltx latex sources
\def\#makechapterhead#1{%
\thispagestyle{empty}%
\vspace*{50\p#}%
\vspace*{10\p#}%
{\parindent \z# \centering \reset#font
\thickhrulefill\quad
\scshape \#chapapp{} \thechapter
\quad \thickhrulefill
\par\nobreak
\vspace*{10\p#}%
\interlinepenalty\#M
\hrule
\vspace*{10\p#}%
\Huge \bfseries #1\par\nobreak
\par
\vspace*{10\p#}%
\hrule
\vskip 40\p#}}
Regarding problem #2 an alternative without additional packages is to change the vertical offset of the page, and then resetting it to the previous value.
\voffset -1in
\chapter{Your chapter}
% text
\voffset 0in

How to set tab stops after whitespaces in LaTeX?

I'm trying to set tab stops in LaTeX in the tabbing environment. My problem is that I want to set a tab stop after a number of whitespaces. The problem is that LaTeX of course ignores multiple whitespaces, and it seems to only support setting tab stops after actual text.
What I would like to be able to do is format the arrows below so that they line up together.
A -> B
CD -> A
BDD -> F
The problem is that the extra spaces after the characters on the left of the arrows are ignored for the purposes of setting the tab stop. What is the solution?
The tabbing environment allows to set tab stops and position text accordingly; it may be used to simulate simple tables.
\= in the first line sets a tab stop, \> advances to the next tab stop in the second line and below.
Please note that tabbing does not expand tab stops, so you need to ensure they are placed wide enough from each other. For example, I put some nonbreakable spaces after A in the first line:
\begin{tabbing}
A~~~~ \= $\to$ \= B \\
CD \> $\to$ \> A \\
BDD \> $\to$ \> F \\
\end{tabbing}
The result looks like
Using tables (e.g. tabular) is often easier, but tabbing allows to redefine tab points later, so it may be used to simulate indented text, like source code.
See also: LaTeX: tabbing.
If you want this in math mode, put \usepackage{amsmath} in your preamble, and try
\begin{align*}
A &\to B \\
CD &\to A
\end{align*}
The ampersands are invisible, and are aligned with each other, so the arrows will line up.
This can also be done in text mode as a table (without needing the amsmath package):
\begin{tabular}{r #{$\to$} l}
A & B \\
CD & A
\end{tabular}
With the # expression in the column specification, the columns will be separated by whatever symbol you like -- in this case, the arrow -- thus aligning that symbol between rows.
Use {\hskip 4em} to specify whitespace four font-width spaces wide, or what have you. There are a number of prespecified whitespace characters in Latex, such as \qquad for \hskip2em.
\hskip whitespace specified in this way is inflexible, that is, Tex will not change the amount of whitespace, but you can use something like {\hskip 3em plus 1em minus 1em} for space that tries to be 3ems long, but can stretch or shorten to between 2ems and 4ems.
If you want to use tabbing (instead of e.g. tabular), you can use kill to make a "template" line that sets the stops. See http://latex.computersci.org/Reference/TableEnvironments.

latex template or example for personal statement

I am writing a personal statement in latex. I don't want the big margin at the top of the page not big title taking a lot of space. I just like to make the layout compact but still clearly spaced with title, name and other necessary information, since there may be restriction on the number of pages. One example would be http://www.hsc.unt.edu/education/CIM/Documents/PS-Sample2_000.pdf. I wonder where to find some good latex templates or examples?
Thanks and regards!
I would use the geometry package to establish the desired margins. To get the margins in your sample document, try:
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
Your next requirement was to fix the title block. LaTeX uses the internal command \#maketitle to format the title block. You can redefine this as you like. To achieve the same title block style as in the sample document, use:
\usepackage[svgnames]{xcolor}% provides colors for text
\makeatletter% since there's an at-sign (#) in the command name
\renewcommand{\#maketitle}{%
\begin{center}
\parskip\baselineskip% skip a line between paragraphs in the title block
\parindent=0pt% don't indent paragraphs in the title block
\textcolor{red}{\bf\#title}\par
\textbf{\#author}\par
%\#date% remove the percent sign at the beginning of this line if you want the date printed
\end{center}
}
\makeatother% resets the meaning of the at-sign (#)
The \#title, \#author, and \#date commands will print the title, author, and date. You can use whatever formatting commands you like to set the text in bold, different colors, etc.
Put all of the above commands in the preamble of the document. The preamble is the space between \documentclass and \begin{document}.
\documentclass{article}
% this is the preamble
% put all of the above code in here
\title{Personal Statement}
\author{Tim}
\begin{document}
\maketitle% prints the title block
Emergency medicine has always been a passion of mine\ldots
\end{document}
Attempt #1: I've used the following style file, which I call cramp2e, for similar purposes. It is probably not right for you, but have a look:
\oddsidemargin -1cm
\evensidemargin -2cm
\topmargin 1cm
\textheight 24cm
\textwidth 19cm
\headheight 0cm
\headsep .7cm
\footskip .7cm
\parskip .2cm
\paperheight 25cm
\setlength\voffset{-.33in}
\setlength\hoffset{-.25in}
Any good?
Postscript This is for A4 size paper.
A slightly less LaTeX-ey solution would be to not use the \maketitle command. A couple of times I've simply used this as my title(marginsize helps too).
Set up smaller margins:
\documentclass{article}
\usepackage{anysize}
\marginsize{1cm}{1cm}{1cm}{1cm}
(EDIT: 1cm might be even better..)
Minimal title:
\begin{document}
\begin{center}
\section*{My Document Title}
\today
\end{center}
% content goes here
\end{document}
The result looks something like:

Resources