3

I am working on a book whose geometrical page dimensions (W x H) are 4" x 6".

For one page, I would like to perfectly display a 4" x 6" pspicture.

Consider the following code:

\documentclass{book}
\usepackage[showframe,paperwidth=4in,paperheight=6in]{geometry}
\textheight=6in \textwidth=4in
\usepackage[frame,noinfo,center]{crop}
\usepackage{xcolor}
\usepackage{pstricks,psvectorian}

\definecolor{cadmiumgreen}{rgb}{0.0, 0.42, 0.235} % 0, 107, 60
\psset{unit=1in}

\begin{document}
\thispagestyle{empty}

\begin{pspicture}(0,0)(4,6)%

\renewcommand*{\psvectorianDefaultColor}{red}%
\psframe[fillcolor=cadmiumgreen,fillstyle=solid](0,0)(4,6)%
\psframe[linecolor=cadmiumgreen](0,0)(4,6)% frame

\rput(0,5){PLACED AT (0,5)}
\end{pspicture}
\end{document}

In the case of the MWE, I am trying to code a 4" x 6" solid green page. However, (including the worded display at the point (0,5)), this is what is produced:

enter image description here

By the displayed note, ``PLACED AT (0,5)'', it seems that Latex has produced what it recognizes as a 4x6 green pspicture. However, there is much white space also displayed, which to me indicates that if the pspicture is 4x6, then the dimensions of the page are not 4x6, despite the commands, \usepackage[showframe,paperwidth=4in,paperheight=6in]{geometry} \textheight=6in \textwidth=4in.

I'm not sure what has caused all this.

QUESTION: Overall, how may I accomplish the following: (1) a page to be printed on 4" x 6" paper, with (2) a 4" x 6" pspicturethat entirely covers the said page --- so that when I print the output on 4" x 6" paper, the page is entirely comprised of the said pspicture?

Remarks: The pstricks and psvectorian packages are included in the MWE because I may be using them in the actual pspicture. The code is compiled with xelatex.

Thank you.

2 Answers 2

3

The page size is defined by geometry and is exactly 4x6 inches as seen in the properties of the pdf file.

b

An easy way to place a 4x6 inch figure in the center of a 4x6 inch page is to use a tikz node.

Frame line color was set to red to verify the correct positioning.

a

\documentclass{book}
\usepackage[showframe,paperwidth=4in,paperheight=6in]{geometry}
\textheight=6in \textwidth=4in
\usepackage[frame,noinfo,center]{crop}
\usepackage{xcolor}
\usepackage{pstricks,psvectorian}   

\definecolor{cadmiumgreen}{rgb}{0.0, 0.42, 0.235} % 0, 107, 60

\psset{unit=1in}

\usepackage{tikz} % added <<<<<<<<<<<<<<<<

\newcommand{\placecover}{% put the image in the center of the page <<<<<<<<<
    \begin{tikzpicture}[remember picture,overlay]
        \node at (current page.center){\coverimg};
    \end{tikzpicture}}

\newcommand{\coverimg}{% define the image <<<<<<<<<
    \begin{pspicture}(0,0)(4,6)%        
        \renewcommand*{\psvectorianDefaultColor}{red}%
        \psframe[fillcolor=cadmiumgreen,fillstyle=solid](0,0)(4,6)%
        \psframe[linecolor=red](0,0)(4,6)% frame changed <<<<<
    \end{pspicture}}

\begin{document}
    \thispagestyle{empty}       
    \placecover % place the image       
\end{document}
1
  • Many thanks Simon Dispa for this very helpful answer. Nov 27, 2022 at 20:46
2

Does this satisfy

\documentclass{book}

\usepackage[paperheight=6in, paperwidth=4in, margin=0pt, showframe]{geometry}
\usepackage{xcolor, pstricks}

\definecolor{cadmiumgreen}{rgb}{0.0, 0.42, 0.235}

\psset{unit=1in}

\begin{document}
    \thispagestyle{empty}
    \noindent
    \begin{pspicture}(0,0)(4,6)
        
        \psframe[%
                        fillstyle=solid,
                        fillcolor=cadmiumgreen,
                        linewidth=2pt,
                        linecolor=red]
                        (0,0)(4,6)
        
    \end{pspicture}
\end{document}

enter image description here

1
  • +1 Thank you for this very nice alternative to Simon Dispa's answer. Nov 28, 2022 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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