%# -*- ascii characters only -*-

\documentclass[a4paper]{article}
\usepackage{doc}
\makeatletter
%%% dangerous bend
\font\man=manfnt at 10pt
\def\dbend{\leavevmode\raise0pt\hbox{\man\char'177}}
\newenvironment{dangerous}{%
  \ifnum\@listdepth>\z@
    \GenericError{}{Do not use `dangerous' environment inside any list}{}{}
  \fi
  \par\addvspace\medskipamount
  \@tempdima=\dimexpr\textwidth-2zw\relax\small
  \divide\@tempdima by\dimexpr1zw\relax\@tempcnta=\@tempdima
  \leftskip=\dimexpr\textwidth-\@tempcnta zw\relax
    \@totalleftmargin\dimexpr\leftskip+0zw
    \linewidth=\dimexpr\@tempcnta zw-0zw
  \parindent1zw\noindent\kern-\leftskip\hbox to\leftskip{\dbend\hss}%
  \everypar{\everypar{}}\ignorespaces
}{\par\addvspace\medskipamount}
%%% misc
\newcommand{\Meta}[1]{$\langle$\mbox{}\textit{#1}\mbox{}$\rangle$}
%%%
\makeatother
\usepackage{longtable}
\usepackage{gentombow}
\usepackage{bxpapersize}
\GetFileInfo{gentombow.sty}
\title{Package \textsf{gentombow} \fileversion}
\author{Hironobu Yamashita}
\date{\filedate}
\begin{document}

\maketitle

It is convenient to print documents for final smaller paper sizes
on paper of the printer's standard physical paper size;
it allows printing close to the logical paper edge
and even outside the logical page.

This package \textsf{gentombow} provides a Japanese-style
crop marks (called `tombow' in Japanese) for trimming paper stacks,
and place the document page at the center of a larger physical
paper sheet. It automatically detects the page size
(\verb+\paperwidth+, \verb+\paperheight+) which is
going to set by document class.
This document itself is a demonstration of this package,
with final A4 paper printed on B4 (JIS B4; not ISO B4!) paper.

Note that this package does nothing about output paper size
specification; use one of the followings to do it.
\begin{itemize}
\item \textsf{graphicx} package
  with \texttt{setpagesize} feature added in 2016
  (supports all engines)
\item \textsf{bxpapersize} package
  (supports all engines; by Takayuki YATO)
\item \textsf{bounddvi} package
  (supports only DVI output mode; part of \textsf{platex-tools} bundle)
\end{itemize}

A basic usage:
\begin{verbatim}
  \documentclass[a4paper]{article}
  \usepackage{gentombow}
  \usepackage{graphicx}
  \begin{document}
  The content
  \end{document}
\end{verbatim}
For Japanese people, \textsf{pxgentombow} (also part of
\textsf{platex-tools} bundle) is also available;
it requires Japanese p\LaTeX/up\LaTeX\ or Lua\TeX-ja.

This package is part of \textsf{platex-tools} bundle:
\begin{verbatim}
  https://github.com/aminophen/platex-tools
\end{verbatim}

\section*{Automatic Determination of Output Size}

In this package,
the following printer's standard physical paper sizes are predefined;
A series (\texttt{a0}--\texttt{a10}),
B series (\texttt{b0}--\texttt{b10}),
C series (\texttt{c0}--\texttt{c10}),
\texttt{letter}, \texttt{legal} and \texttt{executive}.
In the current release, `B series' is JIS standard,
not ISO standard (this might be changed in the near future).
Also, some variations \texttt{a4var} and \texttt{b5var} are predefined.

When one of the above sizes (except \texttt{a0}, \texttt{b0}
and \texttt{c0}) is detected, the output size is
automatically determined along with the following rule:
\begin{itemize}
\item When A series detected:
        the output is going to be larger B series
\item When B/C series or
      \texttt{letter}, \texttt{legal}, \texttt{executive} detected:
        the output is going to be larger A series
\end{itemize}
The crop marks are automatically added.
The orientation (landscape/portrait) of the input paper is
also preserved.

The following list shows common examples:
\begin{longtable}[c]{cc}
  \hline
  Detected page size & Output size \\
  \hline
  a6 & b6 \\
  b6 & a5 \\
  a5 & b5 \\
  b5 & a4 \\
  a4 & b4 \\
  b4 & a3 \\
  a3 & b3 \\
  b3 & a2 \\
  \hline
  c6 & a5 \\
  c5 & a4 \\
  c4 & a3 \\
  c3 & a2 \\
  \hline
  letter    & a3 \\
  legal     & a3 \\
  executive & a4 \\
  \hline
\end{longtable}

\section*{When Automatic Determination Failed}

When the page size is different from any of the predefined sizes,
the page is placed with the surrounding 1~inch margins.
For example, when the page has $100\,\mathrm{mm}$ width and
$200\,\mathrm{mm}$ height, the output size is going to be
$100\,\mathrm{mm}+2\,\mathrm{in}$ width and
$200\,\mathrm{mm}+2\,\mathrm{in}$ height.

\section*{Explicit Specification of Output Size}

You can also force the output size using package option.
For example,
\begin{verbatim}
  \documentclass[a4paper]{article}
  \usepackage[tombow-a4]{gentombow}
  \begin{document}
  The content
  \end{document}
\end{verbatim}
forces the output size to be a3 (the automatic determination
`b4' is discarded). Available sizes are the same as
the predefined sizes, that is,
A series (\texttt{a0}--\texttt{a10}),
B series (\texttt{b0}--\texttt{b10}),
C series (\texttt{c0}--\texttt{c10}) and
\texttt{a4var}, \texttt{b5var},
\texttt{letter}, \texttt{legal}, \texttt{executive}.
The orientation (landscape/portrait) of the input paper is
also preserved again.

The option format is:
\Meta{crop mark format}\texttt{-}\Meta{output size}.
The crop mark format is one of the following:
\verb+tombow+ (default), \verb+tombo+ (without a job info),
\verb+mentuke+ (do not print actual crop marks).

\section*{Disabling Job Info Printing}

When the output size is automatically determined,
the crop marks are printed with a job info like
\makeatletter\texttt{\the\@bannertoken}\makeatother.
To disable it, use \texttt{notombowdate} option:
\begin{verbatim}
  \documentclass[a4j]{jarticle}
  \usepackage[notombowdate]{gentombow}
  \begin{document}
  The content
  \end{document}
\end{verbatim}

\section*{Note for \textsf{BXjscls} users}

When using \textsf{BXjscls} (by Takayuki YATO) with size option
other than 10pt, please add \verb+nomag+ or \verb+nomag*+ to the
class option. For example,
\begin{verbatim}
  \documentclass[a4paper,14pt]{bxjsarticle}
  \usepackage{gentombow}
\end{verbatim}
will not work as expected (\textsf{gentombow} throws an error
for safety).

\section*{Note about Layout Settings}

You should not change \verb+\hoffset+ or \verb+\voffset+ to non-zero
value, for the purpose of layout settings. Such settings will
conflict with the feature of \textsf{gentombow} package.
To set page layout correctly, you should adjust \verb+\oddsidemargin+
or \verb+\topmargin+, or leave it to \textsf{geometry} package.

\section*{Change History}

\begin{itemize}
  \item 2017/12/17 v0.9 First CTAN release
\end{itemize}

\end{document}
