latex-beamer 格闘中

やりたいこと

会社から提供されている ppt と同じフォーマットのものを latex-beamer で作成したい

やったこと

インストール
# apt-get install latex-beamer

evince/xpdf は使えない. adobe reader をインストール.

独自のテーマを作成.

準備

% cd /usr/share/texmf/tex/latex/beamer/themes
% cp */*default.sty $(DIR)
% 適当に rename
# シンボリックリンクはる ln -s XXX
% vi $(DIR)/*.sty  1行目のところも影響あるようなので適当に変更.
# mktexlsr (debian では update-texmf?)
% platex new.tex してエラーがでるところを除去

あとはテーマをいじる. タイトルページと, ヘッダフッタと.
\usetheme で指定するテーマは /usr/share/texmf/tex/latex/beamer/themes/theme にそれっぽいファイル名であるので元にしたいテーマがあるならそれを基本にしたほうがいいかも.


背景画像の変更. 変更したい frame の直前で以下を実行

  \setbeamertemplate{background}{\includegraphics[width=\paperwidth]{filename}}

できていないこと

  • ページの上揃え

いちおう、一番下に vspace で無意味な空白をいれてあげるとできる

  • ページの下揃え
  • タイトルなし block
  • 固定位置で画像を張り替えてパラパラ漫画
  • 一部だけ違うテーマを使う
  • table の cell 表示順序指定
  • beamercolorbox は使っていいのか?
  • columns/column
  • verbatim/verb を使用する場合の frame オプション
  • block の背景色の指定方法

memo

Debian 固有の rounded なバグ

rounded なテーマを使っているときに, block な感じのやつを使うとそれ以降の文字色が block の背景色になってしまうバグ.
意味がわからないので, 例を示すとたとえば CambridgeUS テーマ. beamerthemeCambridgeUS.sty の中をみると inner のテーマが rounded になっている.

\useinndertheme[shadow=true]{rounded}

こういう(example等のブロックが丸まっている)テーマを使用しているときに, block, alert, example, theorems 等の beamercolorbox に関連するものをよびだすと,

sentence 1
\begin{example}
 hoge hoge
\end{example}
sentence2

sentence2 以降の文字色が example の背景色になってしまう. というバグです.
以下のパッチでなおりますた.

In the file latex-beamer/base/beamerbaseboxes.sty apply the following path:

116c116
<   \setbox\bmb@colorbox=\hbox{\color{lower.bg}}%
    • -
> \setbox\bmb@colorbox=\hbox{{\pgfpicturetrue\pgfsetcolor{lower.bg}}}%
http://www.nabble.com/Bug-394792%3A-Updating-pgf-to-1.09-1-breaks-latex-beamer-blocks-td7242520.html#a7242520
> dpkg -l latex-beamer
ii  latex-beamer     3.06.dfsg.1-0.1  LaTeX class to produce presentations

無線LANの設定(WPA)

WEP はもう使ってはいけない時代になってしまったので WPA を使いましょうと.

# apt-get install wpasupplicant

# vi /etc/network/interface
allow-hotplug eth1
iface eth1 inet dhcp
wpa-ssid [SSID]
wpa-psk [PASS]
auto eth1

# ifup eth1 

一応 WEP の場合

# vi /etc/network/interface
iface eth1 inet dhcp
wireless-essid [SSID]
wireless-key [PASS]
auto eth1 

w3m をソースからインストール

テキストブラウザ w3m のインストール.

  • インストール先は $DIR
% tar xvzf w3m-0.5.2.tar.gz
% cd w3m-0.5.2
% ./configure --prefix=$DIR
...
checking gc.h presence... no
checking for gc.h... no
configure: error: gc.h not found

gc.h は Boehm GC のヘッダファイル.

w3m は, Boehm GC というライブラリを利用している.これは私が書いたものではないが,コンパイル時の便宜を考えて配布パッケージに含めている.なお,libwww は使っていない.

History of w3m

含めてあるそうだけどないと言われた.

インストールをするには,次のようにします.

  - GC library (6.1より新しいもの?)をインストールしておきます。
    GC library は
     http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/
    から入手できます。

    GC library 6.1を使っている場合は gc.h を PREFIX/include に
    インストールしておく必要があります。
         # cp gc-6.1/include/gc.h PREFIX/include

w3m-0.5.2/doc-jp/README

ということで, Boehm GC のインストール.

% tar xvzf gc.tar.gz
% cd gc6.7
% ./configure --prefix=$DIR
% make && make install

w3m の configure からもう一度

% cd w3m-0.5.2
% ./configure --prefix=$DIR --with-gc=$DIR
...
checking for long long... yes
checking size of long long... configure: error: cannot compute sizeof (long long), 77
See `config.log' for more details.
% setenv LD_LIBRARY_PATH $DIR/lib    (libgc が見つからないため実行時エラー)
% ./configure --prefix=$DIR --with-gc=$DIR -with-ssl=$DIR
% make && make install

Σ

Subversion をソースからインストール

root になれない状況でインストールしてみましたメモ.
以下の異常時の対処は configure の中身をのぞいてほげほげしてみました.

  • ... は省略していることをあらわしています.
  • すべて $DIR 配下にインストールするようにしました.
  • ドキュメントはちゃんと読みましょう :-)

まずは http://subversion.tigris.org/ からソースを入手.

% tar xzf subversion-1.5.2.tar.gz
% cd subversion-1.5.2
% ./configure --prefix=$DIR
...
checking for Apache module support via DSO through APXS... no
==================================================================
WARNING: skipping the build of mod_dav_svn
         --with-apxs or --with-apache must be used
==================================================================
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and supply the appropriate
 --with-apr option to 'configure'
...


% view INSTALL
...
  B. Dependency Overview
...
      * libapr and libapr-util (REQUIRED for client and server)
...
      * libneon or libserf  (OPTIONAL for client)
...
      * OpenSSL (OPTIONAL for client and server)
...
      * Berkeley DB (OPTIONAL for client and server)
...

http://apr.apache.org/ から apr/apr-util のソースを入手

% tar xvzf apr-1.3.3.tar.gz
% cd apr-1.3.3.tar.gz
% ./configure --prefix=$DIR
% make && make install

% tar xvzf apr-util-1.3.4.tar.gz
% cd apr-util-1.3.4/
% ./configure --prefix=$DIR --with-apr=$DIR
% make && make install 
...
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
...

環境変数 LD_LIBRARY_PATH に $DIR/lib を追加

% cd subversion-1.5.2
% ./configure --prefix=$DIR --with-apr=$DIR  --with-apr-util=$DIR
...
configure: WARNING: we have configured without BDB filesystem support


You don't seem to have Berkeley DB version 4.0.14 or newer
installed and linked to APR-UTIL.  We have created Makefiles which
will build without the Berkeley DB back-end; your repositories will
use FSFS as the default back-end.  You can find the latest version of
Berkeley DB here:
  http://www.oracle.com/technology/software/products/berkeley-db/index.html
...
% ls Makefile
Makefile

Makefile はできているようだけど, berkeley-db をいれることにする. berkeley-db を使わない場合はここで make すればいいと思われる. 上記 URL からソースを入手して

% tar xvzf db-4.7.25.tar.gz
% cd db-4.7.25
...
  @see docs/index.html
...
% cd build_unix
% ../dist/configure --prefix=$DIR
% make && make install


% cd subversion-1.5.2
% ./configure --prefix=$DIR  --with-apr=$DIR  --with-apr-util=$DIR --with-berkeley-db=$DIR
...
checking for socket in -lsocket... no
configure: error: APR-UTIL was installed independently, it won't be
                        possible to use the specified Berkeley DB: /XXXX

(apr-util のバージョンを調べにいって, berkeley-db を使わないモードなので?エラーになっている)
% $DIR/bin/apu-1-config --db-version
0   # berkeley-db 使わないモード
% cd apr-util-1.3.4/
% ./configure --prefix=$DIR --with-apr=$DIR --with-berkeley-db=$DIR
% make clean
% make && make install
% $DIR/bin/apu-1-config --db-version
4   # berkeley-db 使うモード

% cd subversion-1.5.2
% ./configure --prefix=$DIR  --with-apr=$DIR  --with-apr-util=$DIR --with-berkeley-db=$DIR
% make && make install

これでインストール完了. svnserve を立ち上げてクライアントから接続できるようになりました.

% mkdir $SVNDIR
% svnadmin create $SVNDIR
% vi $SVNDIR/conf/svnserve.conf
@@ -12,3 +12,3 @@
  # anon-access = read
 -# auth-access = write
 +auth-access = write
  ### The password-db option controls the location of the password
@@ -19,3 +19,3 @@
  ### Uncomment the line below to use the default password file.
 -# password-db = passwd
 +password-db = passwd
  ### The authz-db option controls the location of the authorization
% vi $SVNDIR/conf/passwd
[users]
mariyie = tako
% svnserver --listen-port 9876 -d

client % cd xxx
client % svn import --username mariyie svn://server:9876/$SVNDIR/ -m "initial import"
.... 

platex/xdvi de error

ある提供された style ファイルを利用した tex ファイルを入力として...

% platex a.tex
...
kpathsea: Running mktextfm jis
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input jis
This is METAFONT, Version 2.71828 (Web2C 7.5.4)

kpathsea: Running mktexmf jis
! I can't find file `jis'.
<*> \mode:=ljfour; mag:=1; nonstopmode; input jis

Please type another input file name
! Emergency stop.
<*> \mode:=ljfour; mag:=1; nonstopmode; input jis

Transcript written on mfput.log.
grep: jis.log: そのようなファイルやディレクトリはありません
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input jis' failed to make jis.tfm.
kpathsea: Appending font creation commands to missfont.log.

! Font JY1/jis/m/n/10=jis at 9.60999pt not loadable: Metric (TFM) file not found.
...

奥村先生の jsarticle.cls によるエラーらしいので, この変を追加する(この方法では不十分).

% wget http://oku.edu.mie-u.ac.jp/~okumura/texfaq/jis-tfm.zip
% wget http://oku.edu.mie-u.ac.jp/~okumura/texfaq/jis-pl.zip
% mkdir jis
% (cd jis; unzip ../jis-tfm.zip)
# mv /usr/share/texmf/fonts/tfm
% (cd jis; unzip ../jis-pl.zip)
# mv /usr/share/texmf/fonts/source
# mktexlsr

このファイルを xdvi で表示しようとすると以下のメッセージを出力してお亡くなりになります.

% xdvi a.dvi
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+519/600 --dpi 519 jis
mktexpk: don't know how to create bitmap font for jis.
kpathsea: Appending font creation commands to missfont.log.
xdvi: Error: Can't find font jis; using cmr10 instead. Expect ugly output.
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+230/600 --dpi 830 jis
mktexpk: don't know how to create bitmap font for jis.
xdvi: Error: Can't find font jis; using cmr10 instead. Expect ugly output.
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+396/600 --dpi 996 jis
mktexpk: don't know how to create bitmap font for jis.
xdvi: Error: Can't find font jis; using cmr10 instead. Expect ugly output.
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+461/600 --dpi 461 jis
mktexpk: don't know how to create bitmap font for jis.
xdvi: Error: Can't find font jis; using cmr10 instead. Expect ugly output.
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+577/600 --dpi 577 jis
mktexpk: don't know how to create bitmap font for jis.
xdvi: Can't find pixel font jis; using cmr10 instead at 577 dpi.
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
xdvi.bin 22.84.10 j1.33 (Xaw toolkit): events.c:4144: Shouldn't happen: Segmenta tion fault - trying to clean up and aborting ...
xdvi: xdvi.bin terminated abnormally: 6


xdvi に "jis" の在り処を教えてあげればいいのでしょうと以下のようにやってみたらきれいに表示できました.
update-texmf はやっていない..

引き続き必要なパッケージの追加。必要不可欠な奥村さんのクラスファイル(2005.03.19-1)もこれで使えます。

# apt-get install okumura-clsfiles vfdata-morisawa5

設定中に指示されたように、日本語で dvips などを使用する場合は、最後に root で

# jisftconfig add

とするのを忘れずに。

mktexlsrの代わりに、debianでは

# update-texmf

が使えます。

Linux/Debian の編集 - TeX Wiki


...

Debian GNU/Linux にも okumura-clsfiles として収録していただいており, Ringサーバのミラー にも置いてあります。

pLaTeX2e 新ドキュメントクラス

@[nn] なかんじの *.dll を gcc/cygwin でコンパイル その2

前回の続き. 今度は -mno-cygwin オプションをつけて, cygwin な dll が不要なモジュールを作成しましょう.

$ gcc -mno-cygwin test.c -L. -lAAA
d000007.o:(.text+0x0): multiple definition of `__onexit'
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o:crt1.c:(.text+0x2d0): first defined here
d000009.o:(.text+0x0): multiple definition of `_atexit'
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o:crt1.c:(.text+0x2c0): first defined here
collect2: ld returned 1 exit status
make: *** [test_simple] Error 1

ためしに -lAAA ではなくて AAA.dll をフルパス指定で gcc に与えてみるとエラーの内容が変わる.

$ gcc -mno-cygwin test.c /cygdrive/d/..../AAA.dll
test.o: test.c:(.text+0xbf): undefined reference to `_FFF@24`

今度は -lAAA ではなくて AAA.lib をフルパス指定で渡すとうまくいった.

$ gcc -mno-cygwin test.c /cygdrive/d/..../AAA.lib


ほかのソースをコンパイルしてみると今度は違うエラーが(-mno-cygwin がなければコンパイルは通る)

$ gcc -mno-cygwin test2.c -L. -lAAA
test2.o:test2.c:(.text+0x157): undefined reference to `__imp___iob'
test2.o:test2.c:(.text+0x191): undefined reference to `__imp___iob'
test2.o:test2.c:(.text+0x1cb): undefined reference to `__imp___iob'
test2.o:test2.c:(.text+0x205): undefined reference to `__imp___iob'
test2.o:test2.c:(.text+0x23f): undefined reference to `__imp___iob'
test2.o:test2.c:(.text+0x279): more undefined references to `__imp___iob' follow
collect2: ld returned 1 exit status

なんじゃらほい.