I'm setting the margin configurations for multiple environments. For instances firstenvironment sets the margins using \setlength, then I make use of the multicols package inside the new environment. The problem is that the text doesn't seem to respect the bottom margin in the first page where the environment is just being used, but the text in the next pages do respect the margins. The same happens when I create a second environment with its own margin configurations. Not sure why the margins are not activated immediately when the environment begins. Any suggestions would be welcome, thanks!
PD. PDF compiled with Xelatex
\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{showframe} % show the frame margins
\usepackage{multicol}
\newenvironment{firstenvironment}{
\setlength{\hoffset}{0mm}
\setlength{\voffset}{0mm}
\setlength{\headsep}{20pt}
\setlength{\headheight}{4em}
\setlength{\textheight}{6in}
\setlength{\footskip}{10mm}}{}
\newenvironment{secondenvironment}{
\setlength{\hoffset}{0mm}
\setlength{\voffset}{0mm}
\setlength{\headsep}{5pt}
\setlength{\headheight}{2em}
\setlength{\textheight}{5in}
\setlength{\footskip}{20mm}}{}
\begin{document}
\begin{firstenvironment}
\setlength\columnsep{30pt}
\begin{multicols}{2}
{\Large\bf 1ST LIPSUM}\\
\lipsum[1-10]
\end{multicols}
\end{firstenvironment}
\newpage
\begin{secondenvironment}
\begin{multicols}{2}
{\Large\bf 2ND LIPSUM}\\
\lipsum[1-10]
\end{multicols}
\end{secondenvironment}
\end{document}
Photo, text out of bottom margin: image
I just figure out how to fix it. I made use of the package changepage. The idea is to include in the parameters of this command, the differences between the new margins and old margins. There is no need to use environments to set pages with different margins (which considers header, footer and margin notes), but to keep the same structure of the original post, I provide a solution that can be easily compared with.
\documentclass[12pt]{article}
\usepackage[paperheight=11in,paperwidth=8.5in,includeheadfoot]{geometry}
\usepackage{lipsum}
\usepackage{showframe}
\usepackage{multicol}
\usepackage{changepage}
\usepackage{calc}
\newenvironment{firstenvironment}{}{}
\newenvironment{secondenvironment}{}{}
\begin{document}
\setlength{\textheight}{7in}
\setlength{\headsep}{20pt}
\setlength{\headheight}{4em}
\setlength{\footskip}{10mm}
\begin{firstenvironment}
\begin{multicols}{2}
{\Large 1ST LIPSUM}\\
\lipsum[1-10]
\end{multicols}
\end{firstenvironment}
\newpage
\changepage{-2in}{}{}{}{}{}{2em-4em}{5pt-20pt}{20mm-10mm}
%\changepage{textheight}{textwidth}{evensidemargin}{oddsidemargin}{columnsep}{topmargin}{headheight}{headsep}{footskip}
\begin{secondenvironment}
\begin{multicols}{2}
{\Large 2ND LIPSUM}\\
\lipsum[1-10]
\end{multicols}
\end{secondenvironment}
\restoregeometry
\begin{firstenvironment}
\begin{multicols}{2}
{\Large 3rd LIPSUM}\\
\lipsum[1-10]
\end{multicols}
\end{firstenvironment}
\end{document}
The command \changepage considers the following parameters:
\changepage{textheight}{textwidth}{evensidemargin}{oddsidemargin}{columnsep}{topmargin}{headheight}{headsep}{footskip}
The margins that are left in blank under the \changepage command consider the default margins of the article class. If you want to restore the margins after setting a new one, just use the command \restoregeometry
Related
Hello I am new at beamer (overleaf), so I have learned very much, so I would like to change the design of the numeration in table of contents. I mean with that (see picture attached):
I would like to change to a square, or simply the number. Anyone knows others styles? I am using the \usetheme{CambridgeUS}.
You can set the sections/subsections in toc template to change to e.g. a square or plain numbered sections:
\documentclass{beamer}
\usetheme{CambridgeUS}
\setbeamertemplate{sections/subsections in toc}[square]
%\setbeamertemplate{sections/subsections in toc}[sections numbered]
\begin{document}
\section{title}
\begin{frame}
\tableofcontents
\end{frame}
\end{document}
I'm new to LaTex and I wanted to know how I can change the Margins of my scrreport so that the chapter title, text and basically everythin starts a bit higher and ends a bit lower. In my opinion there is too much empty space before anything starts.
If I use this simple example:
\documentclass[12pt,a4paper,twoside]{scrreport}
\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
\blindtext
\end{document}
I think the margins from top and bottom are too big. So i want everything to move up a little bit.
Thanks!
Method 1:
Choose one of the predefined layouts. You'll find a list of available options in the koma script documentation.
\documentclass[12pt,a4paper,twoside,DIV=15]{scrreport}
\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
\blinddocument
\end{document}
Method 2:
Setting up the text area manually. You should be really sure that you know what you are doing to get an aesthetically pleasant result.
\documentclass[12pt,a4paper,twoside]{scrreport}
\areaset[current]{168.00mm}{250mm}
\usepackage{blindtext}
\begin{document}
\chapter{First Chapter}
\blinddocument
\end{document}
is there a way to control the white space above just one specific section in latex? Most solutions I've found rely on the titlesec package, but as far as I know that would change every section.
Thanks for the help!
Use \vspace*{length} command, just before your section begins. For example:
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum
\section{Section 1}
\lipsum
\vspace*{1cm}
\section{Section moved down}
\lipsum
\end{document}
moves the second section 1cm down.
I am new to latex and I wrote the below tex code on Texmaker editor.
What I want to do is to add the "University" section without any numbering preceeding it and to be centered horizontally, because when I run the code I find that the word "University" is displayed but it is preceeded by a number and I do not want to display any number preceeding that word.
code:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\section{University}
\end{document}
\section*{\centering University}
% * removes numbering for _this_ \section instance,
% \centering within environment centres the title.
Note however, that this is a local solution, and that it's better practice (and easier for you to make later document-global changes) to re-define the \section, \subsection, ... environments using the titlesec package, as is described well in Alan Munn:s answer in the following tex.stackexchange thread:
https://tex.stackexchange.com/questions/8546/section-heading-centering-problem
All you have to do is to edit your line 9:
\section{University}
this way:
\section*{\centering University}
since the command \section* produces unnumbered sections.
Further, if you want to to include an unnumbered section to your table of contents, you can add
\addcontentsline{toc}{section}{University}
(this time without \centering) just after. The resulting code:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\tableofcontents
\section*{\centering University}
\addcontentsline{toc}{section}{University}
Text.
\end{document}
I am writing my thesis in Latex, document class: report. I have got front matter containing of abstract, acknowledgement and so on.
I want to add header only to my main matter which starts with my first chapter:Introduction. I want the header to be the chapter number without the word "chapter" and the chapter title next to it. I also want the page number to appear in the centre on the bottom of the page in all pages of the main matter.
I don't want any header or line in any page of my front matter.
Can you please guide me? Thanks
Here it is the sample code that I am applying.
\documentclass[a4paper,12pt,titlepage]{report}
\usepackage{amsfonts}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{color}
\usepackage{colordvi}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{theorem}
\usepackage{lineno}
\usepackage{multirow}
\usepackage [toc,page]{appendix}
\usepackage{framed}
\usepackage{setspace}
\doublespacing
\usepackage[left=1.5in,top=2in,right=1in,bottom=2in]{geometry}
\begin{document}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
\renewcommand{\thepage}{\roman{page}}
% here it comes my front matter for example:
\clearpage
\addcontentsline{toc}{chapter}{Abstract}
\chapter*{Abstract}
ABSTRACT CONTENTS
%then:
\clearpage
\cleardoublepage
\pagenumbering{arabic}
% here it starts my main matter:
\chapter{Introduction} %first chapter
\chapter{First Esssay in XXX} %second chapter
\end{document}
You have a number of options to set headers in a document. The most frequently-used package is fancyhdr.
First of all, you need to remove the word Chapter from the regular chapter mark. For this, add
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps#fancy{%
\patchcmd{\chaptermark}% <cmd>
{\#chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
to your preamble. The above strips out \#chapapp\ (note the space) from \chaptermark as part of the call to \pagestyle{fancy}. That's required as fancyhdr may update \chaptermark upon calling \pagestyle{fancy}.
Second, you need to set the headers/footers. Here's a setting that yields what you're after:
\usepackage{fancyhdr}
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}% Chapter mark
\fancyfoot[C]{\thepage}% Footer contains the page number
\renewcommand{\headrulewidth}{.4pt}% Header rule width
The above sets the header as \leftmark, which contains the \chaptermark setting (since \chaptermark actually issues \markboth{<leftmark>}{<rightmark>} with an empty <rightmark>).
\documentclass{report}
\usepackage{fancyhdr,lipsum}
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps#fancy{%
\patchcmd{\chaptermark}% <cmd>
{\#chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\begin{document}
%\frontmatter
\pagenumbering{roman}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
% here it comes my front matter for example:
\cleardoublepage
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{Abstract}%
\chapter*{Abstract} \lipsum[1]
\cleardoublepage
\pagenumbering{arabic}
\pagestyle{fancy}
\chapter{Introduction} \lipsum[1-50] % first chapter
\chapter{Methodology} \lipsum[1-50] % second chapter
\chapter{Conclusion} \lipsum[1-50] % last chapter
\end{document}
Note that \chapters are set by default using the plain style. If you wish this to be different, you'll have to redefine the plain page style.
You can achieve the same output using a different header/footer package like titleps.