Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My question is already written on the title above.


EDIT 1:

I attempted to use \Centering and remove \arraybackslash in my original code below. It cannot be compiled.

\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}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

\Centering allows hyphenation, \centering not and it also can be used in tabular headings to centering the contents without using the \arraybackslash macro. Same for \RaggedRight and \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}
share|improve this answer
    
@Herbert, thanks for answering. I will stop using \centering from now on. –  xport Dec 24 '10 at 8:56
    
Just a note that the command is not a standard LaTeX or standard LaTex commna but is provided by the ragged2e package (ctan.org/tex-archive/macros/latex/contrib/ms/ragged2e.pdf) –  Yiannis Lazarides Dec 24 '10 at 9:00
    
@Yiannis Lazarides: Do not use URLs in that way. Use http://mirror.ctan.org/macros/... instead, without tex-archive and with mirror –  Herbert Dec 24 '10 at 9:07
    
@Herbert, see my edit 1 above. Removing \arraybackslash will result in compilation errors even though you use \Centering instead of \centering. –  xport Dec 24 '10 at 9:17
1  
ok, a misunderstanding. For this column you do not have any setting of \Centering et-al. The reason why you need it here –  Herbert Dec 24 '10 at 9:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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