打印时边距不正确

打印时边距不正确

我正在使用geometry这样的包:

\usepackage[landscape]{geometry}
\newgeometry{twocolumn, left=0.25cm, right=0.25cm, top=0.8cm, bottom=0.4cm}

fancyhdr这样的包装:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\bf{Some text}}
\fancyhead[C]{\leftmark}
\fancyhead[R]{\thepage}
\fancyheadoffset[L]{0.42cm}
\fancyheadoffset[R]{-0.26cm}

并且所有带边距的内容都正常。但是当我在纸上打印 PDF 时,所有边距都会发生变化。如何修复打印页边距?

所有代码如下所示:

\documentclass[8pt]{extarticle}

\usepackage[cp1251]{inputenc}

\usepackage[russian,english]{babel}

\usepackage[landscape]{geometry}

\usepackage{fancyhdr}

\pagestyle{fancy}

\fancyhf{}

\fancyhead[L]{\bf{Some text}}

\fancyhead[C]{\leftmark}

\fancyhead[R]{\thepage}

\fancyheadoffset[L]{0.42cm}

\fancyheadoffset[R]{-0.26cm}

\setlength{\headsep}{0.2cm}

\usepackage{listings}

\usepackage{color}

\definecolor{mygreen}{rgb}{0,0.6,0}

\definecolor{mygray}{rgb}{0.5,0.5,0.5}

\definecolor{myviolet}{rgb}{0.5,0,0.36}

\lstset{
backgroundcolor=\color{white},
language=C++,
keywordstyle=\color{myviolet},
commentstyle=\color{mygreen},
frame=single,
framerule=0.1pt,
rulecolor=\color{black},
breakatwhitespace=true,
breaklines=true,
numbers=left,
stepnumber=1,
numbersep=5pt,
numberstyle=\tiny\color{mygray},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
framexleftmargin=10pt,
framexrightmargin=-10pt,

}

\usepackage{amsmath}

\begin{document}

\selectlanguage{russian}

\newgeometry{twocolumn, left=0.7cm, right=0cm, top=0.8cm, bottom=0.4cm}

\begin{lstlisting}
/* bfdlink.h -- header file for BFD link routines
   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
   Free Software Foundation, Inc.
   Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.

   This file is part of BFD, the Binary File Descriptor library.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */

#ifndef BFDLINK_H
#define BFDLINK_H

/* Which symbols to strip during a link.  */
enum bfd_link_strip
{
  strip_none,       /* Don't strip any symbols.  */
  strip_debugger,   /* Strip debugging symbols.  */
  strip_some,       /* keep_hash is the list of symbols to keep.  */
  strip_all     /* Strip all symbols.  */
};

/* Which local symbols to discard during a link.  This is irrelevant
   if strip_all is used.  */
enum bfd_link_discard
{
  discard_sec_merge,    /* Discard local temporary symbols in SEC_MERGE
               sections.  */
  discard_none,     /* Don't discard any locals.  */
  discard_l,        /* Discard local temporary symbols.  */
  discard_all       /* Discard all locals.  */
};

/* Describes the type of hash table entry structure being used.
   Different hash table structure have different fields and so
   support different linking features.  */
enum bfd_link_hash_table_type
  {
    bfd_link_generic_hash_table,
    bfd_link_elf_hash_table
  };

/* These are the possible types of an entry in the BFD link hash
   table.  */

enum bfd_link_hash_type
{
  bfd_link_hash_new,        /* Symbol is new.  */
  bfd_link_hash_undefined,  /* Symbol seen before, but undefined.  */
  bfd_link_hash_undefweak,  /* Symbol is weak and undefined.  */
  bfd_link_hash_defined,    /* Symbol is defined.  */
  bfd_link_hash_defweak,    /* Symbol is weak and defined.  */
  bfd_link_hash_common,     /* Symbol is common.  */
  bfd_link_hash_indirect,   /* Symbol is an indirect link.  */
  bfd_link_hash_warning     /* Like indirect, but warn if referenced.  */
};

enum bfd_link_common_skip_ar_symbols
{
  bfd_link_common_skip_none,
  bfd_link_common_skip_text,
  bfd_link_common_skip_data,
  bfd_link_common_skip_all
};

struct bfd_link_hash_common_entry
  {
    unsigned int alignment_power;   /* Alignment.  */
    asection *section;      /* Symbol section.  */
  };

/* The linking routines use a hash table which uses this structure for
   its elements.  */

struct bfd_link_hash_entry
{
  /* Base hash table entry structure.  */
  struct bfd_hash_entry root;

  /* Type of this entry.  */
  ENUM_BITFIELD (bfd_link_hash_type) type : 8;

  unsigned int non_ir_ref : 1;

  /* A union of information depending upon the type.  */
  union
    {
      /* Nothing is kept for bfd_hash_new.  */
      /* bfd_link_hash_undefined, bfd_link_hash_undefweak.  */
      struct
    {
      /* Undefined and common symbols are kept in a linked list through
         this field.  This field is present in all of the union element
         so that we don't need to remove entries from the list when we
         change their type.  Removing entries would either require the
         list to be doubly linked, which would waste more memory, or
         require a traversal.  When an undefined or common symbol is
         created, it should be added to this list, the head of which is in
         the link hash table itself.  As symbols are defined, they need
         not be removed from the list; anything which reads the list must
         doublecheck the symbol type.

         Weak symbols are not kept on this list.

         Defined and defweak symbols use this field as a reference marker.
         If the field is not NULL, or this structure is the tail of the

\end{lstlisting}

\end{document}

编译命令行:

latex a.tex dvipdfm a.dvi

答案1

可能的原因:

Acrobat Reader/缩小至可打印区域

使用 Acrobat Reader 打印的选项有(命名可能有所不同):

  1. 没有任何
  2. 适合页面区域
  3. 缩小至可打印范围

默认值为 (3),即如果需要,页面会缩小以适合可打印区域。选项 (2) 也可以放大页面。您需要“无”以避免缩放。

纸张尺寸错误

某些 TeX 发行版可以配置默认纸张大小。但这不会改变标准类的默认设置。如果没有纸张大小选项,标准类将使用letterpaper。如果将边距设置为信纸大小,则 A4 纸上的边距不正确。

备注:LaTeX 和标准类不会告诉驱动程序正确的纸张大小。后者由诸如geometry、、 hyperrefsome pdftex.defgraphics/的驱动color程序)、… 等软件包完成。如果没有这样的软件包和纸张大小选项,结果可能是纸张大小为 A4(TeX 发行版/驱动程序默认)的 PDF 文档,但在 LaTeX 级别,页面布局(包括边距)配置为信纸大小。

更新:使用的类是extarticle,其默认是论文,因此a4paper需要选项:

\documentclass[a4paper,8pt]{extarticle}

相关内容