The proof copies of a book laid out with KOMA scrbook show that the inner margins are too narrow. I had BCOR set to 10mm and want to increase them, but my experiments with BCOR set to 20mm show that the layout is the same independent what BCOR value I set. Here my MWE:
\documentclass{scrbook}
\KOMAoptions{paper=
128.5mm:198.4mm, %(5,06" x 7,91") %ziel
BCOR=20mm,
twoside,
headinclude=false, footinclude=false,
headings=normal,
titlepage=true,
% draft=true,
DIV=9, %ziel kleines buch
fontsize=12pt,
}
\usepackage[german]{babel}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage[a4,axes,cross,pdftex,center]{crop}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{ Philosophie}
some text
\lipsum
\lipsum
\end{document}
What is wrong?
My real question is: how can I just move the text area on both pages to the outside (i.e. making the gutter wider) without changing the text area size (and thus preserve line breaks)?
I found a hint in some other questions answered before and the problem was caused by the interaction between the KOMA script and the geometry package. Using the geometry package recalculates the page layout and overwrites the one calculated by scrbook including the BCOR value. This can be avoided when adding the option pass to geometry as in
`\usepackage[pass]{geometry}`.
In general the interaction between the layout calculated by KOMAscript and other package can lead to surprises. The discussion in https://tex.stackexchange.com/questions/182821/div-and-bcor-setting-in-koma-best-practices/183839 is very useful.
Related
I am having issues with a report I am writing. First time using latex and after getting some help on here regarding some tables weirdness I again have a silly frustrating issue. Figures don't stay where I put them. I made a MWE Posted Below
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./Figures/} }
%%%%%% Referencing %%%%%%
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={(},close={)}}
\title{MWE}
\begin{document}
\maketitle
\section{Introduction}
The average sea surface temperature (SST) trend is shown in Figure \ref{fig:SST}.
\section{Figures}
\begin{figure}
\includegraphics[width = \linewidth]{Figures/SST.png}
\label{fig:SST}
\end{figure}
\section{References}
\bibliography{References.bib}
\bibliographystyle{agsm}
\end{document}
I expect, probably an error, for the figure to be inserted under the Figures subheading however it appears on the next page after references. I have to refer to my figure in the text, hence the \ref{fig:SST} so it is clickable. It's not a size issue as there is more than enough space on the page to accommodate the figure. Even if that was the issue I would expect the references subheading to be after it.
Most latex classes use so called floats for figures, tables etc. The idea is that latex will automatically find a good place for your images and avoid ugly white space.
To make use of the abilities of latex to produce a good looking output, you must specify possible placements with floating specifier such as [htbp], which allows latex to place the image here, at the top, at the bottom or an a separate page.
Also if you want to use the \label-\ref mechanism, your figure must have a caption (and the label inside or after the caption).
\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./Figures/} }
%%%%%% Referencing %%%%%%
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={(},close={)}}
\title{MWE}
\begin{document}
\maketitle
\section{Introduction}
The average sea surface temperature (SST) trend is shown in Figure \ref{fig:SST}.
\section{Figures}
\begin{figure}[htbp]
\includegraphics[width = \linewidth]{example-image-duck}
\caption{test}
\label{fig:SST}
\end{figure}
\section{References}
\bibliography{References.bib}
\bibliographystyle{agsm}
\end{document}
Generally, LaTeX's attitude is ‘you write the text, let me worry about placing the figures’.
Floats (that is, figures and tables) will float to where LaTeX thinks they go best. I can't remember the precise rules in the article style, but generally they float to the top of the nearest following page that has room for them. LaTeX won't fill too much of a page with figures, so if you have a dense sequence of large-ish figures, some of them can end up quite a long way away from the point in the source text where they're written.
This is normal, and how figures and tables appear in the majority of published books and articles.
You'll usually write a caption:
\begin{figure}
\includegraphics{...blah...}
\caption{This is a caption for my figure\label{fig:SST}}
\end{figure}
Then you can write
...this is shown in Figure~\ref{fig:SST}
If you want to, you might add ...on p.\thinspace\pageref{fig:SST} and LaTeX will insert the page number where the figure ends up. Also, see the prettyref package.
As mentioned in the other answer, you can add placement specifiers like [ht], which give LaTeX permission to put the figure ‘here’ or at the top of a page, but that doesn't force anything. It is possible to fight with LaTeX about this (the Overleaf docs give some hints), but it's generally not worth it in my experience.
That said, one bit of guidance it's useful to give LaTeX is something like \renewcommand{\floatpagefraction}{.8}, which says that LaTeX is allowed to use as much as 80% of the page for floats (ie, figures and tables) – the default value is a bit tight (there are more comments on this in this TeX.SE question – tex.stackexchange.com is generally a better site for LaTeX-related questions).
If you do feel compelled to fight/fiddle with float placement, do it at the very end of the process, where you're fine-tuning the punctuation of your document. Small changes in the document can have big effects on where floats end up, and it's simply not worth worrying about this until your document is almost finalised.
Your final puzzlement was about the figure ending up after the references. In the case of your document, the figure goes on p.2, so there's plenty of space on p.1 for LaTeX to carry on setting text, so naturally it puts the references there. Since you generally do want the references to go at the very end of an article, this is a case where it's reasonable to exert a little control over placement, and a good idea would be to put \clearpage before the References section. What that does is to make a new page and force out any floats which are still in the queue waiting for space to appear.
Looking for the best way to fit a figure tightly that spans the full height of a page. I'm writing a document about the ionosphere and want to include this image along the side: https://en.wikipedia.org/wiki/Thermosphere#/media/File:EarthAtmosphereBig.jpg
Seems like a job for minipage but I can't quite figure out a good solution. Any tips?
You can achieve this by placing two minipages, one with a larger width than the other, side-by-side.
\documentclass[12pt]{article}
\usepackage[demo]{graphicx} %demo option should be omitted in real document
\usepackage{lipsum} %for random text, should be omitted in real document
%--------%Shows page layout, also should be omitted in real document.
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%--------%Idea from Zarko of TEX.SE
\begin{document}
\begin{minipage}{0.8\textwidth}
\lipsum[1-3]
\end{minipage}
\begin{minipage}[r]{0.2\textwidth}
\centering
\includegraphics[width=0.2\textwidth, height=\textheight]{demo.png}
\end{minipage}
\end{document}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I am trying to write a CV in Latex, but now I am stuck. Since I want to learn Latex, I don't really want to just use a template.
I am thinking about one page divided in to columns/minipages:
Left column: an image + contact information etc.
Right Column: Education, experience, volunteer work etc.
Tried minipages and columns, but the image is destroying the whole format... Tried to use parts from templates, which worked fine, i.e. secsty etc. See example under.
Not a specific question, but hope someone has a good idea for how to make something out of this idea :)
Example:
%Preamble
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{a4paper, total={170mm,257mm}, left=10mm, top=10mm}
\pagestyle{empty}
%%% Custom sectioning (sectsty package)
\usepackage{sectsty}
\sectionfont{\usefont{OT1}{phv}{m}{n}\sectionrule{0pt}{0pt}{-10pt}{1pt}}
\subsectionfont{\usefont{OT1}{phv}{m}{n}}
%Document
\begin{document}
\begin{minipage}[250mm]{0.4\linewidth}
\includegraphics{image.png}
Date of birth:
Phone:
Email:
\end{minipage}
\begin{minipage}[250mm]{0.65\linewidth}
\part*{Name}
\section*{EDUCATION}
\section*{EXPERIENCE}
\end{minipage}
\end{document}
It is great to see that you don't simply copy one of the existing templates, but want to learn some latex instead.
Some comments about your code:
if you want the minipages besides each other to emulate columns, their combined sum has to be equal or smaller than the linewidth. In your example 0.4+0.65= 1.05, so they won't fit in one line. In fact I would make them a bit smaller and add a \hfill between to get a bit of space between them
to make sure each minipage is only as wide as you specified, I would add the [width=\linewidth] option to the image. This will automatically scale the image correctly
if you want both minipages in one line, don't leave an empty line between them. In latex and empty line in the source code is interpreted as a paragraph break, thus forcing your second minipage in a new line
To get a better vertical alignment of the image, I would remove the optional height argument from the minipage and let tex determine how high your minipages are and add the options [T] and [b] respectively to determine the vertical alignment
this is more a design question: at the moment your page geometry is highly asymmetric. You can visualise this by adding showframe to your geometry options, e.g. \geometry{a4paper, total={170mm,257mm}, left=10mm, top=10mm,showframe}. Are you sure this is a good choice for a CV?
%Preamble
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{a4paper, total={170mm,257mm}, left=10mm, top=10mm}
\pagestyle{empty}
%%% Custom sectioning (sectsty package)
\usepackage{sectsty}
\sectionfont{\usefont{OT1}{phv}{m}{n}\sectionrule{0pt}{0pt}{-10pt}{1pt}}
\subsectionfont{\usefont{OT1}{phv}{m}{n}}
%Document
\begin{document}
\noindent
\begin{minipage}[T]{0.4\linewidth}
\includegraphics[width=\linewidth]{example-image-duck}
Date of birth:
Phone:
Email:
\end{minipage}%
\hfill
\begin{minipage}[b]{0.55\linewidth}
\part*{Name}
\section*{EDUCATION}
\section*{EXPERIENCE}
\end{minipage}
\end{document}
Question:
I use caution statements in my LaTex documents using the code below which works, but I need the caution symbol to be centre aligned against the text like below image that shows current and expected. How?
\newlist{Caution}{enumerate}{1}
\setlist[Caution]{label=\scshape{\color{black}\colorbox{yellow}{{\textbf{{\faWarning} caution}}}},leftmargin=*}
\begin{Caution}
\item {A hazardous situation which, if not avoided, could result in minor or moderate njury.}
\end{Caution}
Edit 1: Minimum Reproducible Example
\documentclass[11pt,a4paper]{article}
\usepackage[a4paper,bindingoffset=0mm,left=20mm,right=20mm,%
top=30mm,bottom=20mm,footskip=10mm,headsep=10mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{palatino}
\usepackage{enumitem}
\usepackage{xcolor, fontawesome}
\usepackage{multicol}
\twocolumn
\newlist{Caution}{enumerate}{1}
\setlist[Caution]{label=\scshape{\color{black}\colorbox{yellow}{{\textbf{{\faWarning} caution}}}},leftmargin=*}
\begin{document}
\begin{Caution}
\item {A hazardous situation which, if not avoided, could result in minor or moderate injury.}
\end{Caution}
\end{document}
You can control the vertical position of any box with the command \raisebox and this can be used to raise or lower the label. But it is not a very good idea for your problem as the amount that the label must be lowered depends on the number of lines in the item text. More, it is not very easy to pass optional positioning parameters to a label, and this solution really lacks flexibility, but I included it for comparisons and completeness.
I propose another solution with minipages. It is sufficient to put the caution label and the text in minipages and to specify a center ([c]) vertical alignment.
The width of either parts are computed with the calc package and it adapts to font size modifications. There is an optional argument that allows to control the spacing between the label and the text. Default value of this parameter mimics the spacing in a list, but it can be adjusted if required.
\documentclass[11pt,a4paper]{article}
\usepackage[a4paper,bindingoffset=0mm,left=20mm,right=20mm,%
top=30mm,bottom=20mm,footskip=10mm,headsep=10mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{palatino}
\usepackage{enumitem}
\usepackage{xcolor, fontawesome}
\usepackage{multicol}
\usepackage{calc}
\twocolumn
\newcommand{\cautionmark}{\scshape{\color{black}\colorbox{yellow}{\faWarning caution}}}
\newlist{Caution}{enumerate}{1}
\setlist[Caution]{label=\raisebox{-0.5cm}[0pt][0pt]{\cautionmark},leftmargin=*}
\newcommand{\newcaution}[2][0.7em]{
\begin{minipage}[c]{\widthof{\cautionmark}}
\cautionmark
\end{minipage}%
\hfill%
\begin{minipage}[c]{\linewidth-\widthof{\cautionmark}-#1}
#2
\end{minipage}
}
\begin{document}
\begin{Caution}
\item A hazardous situation which, if not avoided, could result in
minor or moderate injury.
\end{Caution}
\newcaution{A hazardous situation which, if not avoided, could result
in minor or moderate injury.}
\newcaution[1cm]{A hazardous situation which, if not avoided, could result
in minor or moderate injury.}
\end{document}
This is a follow-up to a question I posted earlier (How to center LaTeX xtable output in full text width).
I realize that my MWE from this previous post was incomplete. In an effort to make it as minimal of an example as possible, I did leave out something that ended up conflicting. Hence, here, I am posting the issue more fully.
I am using tufte-handout (http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/tufte-latex/sample-handout.pdf) to create a small report in latex. I have a file code.Rnw that I knit into code.tex. Below is my code.Rnw:
\documentclass[12pt,english,nohyper]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[space]{grffile}
\usepackage{geometry}
\usepackage{pgffor}
\usepackage{calc}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{tabularx}
%\usepackage{floatrow}
\begin{document}
<<include=FALSE>>=
library(ggplot2)
library(xtable)
#
\begin{fullwidth}
\makeatletter\setlength\hsize{\#tufte#fullwidth}\makeatother
<<echo=FALSE,results='asis'>>=
x.big <- xtable(mtcars[1:10,1:4], label ='tab:mtcars',caption ='This is the mtcar dataset head.',align = c("rr|lr|r"))
print(x.big, tabular.environment ='longtable', floating = FALSE, include.rownames=FALSE)
#
\end{fullwidth}
<<echo=FALSE,results='asis'>>=
fnameO <<- "plot.pdf"
pdf(paste0("./",fnameO),width=6,height=7)
print(qplot(hp, mpg, data=mtcars, main="Scatterplots of MPG vs. Horsepower", xlab="Horsepower", ylab="Miles per Gallon"))
{dev.off();invisible()}
#
\begin{fullwidth}
\makeatletter\setlength\hsize{\#tufte#fullwidth}\makeatother
\begin{figure}[!ht]
\includegraphics[width=\linewidth]{\Sexpr{fnameO}}
\caption{This is a plot of the mtcars dataset from R. It compares the horsepower with the miles per gallon. It uses the qplot function from ggplot2.}
\label{fig:LearningObj_summary}
\end{figure}
\end{fullwidth}
\end{document}
This is the output:
I am desiring to have both the table and the figure centered (across the whole page). As shown above, I am successfully able to get the table centered (thanks to advice from a user in my previous post).
However, I am unable to get the figure centered across the whole page with the caption below it. Instead, likely due to the document class I am using (tufte-handout), the figure itself is in the non-margin area, and its caption is in the margin area.
For starters, I uncommented the \usepackage{floatrow} in the code, in an attempt to force the figure caption to be below the figure instead of to the right of it. This lead to an output as such (where both the table and figure are undesirably on the left side instead of centered, but the figure caption is indeed below the figure):
My question is: How can I center both the table and figure (with the caption below it), so that the output would look more like this?:
Thank you.
As a crude hack, you could simply modify the figure environment of your MWE to use the original \caption command:
\begin{fullwidth}
\begin{figure}[!ht]
\makeatletter\setlength\hsize{\#tufte#fullwidth}\setlength\linewidth{\#tufte#fullwidth}\let\caption\#tufte#orig#caption\makeatother
\includegraphics[width=\linewidth]{\Sexpr{fnameO}}
\caption{This is a plot of the mtcars dataset from R. It compares the horsepower with the miles per gallon. It uses the qplot function from ggplot2.}
\label{fig:LearningObj_summary}
\end{figure}
\end{fullwidth}
...or, for a bit smaller figure that is centered on the page:
\begin{fullwidth}
\begin{figure}[!ht]
\makeatletter\setlength\hsize{\#tufte#fullwidth}\setlength\linewidth{\#tufte#fullwidth}\let\caption\#tufte#orig#caption\makeatother
\centering
\includegraphics[width=.4\linewidth]{\Sexpr{fnameO}}
\caption{This is a plot of the mtcars dataset from R.}
\label{fig:LearningObj_summary}
\end{figure}
\end{fullwidth}
If you find the original \caption command lacking and if none(!) of the floats in your document need to use tufte captions you can overwrite the \caption command using something like \usepackage[labelfont=bf,compatibility=false]{caption}.