Opened 18 years ago

Closed 16 years ago

#2721 closed defect (fixed)

LyX creates documents without correct orientation

Reported by: sven@… Owned by: Uwe Stöhr
Priority: high Milestone: 1.5.6
Component: converters Version: 1.3.7
Severity: normal Keywords: patch
Cc: j.spitzmueller@…, drummond@…, forenr@…, ps@…, rogermc@…

Description

When you export a dvi document with landscape format or open one from within LyX
the dvi viewers (tested xdvi and kdvi) are not able to render it properly. It
seems that the dimension information should somehow be embedded in the dvi
documents. The xdvi manpage recommends to use this package within the TeX document:
\usepackage[dvips]{geometry}

Regards,
Sven

Attachments (7)

a.lyx (848 bytes ) - added by ps@… 16 years ago.
source doc
a.tex (290 bytes ) - added by ps@… 16 years ago.
exported .tex file
a.ps (4.5 KB ) - added by ps@… 16 years ago.
exported .ps file
test.log (4.0 KB ) - added by rogermc@… 16 years ago.
TeXShop log for previous comment
xdvil (608 bytes ) - added by forenr@… 16 years ago.
xdvil: a wrapper sh script for xdvi
papersize-2.diff (1.4 KB ) - added by forenr@… 16 years ago.
Updated patch
papersize.diff (1.8 KB ) - added by forenr@… 16 years ago.
Fix for 1.5

Download all attachments as: .zip

Change History (47)

comment:1 by Uwe Stöhr, 17 years ago

Well spotted! Yes,
\usepackage[dvips]{geometry}
should be used when using landscape orientation. This also works for exporting PDF.

comment:2 by Uwe Stöhr, 17 years ago

Summary: LyX creates dvi documents without proper dimension informationLyX creates documents without correct orientation

comment:3 by Uwe Stöhr, 17 years ago

Owner: changed from nobody@… to Uwe Stöhr

comment:4 by Uwe Stöhr, 17 years ago

op_sys: otherAll
Version: 1.4.21.3.7

comment:5 by Uwe Stöhr, 17 years ago

Cc: drummond@… added

comment:6 by Uwe Stöhr, 17 years ago

* #1250 has been marked as a duplicate of this bug. *

comment:7 by Uwe Stöhr, 17 years ago

Cc: ps@… added

comment:8 by Uwe Stöhr, 17 years ago

* #3897 has been marked as a duplicate of this bug. *

comment:9 by sergey.ostashenko@…, 16 years ago

Is there some workaround for this bug?

comment:10 by sven@…, 16 years ago

You can adjust that in the latex header for the document with the \usepackage
line in addition to set the document format to landscape in the lyx document
settings.

comment:11 by Juergen Spitzmueller, 16 years ago

Cc: j.spitzmueller@… added

If the geometry solution is used, several things have to be noted:

  1. geometry changes the page layout, even if loaded without options. So the

\usepackage[dvips]{geometry} "fix" only makes sense if geometry is used anyway.

  1. There are classes and packages that provide their own methods and don't need

the geometry "fix", e.g. the KOMA classes (when the document option "dvips" is
used) or memoir.

  1. This solution should only be used for dvi output.

So the geometry fix is only applicable for a subset of documents. The general
solution for this problem is to insert "-paper" in
Tools->Preferences->Output->Latex->DVI viewer paper options. Note that not all
papaer sizes are supported yet (see #4432), but this is easy to fix.

comment:12 by forenr@…, 16 years ago

Cc: forenr@… added

comment:13 by forenr@…, 16 years ago

AFAIK, the dimension information is always stored in the dvi file. When
using xdvi as a previewer, an easy workaround is using a wrapper that
looks at the horizontal and vertical dimensions (this may be done with
dvitype) and passes the -paper option to the real xdvi when the horizontal
dimension is greater than the vertical one.

comment:14 by forenr@…, 16 years ago

We could distribute the xdvil script with LyX in the <lyxdir>/scripts
directory and use it as the DVI previewer when xdvi and dvitype are
detected by the configure.py script. I think that we can use a shell
script, as xdvi is a *nix thing and we can rely on the presence of
/bin/sh.

comment:15 by ps@…, 16 years ago

postcript viewer has the same problem (gv here), so dvi wrapper is of no help.

comment:16 by forenr@…, 16 years ago

Which version? gv 3.6.1 works perfectly here.

comment:17 by rogermc@…, 16 years ago

Cc: rogermc@… added

comment:18 by ps@…, 16 years ago

3.6.3.
just for sure - the steps are -

  1. new file
  2. document settings -> Page layout -> landscape
  3. view -> postscript

comment:19 by forenr@…, 16 years ago

Cannot reproduce, still. Neither with 3.6.1 nor with 3.6.4.
I also get landscape orientation in acroread when viewing the PDF obtained
through either (dvipdfm) or (ps2pdf), but *not* with (pdflatex).
So, when DVI is implied, everything works for me.

comment:20 by ps@…, 16 years ago

this is very strange.
attached the problematic document and its outputs.
in my case it is only postscript which gives wrong orintation.
pdf or dvi has correct orientation, but wrong paper set.

by ps@…, 16 years ago

Attachment: a.lyx added

source doc

by ps@…, 16 years ago

Attachment: a.tex added

exported .tex file

by ps@…, 16 years ago

Attachment: a.ps added

exported .ps file

comment:21 by rogermc@…, 16 years ago

Intel Mac
OSX 10.5.3
LyX1.5.6svn
TeXShop version Version 2.14-svn (2.14)
I also have the problem trying to produce landscape PDF.

I downloaded the exported .tex file:
%% LyX 1.6.0beta3 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[landscape,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}

\begin{document}
aaa
\end{document}

then:

  1. copied its content into a new TeXShop window
  2. clicked the Typeset button

TeXShop produced a PORTRAIT PDF file.
So the problem appears to be with the TeX installation rather than LyX??
Below is the output from the TeXShop tex console.
I hope someone can see a problem here or suggest something else to try with TeXShop.
Regards,
Roger

Output from the TeXShop tex console:
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)

\write18 enabled.
%&-line parsing enabled.

entering extended mode
(./test.tex
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, ng
erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, finnish,

french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, ibyc

us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, por
tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, swedish,
turkish, ukenglish, ukrainian, loaded.
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/inputenc.sty
(/usr/local/texlive/2007/texmf-dist/tex/latex/base/latin9.def))
(/usr/local/texlive/2007/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2007/texmf-dist/tex/generic/babel/english.ldf
(/usr/local/texlive/2007/texmf-dist/tex/generic/babel/babel.def))) (./test.aux)
[1{/usr/local/texlive/2007/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./test.aux) ){/usr/local/texlive/2007/texmf-dist/fonts/enc/dvips/cm-super/cm-s
uper-t1.enc}</usr/local/texlive/2007/texmf-dist/fonts/type1/public/cm-super/sfr
m1000.pfb>
Output written on test.pdf (1 page, 5269 bytes).
Transcript written on test.log.

by rogermc@…, 16 years ago

Attachment: test.log added

TeXShop log for previous comment

comment:22 by forenr@…, 16 years ago

Well, my gv opens in landscape mode the .ps file attached to comment 17.
Maybe you should check your configuration?

comment:23 by ps@…, 16 years ago

yes gv opens it in landscape but the whole text is upside down, right?

comment:24 by forenr@…, 16 years ago

Not for me. This depends on your settings. In "state->gv Options" you have
to select "Swap Landscape" and save.

comment:25 by rogermc@…, 16 years ago

  1. downloaded exported .ps file.
  2. changed extension from cgi tp ps.
  3. double clicked file.
  4. file opened in Preview.app with text in correct orientation on page for landscape

(although page was displayed as portrait which isn't a problem)

So the big question seems to be, at least for Mac:
How to get LyX produce a PDF file that works like this with Preview??

Re Comment 20:
What "configuration" should be checked and
how should it be set?

comment:26 by rogermc@…, 16 years ago

As problem also occurs on Mac can someone set Platform to All.
Thanks
Roger

comment:27 by forenr@…, 16 years ago

rep_platform: PCAll

Note that if you produce a PDF either through dvipdfm or ps2pdf, there
should be no problem (at least, acroread uses the correct orientation).
The problem arises when producing a PDF through pdflatex. In this case,
the solution would be adding \usepackage[pdftex]{geometry}, but see
comment 6 for the reason this cannot be done.

As regards the configuration, this depends on your application. For X11
applications you should check the .Xresources (or .Xdefaults) file and
individual rc files. I don't know how this works for Mac, so cannot help.

by forenr@…, 16 years ago

Attachment: xdvil added

xdvil: a wrapper sh script for xdvi

comment:28 by forenr@…, 16 years ago

attachments.isobsolete: 01

comment:29 by forenr@…, 16 years ago

Milestone: 1.5.6

comment:30 by rogermc@…, 16 years ago

Mac Intel
OSX 10.5.3
Applied "Fix for 1.5".
No changes to "configuration".
View->PDF (ps2pdf) now produces landscape PDF using both Preview and Adobe Reader 8.1.2.
View->PDF (pdflatex) also produces landscape PDF with Adobe Reader 8.1.2 (Preview not checked,
presumed OK)

comment:31 by Juergen Spitzmueller, 16 years ago

attachment 2653 looks like the right approach. Two nitpicks:

  • we do not need the ifpdf package. We can check runparams_.flavor from within

LaTeXFeatures::getMacros and select the appropriate preamble output. This
results in much less preamble code

  • we should honour if a class does not need this workaround (memoir is an

example). So we should use mustProvide("papersize") instead of
require("papersize"), then memoir.layout can set "Provides papersize 1".

comment:32 by forenr@…, 16 years ago

Thanks for the "flavor" hint, but I don't understand what you mean about
mustProvide. We have to "require" papersize and then check whether we
mustProvide it or not (when already provided by the class). But this is
what the patch was already doing, IMO.

comment:33 by Juergen Spitzmueller, 16 years ago

I don't understand what you mean about mustProvide

You're right. Sorry. I didn't read carefully enough.

by forenr@…, 16 years ago

Attachment: papersize-2.diff added

Updated patch

by forenr@…, 16 years ago

Attachment: papersize.diff added

Fix for 1.5

comment:34 by forenr@…, 16 years ago

attachments.isobsolete: 01

comment:35 by Juergen Spitzmueller, 16 years ago

the patch can go in.

comment:36 by Uwe Stöhr, 16 years ago

Keywords: patch added

comment:37 by forenr@…, 16 years ago

Keywords: fixedinbranch fixedintrunk added

comment:38 by ps@…, 16 years ago

Re Comment 20:

Maybe you should check your configuration?

i needed to set
GV.swapLandscape: True

in my .gv settings to have it correctly displayed.

comment:39 by Juergen Spitzmueller, 16 years ago

Keywords: fixedinbranch fixedintrunk removed
Resolution: fixed
Status: newclosed

1.5.6 is ready. Marking FIXED.

comment:40 by Richard Heck, 10 years ago

Component: exportconverters
Note: See TracTickets for help on using tickets.