Alfred5でhomebrew経由でインストールしたemacsを見つける方法
homebrew経由でemacs-macをインストールした場合に,alfred5でemacsを検索してもEmacs.appを見つけてくれなかったのですが,以下の方法で解決できました. 5年以上の前の情報であれば,ウェブ上で日本語のいろいろな情報が見つかるものの,そこに記載されていた解決策では解決できなかったのでメモしておきます. とりあえず,原文の英語をコピペしただけです・・・.
I found a way to let Alfred open aliases to applications (that is, .app directories). Funny, my use case was also to get Homebrew-installed Emacs to show up. As a result, these instructions are for Emacs, but they should generalize to any .app alias.
First, create a macOS alias, not a symlink: In Finder, press Cmd-Shift-g and use Tab auto-complete to enter the path of the directory containing Emacs.app (In my case, it is currently /opt/homebrew/Cellar/emacs-mac/emacs-27.2-mac-8.3) Press Cmd-n to open a new Finder window, then Cmd-Shift-a to go to /Applications Create an alias by Cmd-Option dragging Emacs.app from the homebrew window to the /Applications window.
Now, let's make Alfred include macOS aliases in search results: Open Alfred's preferences, navigate to General > Default Results, and under Extras: click Advanced. A popup window will open that allows you to add file types that will be shown in search results. Drag the Emacs.app alias from the Finder /Applications window to the popup window. The new entry should read com.apple.alias-file | alias Close the popup and try searching for emacs. The result list should include the Emacs.app alias.
情報の元は以下です.
[読書]不審者(伊岡瞬)
かなーり久々のblog更新になってしまいました・・・.
たまに小説を読んでいるのですが,どれを読んだか忘れてしまいがちなので(笑),記録を残しておこうかと思います.
市の図書館の新着本に置いてあったので,借りて読んでみました.
本の校閲をしているお母さんを中心とした家族の話ですが,最後の2,3章で話のどんでん返しがあります.
結構面白かったので,伊岡さんの他の小説も読んでみたいと思います.
PDFの文字数をカウントする方法
Terminal.appやiTerm2.app上で、次のコマンドを使うことで、PDFの文字数をカウントできる。
ps2ascii *****.pdf | wc -w
latexファイルのwordファイルへの変換
はじめに
僕は、論文を始めとする文書の作成はほとんどLaTeXで行っています*1。 しかし、英文校正をはじめとしwordファイルとして提出しなければならないことがたまにあります。 .texを.docxに変換する方法はいくつかありますが、いろいろ思考錯誤し、現状ではpandocを用いる方法に落ち着いています。
pandocとは
pandocは、いろいろなファイル形式間の変換をコマンドラインベースで行うものです。 pandocの公式サイトはこちらです。 公式サイトを見ますと、いろいろなファイル形式に対応していることがわかります。
インストールはMacの場合は、homebrewで行う方法が簡単だと思います*2。
brew install pandoc
pandocによる.texから.docxへの変換
pandoc hogehoge.tex -o hogehoge.docx
上記コマンドで、簡単にlatexファイルをwordファイルに変換できますが、引用文献がきちんと表示されません。
そこで、まず引用文献のスタイルファイルであるcslファイルを準備します*3。 自分でcslファイルを作ることも可能だとは思いますが、文献管理ソフトウェアzoteroのレポジトリからjournalを検索してダウンロードする方法が簡単です。 ちなみに僕は、Applied Mathematics Lettersのスタイルをよく使っています。
cslファイルを作業ディレクトリか、ホームディレクトリに保存したうえで、次のコマンドを実行することで引用文献リストも変換されます。
pandoc --bibliography mybibfile.bib --citeproc --csl applied-mathematics-letters.csl hogehoge.tex -o hogehoge.docx
wordファイルテンプレートreference.docxを事前に作成して、次のコマンドを実行することで、より細かいレイアウトを実現できまるようです。 僕はそこまではやっていません。
pandoc --bibliography mybibfile.bib --citeproc --csl applied-mathematics-letters.cs -t docx --reference-docx=reference.docx hogehoge.tex -o hogehoge.docx
この方法でおおむね僕の需要は満たしているのですが、唯一、数式の参照がうまくいっていません。 wordファイル上で数式の参照は、latexの参照キーがそのまま表示されてしまいます。 参照元の数式のナンバリングがpandocでは実現できないので、この点ができるようになれば、完璧です。
biblatexでの数学系スタイル
bibtexでは数学系のスタイルとしてamsrefsがありますが.biblatexでは似たようなスタイルは(僕が調べた限り)デフォルトではなさそうです. biblatexで数学系のスタイルを使いたい場合には,biblatex-mathを利用されてもらうのが簡単で良さそうです.*1
ダウンロードとインストール方法
git clone https://github.com/konn/biblatex-math cd biblatex-math cp -r tex/latex/* /usr/local/texlive/2020/texmf-dist/tex/latex/
利用方法
% プリアンブル(\begin{document}よりも前)に
\usepackage[backend=biber, bibstyle=math-numeric]{biblatex} %referenceのリストを[1], [2], ...としたい場合
\usepackage[backend=biber, bibstyle=math-alphabetic]{biblatex} %referenceのリストを著者名の一部としたい場合
\addbibresource{hogehoge.bib}
・・・
\begin{document}
・・・
%referenceを表示したいところに
\printbibliography[title=参考文献] % オプテョン[title=*****]で,referenceリストのtitleを*****に変更できる.
・・・
\end{document}
