備忘録

Perl, PHP, XML, C#, PostgreSQL, ....

texで図を複数貼る

2006年07月23日 04時29分40秒 | diary
minipageを使う。

\begin{figure}[t]
\begin{minipage}{1.0\hsize}
\begin{center}
\resizebox{6cm}{4cm}{\includegraphics{errorRoute.eps}}
% \epsfig{file=sysGaiyo.eps, width=1.0\hsize}
%\vspace{2mm}
\caption{Presentation of travel routes}
% \caption{経路生成の平均精度}
\label{fig:errorRoute}
\end{center}
\end{minipage}
\vspace{5mm}
%\end{figure}
%\begin{figure}[t]
\begin{minipage}{1.0\hsize}
\begin{center}
\resizebox{9cm}{6cm}{\includegraphics{imageMap.eps}}
% \epsfig{file=sysGaiyo.eps, width=1.0\hsize}
%\vspace{2mm}
\caption{Estimation of images' geographic locations}
% \caption{経路生成の平均精度}
\label{fig:imageMap}
\end{center}
\end{minipage}
\end{figure}


http://hooktail.org/computer/index.php?%BF%DE%A4%CE%C1%DE%C6%FE#content_1_5

以下、抜粋。

2つの図を並べる †

figure 環境の中に 2つの minipage 環境をつくり,画像を \includegraphics で張ります.

\begin{figure}[htbp]
\begin{minipage}{0.5\hsize}
\begin{center}
\includegraphics[width=70mm]{fig1.eps}
\end{center}
\caption{一つめの図}
\label{fig:one}
\end{minipage}
\begin{minipage}{0.5\hsize}
\begin{center}
\includegraphics[width=70mm]{fig2.eps}
\end{center}
\caption{二つめの図}
\label{fig:two}
\end{minipage}
\end{figure}

perlの正規表現のオプション

2006年07月20日 04時17分14秒 | it
繰り返しマッチさせたいときは、gを使う。他には、狭くマッチさせるために、?など。

タグを除く例:
$content =~ s/\'//g;
$content =~ s/\"//g;
$content =~ s/<.*?>//gi;

以下、
http://www.rfs.jp/sb/perl/02/09.html
を参考

g オプション-繰り返してマッチ

 繰り返してマッチを行います。
カッコを含んだ検索パターン

 カッコを含んだパターンの場合、マッチした全パターンに含まれる全ての部分文字列をリストにして返します。たとえば、変数 $_ から VARIABLE=VALUE という対を全て取り出してハッシュに代入することができます。

%hash = /(\b\w+)=(\S*)/g;
配列でgオプションを指定

 配列に g オプションを指定すると、マッチしたもの全てをリストにして返します。

push( @list, /\w+/g );
whileループの条件部に使う

while ( /\w+/g ){ push( @words, $& ) }