76 Comments

  1. 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.

  2. Eric

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

    • 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.

  3. 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!

  4. 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!

  5. 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

    • 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.

  6. 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

    • 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.

  7. 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

  8. 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

    • 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.

  9. 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.

  10. 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

    • 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?

    • 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”

  11. 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…

  12. 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

    • 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}
  13. 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?

    • Hi! You’ll need a floating environment to fill space automatically. Try using sidewaystable from the rotating package for your table. Best, Tom.

  14. 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.

  15. 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!

  16. 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

  17. Dear Tom,
    Kindly guide me on what I need to do to add caption,tablenote and label to my table using sideways environment.The following shows what I have been doing with caption and label but without success.Thanks.

    \begin{sideways} \small
    \caption{Essential values of constants}
    \centering
    \begin{tabular}
    ............
    .............
    
    \end{tabular}
    \label{Tab:kyu}
    \end{sideways}
    • Hey!

      Thanks for your question. Here is an example using the rotating package:

      \documentclass[11pt]{article}
      \usepackage{rotating}
      \begin{document}
      \begin{sidewaystable}
      \caption{Dummy sideways table}
      \centering
      \begin{tabular}{cc}\hline{}A&B\\\hline{}1&2\\3&4\\\hline{}\end{tabular}
      \label{tab:sidetab}
      \end{sidewaystable}
      \end{document}

      My recent article on the topic might also be of interest to you.

      Cheers, Tom.

      • Many thanks Tom for this useful suggestions.However,I initially opted for sideways environment because the sidewaystable environment will normally relocate the table by one or more pages away from where it is needed in the document.But going by your suggestions,it appears that sidewaystable environment can still not be avoided.Ok,thanks.

      • The solution largely depends on your needs: the size of the table, where you need it, etc. If you are going with sidewaystable, try adding \clearpage at the end. If not, below is a rotated table based on sideways. Please provide a minimal example to illustrate your problem, should this not be what you were looking for.

        Thanks, Tom

        \documentclass[11pt]{article}
        \usepackage{rotating, blindtext}
        \begin{document}
        \blindtext
        \begin{table}[ht]
        \centering
        \begin{sideways}
        \begin{tabular}{cc}\hline{}A&B\\\hline{}1&2\\3&4\\\hline{}\end{tabular}
        \end{sideways}
        \caption{Caption.}
        \label{tab:mytable}
        \end{table}
        \blindtext
        \end{document}
  18. Isabelle

    Thanks for your information! But no matter what I do, it always turns my page in the PDF view. I don’t want that (I only want to turn the table), since the document will be printed. I tried the following two possibilities:

    \usepackage{lscape}
    \begin{landscape}
    \begin{table}
    ...
    \end{table}
    \end{landscape}
    \usepackage{rotating}
    \begin{sideways}
    \begin{table}
    ...
    \end{table}
    \end{sideways}

    I’m grateful for any suggestions on how to rotate my table without rotating the whole PDF page. Thanks!

    • It shouldn’t matter if the physical page is turned, even if you print the document. In any case, here is an example where only the table is rotated, not the page. The first table is embedded between text, the second takes the whole page.

      \documentclass[11pt]{article}
      \usepackage{rotating, blindtext}
      \begin{document}
      
      \blindtext
      \begin{center}
      \begin{sideways}
      \begin{tabular}{ccc}
      a&a&a\\
      b&b&b\\
      \end{tabular}
      \end{sideways}
      \end{center}
      \blindtext
      
      \begin{sidewaystable}
      \centering
      \begin{tabular}{ccc}
      a&a&a\\
      b&b&b\\
      \end{tabular}
      \end{sidewaystable}
      
      \end{document}

      Best wishes,
      Tom

      • Isabelle

        Thank you for your examples, but the page is still turned in my pdf document. I’m working on a mac and I’m using texmaker. I wonder if another package does the turning?

        The problem is that the printer does not notice the turned page and just prints the page like it were portrait.

        I’m glad for further suggestions!

      • It might be another package. When I run the example I posted, the page doesn’t get turned, only when using the landscape environment of the pdflscape package.
        If you can’t fix the issue, why not just rotate the single page back using Preview before printing?

        Tom

  19. Sergiy

    Hi!

    Thanks for a usefull post! For me everything worked fine, but here a small coment on lscape, pdflscape and automatic page rotation.

    pdflscape is thought to work with pdflatex (and lscape with latex). So, for pdflatex everything woks great. If used with latex->dvipdf, the pages in pdf are not rotated (the same happans to lscape).

    To get automatic page rotation with latex, the way over .ps should be used, means latex->dvips->ps2pdf. Then the automatic pages rotation works fine with both packages lscape and pdflscape.

    Just for the case there are some people left who uses “old school” latex :)))

Leave a Reply