[[TeXworks]] > 使い方

&color(White,#5F2F2F){  ''◆CONTENTS◆''  };&br;

#contents

*使い方 [#b6337083]

**タイプセット [#h5dac63f]

&ref(https://github.com/TeXworks/texworks/raw/master/res/images/runtool.png,around,nolink,タイプセット); (タイプセットのアイコン) をクリック,または Ctrl+T (Mac では ⌘T (Command+T)) を入力すると TeX ファイルがコンパイルされ,エラーがなければ PDF ファイルが表示されます.~
エラーが発生した場合は,間違っている箇所を修正して,もう一度タイプセットをしてください.~

***upLaTeX (ptex2pdf), pdfupLaTeX, pdfupLaTeX2, pLaTeX-ng, Latexmk-upLaTeX-pdfdvi, Latexmk-upLaTeX-pdfps, Latexmk-pLaTeX-ng の場合 [#sf7749bb]
----
&color(Black,#DAE0FE){%%% ファイル  編集  検索  フォーマット  タイプセット  スクリプト  ウィンドウ  ヘルプ                   %%%};&br;
//&ref(https://github.com/TeXworks/texworks/raw/master/res/images/TeXworks.png,around,nolink);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/runtool.png,around,nolink,タイプセット);
&color(Black,#EEEEEE){[upLaTeX (ptex2pdf) ▼]};
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-new.png,around,nolink,新規作成);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-open.png,around,nolink,開く);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-save.png,around,nolink,保存);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-undo.png,around,nolink,元に戻す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-redo.png,around,nolink,繰り返す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-cut.png,around,nolink,切り取り);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-copy.png,around,nolink,コピー);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-paste.png,around,nolink,貼り付け);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find.png,around,nolink,検索);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find-replace.png,around,nolink,置換);&br;
&br;
\documentclass[uplatex]{jsarticle}&br;
\begin{document}&br;
&br;
吾輩は猫である。名前はまだ無い。&br;
&br;
どこで生れたかとんと見当がつかぬ。&br;
何でも薄暗いじめじめした所で&br;
ニャーニャー泣いていた事だけは記憶している。&br;
吾輩はここで始めて人間というものを見た。&br;
&br;
\end{document}&br;
----
***pdfLaTeX, Latexmk-pdfLaTeX の場合 [#a69c4d4c]
----
&color(Black,#DAE0FE){%%% ファイル  編集  検索  フォーマット  タイプセット  スクリプト  ウィンドウ  ヘルプ                   %%%};&br;
//&ref(https://github.com/TeXworks/texworks/raw/master/res/images/TeXworks.png,around,nolink);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/runtool.png,around,nolink,タイプセット);
&color(Black,#EEEEEE){[pdfLaTeX       ▼]};
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-new.png,around,nolink,新規作成);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-open.png,around,nolink,開く);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-save.png,around,nolink,保存);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-undo.png,around,nolink,元に戻す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-redo.png,around,nolink,繰り返す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-cut.png,around,nolink,切り取り);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-copy.png,around,nolink,コピー);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-paste.png,around,nolink,貼り付け);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find.png,around,nolink,検索);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find-replace.png,around,nolink,置換);&br;
&br;
\documentclass[pdflatex,jadriver=standard]{bxjsarticle}&br;
\begin{document}&br;
&br;
吾輩は猫である。名前はまだ無い。&br;
&br;
どこで生れたかとんと見当がつかぬ。&br;
何でも薄暗いじめじめした所で&br;
ニャーニャー泣いていた事だけは記憶している。&br;
吾輩はここで始めて人間というものを見た。&br;
&br;
\end{document}&br;
----
***LuaLaTeX, LuaJITLaTeX, Latexmk-LuaLaTeX, Latexmk-LuaJITLaTeX の場合 [#accef197]
----
&color(Black,#DAE0FE){%%% ファイル  編集  検索  フォーマット  タイプセット  スクリプト  ウィンドウ  ヘルプ                   %%%};&br;
//&ref(https://github.com/TeXworks/texworks/raw/master/res/images/TeXworks.png,around,nolink);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/runtool.png,around,nolink,タイプセット);
&color(Black,#EEEEEE){[LuaLaTeX      ▼]};
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-new.png,around,nolink,新規作成);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-open.png,around,nolink,開く);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-save.png,around,nolink,保存);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-undo.png,around,nolink,元に戻す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-redo.png,around,nolink,繰り返す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-cut.png,around,nolink,切り取り);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-copy.png,around,nolink,コピー);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-paste.png,around,nolink,貼り付け);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find.png,around,nolink,検索);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find-replace.png,around,nolink,置換);&br;
&br;
\documentclass{ltjsarticle}&br;
\usepackage[ipaex]{luatexja-preset}&br;
\begin{document}&br;
&br;
吾輩は猫である。名前はまだ無い。&br;
&br;
どこで生れたかとんと見当がつかぬ。&br;
何でも薄暗いじめじめした所で&br;
ニャーニャー泣いていた事だけは記憶している。&br;
吾輩はここで始めて人間というものを見た。&br;
&br;
\end{document}&br;
----
***XeLaTeX, Latexmk-XeLaTeX の場合 [#f211a81a]
----
&color(Black,#DAE0FE){%%% ファイル  編集  検索  フォーマット  タイプセット  スクリプト  ウィンドウ  ヘルプ                   %%%};&br;
//&ref(https://github.com/TeXworks/texworks/raw/master/res/images/TeXworks.png,around,nolink);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/runtool.png,around,nolink,タイプセット);
&color(Black,#EEEEEE){[XeLaTeX       ▼]};
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-new.png,around,nolink,新規作成);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-open.png,around,nolink,開く);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/document-save.png,around,nolink,保存);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-undo.png,around,nolink,元に戻す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-redo.png,around,nolink,繰り返す);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-cut.png,around,nolink,切り取り);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-copy.png,around,nolink,コピー);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-paste.png,around,nolink,貼り付け);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find.png,around,nolink,検索);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find-replace.png,around,nolink,置換);&br;
&br;
\documentclass[xelatex,jadriver=standard]{bxjsarticle}&br;
\begin{document}&br;
&br;
吾輩は猫である。名前はまだ無い。&br;
&br;
どこで生れたかとんと見当がつかぬ。&br;
何でも薄暗いじめじめした所で&br;
ニャーニャー泣いていた事だけは記憶している。&br;
吾輩はここで始めて人間というものを見た。&br;
&br;
\end{document}&br;
----
***プレビュー [#h91f565b]
----
&color(Black,#DAE0FE){%%% ファイル  編集  検索  表示  タイプセット  スクリプト  ウィンドウ  ヘルプ                       %%%};&br;
//&ref(https://github.com/TeXworks/texworks/raw/master/res/images/TeXworks.png,around,nolink);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/runtool.png,around,nolink,タイプセット);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/go-first.png,around,nolink,最初のページ);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/go-previous.png,around,nolink,前のページ);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/go-next.png,around,nolink,次のページ);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/go-last.png,around,nolink,最後のページ);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/actualsize.png,around,nolink,実際のサイズ);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/fitwidth.png,around,nolink,ウィンドウ幅に合わせる);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/fitwindow.png,around,nolink,ウィンドウサイズに合わせる);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/zoom.png,around,nolink,拡大);
&ref(https://github.com/TeXworks/texworks/raw/master/res/images/hand.png,around,nolink,スクロール);
&ref(https://github.com/TeXworks/texworks/raw/master/res/tango/edit-find.png,around,nolink,検索);&br;
&br;
&br;
&br;
&br;
 吾輩は猫である。名前はまだ無い。&br;
 どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶&br;
している。吾輩はここで始めて人間というものを見た。&br;
&br;
&br;
&br;
&br;
----

**エラー箇所にジャンプ [#cfcb69f9]

エラーが発生した場合に e を入力して Enter キーを入力するとエラー箇所にジャンプします.~
OS X の TeXworks では,いまのところ,この機能はサポートされていません.~

**補完 [#a494cf9a]

-[[CodeCompletion:https://github.com/TeXworks/texworks/wiki/CodeCompletion]]
-[[TeXworksの補完機能の設定方法:http://makaroni.sakura.ne.jp/blog/?p=129]]

を参照してください.~

\ (バックスラッシュ) から始まるキーワードの一部を入力した後 Tab キーを入力するとキーワードの補完を行います.~
\alpha などは xa と入力した後 Tab キーを入力する方法で補完を行います.~
bite と入力した後 Tab キーを入力すると~

 \begin{itemize}
 \item
 
 \end{itemize}•

と補完されます.~
\end{itemize}• のように "•" (placeholder) が表示され,Ctrl+Tab (Mac では ⌥Tab (Option+Tab)) を入力すると "•" にジャンプします.~

-[[[texworks] Completion changes...:http://tug.org/pipermail/texworks/2008q4/000417.html]]

デフォルトの補完の仕方が気に入らない場合は TeXworks の completion フォルダの tw-latex.txt の~

 bite:=\begin{itemize}#RET#\item#RET##INS##RET#\end{itemize}•

を例えば~

 bite:=\begin{itemize}#RET#  \item #INS##RET#\end{itemize}•

に修正します.~

**forward and inverse search [#ded2619d]

forward search は エディタ上で Ctrl+左クリック または 右クリック → PDFの該当箇所へジャンプ~
inverse search は PDF ビューア上で Ctrl+左クリック または 右クリック → ソースの該当箇所へジャンプ~
[ウィンドウ]-[マウスフォーカスを追従する] を ON にするとエディタ上をクリックしたときに PDF ビューアを自動的に forward search します.~

**構文の色付け [#p53d7e6e]

[フォーマット]-[構文の色付け]-[LaTeX] を選択します.

**自動インデント [#f7198d43]

[フォーマット]-[自動インデント] から

-Whitespace only
-TeX Comments
-dtx prefixes

のうちのどれかを選択します.

**スペルチェック [#cb9bbbb2]

TeX Live でスペルチェックできない場合は [[TeXworks/設定#スペルチェックの辞書の設定>TeXworks/設定#vd0f0d24]] を参照してください.

[編集]-[スペルチェック]-[English - UnitedStates (en_US)] にチェックをするとスペルが間違っていると思われる単語の下に赤い点線が表示されます.~
日本語の文章を作成するときに赤い点線を表示したくない場合は [編集]-[スペルチェック]-[なし] を選択します.~

**分割ファイルでメインのファイルを指定 [#x9e02ec7]

[[Defining a root file:https://github.com/TeXworks/texworks/wiki/TipsAndTricks]] を参照してください.~
ファイルの先頭に~

 % !TEX root = main.tex

を記述すると main.tex をタイプセットの対象ファイルにしてくれます.~

**TeX エンジンの選択 [#ca3d17a8]

ファイルの先頭に

 % !TEX program = LuaLaTeX

を記述すると LuaLaTeX でタイプセットしてくれます.~

**指定したエンコーディングで再読み込み [#of3f4176]

TeXworks は指定したエンコーディングで再読み込みができます.~
TeXworks のエディタの画面の一番下にあるステータスバーのエンコーディングが表示されている部分をクリックするとエンコーディングのリストが表示されます.~
エンコーディングを指定して,一番上の 『選択した文字コードで再読み込みする』 をクリックすると指定したエンコーディングで再読み込みを行います.~

**目次・PDFの情報・フォントの表示 [#ldabe964]

TeXworks の PDF ビューアの [ウィンドウ]-[表示] から 目次・PDFの情報・フォント を表示することができます.~

**TeXworks を PDF ファイルプレビューアとして使用する [#s646d4ef]

TeXworks はコマンドラインで PDF ファイルを指定すると PDF ビューアが起動します.~

 texworks "hoge.pdf"

この機能を使うと PDF ファイルプレビューアとしても利用できます.~
ファイルの自動更新もしてくれます.~
SyncTeX を使用して forward search をすることも可能です.~
TeX ファイルの 30 行目に対応する PDF ファイルの該当するページにジャンプしたい場合は~

 synctex view -i "30:0:hoge.tex" -o "hoge.pdf" -x "texworks --position=%{page+1} '%{output}'"

のように実行します.~
--position= オプションで指定された値はコマンドラインオプションで TeX ファイルが指定された場合は行番号,PDF ファイルが指定された場合はページ番号になるようです.~