About these ads

Landscape in Latex

The default page layout is “portrait”, but sometimes it is still useful/necessary to have the whole document or only single pages changed to “landscape”. The latter might be due to a large table or figure. This post will tell you how to change the page layout of the whole document or single pages to “landscape”. In addition, it is possible to make single pages appear left side up in the PDF, making them more readable.

Changing the whole document to “landscape” can be done be using the geometry-package:

\usepackage[landscape]{geometry}

You can also just change the page content to landscape, but not the actual page layout through the optional argument of the command “documentclass”. It does not make much sense, but you can do it:

\documentclass[landscape, 12pt]{report}

Next I will show you how to change the page layout of single pages. The lscape-package provides according possiblities:

\usepackage{lscape}

With

\begin{landscape}
...
\end{landscape}

you define the section of your document to be set to “landscape”, e.g. a large table or figure.

This will not automatically rotate the page in the PDF and is useful if the document is destined for printing.

If you want to make appear the left side up, better readable on screen, the pdflscape-package will do it:

\usepackage{pdflscape}

and again:

\begin{landscape}
...
\end{landscape}

for the page to be “landscape”, while the rest will remain in “portrait” orientation. Nevertheless, the header/footer will also be changed in orientation.

About these ads

62 Responses to “Landscape in Latex”

  • Create your slides / presentations with Latex « Blog on Latex Matters

    [...] Nevertheless, this is not sufficient, as it only turns the slide, but not the paper (see the previous post for details). [...]

  • Linda Octa

    Thank you, its very useful!!!!

  • Alin Tolea

    Thanks! The only correct reference on landscape pages in latex!

    Alin

  • Jinbae

    Amazing and perfect!
    Thank you for your post.

  • Hartwork Blog » Single landscape pages in LaTeX

    [...] Actually quite easy. Found it on Texblog. [...]

  • Jason Morgan

    Thank you for this.

    Quick question: when using pdflscape, should the headers and footers also be reoriented or should they remain in a portrait orientation? Mine seem to be doing the latter. I am using fancy headers/footers.

  • Jonathan

    Thanks a lot…it’s very useful information for us!!!

  • Osmikraska

    Thanks a lot ;-)

  • Jobi

    thanks .. was really helpful !

  • Mirek

    Thanks! Very clear and useful!

  • Eric

    Is there a way to get this to work with fancyhdr? It seems using pdflscape rotates the content, but not the fancyhdrs.

    • tom

      The page header/footer is for consultation purposes and therefore should not be rotated with the page. Hence, it is correct that the headers/footers are not rotated with when using pdflscape. Imagine a book with rotated headers!

      If you really want to rotate the header/footer with the content, you might check the typearea package. It seems, you can’t do it with fancyhdr.

      Tom.

  • Peter

    Thanks, completely clear and useful!

  • Raghu Prasad

    A timely tip which saved my time to visit the bookshelf to pick up that fat book.

  • Wagner

    Very useful and very good blog!
    thx for posting it!

  • Mtzie

    Thanks! I was very helpful. keep it up

  • rev. Beraldo

    I was trying using landscape as an option in the documentclass command but the page orientation was still the usual.

    But the package geometry with the option landscape solved it! Thank you!

  • Chris Lasher

    This was extremely helpful, particularly pointing out pdflscape. Thank you!

  • romunov

    Worked like a charm, thank you!

  • raditya

    thank you sooooo much… it was really helpful

  • enoksrd

    I couldn’t get the single page landscape (\usepackage{pdflscape}, \begin{landscape} … \end{landscape}) to work with \mbox. In particular, there was no error message, the page content just didn’t rotate. After removing the mbox it works. Thanks!

  • Joseph

    Thanks a lot, very useful, worked all right, saved me a lot of time and effort.

  • Upananda

    Thanks a lot for your help and saving time for me….

  • pietro

    Once in landscape mode (from \usepackage[landscape]) how to rotate back to vertical one single page, because for example I have a tall table

    thanks

    • tom

      Hi Pietro,

      Once in landscape mode, you can rotate back using \begin{landscape}...\end{landscape} for portrait pages. This is not straight forward, but it works :-) .

      Tom.

  • Matthew Carr

    Great post, helped me to fit a large figure which was causing all sorts of trouble before :) Thanks a lot!

  • jbecker85

    Thanks, useful article!

  • ivik

    very helpful, thx a lot:) I was desperate and this is so simple solution and works perfectly

  • Angelika

    Hi, you all,
    I am using landscape and it works fine to landscape one page and portrait the other ones. However, on a doublesided document the landscape pages of even pagenumbers (on the left side of the document) should be upside down from the ones of the odd pagenumbers (on the right side of the document). How do I get a landscape page rotated 180 degrees?

    Thanks for any idea
    Angelika

    • tom

      Hi Angelika,

      Thanks for your comment. You are right, lscape will not rotate the page accordingly when using the twoside-option. There is another solution however, using the “rotating”-package:

      \usepackage{rotating}
      ...
      \begin{sideways}...\end{sideways}
      \begin{sidewaysfigure}...\end{sidewaysfigure}
      \begin{sidewaystable}...\end{sidewaystable}

      From here. Hope that solves your problem.

      Cheers, Tom.

  • Aravind

    Hi all,

    Thanks for the post…..it is working fine…..but in my case i have a wide and a multi-page table and when i do the above mentioned procedure in addition with longtable package, i can get only 1 page rotated and the other information is being cut that means howmuch ever i include i get only 1 page and rest all is not in the pdf. I would be very greatful if someone could help me with this.

    Cheers,
    Aravind

  • Cyrus Kosar

    YOU ARE THE BEST!

  • Aravind

    Hi tom,

    As i said i have a wide table and therefore i decided to use sideways table so that i can place all the columns well horizontally on a page…..but i am facing a problem when i extend it to multiple pages using longtable package…..may be sideways and longtable packages don’t work parallel….in this case i can see the data only in the frst page of the PDF output

    • tom

      It seems that you cannot combine sideways and longtable. The example below might help depending on how wide you table is. It uses landscape environment, a smaller text size and longtable for multipage.

      \begin{landscape} 
      \begin{footnotesize}
      \begin{longtable}{cccccccccccc} 
      \caption{Longtable example}\\ 
      \hline
      head content...
      \hline
      \endhead
      \hline \multicolumn{12}{r}{\emph{Cont. on following page}} 
      \endfoot
      \hline 
      \endlastfoot
      body content...
      \end{longtable} 
      \end{footnotesize}
      \end{landscape}

      You can also try to change the page margins to get more space using the geometry package:

      \newgeometry{⟨options⟩}

      and

      \restoregeometry

      Cheers, Tom.

  • Warwick Dumas

    I’m glad this page is one of the highest hits on the Google search “tex command landscape portrait”, because it contains just the information that I needed.

  • Naeem

    Hi everybody,

    Thanks to everybody because your posts helped me alot ;-)

    While writing a paper for ACM proceedings I a faced a problem. I added a large image using \begin{landscape} … \end{landscape} in my document. Problem is, LATEX does not adjust the text with the image automatically, e.g., when I add some lines of text before the image then a new page before (landscape) image is shown instead of moving that text after the image, which is normally done in prtrait mode.

    Any ideas how to handle it?

    Thanks in advance,

    Regards,
    Naeem

    • tom

      Hi Naeem,

      Latex will place the figure where it fits “best”. But you can influence the decision using an exclamation mark:

      \begin{figure}[h!t]...

      Tom.

      • Naeem

        Hi Tom,

        Many thanks for your quick reply.

        Unfortunately, use of exclamation doesn’t do the trick for me, i.e., I still face the same problem.

        Let me explain the problem a bit more. I have total 7 pages, landscape image is on page 4 (while page 3 is full with text). If I add a new paragraph just before the image then LATEX moves the image to page 5 and shows only the newly added lines on page 4 while leaving the rest of page 4 empty. If I use the portrait image then it merges the newly added text with the existing text, i.e., do not leaves the empty space with newly added text.

        I face the same problem if I use table in \landscape envoronment.

        Any ideas??

        Thanks again,
        Naeem

        PS: I also tried \clearpage, but no success:-(

      • Chad

        I have the same problem as Naeem. It seems \landscape starts a new page wherever it’s introduced, which makes sense. But I’d like it to act something like a float because I have the same frustrating behavior as Naeem. Anyone else find a solution?

      • Tim Rudnevsky

        I have the same problem too. Maybe someone can suggest something?

      • ebrahim

        use sidewaystable.

    • Maryam

      Hello

      I had the same problem, but “float” package solved it. So you can use the \usepackage{float}, and then the option \begin{figure}[H]. As you see, the difference is that here you have to use the Capital letter “H”

  • randpen

    Thank you Tom. This answered a recurring problem I had with landscape mode. Now I just wish there were an easy way to get fancyhdr to work with \landscape…

  • PaulB

    Hi,

    I think I have a similar problem to Aravind. I am trying to include a pdf document (which is landscape and 7 pages long) into my own document (which is otherwise portrait). I have tried a number of different methods, but I always get the same result that the first page is displayed correctly in landscape, but the subsequent pages aren’t.

    I would be very grateful for any help.

    Paul

    • tom

      Hi Paul.
      I prepared a mini example. The first piece of code generates a document in landscape format which is then included in a portrait-format document in the second piece of code. Hope it helps, Tom.

      \documentclass[landscape, 11pt]{article}
      \usepackage[english]{babel}
      \usepackage{blindtext}
      \usepackage[landscape]{geometry}
      \begin{document}
      \blinddocument
      \end{document}
      \documentclass[11pt]{article}
      \usepackage[english]{babel}
      \usepackage{blindtext}
      \usepackage{pdfpages}
      \begin{document}
      \Blindtext
      \includepdf[landscape=true, pages=-]{lscapeDoc}
      \Blindtext
      \end{document}
  • Musi Ali

    Hi, thanks for it.
    Lets suppose in the portrait mode, I have few lines in page 4, and then I insert table in landscape, and then continue to write other text.
    What is happening—page 4 is left with a lot of space, table goes to page 5, and the new text I write goes to page 6.

    Can not latex do formatting for me itself?

  • Intrepid

    Still very very useful!
    Thanks a lot!

    Intrepid

  • Maryam

    It was so useful Tom :) Thank you so much :)

  • Eric

    Thanks for this great info! The one thing about

    \usepackage[landscape]{geometry}

    is that the even pages have different margins than the odd pages, as if they are going to be printed in a big landscape book, which looks weird when scrolling on a screen. But I found that using

    \usepackage[landscape,centering]{geometry}

    makes all margins uniform.

  • web ressource

    This is very interesting, You are a very skilled blogger.
    I’ve joined your feed and look forward to seeking more of your great post. Also, I’ve shared your web site in my social networks!

  • Xunming Du

    Tom:

    Your message is very helpful. I think everyone loves it if he/she get a chance to read and use what you have written here. Keep the good work!

    Xunming from Nevada

  • Hrushikesh

    Thanks, this helped a lot !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 744 other followers

%d bloggers like this: