梅威瑟:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{libertine}
% custom centering
\newenvironment{mycenter}
{\parskip=1ex\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}
\usepackage{noindentafter}
\NoIndentAfterEnv{mycenter}
\makeatother
\begin{document}
Many years ago Rudyard Kipling gave an address at McGill University in Montreal. He said one striking thing which deserves to be remembered. Warning the students against an over-concern for money, or position, or glory, he said: "Some day you will meet a man who cares for none of these things. Then you will know how poor you are."
In theory there is not much difference between theory and practice. But in practice there is a huge difference.
\begin{mycenter} Hmmm \end{mycenter}
Speaking of statisticians, there is the story that a statistician once told a friend that he never travels by air, because he computed the probability that there be a bomb on the plane, and although the probability was low, it was too high for his comfort. Two weeks later, the friend met the statistician on a plane and asked him why he had changed his theory. The statistician replied: "I didn't change my theory. It's just that I subsequently computed the probability that there be two bombs on the plane, and this probability is low enough for my comfort. So now I simply carry my own bomb."
The single biggest problem in communication is the illusion that it has taken place.
\end{document}
为什么第二段也没有缩进?
答案1
\NoIndentAfterEnv
使用定义
\@ifnextchar\par{%
\def\par{%
\everypar{\setbox\z@\lastbox\everypar{}}%
\@restorepar%
}%
}
\par\noindent
并且您在环境定义中使用mycenter
。后面的第二段\noindent
将\par
执行。
解决方案是\noindent
从mycenter
定义中删除。
\documentclass{article}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{libertine}
% custom centering
\newenvironment{mycenter}
{\parskip=1ex\par\nopagebreak\centering}
{\par\ignorespacesafterend}
\usepackage{noindentafter}
\NoIndentAfterEnv{mycenter}
\makeatother
\begin{document}
Many years ago Rudyard Kipling gave an address at McGill University in Montreal. He said one striking thing which deserves to be remembered. Warning the students against an over-concern for money, or position, or glory, he said: "Some day you will meet a man who cares for none of these things. Then you will know how poor you are."
In theory there is not much difference between theory and practice. But in practice there is a huge difference.
\begin{mycenter} Hmmm \end{mycenter}
Speaking of statisticians, there is the story that a statistician once told a friend that he never travels by air, because he computed the probability that there be a bomb on the plane, and although the probability was low, it was too high for his comfort. Two weeks later, the friend met the statistician on a plane and asked him why he had changed his theory. The statistician replied: "I didn't change my theory. It's just that I subsequently computed the probability that there be two bombs on the plane, and this probability is low enough for my comfort. So now I simply carry my own bomb."
The single biggest problem in communication is the illusion that it has taken place.
\end{document}