0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OverleafでLaTeXがタイムアウトする問題を解決した話:日本語文献管理と複雑なbiblatex設定

Posted at

はじめに

Overleafで日本語と英語の混在する学術論文を書いていたところ、コンパイルが2分でタイムアウトしてしまう問題に遭遇しました。エラーメッセージは「Empty bibliography」でしたが、実際の原因は複雑なbiblatex設定とフォント処理の組み合わせでした。

この記事では、問題の原因分析から解決までのプロセスを共有します。

問題の症状

  • Overleafでコンパイルが2分でタイムアウト
  • エラーメッセージ: Empty bibliography on input line 48
  • 日本語・英語混在の参考文献リスト
  • 複雑なbiblatex設定を使用

原因分析

1. 複雑すぎるbiblatex設定

\usepackage[backend=biber,
    style=authoryear-ibid,
    citestyle=authoryear-comp,
    maxcitenames=2,
    minnames=1,
    maxnames=999,
    uniquelist=false,
    sorting=none,
    defernumbers=true,
    labelnumber=true]{biblatex}

% 日本語/英語文献の自動分離
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=langid, match=\regexp{^(japanese|ja)$}, final]
      \step[fieldset=presort, fieldvalue=a]
    }
    \map{
      \step[fieldsource=langid, notmatch=\regexp{^(japanese|ja)$}, final]
      \step[fieldset=presort, fieldvalue=b]
    }
  }
}

この設定は:

  • 日本語文献と英語文献を自動で分離
  • カスタム引用スタイルの定義
  • 文献番号にプレフィックス(J/F)を付与

2. フォントパッケージの競合

\usepackage{xeCJK}
\usepackage{zxjatype}  % ← 問題の原因
\usepackage[japanese]{babel}
\usepackage{pxrubrica}

zxjatypexeCJKが競合し、処理時間が増大していました。

3. 処理時間の内訳

Overleafの2分制限内での処理:

時間 処理内容
0-45秒 パッケージ読み込み
45-60秒 フォント処理とキャッシュ構築
60-90秒 biblatex複雑設定の処理
90-120秒 biber実行と日本語ソート
120秒 タイムアウト

解決策

1. XeLaTeXへの変更

% Overleafのメニューから
% Compiler: XeLaTeX に変更

2. フォント設定のシンプル化

\usepackage{fontspec}
\usepackage{xeCJK}

% シンプルなフォント設定
\setCJKmainfont{Noto Serif CJK JP}
\setCJKsansfont{Noto Sans CJK JP}
\setCJKmonofont{Noto Sans Mono CJK JP}

3. ローカルフォントの配置

project/
├── main.tex
├── references.bib
└── fonts/
    ├── NotoSerifCJKjp-Regular.otf
    ├── NotoSansCJKjp-Regular.otf
    └── NotoSansMonoCJKjp-Regular.otf

4. csquotesパッケージの追加

\usepackage{csquotes}  % babel/biblatex互換性のため

5. 不要なパッケージの削除

% 削除したパッケージ
% \usepackage{zxjatype}
% \usepackage{pxrubrica}

完全な動作例

\documentclass[11pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{xeCJK}
\usepackage[english,japanese]{babel}
\usepackage{csquotes}

% フォント設定
\setCJKmainfont{Noto Serif CJK JP}
\setCJKsansfont{Noto Sans CJK JP}
\setCJKmonofont{Noto Sans Mono CJK JP}

% biblatex設定(複雑な設定はそのまま維持)
\usepackage[backend=biber,
    style=authoryear-ibid,
    citestyle=authoryear-comp,
    sorting=none]{biblatex}

\addbibresource{references.bib}

\begin{document}
% 本文
\printbibliography
\end{document}

デバッグのポイント

  1. エラーメッセージに惑わされない

    • "Empty bibliography"はタイムアウトの結果であることが多い
  2. 段階的な簡略化

    • 最小構成から始めて、徐々に機能を追加
  3. 処理時間の測定

    • ローカル環境で各パッケージの処理時間を確認
  4. フォントファイルの準備

    • システムフォントに依存せず、プロジェクトに含める

まとめ

Overleafのタイムアウト問題は、単一の原因ではなく複数の要因が重なって発生することが多いです。特に日本語処理と複雑な文献管理を組み合わせる場合は、以下の点に注意が必要です:

  • XeLaTeXの使用を検討
  • フォント設定はシンプルに
  • 必要最小限のパッケージ構成
  • ローカルフォントファイルの準備

この経験が同じ問題で困っている方の参考になれば幸いです。

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?