pages'09 挿入した図表に通し番号

Pages'09を使って文章を作成しています。


そこで気になったのですが、Pagesには挿入した図や表に通し番号を振る機能はないのでしょうか?(MS Wordの図表番号のような・・)

また、もしないのであれば、画像に図題や番号を振るときにはテキストボックスを使って付けるのが一番手っ取り早いのでしょうか…


どなたかお願い致します。

MacBook Pro (13-inch Mid 2010), OS X Mountain Lion (10.8.2)

投稿日 2012/11/19 03:38

返信
返信: 10

2013/01/08 19:32 miiii28 への返信

度々、失礼致します。 AppleScriptで図と表のタイトルを番号順にすることは出来たのですが、表のタイトルは表示出来ない仕様になっているので、何らかの方法で文章の中に入れる必要がありますね。 図表のキャプションに特定のスタイルを指定して、それを基にテキストを編集するようなAppleScriptを作れるといいのですが、私にはまだ難しいです。


tell application "Pages"


set Nfigures to countcharts of document 1

set Ntables to counttables of document 1


repeat with i from 1 to Nfigures

set ChartName to "Figure-" & i

set name of chart i of document 1 to ChartName

end repeat


repeat with i from 1 to Ntables

set TableName to "Table-" & i

set name of table i of document 1 to TableName

end repeat


end tell

2013/01/08 21:56 T22T への返信

追記: 図表の順序を入れ替えても、正しくナンバリングできました。 表の数と同じ数のテキストボックスを用意して、それぞれ、表の上にキャプションとして配置することで表に番号を付けることが出来ましたよ。 上のAppleScriptの下側の表毎の繰り返しの部分を少し変更します(↓)。


repeat with i from 1 to Ntables

set TableName to "Table-" & i

-- set name of table i of document 1 to TableName

set object text of text box i of document 1 to TableName

end repeat

2013/01/12 23:23 miiii28 への返信

度々、失礼致します。 ワープロ書類の文章中に、図表番号を挿入するための特別の文字列(一単語)をあらかじめ記入しておき、それを図表番号に入れ替えるAppleScriptを作ってみました(下記)。 以下の例では、文章中の『FigureCaption』や『TableCaption』という単語を検索して、それを図表番号に置き換えています。 画像に番号をつける場合は、『ImageCaption』なとの単語を探して置き換えるコマンドを追加するだけです。 上記のAppleScriptよりもこちらの方が解りやすいですね。 (文章中の全ての単語を調べて置き換えるので、動作は遅いです)


tell document 1 of application "Pages"


set Nwords to count words of body text

set j to 1 as integer

set k to 1 as integer


repeat with i from 1 to Nwords

if word i = "FigureCaption" then

set word i to ("Figure-" & j)

set j to j + 1

else

if word i = "TableCaption" then

set word i to ("Table-" & k)

set k to k + 1

end if

end if

end repeat


end tell

2013/01/13 04:09 T22T への返信

追記: 日本語の文章では一文字がone wordとして認識されるので、上記のスクリプトは非常に遅くなります。(すみません、後から気付きました) 置き換え用に使用する文字列は英単語で記入しておくと正しく置換してくれます(非常に遅いですが)。

2013/01/13 05:47 T22T への返信

度々、失礼致します。 全単語検索の方法ではなく、パラグラフの最初の単語のみを調べて置換するAppleScriptを作ってみました(下記)。 日本語の文章でも英文でも素早く置換します。


tell document 1 of application "Pages"


set NParagraphs to countparagraphs

set j to 1 as integer

set k to 1 as integer


repeat with i from 1 to NParagraphs

repeat 1 times

tell paragraph i

try

if word 1 = "FigureCaption" then

set word 1 to ("Figure-" & j)

set j to j + 1

else

if word 1 = "TableCaption" then

set word 1 to ("Table-" & k)

set k to k + 1

end if

end if

on error

exit repeat

end try

end tell

end repeat

end repeat


end tell

2013/01/13 17:55 T22T への返信

追記: 図表番号を付けた後で、文章を再編集した場合、番号を付け直す必要もあるかと思います。 上記のAppleScriptを実行した後に、図表番号をもとの特殊な文字列(『FigureCaption』,『TableCaption』)に戻すAppleScriptを作ってみました(下記)。 実行の前に、図表のキャプションに対して専用のパラグラフスタイルを適用しておきます(この例では、それぞれのスタイル名が『Figure Caption』、『Table Caption』となります)。


tell document 1 of application "Pages"

set NParagraphs to countparagraphs

repeat with i from 1 to NParagraphs

repeat 1 times

tell paragraph i

try

if name of paragraph style of word 1 = "Figure Caption" then

set word 2 to ""

set character 7 to ""

set word 1 to "FigureCaption"

else

if name of paragraph style of word 1 = "Table Caption" then

set word 2 to ""

set character 6 to ""

set word 1 to "TableCaption"

end if

end if

on error

exit repeat

end try

end tell

end repeat

end repeat

end tell

このスレッドはシステム、またはAppleコミュニティチームによってロックされました。 問題解決の参考になる情報であれば、どの投稿にでも投票いただけます。またコミュニティで他の回答を検索することもできます。

pages'09 挿入した図表に通し番号

Apple サポートコミュニティへようこそ
Apple ユーザ同士でお使いの製品について助け合うフォーラムです。Apple Account を使ってご参加ください。