Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I compile this MWE, I get a box that takes up about 80% of a vertical page. Since I have specified max height=0.4\textheight in adjustbox, I'd expect a box half the size... is geometry not changing \textheight?

\documentclass[a4paper,10pt]{article}
\usepackage[landscape,hmargin={1.2cm,1cm},vmargin=1cm,footskip=7mm]{geometry}
\usepackage{adjustbox}
\usepackage{boxedminipage}

\begin{document}
\begin{adjustbox}{max width=\textwidth,max height=0.4\textheight,keepaspectratio}
\begin{boxedminipage}{70cm}
\ \vspace{70cm}\ 
\end{boxedminipage}
\end{adjustbox}
\end{document}
share|improve this question
    
Just a guess: doesn't keepaspectratio overwrite the height setting? –  cgnieder Dec 5 '12 at 12:16
    
@Mohan not sure what you trying to achieve your boxedminipage is 70cm? –  Yiannis Lazarides Dec 5 '12 at 12:21
    
@Yiannis Lazarides: I just needed something that was much bigger than the page, to make sure that the adjustbox would shrink it. I couldn't find a cleaner way of drawing a huge square, so I just used boxedminipage. –  Mohan Dec 5 '12 at 12:22
1  
{\fboxsep=-\fboxrule\framebox[70cm]{\rule{0pt}{70cm}}} –  egreg Dec 5 '12 at 12:25
1  
\newcommand{\bigsquare}[1]{{\fboxsep=-\fboxrule\sbox0{}\wd0=#1\ht0=#1\relax\fbo‌​x{\box0}}} and then \bigsquare{70cm} is even faster. –  egreg Dec 5 '12 at 13:04

1 Answer 1

up vote 4 down vote accepted

\textheight is changing as you can verify by adding the verbose option to geometry and looking in the log file. The problem is the adjustbox command. Changing max height to max totalheight gives the desired behaviour.

\documentclass[a4paper,10pt]{article}
\usepackage[landscape,hmargin={1.2cm,1cm},vmargin=1cm,footskip=7mm]{geometry}
\usepackage{adjustbox}
\usepackage{boxedminipage}

\begin{document}
\begin{adjustbox}{max width=\textwidth,max totalheight=0.4\textheight,keepaspectratio}
\begin{boxedminipage}{70cm}
\ \vspace{70cm}\ 
\end{boxedminipage}
\end{adjustbox}
\end{document}

If you do the following

\newsavebox{\test}

\settoheight{\test}{\begin{boxedminipage}{70cm}
  \ \vspace{70cm}\ 
\end{boxedminipage}}
\showthe\\test

\sbox{\test}{\begin{boxedminipage}{70cm}
  \ \vspace{70cm}\ 
\end{boxedminipage}}
\showthe\ht{\test}

then the log file will show that your boxed minipage has height 1001.74644pt and depth 996.74644pt so its total height is about twice its height. (The values are close to being such that the box is vertially centered with respect to the middle of the current row.)

boxedminipage is just like minipage, so you can give it positioning arguments: a \begin{boxedminipage}[b] results in a box with zero depth and full height; \begin{boxedminipage}[t] results in a box with height 0.4pt and (nearly) full depth (the 0.4pt comes from the frame). So instead of using totalheight, you could use

\begin{adjustbox}{max width=\textwidth,max height=0.4\textheight,keepaspectratio}
  \begin{boxedminipage}[b]{70cm}
    \ \vspace{70cm}\
  \end{boxedminipage}
\end{adjustbox}
share|improve this answer
    
THank you. What's the difference between height and totalheight? (I've looked at the documentation, but the only difference I can see is that totalheight is overridden by textheight.) –  Mohan Dec 5 '12 at 12:27
1  
@Mohan A minipage (and boxedminipage too) has not only a height, but also a depth: it extends below the baseline (almost) as much it extends above it. You so occupied 80% of the available height just because of this. –  egreg Dec 5 '12 at 12:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.