TeX Defining Environments (環境)
さて 仕上げとして 文字列の前の部分の 余白 ”the paragraph indentation” を ”\noindent”で 削除する 必要が有ります。
\documentclass[a5paper,12pt]{jarticle}
\newenvironment{exercise}
{\par\noindent\textbf{Exercise}\begin{itshape}\par\noindent}
{\end{itshape}}
\begin{document}
\begin{exercise}
This is a sample.
\end{exercise}
\end{document}
表示は
画像は適宜 切り取り 拡大縮小をしていますが
これを 見ただけでは 何の 変哲も無いものですが
余白の部分だけ 前に よっている ということです。勿論全体の レイアウト も 考慮 しないと いけないのですが、 この例題では そういうことが出来たと いう事です。
悪あがき の追従を 見てみましょう。
\documentclass[a5paper,12pt]{jarticle}
\newenvironment{exercise}% environment name
{\par\noindent\textbf{Exercise}\par\noindent\begin{textit}}% begin code
{\end{textit}}% end code
\begin{document}
\begin{exercise}
{This is a sample.}
\end{exercise}
\end{document}
画像単独では わからないので 比較したものを みてみると
何回も 記載しますが たまたま 上手く 表示されたということの 一例にしか 過ぎません。まあやり方として 色々考えられるという参考です。
にゃんたろう 拝!
2008年 8月 1日 (金) 21:01:12 JST 作成
TeX Defining Environments (環境)
Copyright © 2006.-2008. nyantarou All Rights Reserved.