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

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

新規登録して質問してみよう
ただいま回答率
85.31%
LaTeX

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

TeX

フリーの組版システムで、字や図版などの要素を紙面に配置するという作業をコンピュータで行います

Q&A

解決済

1回答

2214閲覧

【TeX】英文におけるunderlineの使用時の改行

Ray_

総合スコア13

LaTeX

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

TeX

フリーの組版システムで、字や図版などの要素を紙面に配置するという作業をコンピュータで行います

0グッド

1クリップ

投稿2023/06/20 10:39

編集2023/06/20 10:48

実現したいこと

TeXにおいて複数行にわたる英文に下線を引きたいです。適当な場所で区切っても\underline環境下では右端がきちんとそろってくれないのでそこを解決出来たらうれしいです。

イメージとしては大学入試の英文和訳問題のようなものを想定しています。
(右端がきれいにそろうように単語間の距離が自動あるいは手動で調節できるようなもの)

前提

umoline, uline, udlineなどのパッケージは試したつもりでいるのですが、全て上手くいかずに困っています。

問題点

イメージ説明

画像のように、1行目と4行目、と2行目と3行目がそろっていないのがわかるかと思います。これより単語を増やせばさらにはみだし、そうでなければ不足してしまします。

必要な情報が不足していたら教えていただけると嬉しいです。よろしくお願いします。

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

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

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

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

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

guest

回答1

0

ベストアンサー

I searched by Google, and I found question “Why does underlined text not get wrapped once it hits the end of a line ?”.

The answer said, “Use the \ul command of the soul package instead”.

For example, I write the next source.

latex

1\documentclass[12pt, a5paper,dvipdfmx]{article} 2\usepackage{soul} 3 4\begin{document} 5 6Creates a slider widget which can take on the values in `vals' and accepts several ``handles''. 7Pass a vector to `value' with two values if you want to select a range. 8 9\ul{Use the orientation=``vertical'' keyword argument to create a vertical slider. 10By default the slider is top-to-botom and left-to-right, 11but this can be changed using the direction=``rtl'' keyword argument}. 12 13 14\end{document}

The result is next figure.

Result

Or, \usepackage[normalem]{ulem} and \uline{...}, too.
At the question, soul package was troubled with \cite{}, so ulem is better, maybe.

投稿2023/06/20 13:20

編集2023/06/20 13:43
ujimushi_sradjp

総合スコア2179

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

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

Ray_

2023/06/20 13:54

Thank you for your replying! I tried your suggestion as follows, but it does not seem to be doing well. ```tex \usepackage{soul} \begin{document} ${}_{\text{(a)}}\ul{\text{And 17 years later I did go to college}}$ \end{document} ``` and this is the error message for this code. ```markdown Undefined control sequence. l.63 ... of the quest for simplicity is ${}_{\text {(a)}}\ul{And 17 years la... ``` The documentation for the package `soul` says "Currently package soul-ori does not seem to be maintained. Nevertheless if there will be anew version that adds support for UTF8, then this package may become obsolete. " So, It is not support now, I think. Also, I tried the package: `ulem` by next code too. ```tex \documentclass[b5paper, 40pt]{jsarticle} \usepackage[normalem]{ulem} \begin{document} ${}_{\text{(a)}}\uline{\text{And 17 years later I did go to college}}$ \end{document} ``` And, the result was folloing. ```markdown Undefined control sequence. l.62 ... of the quest for simplicity is ${}_{\text {(a)}}\uline{And 17 years la... ``` If what I was doing was wrong, please teach me that. Thank you.
ujimushi_sradjp

2023/06/20 14:54 編集

英文用という質問なので,英語で答えるボケに突き合わせてしまってすみません。 数式中\textを使うなら\usepackage{amsmath}が抜けてますよ。 あと,エラーメッセージですが,エラーが発生したところに改行が入るので,それを参考にすると 勘違いが無くなると思います。 例示されているエラーメッセージだと,「\text⏎」と\textの後で改行されているので,本当のエラーはここです。
Ray_

2023/06/20 14:49

日本の方でしたか(笑) つたない英語をさらしてしまいました(笑) amsmathパッケージ忘れを修正して出力されたものが画像なのですが、やはりどうしても改行がされない状態が続いてしまいます...。 ```tex \documentclass[b5paper, 40pt]{jsarticle} \usepackage[margin=25mm]{geometry} % 下線 \usepackage[normalem]{ulem} \usepackage{amsmath} \begin{document} $\uline{\text{like ”We will steadily lose}}$ \end{document} ``` `log`には特にエラーなしです。
Ray_

2023/06/20 14:56

`soul`の方のログはこのように変化しました。 ```tex Incompatible list can't be unboxed. \SOUL@ulunderline ...hskip \dimen@ }}\unhcopy \z@ } l.70 ...y wander off to more inspiring endeavors.} ``` 囲んでる{}は問題ないことをul -> uline に変更することで確認しています。
Ray_

2023/06/20 14:57

と思ったら数式モードを解除したらできました!完璧ですありがとうございます!
ujimushi_sradjp

2023/06/20 15:20

元々数式$~$の中は何をやっても改行はされないと思います。 数式全体が一文字扱いなので,確かに行末はバラバラになるでしょうね。 いゃぁ。数式内に文字列入れてるって分かってたら絶対に無理だから最初から答えなかったのになぁと今思いました。 会社でWordの数式内に文章ばんばん入れてくるお偉いさんがいて,これどうやって処理しようかと困ったのも思い出しました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.31%

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

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

質問する

関連した質問