I am using the ACM SIG Proceedings Templates, Option 1: LaTeX2e - Strict Adherence to SIGS style. I have no footnote but still the text column does not go to the end of the page. There is still empty space for footnote. How can I remove the empty space and make the text column go up to the end of the page ?
This is because the ACM wants you to use it this way. Publications are very strict in terms of what you can/cannot do, so my first suggestion would be to not change this. The space left on the bottom of the first column on the first page is reserved for a copyright notice:
...however, if you want to remove it, add
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\maketitle}{\#copyrightspace}{}{}{}
\makeatother
to the document preamble. This patch (thanks to etoolbox) removes \#copyrightspace from \maketitle. The result look like this:
Related
I am using the everypage package. Using the \AddEverypageHook command I can repeat actions at the beginning of every page of a document. Now I want to do something like this:
\AddEverypageHook{
\if "New chapter starts at current page." - "Do stuff."
\else "Do other stuff."
\fi
}
How can I check in latex, whether a new chapter starts at the current page?
In a typical document, the issue of a \chapter command is followed by an automated page break. For example, see what \chapter does in report.cls:
\newcommand\chapter{\if#openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\#topnum\z#
\#afterindentfalse
\secdef\#chapter\#schapter}
It issues a \clearpage (or \cleardoublepage), flushing whatever is pending and starting on a new page.
So, depending on your setup, it may suffice to use the afterpage package's \afterpage{<stuff>} macro to execute <stuff> after the current page. For example, in your preamble, you would
\let\oldchapter\chapter % Store \chapter
\renewcommand{\chapter}{% Redefine \chapter to...
\afterpage{\customcommand}% ...execute \customcommand after this page
\oldchapter}
Of course, this would only make sense if you don't execute anything else on non-chapter pages since the condition is tied to \chapter. So, making a document-wide decision at every page might require a slightly different approach.
I'd still suggest tapping into the \chapter macro, but using a conditional. Here is an example (click to enlarge image):
\documentclass{report}
\usepackage{lipsum,afterpage,everypage}
\newcounter{chapterpage}% For this example, a chapterpage counter
\newcounter{regularpage}% For this example, a regularpage counter
\newif\ifchapterpage% Conditional used for a \chapter page
% Just for this example, print page number using:
\renewcommand{\thepage}{\LARGE\thechapterpage--\theregularpage}
\AddEverypageHook{
\ifchapterpage % If on a \chapter page...
\stepcounter{chapterpage}% Increase chapterpage counter
\global\chapterpagefalse% Remove conditional
\else % ...otherwise
\stepcounter{regularpage}% Increase regularpage counter
\fi
}
\let\oldchapter\chapter % Store \chapter
\renewcommand{\chapter}{% Redefine \chapter to...
\afterpage{\global\chapterpagetrue}% ... set \ifchapterpage to TRUE _after_ this page
\oldchapter}
\begin{document}
\chapter{First chapter}\lipsum[1-50]
\chapter{Second chapter}\lipsum[1-50]
\chapter*{Third chapter}\lipsum[1-50]
\chapter{Final chapter}\lipsum[1-50]
\end{document}
The advantage of the above method is that it works for both \chapter and \chapter*. \chapter* doesn't increment the chapter counter and it is therefore insufficient to rely on a condition based on such a comparison.
I have a solution. The idea is to check, whether the chapternumber counter has changed. This is done by a custom counter:
\newcounter{CurrentChapNum}
if the chapter-counter did not change, we are still in the current chapter, so do \customcommand1 stuff.
if the counter has changed, we seem to be at the beginning of a new chapter, so do \customcommand2 stuff and reset the CurrentChapNum-counter to the value of the current chapter.
This is done by this code.
\AddEverypageHook{
\ifnum\value{chapter}=\value{CurrentChapNum} \customcommand1
\else \customcommand2 \setcounter{CurrentChapNum}{\value{chapter}}
\fi
}
Since I am quite new to latex-markup-stuff I hope this is not too clumsy.
I have a LaTeX document like this:
\documentclass{article}
\begin{document}
\section{1}
\section{2}
\section{3}
\section{4}
\section{5}
\section{6}
\section{7}
\section{8}
\section{9}
\section{10}
\section{11}
\section{12}
\section{13}
\section{14}
\section{15}
\section{16}
\section{17}
\section{18}
\section{19}
\section{20}
\section{21}
\section{22}
\section{23}
\section{24}
\section{25}
\section{26}
\section{27}
\section{28}
\section{29}
\section{30}
\end{document}
Lots of section headings, but no text in
It produces something like this:
As you can see it keeps all the section headings on one page, and won't break it into 2 pages. Everything above 26 has disappeared off the end of the page.
Is there anyway to get LaTeX to split these sections across multiple pages? I can't easily change the actual content of body, since it's autogenerated. I can change the preamble though. Is there anyway to do this by changing the preamble?
Adding \mbox{} after a section heading would allow the page break. You could introduce it globally in the preamble by:
\makeatletter
\g#addto#macro\#afterheading{\mbox{}}
\makeatother
or
\makeatletter
\expandafter\def\expandafter\#afterheading\expandafter{\#afterheading\mbox{}}
\makeatother
like in this expandafter example.
You should be able to do something like this with the sectsty package
I'm trying to create a new environment in my LaTeX document where indentation in the next paragraph following the environment is suppressed.
I have been told (TeXbook and LaTeX source) that by setting \everypar to {\setbox0\lastbox}, the TeX typesetter will execute this at the beginning of the next paragraph and thus remove the indentation:
\everypar{\setbox0\lastbox}
So this is what I do, but to no effect (following paragraph is still indented):
\newenvironment{example}
{\begin{list}
{}
{\setlength\leftmargin{2em}}}
{\end{list}\everypar{\setbox0\lastbox}}
I have studied LaTeX's internals as well as I could manage. It seems that the \end routine says \endgroup and \par at some point, which may be the reason LaTeX ignores my \everypar setting. \global doesn't help either. I know about \noindent but want to do this automatically.
Example document fragment:
This is paragraph text. This is paragraph text, too.
\begin{example}
\item This is the first item in the list.
\item This is the second item in the list.
\end{example}
This is more paragraph text. I don't want this indented, please.
Internal routines and switches of interest seem to be \#endpetrue, \#endparenv and others. Thanks for your help.
I couldn't get anything to work without redefining \end, but I'm certainly no expert.
The following is quite hacky, but worked in my limited testing. Of course this will interfere with nested environments (you should be able to redefine \begin to restore the old \end if you have problems).
\newenvironment{example}{%
\bgroup
\let\oldend=\end
\def\end##1{\oldend{##1}\csname #afterindentfalse\endcsname
\csname #afterheading\endcsname}
\begin{list}{}
{\setlength\leftmargin{2em}}
}{%
\end{list}
\egroup
}
Can't you avoid this by not having a blank line between your environment and the next line?
This is paragraph text. This is paragraph text, too.
\begin{example}
\item This is the first item in the list.
\item This is the second item in the list.
\end{example}
% (No blank line)
This is more paragraph text. I don't want this indented, please.
Something as simple as this works for me:
\makeatletter
\newenvironment{example}{%
\bgroup
\list{}{}
}{%
\endlist
\#afterindentfalse
\#afterheading
\egroup
}
\makeatother
But, it doesn't work before the first \section (or \chapter, in the case of classes "book" and "report") is called. I don't know why.
I tried the Ivan's answer, but it wasn't working for me. But I did get it working! Here's what I did:
\makeatletter
\renewenvironment{quotation}{%
\bgroup%
\let\oldend=\end%
\def\end##1{\oldend{##1}\csname #afterindentfalse\endcsname%
\csname #afterheading\endcsname}%
\list{}{\listparindent 1.5em%
\itemindent \listparindent%
\leftmargin 1.5em% This controls the size of the indentation
\rightmargin \leftmargin
\parsep \z# \#plus\p#}% This line reduces inter-paragraph space to normal values.
\item\relax%
}{%
\endlist%%
\egroup%
}
\makeatother
The advantage to this is that it typesets your blockquotes very nicely, and removes the indentation from paragraph after the blockquote.
You can do this without redefining \end
\makeatletter
\newenvironment{example}
{\begin{list}
{}
{\setlength\leftmargin{2em}}}
{\end{list}%
\def\if#endpe{%
\#doendpe
\let\par\##par
\iffalse}}
\makeatother
Explanation
\end changes \everypar after expanding \endexample. To make things even more complicated it sets \par to restore \everypar{}. Appearently \#doendpe is ment to make sure that there is no indentation if the paragraph continues after the environment, but to restore normal behavior if there is a \par (or empty line) after the environment.
You may want to avoid changing \end because it would have to be changed at the begining of the environment and may therefore disturb nested environments. Luckily the definition of \end contains \expandafter\endgroup\if#endpe. We can use \if#endpe as a hook to inject our code to the outer scope. After the \endgroup \if#endpe is automatically restored.
Include \#afterindentfalse\#afterheading at the end of your definition.
I had the same problem. I just used this:
\noindent \newenvironment
You should not mess with the \everypar token list, unless you know exactly what you are doing. Use
\setlength{\parindent}{0pt}
to get rid of indenting in the whole document.
ending your environment with \noindent could help you
I use LaTeX to type up programming homeworks for classes. I need to do this:
my line of text blah blah blah
new line of text with blank line between
I know I can use double slash to break lines \\, but LaTeX will only take the first line break (complains about more) and starts a new line, it produces this :
my line of text blah blah blah
new line of text with blank line between
How can I get that extra line break in there so I can have space between my lines of text?
Line break accepts an optional argument in brackets, a vertical length:
line 1
\\[4in]
line 2
To make this more scalable with respect to font size, you can use other lengths, such as \\[3\baselineskip], or \\[3ex].
Do you want more space between paragraphs? Then you can change the parameter \parskip.
For example, try
\setlength{\parskip}{10pt plus 1pt minus 1pt}
This means that the space between paragraphs is usually 10pt, but can grow or shrink by up to 1pt. This means you give LaTeX the ability to change it up to one 1pt in order to achieve a better page layout. You can remove the plus and minus parts to make it always your specified length.
If you are trying to display source code, try the listings package or use verbatim. If you are trying to typeset pseudocode, try the algorithm package.
Insert some vertical space
blah blah blah \\
\vspace{1cm}
to scale to the font, use ex (the height of a lowercase "x") as the unit, and there are various predefined lengths related to the line spacing available, you might be particularly interested in baselineskip.
You can use the setspace package which gives you spacing environments, e.g.:
\documentclass{article}
\usepackage{setspace}
\begin{document}
\doublespace
my line of text blah blah blah
new line of text with blank line between
\end{document}
Or use a verbatim environment to control the layout of your code precisely.
For programs you are really better off with a verbatim or alltt environment, but if you want a blank line that LaTeX will not bitch about, try
my line of text blah blah blah\\
\mbox{ }\\ %% space followed by newline
new line of text with blank line between
While verbatim might be the best choice, you can also try the commands \smallskip , \medskip or guess what, \bigskip .
Quoting from this page:
These commands can only be used after
a paragraph break (which is made by
one completely blank line or by the
command \par). These commands output
flexible or rubber space,
approximately 3pt, 6pt, and 12pt high
respectively, but these commands will
automatically compress or expand a
bit, depending on the demands of the
rest of the page
I find that when I include a blank line in my source after the \\ then I also get a blank line in my output. Example:
It's time to recognize the income tax as another horrible policy mistake like banning beer, and to return to the tax policies that were correct in the Constitution in the first place. Our future depends on it.
\\
Wherefore the 16th Amendment must forthwith be repealed.
However you are correct that LaTeX only lets you do this once. For a more general solution allowing you to make as many blank lines as you want, use \null to make empty paragraphs. Example:
It's time to recognize the income tax as another horrible policy mistake like banning beer, and to return to the tax policies that were correct in the Constitution in the first place. Our future depends on it.
\null
\null
\null
Wherefore the 16th Amendment must forthwith be repealed.
\\\\
This works on pdfLatex. It creates 2 new lines for you.
Maybe try inserting lines with only a space?
\ \\
\ \\
This just worked for me:
I was trying to leave a space in the Apple Pages new LaTeX input area. I typed the following and it left a clean line.
\mbox{\phantom{0}}\\
This stems out of How can one number paragraphs in LaTeX?, which I asked earlier today:
Running with Brent.Longborough's suggestion for how to number paragraphs in a document:
\setcounter{secnumdepth}{5}
...
\paragraph{If we want to}
\paragraph{do something}
This results in LaTeX producing something likeso:
0.0.0.1 If we want to
0.0.0.2 do something
How can one change the numbering scheme of \paragraph{} to produce something like:
1. If we want to
2. do something
or alternatively
A. If we want to
B. do something
Thank you.
To change the number referenced when referring to paragraphs, you want to change \theparagraph. Here's an example:
\documentclass[12pt]{article}
\setcounter{secnumdepth}{5}
\renewcommand\theparagraph{\roman{paragraph}}
\usepackage{lipsum}
\begin{document}
\paragraph{foo} \lipsum[1]
\paragraph{bar} \lipsum[2]
\end{document}
Instead of \roman you can also use \Roman, \arabic, \alph, \Alph. Although if you have lots of paragraphs you'll want to use the alphalph package and use \alphalph to get more than 26 paragraphs.
Note that \paragraph takes an argument for the "paragraph title". If you never want that, you'll probably want to define your own command to simplify things:
\newcommand\PARA{\paragraph{}}
You'll also probably want to remove the way that paragraphs are numbered "within" sections; i.e., they reset from "1" for every new section. You can get around this with something like
\usepackage{remreset}
\makeatletter
\#removefromreset{paragraph}{section}
\makeatother