質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Visual Studio Code

Visual Studio Codeとは、Microsoft社が開発したマルチプラットフォーム対応のテキストエディタです。Visual Studioファミリーの一員でもあります。拡張性とカスタマイズ性が高く、テキストエディタでありながら、IDEと遜色ない機能を備えることができます。

LaTeX

LaTeXは、レスリー・ランポートが開発したテキストベースの文書整形システムです。 電子製版ソフトウェアである「TeX」にマクロパッケージを組み込む形で構成されており、 通常のTeXより扱いやすくなっているのが特徴です。

Q&A

解決済

1回答

1893閲覧

latex vscode ビルドしたい

mkn66

総合スコア41

Visual Studio Code

Visual Studio Codeとは、Microsoft社が開発したマルチプラットフォーム対応のテキストエディタです。Visual Studioファミリーの一員でもあります。拡張性とカスタマイズ性が高く、テキストエディタでありながら、IDEと遜色ない機能を備えることができます。

LaTeX

LaTeXは、レスリー・ランポートが開発したテキストベースの文書整形システムです。 電子製版ソフトウェアである「TeX」にマクロパッケージを組み込む形で構成されており、 通常のTeXより扱いやすくなっているのが特徴です。

0グッド

0クリップ

投稿2022/05/27 18:50

latexをvsocdeでビルドをしたいです
下記のサイト通りに環境構築をしました。
リンク

setting.jsonはリンクのページと同じです。

json

1{ 2 3 "latex-workshop.latex.outDir": "../out", 4 "latex-workshop.latex.autoClean.run": "onBuilt", 5 "latex-workshop.latex.autoBuild.run": "onSave", 6 7 8 "latex-workshop.view.pdf.viewer": "tab", 9 10 "latex-workshop.latex.recipes": [ 11 { 12 "name": "latexmk (lualatex)🧋", 13 "tools": [ 14 "lualatexmk" 15 ] 16 }, 17 { 18 "name": "latexmk 🔃", 19 "tools": [ 20 "latexmk" 21 ] 22 }, 23 { 24 "name": "latexmk (latexmkrc)", 25 "tools": [ 26 "latexmk_rconly" 27 ] 28 }, 29 { 30 "name": "pdflatex ➞ bibtex ➞ pdflatex × 2", 31 "tools": [ 32 "pdflatex", 33 "bibtex", 34 "pdflatex", 35 "pdflatex" 36 ] 37 }, 38 { 39 "name": "Compile Rnw files", 40 "tools": [ 41 "rnw2tex", 42 "latexmk" 43 ] 44 }, 45 { 46 "name": "Compile Jnw files", 47 "tools": [ 48 "jnw2tex", 49 "latexmk" 50 ] 51 }, 52 { 53 "name": "tectonic", 54 "tools": [ 55 "tectonic" 56 ] 57 } 58 ], 59 60 "latex-workshop.latex.tools": [ 61 { 62 "name": "lualatexmk", 63 "command": "latexmk", 64 "args": [ 65 "-synctex=1", 66 "-file-line-error", 67 "-interaction=nonstopmode", 68 "-lualatex", 69 "-outdir=%OUTDIR%", 70 "%DOC%" 71 ], 72 "env": {} 73 }, 74 { 75 "name": "latexmk", 76 "command": "latexmk", 77 "args": [ 78 "-synctex=1", 79 "-interaction=nonstopmode", 80 "-file-line-error", 81 "-pdf", 82 "-outdir=%OUTDIR%", 83 "%DOC%" 84 ], 85 "env": {} 86 }, 87 { 88 "name": "latexmk_rconly", 89 "command": "latexmk", 90 "args": [ 91 "%DOC%" 92 ], 93 "env": {} 94 }, 95 { 96 "name": "pdflatex", 97 "command": "pdflatex", 98 "args": [ 99 "-synctex=1", 100 "-interaction=nonstopmode", 101 "-file-line-error", 102 "%DOC%" 103 ], 104 "env": {} 105 }, 106 { 107 "name": "bibtex", 108 "command": "bibtex", 109 "args": [ 110 "%DOCFILE%" 111 ], 112 "env": {} 113 }, 114 { 115 "name": "rnw2tex", 116 "command": "Rscript", 117 "args": [ 118 "-e", 119 "knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')" 120 ], 121 "env": {} 122 }, 123 { 124 "name": "jnw2tex", 125 "command": "julia", 126 "args": [ 127 "-e", 128 "using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")" 129 ], 130 "env": {} 131 }, 132 { 133 "name": "jnw2texmintex", 134 "command": "julia", 135 "args": [ 136 "-e", 137 "using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")" 138 ], 139 "env": {} 140 }, 141 { 142 "name": "tectonic", 143 "command": "tectonic", 144 "args": [ 145 "--synctex", 146 "--keep-logs", 147 "%DOC%.tex" 148 ], 149 "env": {} 150 } 151 ] 152}

ソースコードをビルドすると下記のエラーが出ます。

Latexmk: Run number 1 of rule 'latex' This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/OSX WorkShop) (preloaded format=latex) restricted \write18 enabled. entering extended mode Latexmk: Summary of warnings from last run of *latex: Latex failed to resolve 2 reference(s) =====Latex reported missing or unavailable character(s). =====See log file for details. Collected error summary (may duplicate other messages): latex: Command for 'latex' gave return code 1 Refer to 'out/template.log' for details Latexmk: Use the -f option to force complete processing, unless error was exceeding maximum runs, or warnings treated as errors.

logファイルを見ろみたいな感じだと思ったのでlogファイルを下記に載せておきます。

This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/OSX WorkShop) (preloaded format=latex 2021.10.5) 28 MAY 2022 03:23 entering extended mode restricted \write18 enabled. %&-line parsing enabled. **/Users/username/latex/template.tex (/Users/username/latex/template.tex LaTeX2e <2020-10-01> patch level 4 L3 programming layer <2021-02-18> (/opt/osxws/share/texmf-dist/tex/latex/base/article.cls Document Class: article 2020/04/10 v1.4m Standard LaTeX document class (/opt/osxws/share/texmf-dist/tex/latex/base/size10.clo File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option) ) \c@part=\count179 \c@section=\count180 \c@subsection=\count181 \c@subsubsection=\count182 \c@paragraph=\count183 \c@subparagraph=\count184 \c@figure=\count185 \c@table=\count186 \abovecaptionskip=\skip47 \belowcaptionskip=\skip48 \bibindent=\dimen138 ) (/opt/osxws/share/texmf-dist/tex/latex/graphics/graphicx.sty Package: graphicx 2020/09/09 v1.2b Enhanced LaTeX Graphics (DPC,SPQR) (/opt/osxws/share/texmf-dist/tex/latex/graphics/keyval.sty Package: keyval 2014/10/28 v1.15 key=value parser (DPC) \KV@toks@=\toks15 ) (/opt/osxws/share/texmf-dist/tex/latex/graphics/graphics.sty Package: graphics 2020/08/30 v1.4c Standard LaTeX Graphics (DPC,SPQR) (/opt/osxws/share/texmf-dist/tex/latex/graphics/trig.sty Package: trig 2016/01/03 v1.10 sin cos tan (DPC) ) (/opt/osxws/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration ) Package graphics Info: Driver file: dvipdfmx.def on input line 105. (/opt/osxws/share/texmf-dist/tex/latex/graphics-def/dvipdfmx.def File: dvipdfmx.def 2021/03/18 v5.0j Graphics/color driver for dvipdfmx )) \Gin@req@height=\dimen139 \Gin@req@width=\dimen140 ) (/opt/osxws/share/texmf-dist/tex/latex/graphics/color.sty Package: color 2020/02/24 v1.2b Standard LaTeX Color (DPC) (/opt/osxws/share/texmf-dist/tex/latex/graphics-cfg/color.cfg File: color.cfg 2016/01/02 v1.6 sample color configuration ) Package color Info: Driver file: dvipdfmx.def on input line 147. (/opt/osxws/share/texmf-dist/tex/latex/graphics/dvipsnam.def File: dvipsnam.def 2016/06/17 v3.0m Driver-dependent file (DPC,SPQR) )) (/opt/osxws/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def File: l3backend-dvips.def 2021-03-18 L3 backend support: dvips \l__pdf_internal_box=\box47 \g__pdf_backend_object_int=\count187 \l__pdf_backend_content_box=\box48 \l__pdf_backend_model_box=\box49 \g__pdf_backend_annotation_int=\count188 \g__pdf_backend_link_int=\count189 \g__pdf_backend_link_sf_int=\count190 ) (out/template.aux) \openout1 = `template.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4. LaTeX Font Info: ... okay on input line 4. ! Package inputenc Error: Unicode character レ (U+30EC) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.8 \maketitle You may provide a definition with \DeclareUnicodeCharacter ! Package inputenc Error: Unicode character ポ (U+30DD) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.8 \maketitle You may provide a definition with \DeclareUnicodeCharacter //中略 [1 ] [2] (out/template.aux) LaTeX Warning: There were undefined references. LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) Here is how much of TeX's memory you used: 1055 strings out of 478995 15329 string characters out of 5861724 305001 words of memory out of 5000000 18575 multiletter control sequences out of 15000+600000 408165 words of font info for 43 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 68i,6n,74p,241b,262s stack positions out of 5000i,500n,10000p,200000b,80000s Output written on out/template.dvi (2 pages, 2056 bytes).

ビルドしようとしたコードは下記です。

latex

1\documentclass[a4paper]{article} 2\usepackage[dvipdfmx]{graphicx} 3\usepackage[dvipdfmx]{color} 4\begin{document} 5\title{レポート} 6\author{A} 7\date{\today} 8\maketitle 9\section{自分が選んだ力学の問題} 10原点から斜方放射された物体が空気抵抗を受ける運動を考える。 11\begin{equation} 12m\frac{dv_x}{dt} = -mkv_x 13 14m\frac{dv_y}{dt} = -mkv_y - mg 15\end{equation} 16ベクトル${\bf r}=(x,y)$で、2次元系について、各方向の運動方程式を解く。空気抵抗は速度に比例するとし、 17座標、力の部分を以下の様にする。簡単のため初速度$v_0= 15.0, \theta = 60, m = 2.0$とする 18\begin{verbatim} 19 20 do t=tini,tmax, dt 21 i=i+1 22 fx=-m*k*vx 23 fy=-m*g-m*k*vy 24 xx=v0x/k*(1-exp(-k*i)) 25 yy=-g/k*i+1/k*(v0y+g/k)*(1-exp(-k*i)) 26 \end{verbatim} 27 28\section{計算結果} 29\begin{figure} 30 \caption{k = 0.5のときの軌道} 31 \includegraphics[width=8cm]{bb.pdf} 32\label{fig1} 33\end{figure} 34\begin{figure} 35 \caption{k = 1.0のときの軌道} 36 \includegraphics[width=8cm]{aa.pdf} 37\label{fig2} 38 39\end{figure} 40 41k = 0.5とk = 1.0の軌道の計算結果を図{\ref{fig1}}と図{\ref{fig2}}に示した。 42\section{考察} 43空気抵抗が大きいほど飛距離、最高点が小さくなった。 44\section{まとめ} 45このレポートでは、空気抵抗を考慮した斜方投射の軌道についてシミュレーションをおこなった。 46空気抵抗が大きいほど飛距離、最高点が小さくなった。 47\end{document} 48

unicodeがおかしいのかな。
homebrewでインストールした mactex-no-gui じゃなくて別のlatexが使われているかも。
pcは
MacBook Pro Big Sur 11.6   M1 チップです。
よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

ログファイルに以下とあるため、LaTeX処理系にはpdfTeXが使用されていることがわかります。

log

1This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/OSX WorkShop) (preloaded format=latex 2021.10.5) 28 MAY 2022 03:23

pdfTeXでは簡単には日本語のLaTeX文書をコンパイルすることができません。一方でVSCodeの設定ファイルにはpdf(La)TeX用の設定があります。したがって、どこかで(LuaLaTeXではなく)pdf(La)TeXを実行コマンドの設定が呼び出されたのでしょう。

以下の記事の手順で、(「Recipe: latexmk (lualatex)🧋」ではなく)誤って「Recipe: pdflatex」を選択されたのではないかと予想します。

cmd+option+bを押下するか、TeXタブの「Build LaTeX project」から、「Recipe: latexmk (lualatex)🧋」を押下する。

投稿2022/05/29 10:59

gemmaro

総合スコア358

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

mkn66

2022/05/30 08:24

回答ありがとうございます。 助かりました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問