`\everypar` 정당화 진술은 어떻게 사용될 수 있습니까?

`\everypar` 정당화 진술은 어떻게 사용될 수 있습니까?

@David Purton에 댓글을 달았습니다.라텍스가 현명하지 않을 때 텍스트를 정당화하지 않도록 자동으로 강제하는 방법은 무엇입니까?

주제별 TeX에서(eijkhout.net/texbytopic/texbytopic.html) 단락의 줄이 너무 부족한 경우 바로 정렬되도록 하는 예가 있습니다. 섹션 5.9.6을 참조하세요. 아마도 이 방법이 적합하지 않을까요?

그 책에서 나는 다음 페이지를 발견했습니다.

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

이는 매크로를 참조합니다.

\newbox\linebox \newbox\snapbox
\def\eatlines{
\setbox\linebox\lastbox % check the last line
\ifvoid\linebox
\else % if it’s not empty
\unskip\unpenalty % take whatever is
{\eatlines} % above it;
% collapse the line
\setbox\snapbox\hbox{\unhcopy\linebox}
% depending on the difference
\ifdim\wd\snapbox<.90\wd\linebox
\box\snapbox % take the one or the other,
\else \box\linebox \fi
\fi}

그 안에는 텍스트로 채워지는 줄을 .98참조해야 하는 숫자 와 텍스트 맞춤 으로 인해 빈 간격이 있음을 알 수 있습니다 .98%2%LaTeX

현재 다음과 같이 사용할 수 있었습니다.

% proposal.tex
% Based on http://www.latextemplates.com/template/simple-sectioned-essay
\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage[brazil]{babel}

\usepackage{hyphsubst}
\usepackage{mathptmx}

\newbox\linebox \newbox\snapbox
\def\eatlines{
\setbox\linebox\lastbox % check the last line
\ifvoid\linebox
\else % if it’s not empty
\unskip\unpenalty % take whatever is
{\eatlines} % above it;
% collapse the line
\setbox\snapbox\hbox{\unhcopy\linebox}
% depending on the difference
\ifdim\wd\snapbox<.90\wd\linebox
\box\snapbox % take the one or the other,
\else \box\linebox \fi
\fi}

\begin{document}

\section{Riscos}

\indent
\vbox{

    In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
    and raggedright setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.

\par\eatlines}

\end{document}

게다가 본문에서 그는 에 대해 언급합니다 it can be inserted automatically with \everypar. 그런데 어떻게 자동으로 처리할 수 있는지 이해가 되지 않습니다 \everypar. 지금까지 나는 이것을 시도했습니다 :

\begin{document}

\section{Riscos}

\indent
\everypar{

    In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
    and raggedright setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.

}

\end{document}

그러나 이미지가 비어 있습니다. 이 진술은 어떻게 \everypar사용될 수 있습니까?

그 다음에는 각 단락을 다음과 같이 포함하는 대신 이 텍스트 자리맞추기 변환을 모든 텍스트에 적용하는 신뢰할 수 있고 간단한 방법이 있습니까 \everypar{ My paragraph 1 text } \n\n \everypar{ My paragraph 2 text }?


예를 들어, 다음과 같이 쓰는 대신:

\begin{document}

\section{Riscos}

\indent
\everypar{

    My paragraph 1, In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
}

\medskip
\indent
\everypar{

    My paragraph 2, and raggedright setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.
}

\end{document}

다음과 같이 좀 더 간단한 작업을 수행하십시오.

\begin{document}

\section{Riscos}

My paragraph 1, In typesetting advertisement copy, a way of justifying paragraphs has
become popular in recent years that is somewhere between flushright

\medskip
My paragraph 2, and raggedright setting. Lines that would stretch beyond certain limits
are set with their glue at natural width. This single paragraph is but an
example of this procedure; the macros are given next.

\end{document}

그리고 텍스트를 양쪽 정렬하는 것이 즐겁지 않은 줄에 제공되는 스마트 라텍스 텍스트 양쪽 정렬의 이점을 여전히 누리십니까?


업데이트

후에@바바라비튼\everyparcomment, and 문을 사용하면 자동으로 처리할 수 있다고 생각합니다 \par. 그런 다음 다음과 같이 쓰려고했습니다.

\begin{document}

\section{Riscos}

\everypar={\indent\vbox\{}
\par={\par\eatlines\}}

% \indent
% \vbox{

    In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
    and raggedright setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.

% \par\eatlines}

\end{document}

진술을 희망하며 \vbox{모든 \par\eatlines\}단락 시작/끝에 삽입됩니다. 그러나 라텍스는 오류를 발생시키기 때문에 그것을 받아들이지 않는 것 같습니다:

main2.tex:38: TeX capacity exceeded, sorry [input stack size=5000]. [    I]

main2.tex:33: Missing { inserted. [\par=]
main2.tex:33: Missing { inserted. [\par=]
main2.tex:33: Missing { inserted. [\par=]
main2.tex:33: Missing { inserted. [\par=]
main2.tex:33: Missing { inserted. [\par=]
...
Too many errors. TeX stopped.

답변1

의 첫 번째 문자가 다음 단락을 시작하므로 다음이 처리되므로 로컬 \everypar={}로 설정해야 합니다 . 새 항목이 열리고 새 항목이 처리됩니다. 끝없는 루프가 여기에 있습니다. 이로 인해 "TeX 용량" 오류가 발생합니다.\vbox\vbox\everypar\vbox\everypar

어쩌면 다음과 같은 것이 필요할 수도 있습니다:

\newbox\linebox \newbox\snapbox
\def\eatlines{
  \setbox\linebox\lastbox % check the last line
  \ifvoid\linebox
  \else % if it’s not empty
    \unskip\unpenalty % take whatever is
    {\eatlines} % above it;
    \setbox\snapbox\hbox{\unhcopy\linebox}
    \ifdim\wd\snapbox<.98\wd\linebox
       \box\snapbox % take the one or the other,
    \else \box\linebox \fi
  \fi}

\everypar={\setbox0=\lastbox \par 
   \vbox\bgroup \everypar={}\def\par{\endgraf\eatlines\egroup}}


    In typesetting advertisement copy, a way of justifying paragraphs has
    become popular in recent years that is somewhere between flushright
    and raggedright setting. Lines that would stretch beyond certain limits
    are set with their glue at natural width. This single paragraph is but an
    example of this procedure; the macros are given next.

    Second paragraph.

\bye

in \setbox0=\lastbox \par\everypar기본 수직 목록에서 빈 줄을 제거합니다( \lastbox들여쓰기 상자를 소비하고 \par빈 단락을 마무리합니다. 기본 수직 목록에는 아무것도 추가되지 않습니다). 다음 자료 는 위에서 설명한 이유로 인해 로컬에서 처리하기 위해 \everypar열리고 \vbox로컬로 재정의 됩니다.\par\eatlines\everypar={}

관련 정보