58

I have seen several posts related to this one, but I'm not satisfied with given explainations and examples. I can't get them working!

What I want is simple landscape document. I have tried the \usepackage{pdflscape} but only the paper rotates not the whole thing. The coordinates(0,0) are still at the upper right. I want the origin(0,0) at the upper left just like what happens when I do MS Word Landscape layout.

I really need your help. I'm using Latex.

\documentclass{article}
\usepackage[paperheight=8.5in,paperwidth=13.0in,margin=0.1in,headheight=0.0in,footskip=0.5in,includehead,includefoot]{geometry}
%%\special{papersize=279mm,216mm}
\usepackage{graphicx}
\usepackage[landscape]{geometry}
\usepackage{fancyhdr}
\usepackage{fancybox}
\usepackage{longtable}
\usepackage{setspace}
\usepackage{fmtcount}
\usepackage{color}
\usepackage{multirow}
\usepackage[absolute]{textpos}
\usepackage{yfonts}
\usepackage{rotating}
\renewcommand{\familydefault}{\sfdefault}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\begin{document}
\begin{landscape}
{.SELECT UPPER(company_name) as c_comp,address as c_add,tel_nos as c_tel FROM tools.`clients` WHERE client_id=1}
\begin{textblock}{14}(0.75,0.08)
\raggedright{
\includegraphics[height=1.0in]{/u2/images/school/stc_logo}
}
\end{textblock}
\begin{landscape}
\end{document}
Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
eggshot
  • 913
  • 7
    Try \documentclass[a4paper,landscape]{article} or use \usepackage[landscape]{geometry} – Jesse Nov 29 '13 at 06:58
  • then how to use the \begin{landscape}? Should I put my \begin{document} inside? – eggshot Nov 29 '13 at 06:59
  • That is used inside a document for change orientation of a specific part if you want a portait layour. For this, you need package pdflscape. – Jesse Nov 29 '13 at 07:02
  • remove the option absolute from textpos. See the answer below. –  Nov 29 '13 at 07:21

2 Answers2

82

You can create a landscape document by using

\documentclass[a4paper,landscape]{article}

or with the help of geometry package:

\usepackage[a4paper,margin=1in,landscape]{geometry}

Here text will be in landscape, but page directions will be the same. Consider the following example:

\documentclass{article}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\usepackage{blindtext}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
  \node at ($(current page.north east) + (-1cm,-1cm)$) {NE};
\end{tikzpicture}
 \blinddocument
\end{document}

enter image description here

Here NE is the north east of the page while text is in landscape. On the other hand if you want only few pages in landscape, you can use lscape or pdflscape packages.

\documentclass{article}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{kantlipsum}
\usepackage{lscape}
%\usepackage{pdflscape} %uncomment this  and comment above line to see the difference
\begin{document}
    \begin{landscape}
      \kant[1-4]
    \end{landscape}
    \kant[5-10]
\end{document}

pdflscape will auto rotate the page on the screen so as to make reading easy.

Having said that, in your example, remove the option absolute from textpos. Hence you will be able to keep the origin changing when you rotate the text. Further, you have used _ in text which should be \_.

\documentclass{article}
\usepackage[paperheight=8.5in,paperwidth=13.0in,margin=0.1in,headheight=0.0in,footskip=0.5in,includehead,includefoot]{geometry}
\usepackage{graphicx}
\usepackage{textpos}
\usepackage{pdflscape}


\begin{document}
\begin{landscape}
{.SELECT UPPER(company\_name) as c\_comp,address as c\_add,tel\_nos as c\_tel FROM tools.`clients` WHERE client\_id=1}
\begin{textblock}{14}((0.75,0.08))
\raggedright{
\includegraphics[height=1.0in]{example-image-a}
}
\end{textblock}
\end{landscape}
\end{document}

enter image description here

  • The MySQL query is not supposed to be printed, it's not part of the document itself but it does fetch data to be printed (QCGI syntax). But anyways, your example has given me an idea. Thanks. – eggshot Nov 29 '13 at 10:02
  • 7
    For the case \documentclass[landscape]{article} and pdflatex, use \setlength{\pdfpagewidth}{\paperwidth} and \setlength{\pdfpageheight}{\paperheight} in preamble. Without it the pdflatex will produce portrait and you may waste a lot of time looking for the bug. – dmitry_romanov Sep 26 '14 at 04:14
  • 2
    @dmitry_romanov That is why, we use geometry :-) –  Sep 26 '14 at 04:23
0

If you would like to have some landscape pages in a portrait document, I recommend the lscape package.

It works like this:

\documentclass{article}
\usepackage{lscape}    
\begin{document}    
portrait    
\begin{landscape}
landscape
\end{landscape}    
\end{document}
MrMartin
  • 293