我的问题已经写在上面的标题上了。
编辑1:
我尝试在下面的原始代码中使用\Centering
和删除\arraybackslash
。无法编译。
\documentclass[dvips,dvipsnames,rgb]{book}
\usepackage[a4paper,margin=10mm,showframe]{geometry}
\usepackage{longtable}
\usepackage{array}
\usepackage{calc}
\usepackage{ragged2e}
\usepackage{lscape}
\newcounter{No}
\renewcommand{\theNo}{\stepcounter{No}\arabic{No}}
\newenvironment{MyTable}[4]%
{%
\newcolumntype{A}[1]%
{%
>{%
\begin{minipage}%
{%
##1\linewidth-2\tabcolsep-2\arrayrulewidth%
}%
\vspace{\tabcolsep}%
}%
c%
<{\vspace{\tabcolsep}\end{minipage}}%
}%
\setcounter{No}{0}%comment out this if you want to continuous numbering for all tables.
\begin{longtable}%
{%
|>{\scriptsize\Centering\theNo}A{#1}<{}%
|>{}A{#2}<{\Centering\input{\jobname.tmp}}%
|>{\Centering\lstinputlisting{\jobname.tmp}}A{#3}<{}%
|>{\scriptsize\arraybackslash}A{#4}<{}%Please try to remove \arraybackslash here.
|%
}%
\hline\ignorespaces%
}%
{%
\end{longtable}%
}
\newcommand{\Comment}[1]{& & & #1\\\hline}
\usepackage{listings}
\lstset{%
language={PSTricks},
basicstyle=\ttfamily\scriptsize,%
keywordstyle=\color{blue}%,
%backgroundcolor=\color{yellow!30}%
}
\usepackage{fancyvrb}
\def\MyRow{%
\VerbatimEnvironment%
\begin{VerbatimOut}{\jobname.tmp}%
}
\def\endMyRow{%
\end{VerbatimOut}%
}
\usepackage{pstricks,pst-node}
\newpsstyle{gridstyle}{%
gridwidth=0.4pt,%default: 0.8pt
gridcolor=Red!20,%default: black
griddots=0,%default: 0
%
gridlabels=3pt,%default: 10pt
gridlabelcolor=Blue,%default: black
%
subgriddiv=5,%default: 5
subgridwidth=0.2pt,%default: 0.4pt
subgridcolor=Green!20,%default: gray
subgriddots=0%default: 0
}
\usepackage{lipsum}
\begin{document}
\chapter{Introduction to PSTricks}
\lipsum[1]
\section{At a glance galleries}
\lipsum[1-5]
%Landscape starts here.
\pagestyle{empty}
%\begin{landscape}
\begin{MyTable}{0.05}{.25}{0.4}{0.3}%
%=============
\begin{MyRow}
\pspicture*[showgrid](4,4)
\pnode(1,1){A}
\pnode(3,3){B}
\ncline{A}{B}
\endpspicture
\end{MyRow}
\Comment{\lipsum[1]}
%=============
\begin{MyRow}
\begin{pspicture}[showgrid](4,3)
\psframe*[linecolor=red!30](3,2)
\end{pspicture}
\end{MyRow}
\Comment{\lipsum[2]}
%=============
\begin{MyRow}
\pspicture[showgrid](4,3)
\psframe*[linecolor=green!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[3]}
%=============
\begin{MyRow}
\pspicture[showgrid](4,3)
\psframe*[linecolor=yellow!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[4]}
%=============
\begin{MyRow}
\pspicture[showgrid](4,3)
\psframe*[linecolor=Maroon!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[5]}
%=============
\end{MyTable}
%Landscape stops here.
%\end{landscape}
\pagestyle{plain}
\section{Node}
\lipsum[1-5]
\end{document}
答案1
\Centering
允许连字符,\centering
而不是,它也可以用于表格标题中,以使内容居中,而无需使用宏\arraybackslash
。\RaggedRight
和也一样\RaggedLeft
\documentclass[a5paper,english]{article}
\usepackage{babel}
\usepackage[originalcommands]{ragged2e}
\begin{document}
\centering this spaceframeconstruction spaceframe this spaceframeconstruction
this spaceframeconstruction this spaceframeconstruction this spaceframeconstruction
\Centering this spaceframeconstruction spaceframe this spaceframeconstruction
this spaceframeconstruction this spaceframeconstruction this spaceframeconstruction
\end{document}