I'm trying to use Latex for a purpose it's probably not quite designed for and unsurprisingly having some difficulty. I'm attempting to include text from a series of emails, and then I want to write a summary that refers to line numbers within the emails, drawing attention to certain portions of a conversation.
For line numbering, I've found the lineno package works well and allows me to set up my reference targets with \linelabel{label1} macros, which can then be referenced with \ref{label1}.
However, as email chains in text format have many characters that need escaped such as > characters, I've been looking for a package that will allow me to treat the text as preformatted text while also still parsing the \linelabel Latex macro.
I've tried the verbatim environment and the lstlisting environment, but both appear to ignore the \linelabel macro. Is anyone aware of a package that does what I'm looking for?
Thanks in advance!
Edit: Added MWE. Runs in overleaf. Demonstrates that with lineno package I can successfully get line numbers to be output and they can be referenced when labels are defined in email content, but there are many characters that would need to be escaped. Also shows putting the email content within a lstlisting block, which formats the email more nicely but loses the linelabel macro parsing. Looking for a happy medium.
\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}
\usepackage{listings}
\lstset{basicstyle=\footnotesize,stringstyle=\footnotesize,language=,}
\usepackage{lineno}
\begin{document}
\section{Summary}
Refer to line \ref{label1}. And then he did it again on line \ref{label2}.
\newpage
\linenumbers
\section{Emails with no formatting}
Email response number 2
On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:
> Hi Umptyscrunch,
>
> I'm letting you know that I did that thing.
>
> Thanks,
> Marklar
>
Hi Marklar,
\linelabel{label1} Yeahhh. I'm going to need you to come in this Saturday.
Thanks,
Umptyscrunch
---------- Forwarded message ---------
No rush, it's all good my friend. It's a minimal working example.
\section{Emails with listing formatting}
\begin{lstlisting}
Email response number 2
On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:
> Hi Umptyscrunch,
>
> I'm letting you know that I did that thing.
>
> Thanks,
> Marklar
>
Hi Marklar,
\linelabel{label2} Yeahhh. I'm going to need you to come in this Saturday.
Thanks,
Umptyscrunch
---------- Forwarded message ---------
No rush, it's all good my friend. It's a minimal working example.
\end{lstlisting}
\end{document}
I would use the listings package. It can show line numbers, reference specific lines and you can even colour replies:
\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}
\usepackage{listings}
\lstset{
basicstyle=\footnotesize\ttfamily,
stringstyle=\footnotesize,
escapeinside={&}{&},
numbers=left,
morecomment=[l][\color{blue!80}]{> },
morecomment=[l][\color{red!80}]{>> },
}
\begin{document}
\section{Summary}
Refer to line \ref{label2}.
\begin{lstlisting}
Email response number 2
On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:
> Hi Umptyscrunch,
>
> I'm letting you know that I did that thing.
>
>> previous reply
>
> Thanks,
> Marklar
>
Hi Marklar,
&\label{label2}&Yeahhh. I'm going to need you to come in this Saturday.
Thanks,
Umptyscrunch
---------- Forwarded message ---------
No rush, it's all good my friend. It's a minimal working example.
\end{lstlisting}
\end{document}
(replace the & for the escape char with any letter or letter sequence that won't occur in your emails)
Here's something I'm moderately happy with. Although I don't want to have to insert the newline \\ characters at the end of each line. I'd rather it be like the verbatim package which treats newlines in the input as line breaks in the output. Switching to courier font resolves problems with the > characters showing up as ? in the output.
\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}
\renewenvironment{email}{\fontfamily{pcr}\selectfont\begin{footnotesize}}{\end{footnotesize}\par}
\renewcommand{\L}{\linelabel}
\usepackage{lineno}
\begin{document}
\section{Summary}
Refer to line \ref{label1}. And then he did it again on line \ref{label2}.
\newpage
\linenumbers
\section{Emails with no formatting}
\begin{email}
Email response number 2\\
\\
On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:\\
\\
> Hi Umptyscrunch,\\
>\\
> I'm letting you know that I did that thing.\\
>\\
> Thanks,\\
> Marklar\\
>
\\
Hi Marklar,
\\
\L{label1}Yeahhh. I'm going to need you to come in this Saturday. This line is so long it should wrap. I believe you have my stapler. \\
\\
Thanks,\\
Umptyscrunch
---------- Forwarded message ---------
No rush, it's all good my friend. \linelabel{label2}It's a minimal working example.
\end{email}
\end{document}
Related
Hey I am getting the following error
Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `\' on input line 86.
I've tried the following
\subsection{University of North Carolina \\ at Chapel Hill}
\subsection{{University of North Carolina} {\\} {at Chapel Hill}}
this is a warning and not an error message
manually putting formatting instructions in macros like \subsection is bad style. If you want your subsections to appear in a certain way, you should redefine their appearance instead.
using \\ for line breaks is also bad. You shouldn't use it outside of tabular and similar environments.
if you really must use it, provide an alternative string which hyperref can use to create the pdf bookmarks
\documentclass{book}
\usepackage{hyperref}
\begin{document}
\subsection{\texorpdfstring{University of North Carolina \\ at Chapel Hill}{University of North Carolina at Chapel Hill}}
\end{document}
The text is too long and will random break my first word over the entire first line...I don't know how to make it look like the other with short text. This is my code:
\documentclass[letterpaper,11pt]{article}
\usepackage{simplecv}
\begin{document}
\vspace{1em}
\entrybig
{\textbf{LexBox}}{Nov 2020 - Present}
LexBox represents the fastest and the most efficient way to make a contravention complaint without to get in touch with a lawyer.
\\\textbf{Technologies:} C\#, ASP.NET, jQuery AJAX, CSS \& HTML
\entrybig
{\textbf{GAM - Group Activity Manager}}{Oct 2020 - Present}
{This application is designed to remote control multiple desktops at the same time. \\
\textbf{Technologies:} C\#, .NET Framework}
\end{document}
and the .sty file is this
and the result is
this
Three major problems:
you must not use \entrybig on its own, it need to be inside a list, e.g. \outerlist{}
The syntax you use for \entrybig is wrong. This macro takes 4 mandatory arguments, not 2, not 3, exactly 4
as this macro gets inserted into table cells, you must not abuse \\ for line breaks
\documentclass[letterpaper,11pt]{article}
% Choose bibliography style for formatting list of publications
\usepackage[style=ieee,url=false,doi=false,maxbibnames=99,sorting=ydnt,dashed=false]{biblatex}
\bibliography{papers}
% Choose theme, e.g. black, RedViolet, ForestGreen, MidnightBlue
\def\theme{MidnightBlue}
\usepackage{simplecv}
\begin{document}
See more of my projects on \website{https://github.com/Mihutzen}
\vspace{1em}
\outerlist{
\entrybig
{\textbf{ETH Zurich}}
{Zurich, CH}
{M.S. in Computer Science, GPA: 5.63/6.00}
{2018\textendash 2020}
}
\end{document}
I have searched but nothing useless, only "use \newline" or "use \".
I'm creating a simple latex document to store any texts instead of using .txt, and the problem is that the pdf document contains the lines going towards right until they go out of the paper.
I'm using this simple code
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlabore etdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillum doloreeufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Since latex sees it as a one word, it refuses to break it since it doenst know its hyphenation. But I would like to allow latex to break it regardless. Any thoughts ?
Remarks: I already have used:
\hspace{0pt}
\leavevmode\nobreak\hspace{0pt}
\mbox{Loremip...larorum.}
Nothing worked.
I think I got why nothing worked. See my code below, that I managed to compile successfully after editing your MWE.
You basically have two ways to force hyphenation here.
As in the comment by SamCarter, you manually split words within text, just using \- where necessary. I did it below in line 18 (6 from bottom).
You add to your preamble the command \hyphenation{word-to-split}: I did this below to hyphenate the word in line 20 (4 from bottom). Notice that, in this case, you use - instead of \- within the braces {} enclosing the argument.
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\hyphenation{Duisauteiruredolorinre-prehenderitinvoluptatevelitesse-cillum doloreeufugiatnullapariatur}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet, consecteturadipiscingelit,
seddoeiusmodtemporincididuntutlaboreetdoloremagna.
Uten\-imadminimveniam,
quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.
Excepteursintoccaecatcupidatatnonproident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Finally, if the full stop character . is not followed by a space, two separate words may be interpreted as one and the command \hyphenation may not work as expected. Not sure that this was the detail making you write that nothing worked, but be careful to this too.
I'm trying to write a paper based on VLDB .cls and .tex files, it can be reached from here.It uses ACM SIG Proceedings Style.After fixing many errors, now i don't get any errors, However when i save my file as pdf or ps,i can not see the author names.
The title and abstract are shown just not the code between these is not shown.
i'm using lyx on Ubuntu.
Here is the code for the authors.
% ****************** TITLE ****************************************
\title{A Sample {\ttlit VLDB} Proceedings Paper in LaTeX
Format\titlenote{for use with vldb.cls}}
\subtitle{[Extended Abstract]
\titlenote{A full version of this paper is available as\textit{Author's Guide to Preparing ACM SIG Proceedings Using \LaTeX$2_\epsilon$\ and BibTeX} at \texttt{www.acm.org/eaddress.htm}}}
% ****************** AUTHORS **************************************
% You need the command \numberofauthors to handle the 'placement
% and alignment' of the authors beneath the title.
%
% For aesthetic reasons, we recommend 'three authors at a time'
% i.e. three 'name/affiliation blocks' be placed beneath the title.
%
% NOTE: You are NOT restricted in how many 'rows' of
% "name/affiliations" may appear. We just ask that you restrict
% the number of 'columns' to three.
%
% Because of the available 'opening page real-estate'
% we ask you to refrain from putting more than six authors
% (two rows with three columns) beneath the article title.
% More than six makes the first-page appear very cluttered indeed.
%
% Use the \alignauthor commands to handle the names
% and affiliations for an 'aesthetic maximum' of six authors.
% Add names, affiliations, addresses for
% the seventh etc. author(s) as the argument for the
% \additionalauthors command.
% These 'additional authors' will be output/set for you
% without further effort on your part as the last section in
% the body of your article BEFORE References or any Appendices.
\numberofauthors{8} % in this sample file, there are a *total*
% of EIGHT authors. SIX appear on the 'first-page' (for formatting
% reasons) and the remaining two appear in the \additionalauthors section.
\author{
% You can go ahead and credit any number of authors here,
% e.g. one 'row of three' or two rows (consisting of one row of three
% and a second row of one, two or three).
%
% The command \alignauthor (no curly braces needed) should
% precede each author name, affiliation/snail-mail address and
% e-mail address. Additionally, tag each line of
% affiliation/address with \affaddr, and tag the
% e-mail address with \email.
%
% 1st. author
\alignauthor
Ben Trovato\titlenote{Dr.~Trovato insisted his name be first.}\\
\affaddr{Institute for Clarity in Documentation}\\
\affaddr{1932 Wallamaloo Lane}\\
\affaddr{Wallamaloo, New Zealand}\\
\email{trovato#corporation.com}
% 2nd. author
\alignauthor
G.K.M. Tobin\titlenote{The secretary disavows
any knowledge of this author's actions.}\\
\affaddr{Institute for Clarity in Documentation}\\
\affaddr{P.O. Box 1212}\\
\affaddr{Dublin, Ohio 43017-6221}\\
\email{webmaster#marysville-ohio.com}
% 3rd. author
\alignauthor Lars Th{\Large{\sf{\o}}}rv{$\ddot{\mbox{a}}$}ld\titlenote{This author is the
one who did all the really hard work.}\\
\affaddr{The Th{\large{\sf{\o}}}rv{$\ddot{\mbox{a}}$}ld Group}\\
\affaddr{1 Th{\large{\sf{\o}}}rv{$\ddot{\mbox{a}}$}ld Circle}\\
\affaddr{Hekla, Iceland}\\
\email{larst#affiliation.org}
\and % use '\and' if you need 'another row' of author names
% 4th. author
\alignauthor Lawrence P. Leipuner\\
\affaddr{Brookhaven Laboratories}\\
\affaddr{Brookhaven National Lab}\\
\affaddr{P.O. Box 5000}\\
\email{lleipuner#researchlabs.org}
% 5th. author
\alignauthor Sean Fogarty\\
\affaddr{NASA Ames Research Center}\\
\affaddr{Moffett Field}\\
\affaddr{California 94035}\\
\email{fogartys#amesres.org}
% 6th. author
\alignauthor Charles Palmer\\
\affaddr{Palmer Research Laboratories}\\
\affaddr{8600 Datapoint Drive}\\
\affaddr{San Antonio, Texas 78229}\\
\email{cpalmer#prl.com}
}
% There's nothing stopping you putting the seventh, eighth, etc.
% author on the opening page (as the 'third row') but we ask,
% for aesthetic reasons that you place these 'additional authors'
% in the \additional authors block, viz.
\additionalauthors{Additional authors: John Smith (The Th{\o}rv\"{a}ld Group,
email: {\texttt{jsmith#affiliation.org}}) and Julius P.~Kumquat
(The Kumquat Consortium, email: {\texttt{jpkumquat#consortium.net}}).}
\date{30 July 1999}
% Just remember to make sure that the TOTAL number of authors
% is the number that will appear on the first page PLUS the
% number that will appear in the \additionalauthors section.
\maketitle
i also tried another author format and still author names not shown.
% ****************** TITLE ****************************************
\title{Alternate {\ttlit ACM} SIG Proceedings Paper in LaTeX
Format\titlenote{(Produces...}}
\numberofauthors{3}
% Three authors sharing the same affiliation.
\author{
\alignauthor Ben King\\
\email{king#cs.berkeley.edu}
%
\alignauthor Georgia Tobin\\
\email{tobin#cs.berkeley.edu}
%
\alignauthor Gerald Murray\\
\email{murrray#cs.berkeley.edu}
%
\sharedaffiliation
\affaddr{Department of Electrical Engineering and Computer Science } \\
\affaddr{University of California, Berkeley } \\
\affaddr{Berkeley, CA 94720-1776 }
}
%
\maketitle
also when i checked the title i see that:
Error in latexParagraphs: You should not mix title layouts with normal ones.
however i see my the document as dvi,ps or pdf
i'm not sure what causes the problem?
EDIT
WHILE converting from .lyx to pdf or dvi i still don't see the authors however, by using shell commands everthing is fine.
i think this is a problem of lyx,
i spend 8 hours to solve it, seriously i set up windows 7 lyx and tried there, still same.
thanks lyx:) You are good when you are working properly.
The vldb.cls class from the link you mention does not define a command called \sharedaffiliation. Commenting out that code allows the file to compile and also see the author names:
\documentclass{vldb}
\title{Alternate {\ttlit ACM} SIG Proceedings Paper in LaTeX
Format\titlenote{(Produces...}}
\numberofauthors{3}
\author{
\alignauthor Ben King\\
\email{king#cs.berkeley.edu}
\alignauthor Georgia Tobin\\
\email{tobin#cs.berkeley.edu}
\alignauthor Gerald Murray\\
\email{murrray#cs.berkeley.edu}
% \sharedaffiliation
\affaddr{Department of Electrical Engineering and Computer Science } \\
\affaddr{University of California, Berkeley } \\
\affaddr{Berkeley, CA 94720-1776 }
}
\begin{document}
\maketitle
\end{document}
The address is ugly this way, though. It is up to the journal to define how to display author addresses with a single affiliation. Unfortunately, the sample file does not do this. In that situation I would contact the editor and ask.
I use the listings package to insert source code. I would like to print all keywords uppercase in the output, regardless of the case in the input.
The manual states that
keywordstyle=[number][*]style
produces just what I want. However the following (almost) minimal example does not work.
if I set keywordstyle to "[1][]{\bfseries}" I end up with "[]" in front of every keyword
and "[*]{\bfseries}" gives me an asterisk in the start of the document.
I also tried "\MakeUppercase" and "{\MakeUppercase}" for keywordstyle which resulted in several errors, the first being:
! Incomplete \iffalse; all text was ignored after line 11
Minimal example:
\documentclass{article}
\usepackage{listings}
\lstdefinelanguage{KA_assembler}
{morekeywords={add,and,or,xor},
keywordstyle=[1][*]{\bfseries},
sensitive=false,
}
\lstset{language=KA_assembler}
\begin{document}
\begin{lstlisting}
and %r1, %r2
xor %r2, %r3
and %r4, %r5
\end{lstlisting}
\end{document}
I use Miktex for compilation of the tex files. So how do I force uppercase for Keywords?
In the manual, the brackets around the * look a bit different then the brackets around number. The reason is that the brackets around * are not meant to be used in the latex code, they just indicate that the presence of the * is optional. So try
keywordstyle=[1]*\bfseries
or
keywordstyle=*\bfseries
- it worked for me.