# how to put ">" before lines?

For answering the peer reviewers of a venue, one way is creating a TeX file in which you quote the reviews by putting a ">" before the lines and, then, answering your edits in simple lines.

Putting the ">" symbols at the beginning of each line, manually, is not that easy and, moreover, the lines will not be aligned, because you should go to the first of the next line, manually.

Is there any automatic way to put ">" symbols at the beginning of the entire lines of a paragraph?

• You are obviously talking about an editor, but not mentioning its name. Any decent editor with regex can substitute the beggining of a line with that character s/^/>/ EDIT: Wait, scientific-workplace is the editor? Jun 6, 2015 at 17:38
• @Johannes_B I am not sure if my question is about an editor because I expected a latex package solution or something like that. However, my editor is TeXstudio. Jun 6, 2015 at 17:40
• You want to have those symbols in front of lines in the output pdf? Jun 6, 2015 at 17:41
• At the beginning of each line. Jun 6, 2015 at 17:43
• @Mico I was not aware of such software. One of the synonyms of workplace is structure by which I suppose that this tag is for scientific structures. Jun 6, 2015 at 17:55

\documentclass{article}
\setlength\parindent{0pt}
\setlength\parskip{\baselineskip}

\newenvironment{q}
{\bigskip
\hspace*{1em}\begin{minipage}[b]{\dimexpr\textwidth-1em}}
{\par
\count0=\prevgraf
\count2=\prevgraf
\vskip-\baselineskip
\loop
\llap{\textgreater\space}\par
\vskip-2\baselineskip
\ifnum\count0>0
\repeat
\kern\count2\baselineskip\mbox{}%
\end{minipage}}

\begin{document}

\begin{q}One two three four \def\z{Red blue elephant giraffe green yellow monkey dog cat purple}
\z. \z\ \z. Five six seven \z.
\end{q}
Some comment on the quoted text

\end{document}

• May I ask the reason for including it in a minipage? Jun 6, 2015 at 22:39
• @MyUserIsThis a page break in the quoted paragraph would be bad, the > would all be on the second page, going up into the page head, so simplest thing is to use a minipage to avoid the problem Jun 6, 2015 at 23:02
• I tried that solution here: \begin{q} \input{foo.txt} \end{q}, but didn't respect the break lines of the input text. Nov 21, 2016 at 11:50

ConTeXt users can use the delimitedtext environment which is used for quotations and blockquotes. With the nextleft you can set a symbol which is shown at the left margin of each line.

\definedelimitedtext
[location=paragraph,
%    indenting=no,
left={> },
nextleft={> }]

\setupindenting[yes,big]

\starttext

\input ward

\input ward\par
\input ward

\input ward

\stoptext


A limitation of this method is that you to disable the indentation of the paragraphs because the symbol in the first line will be placed at the wrong position.

Even though one can fix this for the first line when you never have more than one paragraph there is a better solution with the help of the linenumbering mechanism. The counter for the line numbers can be hidden with the conversion=empty setting.

\definelinenumbering
[conversion=empty,
location=text,
margin=\widthofstring{> },
left={> }]

\setupindenting[yes,big]

\starttext

\input ward

\input ward\par
\input ward
\stoplinenumbering

\input ward

\stoptext


The following solution also works across pages, but it still requires a bit of luck:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\makeatletter

\par
\dimen@ \prevdepth
\setbox\z@ \vbox\bgroup
\prevdepth \dimen@
\sbox\z@{\textgreater\ }%
\leftskip \wd\z@ \relax
% A legal breakpoint must exist between any two lines of a paragraph:
\ifnum\interlinepenalty<\@M\else
\interlinepenalty 9999
\fi
\ifnum\clubpenalty<\@M\else
\clubpenalty 9999
\fi
\ifnum\widowpenalty<\@M\else
\widowpenalty 9999
\fi
% Also ensure that e-TeX extensions are not used (standard LaTeX does not
% use them):
\interlinepenalties \z@
\clubpenalties \z@
\widowpenalties \z@
}{%
\par
\egroup % finish \vbox
\splitmaxdepth \maxdepth % to be safe
\splittopskip \z@skip
\vfuzz \maxdimen % suppress overfull \vbox warnings
\loop
\setbox\tw@ \vsplit\z@ to\z@
\unvbox\tw@
\setbox\tw@ \lastbox
\nointerlineskip
\ifhbox\tw@
\hbox{\rlap{\textgreater\ }\box\tw@}
\else \ifvbox\tw@ % this should never happen...
\box\tw@ % ... but if it does, simply reinsert the box
\fi\fi
\unless\ifvoid\z@
\repeat
}

\makeatother

\tracingpages = 1 % You can check in the log file that the club line at the end
% of page 1 has been assessed at the usual penalty.

\begin{document}
\lipsum[1]
Text with some descenders: fgjpqy.

• @SeanAllred: I just mean that the solution is not perfect: for one thing, it doesn’t fully preserve the settings for the interline penalties (although it works in standard situations). Also, if a box is followed by a mark, a whatsit, or something like this, \lastbox will not be able to remove it.