4
votes
3answers
57 views

cellspacebreak macro

(I am rolling my own little system to take my LaTeX file and convert it to reasonable HTML and Epub. I have run into the following problem.) I would like to keep my tabulars very simple. There are ...
3
votes
1answer
47 views

Make a command start new line in a list if it is not currently at the end of another list

I am trying to typeset a structured proof as demonstrated by Leslie Lamport in his paper How to Write a 21st Century Proof. In particular, I am trying to typeset Figure 3 (shown below). My code and ...
7
votes
1answer
64 views

Reversing the effect of a \newline with the next command?

I'm using the harvard package and the agsm bibliography style. I'm aware that there are alternatives, e.g., natbib plus har2nat, and I will be looking into those in the not-too-distant future, but at ...
4
votes
1answer
49 views

How to make a hbox several lines under the specified place?

Recently I asked How to colourfuly highlight some lines of an algorithm using algorithm2e? I wanted to acheive this effect using the algorithm2e package: Thanks to JLDiaz's answer I know how to do ...
7
votes
1answer
75 views

Remove space before macro if exist a environment

I create a new macro: \newcommand{\intersection}[1]{% \par\vspace{\baselineskip}% \noindent\textbf{\large\bfseries\sffamily #1}\par} It works perfectly for what I want, but when there is a ...
3
votes
1answer
70 views

Using savebox around the BODY of environ

I tried to use a \savebox around the \BODY macro of \NewEnviron. Can I keep the linebreaks somehow (they are gone, in the MWE)? \documentclass{article} \usepackage{environ} \newsavebox{\mybox} ...
0
votes
0answers
117 views

Detect a newline after dollar $ sign

I would like to be able to use \ifnextchar to check if the next character is a new line character. The reason is that I would like to redefine the $ sign to behave differently if it is followed by a ...
3
votes
1answer
162 views

Hyphenation when using \verb command

I'm having a problem using \verb command. Usually when I want some verbatim font in the current line (not in a new paragraph) I use the \verb command, not the verbatim environment. So, when I use ...
3
votes
2answers
71 views

Why linebreaks break the line height within certain environments with size-changing macros?

Why linebreaks break the line height within certain environments with size-changing macros? I'm trying to understand what's the difference between these three approaches: \newenvironment between {} ...
3
votes
1answer
92 views

Retain line breaking behaviour inside macro

I use a macro which just wraps its argument in a pair of delimiters (brackets). It interferes with the way LaTeX would normally wrap an inline math expression. The following illustrates: ...
8
votes
1answer
84 views

Macro to capture until end-of-line as argument

Is it possible to capture the contents to the end-of-line as a macro argument? For example, consider the following naive visualization: \documentclass{article} \newenvironment{myitemize} ...
3
votes
1answer
68 views

output generated macro content with newline

I would like to debug a latex macro, but I do not really know how. I got the following MWE which replaces the \\ in a string. I would like to print the value of generated string to check the result. ...
3
votes
2answers
94 views

Using \color in a paragraph column inside a tabular environment results in a line break [duplicate]

Some of my documents are compiled into multiple outputs. Some Versions contain certain parts, while other versions contain only a placeholder. For this purpose I have a macro \markup that colors its ...
3
votes
1answer
136 views

How to enforce newlines in latex

I am creating a macro driven songbook in LaTeX, and have run into a problem: Linebreaks. I want the input text: Line1 Line2 Line3 To output like that in the PDF as well. It is not an option to use ...
1
vote
1answer
476 views

Positioning \NewEntry elements in a CV

I need to write a CV that is attached to my thesis. Because I wrote my thesis in latex (classic thesis), I would like to set my CV in latex as well so it fits the layout of the thesis. I use this ...
6
votes
2answers
211 views

Custom verbatim that sets all spaces (“ ”) as visible spaces (“␣”) that can line-break

It makes sense to typeset code in a monospaced font. Sometimes such code needs to be embedded in a paragraph context, and then it will be useful to allow it to linebreak. In order to visualize spaces ...
4
votes
3answers
217 views

How are space tokens and empty lines processed by long commands (as their potential arguments)?

How are spaces and empty lines processed by long commands (i.e., those that do not accept paragraph breaks inside)? Are there different space tokens aside from " " and an empty line? It appears that ...
4
votes
2answers
412 views

Line break (continuation) for commands (options, arguments)

How to do proper line breaking (continuation) for commands, i.e. their options and/or their arguments? For example, in order to transform this: \usepackage[top=1.0cm, bottom=1.0cm, left=1.0cm, ...
4
votes
1answer
285 views

wrapping inline long lines and adding background color

Objective I'm trying to achieve the following output. Here's the code I used to produce it. I had to hack it \begin{document} \begin{description} \item In ...
8
votes
3answers
227 views

Useful macro definitions

This question is related to Question: linebreak in macros, however it is not asking for the same information and I separated it out: In my documents, I make use of commands like the following: ...
3
votes
1answer
513 views

How to use \newline in a macro?

I want to introduce \newline after the figure label instead of :. I am aware that caption package does this via \captionsetup. However, I would like to do it without it. I read from the memoir class ...
13
votes
2answers
235 views

Persuading (la)tex “silently to go beyond the envelope of 'good taste' ” to avoid an overfull hbox

My understanding, based on reading this website, is that (la)tex performs at most three passes when trying to typeset a paragraph: one based on \pretolerance, one based on \tolerance, and one based on ...
3
votes
1answer
428 views

Automatic break line after multicolumn

Is there a way to put \\ after multicolumn automatically, each time it appears in the code? Pseudocode would look like this: \newcommand{\commandThatAddsBreaklines} if(thereIsAMulticolumn == true) ...
4
votes
1answer
172 views

\newcommand creates underfull\hbox (badness 10000) in paragraph

I have a 2-column document with repeating boxes. So I created these macros (don't mind the colors and boxheight): % ------------------------------------------------------- % aitparagraph % % gives ...
23
votes
2answers
523 views

What is “\\” called?

I’ve seen it take arguments, and apparently there’s a starred version, but I can’t find any documentation because it is ungooglable!
5
votes
2answers
324 views

Text created with a \newcommand overflows into margin (not xspace question)

I am aware of the use of xspace to handle the space after a macro in different situations. However, it seems that I cannot avoid having my text created with a \newcommand from running into the ...
4
votes
2answers
173 views

Hyphenatable material enclosed in group braces

I have text that I need to repeat quite a few times: \newcommand{\repeatme}{text to repeat that is somewhat long and verbose} I'd like to underline this text and have it not cause hbox overflow ...
3
votes
3answers
326 views

how to force TeX to keep line breaks?

I would like to write a programme code to a file, so that it can be later on executed. The language requires to keep line breaks. \begin{myCode} one two three \end{myCode} In my macro I have ...
3
votes
1answer
396 views

How can I get rid of an Underfull \hbox message in my macro?

I can't find the reason for getting this message: Underfull \hbox (badness 10000) in paragraph This is my test case: \newcommand{\ruler}{\noindent\rule[1ex]{\textwidth}{1pt}\\} ...
5
votes
3answers
1k views

Defining rules for line breaks in \newcommand

Thanks to the help of this answer, I've defined a command for creating a blank line: \newcommand{\blank}[1]{\rule{#1}{0.4pt}} However, because this is a user-defined command, LaTeX doesn't seem to ...
10
votes
3answers
538 views

Censor text spanning multiple lines

I'd like to censor or hide some text while replacing it with the appropriate amount of white-space. The replacement text cannot be searchable. The text to be hidden usually exists in the LR mode. The ...
2
votes
1answer
581 views

Macro for tabbing with complex line breaks (or similar environment)

I have a complicated transcription with mid-line aligned text. I've been using tabbing to do it automatically, but it obviously doesn't do line breaks. I want to write a macro (unless something ...
4
votes
1answer
397 views

How to adjust macro to respect current \linewidth?

I'm having issues with text going past the end of the specified \textwidth. I posted this question about why text was being placed beyond the specified line width. The MWE provided there produced ...
3
votes
2answers
219 views

Macro with \n doesn't work, not sure why.

I created a macro called \code to wrap all the code fragments in my book, \newcommand{\code}[1]{\emph{#1}} But for some reason when I use this \code{\\n}, I never get the \n displayed. For some ...
2
votes
1answer
528 views

Context-sensitive newline macro

I'd like to write a new command putOnNewLine such that \putOnNewLine{ABC} puts ABC on a new line, with exactly one line's vertical space separating it from what has gone before. It must also ...
5
votes
2answers
922 views

Centering and \MakeUppercase with linebreaks

I wish to make the list of authors show up as centered, uppercase and listed vertically on my titlepage. My documentclass contains a section like this \begin{center} ... ...
1
vote
1answer
491 views

Why does my linebreak not work?

I have the following code: \section{Questions} \freequestion What is the largest (LOC) class in the project? \par \makebox[\textwidth]{% \begin{tabularx}{\textwidth}{|X|S|S|S|S|S|X|} \hline ...
19
votes
5answers
1k views

Wrapping long lines that contain no spaces

I need to format extremely long strings of text. I would like to be able to specify their width, and have them wrap, with or without some special symbol to indicate that the line is wrapped. The ...