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.

I'm starting with LaTeX, and there are things that puzzle me. I'm trying to set a length that's the \textwidth minus (let's say for example) two inches. In the preamble, I wrote:

\newlength{\bplen}
\setlength{\bplen}{\textwidth}
\addtolength{\pblen}{-2in}

The compiler tells me:

! Undefined control sequence. <argument> \pblen 
l.21 \addtolength{\pblen}{-2in}
! You can't use `blank space  ' after \advance.
\addtolength #1#2-<\advance #1 
                               #2\relax
l.21 \addtolength{\pblen}{-2in}
! LaTeX Error: Missing \begin{document}.

I've just defined \bplen and what's that about a missing \begin{document}? Aren't I allowed to set lengths in the preamble?

share|improve this question
2  
Is pblen a typo you made in the document? –  Seamus Nov 26 '10 at 17:41
    
@Seamus: I'm not sure how to handle question like this one, but you were faster and should have gotten the upvote reputation. –  lockstep Nov 26 '10 at 17:55
    
I feel shame. I do. Sorry. –  eje211 Nov 26 '10 at 18:01
    
@lockstep Don't worry about it. Your answer included the useful \the trick which I'd forgotten about, so that's value added. But I am going to spend the next week trawling through all your posts on this site and downvoting every single one. –  Seamus Nov 26 '10 at 18:56
add comment

closed as too localized by cgnieder, lockstep, Stefan Kottwitz Nov 15 '12 at 17:04

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 3 down vote accepted

Could it be simply a typo? Your first and your second code line contain \bplen, but your third \pblen.

EDIT: Without the typo your code works as intended:

\documentclass{article}

\newlength{\bplen}
\setlength{\bplen}{\textwidth}
\addtolength{\bplen}{-2in}

\begin{document}

Value of textwidth: \the\textwidth

Value of bplen: \the\bplen

\end{document}
share|improve this answer
    
I proofread it for typos maybe ten times! This is VERY embarrassing. Being new to LaTeX, I thought I'd done something wrong... –  eje211 Nov 26 '10 at 18:00
    
Actually, I did not know about the \the command. This is VERY useful. Thanks. –  eje211 Nov 26 '10 at 18:37
1  
@eje211 typos are unavoidable. I spent some time today raging that LaTeX kept telling me that the vebratim environment doesn't exist... –  Seamus Nov 26 '10 at 22:00
add comment

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