인라인 수학을 여러 줄에 걸쳐 분할하지 않도록 라텍스에 더 열심히 노력하도록 요청

인라인 수학을 여러 줄에 걸쳐 분할하지 않도록 라텍스에 더 열심히 노력하도록 요청

나는 인라인 수학이 여러 줄에 걸쳐 나누어지는 것을 좋아하지 않습니다. 필요하다면 감수하겠지만, 차라리 그런 일이 일어나지 않았으면 좋겠습니다. 비록 이것이 언젠가 정당화가 조금 더 나쁘다는 것을 의미하더라도 말이죠. 나는 이것을 라텍스에게 전달하고 싶습니다.

그것이 단어라면 나는 \hyphenpenalty더 큰 것으로 설정할 것입니다. 그것이 수학에 적용될지 아닐지 잘 모르겠지만, 어쨌든 나는 그것을 단어로 바꾸고 싶지 않고 단지 수학으로만 바꾸고 싶습니다.

예:

\documentclass{article}
\begin{document}
    \begin{minipage}{3.8cm}
    Recall that the meaning of
    $P( w_j \mid w_i)$  is actually  that 
    $P(W_j{=}w_j \mid W_i {=} w_i)$.
    By not using softmax, with its normalising denominator this means that we expect that:
    $\sum_{\forall w_j \in V} P(w_j \mid w_i) \neq 1$ (except by coincidence).
    \end{minipage}
\end{document}

출력:

출력이 좋지 않음

별로 좋지 않습니다. 한 줄에 들어갈 수 있는 수학이 어떻게 두 줄로 나뉘는지 보시겠습니까?

수동으로 줄바꿈을 하면 더 좋습니다.

더 좋아졌지만 여전히 좋지는 않습니다.

(약간의 단어 변경으로 더 나은 방법도 가능하지만 이는 라텍스의 용량을 초과합니다 :-D)

답변1

분해하고 싶지 않은 것을 상자에 넣을 수 있습니다. 물론 이는 수동 개입이지만 상황에 따라 최선일 수 있습니다.

\documentclass{article}
\begin{document}
    \begin{minipage}{3.8cm}
    Recall that the meaning of
    \mbox{$P( w_j \mid w_i)$}  is actually  that 
    \mbox{$P(W_j{=}w_j \mid W_i {=} w_i)$}.
    By not using softmax, with its normalising denominator this means that we expect that:
    \mbox{$\sum_{\forall w_j \in V} P(w_j \mid w_i) \neq 1$} (except by coincidence).
    \end{minipage}
\end{document}

여기에 이미지 설명을 입력하세요

상자 안의 콘텐츠는 여백 제약에 따라 확장되거나 압축되지 않습니다. 따라서 \mbox첫 번째 수학 개체에서 가 제거되면 내부 수학 간격이 여백 제약 조건에 맞게 조정됩니다.

클립:

여기에 이미지 설명을 입력하세요

대안적으로\nobreak, 수학 중단을 수동으로 방지하기 위해 를 사용할 수도 있습니다. 여기에서는 두 번째 수학 요소 \nobreak뒤에 를 한 번만 추가하면 \mid모든 것이 해결됩니다....현재로서는. 하지만 여기 저기에 다른 단어를 추가하면 다시 개입해야 합니다.

\documentclass{article}
\begin{document}
    \begin{minipage}{3.8cm}
    Recall that the meaning of
    $P( w_j \mid w_i)$  is actually  that 
    $P(W_j{=}w_j \mid\nobreak W_i {=} w_i)$.
    By not using softmax, with its normalising denominator this means that we expect that:
    $\sum_{\forall w_j \in V} P(w_j \mid w_i) \neq 1$ (except by coincidence).
    \end{minipage}
\end{document}

여기에 이미지 설명을 입력하세요

답변2

수학 모드에서 자동 줄 바꿈은 매개변수 \relpenalty및 에 의해 제어됩니다 \binoppenalty. 중단은 관계 기호나 이진 연산 기호 뒤 또는 사용자가 명시적으로 삽입한 페널티에서만 가능합니다.

설정을 통해 자동 줄 바꿈을 완전히 금지할 수 있습니다(어쩌면 그룹에 로컬로).

\relpenalty=10000
\binoppenalty=10000

나중에 적절한 선택적 인수와 함께 \linebreak실행 가능한 줄 바꿈을 지정할 수 있습니다.\nolinebreak

10000보다 작은 값을 설정하면 줄 바꿈이 덜 바람직해집니다. 기본값은 각각 500과 700입니다.

답변3

여기에 이미지 설명을 입력하세요

\documentclass{article}

\begin{document}
    \begin{minipage}{3.8cm}%\RaggedRight
    Recall that the meaning of
    $P( w_j{\mid}w_i)$ is actually that
    \mbox{$P(W_j{=}w_j{\mid}W_i{=}w_i)$}.
    By not using softmax, with its normalising denominator this means that we expect that:
    \mbox{$\sum_{\forall w_j \in V} P(w_j{\mid}w_i) \neq 1$} (except by coincidence).
    \end{minipage}
\end{document}

좁은 환경에서 정당한 환경을 사용하면 보기에 좋지 않은 솔루션으로 이어질 수 있습니다. RaggedRightfrom 패키지 사용이 raged2e허용되는지 확인하십시오.

\documentclass{article}
\usepackage{ragged2e}
\begin{document}
    \begin{minipage}{3.8cm}\RaggedRight
    Recall that the meaning of
    $P( w_j{\mid}w_i)$ is actually that
    \mbox{$P(W_j{=}w_j{\mid}W_i{=}w_i)$}.
    By not using softmax, with its normalising denominator this means that we expect that:
    \mbox{$\sum_{\forall w_j \in V} P(w_j{\mid}w_i) \neq 1$} (except by coincidence).
    \end{minipage}
\end{document}

여기에 이미지 설명을 입력하세요

답변4

내가 생각할 수 있는 가장 쉬운 해결책 \raggedrightminipage. 좁은 열에서 자료를 완전히 정당화하려고 하면 다소 크고 매력적이지 않은 단어 간 간격이 발생할 가능성이 높습니다. \raggedright하이픈 넣기와 인라인 수학 자료 내부의 줄 바꿈도 억제하는 를 호출하여 정렬을 포기하는 것이 가장 좋습니다 .

여기에 이미지 설명을 입력하세요

\documentclass{article}
\begin{document}
\begin{minipage}{3.8cm}
    \raggedright
    Recall that the meaning of
    $P(w_j \mid w_i)$  is actually  that 
    $P(W_j=w_j \mid W_i = w_i)$.
    By not using softmax, with its normalising denominator 
    this means that we expect that:
    $\sum_{\forall w_j \in V} P(w_j \mid w_i) \neq 1$ 
    (except by coincidence).
\end{minipage}
\end{document}

관련 정보