質問用フォーラムです。ご質問の前に質問のしかたをご覧ください。

正規表現で任意文字を残して置換したい

- ueki ichiro の投稿

Windows11の富士通ノートパソコンで texworksで論文を書いています。

古い論文のなかで \textbf{...} を使って太字で書いた数字を普通の数字に直すため、 ... で表した数字を残して ... の前後の \textbf{} を消去したいのです。

このため正規表現で検索文字を (textbf{[0-9]+}) 、置換文字を $1 としましたが失敗しました。正しい方法をご教示ください。また検索文字をを (\textbf{[0-9]+}) とすると検索もエラーになりました。\  を含む上のような文字列の検索法も教えて頂ければ幸いです。

  植木

表のセル内の単語間の空白の制御

- matushiro 97 の投稿

英語論文の表の中に文章があります.単語間の空白が広めになる所があり見た目が悪いです.
単語間の空白が半角サイズ,一つの単語が2行にまたがる場合は,単語を次行に送るか,または"-"で分割という処理はできないでしょうか.

\usepackage{animate}でエラーが出る

- gbb 60166 の投稿

ご無沙汰しています。gbb60166です。
以前コンパイルできていたファイルが、コンパイルできなくなったので質問です。

https://unilab.gbb60166.jp/prekou/tex/nageage.tex
を自宅のWindows7,TeXLive2024最新版のuplatexでコンパイルするとエラーが出ます。

しかし職場のWindows10,TeXLive2024少し古い版のuplatexでコンパイルするとコンパイルできてdvipdfmxでPDFに変換できました。しかし職場のTeXLive2024も最新版に更新するとコンパイルエラーが出るようになってしまいました。

2つのログを比較するとpdfbase.styとocgx2.styのバージョンが違います。pdfbase.sty 2022/08/04 v0.55だとコンパイルできるが、2024/09/02 v0.57だと! Missing number, treated as zero.エラーが出ます。

さらに調べると、nageage.tex だけの問題では無くて\usepackage{animate}を使った\begin{animateinline}を使用した他のファイルも全部エラーが出るようになっていました。

media9パッケージの変更が原因のような気がするのですが、どなたか確認していただけないでしょうか?(私ももう少し調べてみます。ソースコードを工夫することでエラーが出ないように出来るのでしょうか?)

schlmath.styで共通テストのような箱が作れない

- Yoshikawa Kaoru の投稿

初めて質問させていただきます。sclmath.sty を用いて、共通テスト(センター試験)のような解答欄を作成したいのですが、作成できずに困っております。

\documentclass[a4, 11pt]{jarticle}

\usepackage{amsmath,amssymb,ascmac,schlmath,emathPp,epic,eepic}

\usepackage[margin=10mm]{geometry}

\usepackage{layout}

\newcounter{kadainum}

\setcounter{kadainum}{0}

\newcommand{\kadai}{%

\refstepcounter{kadainum}%

\thekadainum

}

\newcounter{toi} \newcounter{subtoi}[toi]

\newcounter{subsubtoi}[subtoi]

\newcounter{test}

\setcounter{test}{0}

\newcommand{\test}[1][]{\refstepcounter{test}}

\def\toi{\refstepcounter{toi}

\makebox[2zw][r]{\fbox{\Large\arabic{toi}}\hspace{1zw}}\hangindent=1zw}

\def\subtoi{\refstepcounter{subtoi}

\def\subsubtoi{\refstepcounter{subsubtoi}}

%\def\test{\refstepcounter{test}}

\pagestyle{empty}

\def\LabelNo{\KANA\theLocalNumber}

\makebox[3.4zw][r]{(\arabic{subtoi})\hspace{1zw}}\hangindent=2.4zw}

\def\arraystretch{2.05}

\pagestyle{empty}

\textwidth=18cm

\textheight=25cm

\oddsidemargin=-1.2cm

\topmargin=-1.2cm

\everymath{\displaystyle}

\begin{document}

\lineskiplimit=2.0ex

\normallineskiplimit=\lineskiplimit

\lineskip=\lineskiplimit

\normallineskip=\lineskiplimit

{\LARGE 日々の演習 No.\thepage}

\hskip2zw\\

\hfill

\underline{\hskip1zw 3年 \hskip2zw 6組 \hskip4zw 番 \hskip1zw 氏名 \hskip30ex}

\ResetNo

\Toi $a = \frac{1 + \sqrt{3}}{1 + \sqrt{2}}$, $b = \frac{1 - \sqrt{3}}{1 - \sqrt{2}}$ とおく。

\SubToi $ab=\NO$

\end{document}

コンパイル結果

This is ptex2pdf[.lua] version 20200520.0.

Processing rnsyu.tex

This is e-upTeX, Version 3.141592653-p4.1.1-u1.30-230214-2.6 (utf8.sjis) (TeX Live 2024) (preloaded format=platex)

restricted \write18 enabled.

entering extended mode

(./rnsyu.tex

pLaTeX2e <2023-02-14>+1, based on

LaTeX2e <2023-11-01> patch level 1

L3 programming layer <2024-03-14>

(c:/texlive/2024/texmf-dist/tex/platex/base/jarticle.cls

Document Class: jarticle 2020/09/30 v1.8f Standard pLaTeX class

(c:/texlive/2024/texmf-dist/tex/platex/base/jsize11.clo))

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty

For additional information on amsmath, use the `?' option.

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty))

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty)

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty))

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty))

(c:/texlive/2024/texmf-dist/tex/latex/ascmac/ascmac.sty

(c:/texlive/2024/texmf-dist/tex/latex/ascmac/tascmac.sty))

(c:/texlive/2024/texmf-dist/tex/latex/schlmath/Schlmath.sty

UTF-8/高等学校数学用 pLaTeX2e 用マクロ集 Ver4.09.05 2018.01.13 金沢光則

) (c:/texlive/texmf-local/tex/platex/misc/emath/emathPp.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emathPh.sty

(c:/texlive/2024/texmf-dist/tex/latex/eepic/epic.sty

Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986

) (c:/texlive/2024/texmf-dist/tex/latex/eepic/eepic.sty

Extension to Epic and LaTeX. Version 1.1e - Released Dec 21, 1999

) (c:/texlive/2024/texmf-dist/tex/latex/eclarith/eclarith.sty

eclarith.sty 1.1 --- July 1, 1992

) (c:/texlive/texmf-local/tex/platex/misc/emath/emath.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emath2e.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emathE.sty

(c:/texlive/2024/texmf-dist/tex/latex/tools/enumerate.sty)

(c:/texlive/texmf-local/tex/platex/misc/emath/emathEc.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emathC.sty

(c:/texlive/2024/texmf-dist/tex/latex/tools/calc.sty)

(c:/texlive/2024/texmf-dist/tex/latex/base/ifthen.sty))

(c:/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))

(c:/texlive/texmf-local/tex/platex/misc/emath/jquote.sty)

(c:/texlive/texmf-local/tex/platex/misc/emath/emathK.sty))))

(c:/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty

(c:/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty

(c:/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty)

(c:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)

(c:/texlive/2024/texmf-dist/tex/latex/graphics-def/dvips.def)))

(c:/texlive/2024/texmf-dist/tex/latex/graphics/color.sty

(c:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg)

(c:/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def)

(c:/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx))))

(c:/texlive/2024/texmf-dist/tex/latex/geometry/geometry.sty

(c:/texlive/2024/texmf-dist/tex/generic/iftex/ifvtex.sty

(c:/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty)))

(c:/texlive/2024/texmf-dist/tex/latex/tools/layout.sty)

(c:/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)

LaTeX Warning: Unused global option(s):

[a4].

(./rnsyu.aux)

*geometry* driver: auto-detecting

*geometry* detected driver: dvips

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/umsa.fd)

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/umsb.fd)

! Missing number, treated as zero.

<to be read again>

=

l.49 \SubToi $ab=\NO$

?

様々なページを当たってみましたが、解決策がわかりません。どなたかご教示願えないでしょうか。

ヘッダーのみ文字化け

- M K の投稿

はじめまして。TeX LIVE 2024を使用しています。某サイトのサンプルとして使用されている下記のコードで、PDF化すると「先生と私」というヘッダーの文字だけが化けしてしまいます。日本語の場合のみ文字化けして、アルファベットの場合は文字化けしません。解決策をご存知の方はいらっしゃいますでしょうか。よろしくお願い致します。

\RequirePackage{plautopatch}
\documentclass[uplatex,
  tate, % 'yoko' で通常の横書き文書
  book,
  onecolumn, % 'twocolumn' で2段組
  paper=a6,  % 紙面サイズを指定
  twoside,
  openany,
  fontsize=9pt,       % 文字サイズ
  jafontsize=9pt,     % 和文字サイズ
  number_of_lines=14, % 行数
  line_length=35zh,   % 一行の文字数
  baselineskip=16pt,  % 行間
  hanging_punctuation,
]{jlreq}
%%% ルビ生成のためのパッケージ
\usepackage{pxrubrica}
%%% 背景色指定のパッケージ
\usepackage{color}
\definecolor{background}{cmyk}{0, 0, 0, 0} % 白
%%% ページの書式を指定
\ModifyPageStyle{plain}{%
running_head_position=top-left,
nombre_position=bottom-left,
odd_running_head={_chapter},
even_running_head={},
mark_format={_chapter={#1}}
}
\pagestyle{plain}
%%% 章・節の書式を指定
\ModifyHeading{chapter}{format={\large\sffamily #2},indent=2zw,lines=4}
\ModifyHeading{section}{format={\normalsize #2},indent=4zw,lines=2}
 
%%% ここから本文
\begin{document}
\pagecolor{background}
 
\chapter{先生と私}
\section{一}
 
\ruby[<>]{私}{わたくし}はその人を常に先生と呼んでいた。 % \ruby[<>] ルビを前後に進入
だからここでもただ先生と書くだけで本名は打ち明けない。
これは世間を\ruby{憚}{はば}かる遠慮というよりも、その方が私にとって自然だからである。
私はその人の記憶を呼び起すごとに、すぐ「先生」といいたくなる。
筆を\ruby{執}{と}っても心持は同じ事である。
よそよそしい\ruby[g]{頭文字}{かしらもじ} などはとても使う気にならない。
 
\end{document}

Excelで作成したグラフをpdfcropしたものを印刷すると線情報が無視される?

- M. I. の投稿

TeXそのものの質問ではないのですが、pdfcropについてご存じでしたらご教示いただけますと幸いです。

Excelで作成したグラフをExcelの標準機能でPDF化し、pdfcropで余白を削除したものをプリンタで印刷すると、グラフの線情報が無視される?現象が起きています。詳細は以下のとおりです。

Windows 11、Excel 2019で作成した折れ線グラフを、グラフのみ選択しExcelの標準機能でPDFとしてエクスポートしました。エクスポート時のオプションは以下のとおりです。

  • 最適化:標準
  • ページ範囲:すべて
  • 発行対象:選択したグラフ
  • 印刷対象外の情報を含める
    • ドキュメントのプロパティはチェック有りでグレーアウト
    • アクセシビリティ用のドキュメント構造タグはチェック無し
  • PDF/A準拠はチェック有り

pdfcropのバージョンは1.42で、オプションは付けず入力ファイル名のみを引数として実行しました。

Excelで生成したPDF、pdfcropで出力されたPDFそれぞれをAcrobat Readerで表示すると同じようなグラフに見えるのですが、プリンタで印刷すると前者は見た目どおり印刷され、後者は線情報が無視されたかのように印刷されます。

添付ファイルをご覧いただければ幸いです。
よろしくお願いいたします。

  • graph.pdf:Excelからエクスポートしたファイル
  • graph-crop.pdf:pdfcropで出力したファイル
  • graph_scan.pdf:graph.pdfを印刷し、スキャンしたもの
  • graph-crop_scan.pdf:graph-crop.pdfを印刷し、スキャンしたもの

漢文訓点用のマクロと前処理システムについて

- yasu oka の投稿
漢文訓点用のマクロと白文と書き下し文からそのマクロにはめ込む(白文に送り仮名を割り振って、返点を付与する)前処理システムを作ってみました。(一式、添付ファイルにつけてあります)
Windows用、macOS用のインターフェイスも作ってありますので、ご覧になって、ご感想などお聞かせねがえれば改良を進めていきたいと思います。

ところで、マクロはLuaLaTeXの使用を前提に作っているのですが、ヘッダーに
\usepackage{luatexja-fontspec}
\setmainjfont[
BoldFont = HaranoAjiGothic-Medium.otf
]{HanaMinA}
を入れて、花園明朝を使おうとすると、句読点があらぬ位置にはまってしまいます。(これは、A4縦の書式を選んで前処理をさせるとこのヘッダーが使われています)前処理システムが5桁ユニコード(utf-8で4バイト)の漢字が処理できるように作ってあるので、できれば花園明朝のようなフォントが使いたいのです。領域を指定して、
\usepackage{luatexja-fontspec}
\setmainjfont[AltFont={
{Range="20000-"2FFFF, Font=HanaMinB},
{Range="0080-"FFFF, Font=IPAexMincho},
}]{HanaMinA}
といったことをすれば、使えるのですが、処理に時間がかかってしまいます。良い知恵をお持ちの方がおられましたら、是非お教えください。

アップデートを元に戻す方法

- 山下 山下 の投稿

Windows 10 で TexLive 2024 を使っています。先ほど TLShell TeX Live Manager を起動してアップデート可能なものを全てアップデートしたところ,以下のエラーが出るようになりました。

(前略)
(c:/texlive/2024/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
(c:/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty

! LaTeX Error: Mismatched LaTeX support files detected.
(LaTeX)        Loading 'expl3.sty' aborted!
(LaTeX)        
(LaTeX)        The L3 programming layer in the LaTeX format
(LaTeX)        is dated 2024-07-20, but in your TeX tree the files require
(LaTeX)        at least 2024-08-16.

For immediate help type H <return>.
 ...                                              
                                                  
l.78      \ExplLoaderFileDate{expl3.sty}}
                                       %


直前には問題なかったため,アップデートが原因だろうと思われます。

そのためアップデート前の状態に戻したいのですが,例えば「2024年9月4日の状態に戻す」などの処理は可能なのでしょうか。

https://qiita.com/m20027/items/bb55ea93163456ecfca3

などを見ますと不具合のあるスタイルファイルを戻せばよいありますが,どれが不具合のあるファイルか分かりません。結局,

C:\texlive\2024\tlpkg\backups

の更新日時が新しいファイルを全て,1つずつ戻すしかないのでしょうか。

ご存じの方,ご教示いただければ幸いです。よろしくお願い致します。

山下

changebar.sty とLualatex

- nori mori の投稿

よろしくお願いします。

下記のファイルでエラーになります。

-------------------------- ここから

\documentclass{jlreq}

\usepackage{changebar}

\begin{document}

test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
\cbstart
change change change change change change change change change change change change change change 
\cbend
test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test

\end{document}

--------------------- ここまで

1行目が「\documentclass{jsarticle}」ならエラーは出ません。

emacs上のeshellで実行したときのエラーメッセージは以下のとおりです。

-------------------- ここから

~/tex-rensyu $ lualatex.exe changebar-lua.tex 

This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) 
 restricted system commands enabled.
(./changebar-lua.tex
LaTeX2e <2024-06-01> patch level 2
L3 programming layer <2024-05-27>
 (c:/texlive/2024/texmf-dist/tex/latex/jlreq/jlreq.cls
Document Class: jlreq 2024/02/16 jlreq

  --- 略 ---

No file changebar-lua.aux.
(c:/texlive/2024/texmf-dist/tex/latex/base/ts1cmr.fd)
! Undefined control sequence.
\cb@defpoint ...ount }}\let \the =\z@ \pdfsavepos 
                                                  \edef \cb@temp {\write \@a...

l.9 c
   hange change change change change change change change change change chan...

---------------------- ここまで

changebarのバージョンは以下のとおりです。

  [2024/07/17 v3.7e Indicate changes with marginal bars]

ネットでpdfsaveposとsaveposの情報を散見するのですが、私には少しむつかしいです。

解決策をお教えいただければ感謝です。

論文を英文化したときの問題

- matushiro 97 の投稿

日本語の論文を英訳したいのですがいくつか解決できない問題が発生しました.
ファイルのサイズは大きく種類も多いのですが,一部を抜粋したときに問題が再現されないかもしれないので元のファイルをそのままアップします.
使用しているツールはTexWorksでLukaTexを使用しています.
解決策をご教示いただければ幸いです.

日本語論文.tex→日本語論文です.
英語論文.tex→英語論文です

preamble.tex→日本語論文.texで使用するプリアンブル部分."日本語論文.tex"の先頭の\input命令で読み込む.
preamble_E.tex→英語論文.texで使用するプリアンブル部分."英語論文.tex"の先頭の\input命令で読み込む.
preamble.texとpreamble_E.texの違いは二点です.
a.\newtheorem命令の表示がpreamble.texは日本語で,preamble_E.texは英語
b.preamble.texの\documentclassは"ltjsarticle"だけだが,preamble_E.texでは"ltjsarticle"と"larticle"の2つあり,1つをコメントアウトして選べるようになっている.

問題点:
1.日本語論文.texはコンパイルできてPDFファイルを出力します.これは問題ありません.
2.英語語論文.texはpreamble_E.texで"ltjsarticle"を選ぶとコンパイルできてPDFファイルを出力しますが,"larticle"を選ぶとコンパイルできません."ltjsarticle"のままでは,「目次」「概要」など組み込み済みの見出しが日本語なので,"larticle"(または適切な英論文のテンプレート)に変える必要があります.preamble_E.texや英語語論文.texの何を修正すればよいのでしょうか.
3.英語語論文.texはpreamble_E.texで"ltjsarticle"を選びコンパイルできた時でも,目次の"Appendix1"と"Deviation"の文字が重なって表示される.ちなみに,日本語論文の目次では「付論1 3次元技術面と1次元価値面の導出」のように適切に表示される.

4.本文中の見出しに脚注を付ける場合がありますが,そうすると目次にもこの脚注が再現されます.目次の脚注を表示させない方法はありますでしょうか.日本語論文,英語論文に共通の問題です.tocファイルを修正する方法ですとコンパイルするたびに上書きされるので,できれば避けたいです.tocの修正以外の解決策がなければ,\inhibitglue \footnotes@ve {…}を削除すればいいと思うのですが,削除したあとにコンパイルすると修正が上書きされるので,どうすればいいかわかりません.

よろしくお願いします.

image.png

タグ: