1

I'm using multicols to show the content of a text file, however I need to use the \ttfamily font. As in \texttt{} but that doesn't allow line breaks.

Since is a very extensive file I don't want to use \allowbreak every time.

Tried putting {\ttfamily} in and out of the code but it doesn't work.

Any suggestion about how to show text without using multicols is appreciated as well, however my main issue is being able to use typewriter text in that part of my article.

Thank you.

This is what I've got:

\begin{multicols}{3}[
 Example Text.
 ]
A B C D E F G H I J 

A J


A B 7 0

A C 9 0

A D 7 0

A E 10 0

A F 7 0

A G 10 0

A H 6 0

A I 10 0

A J 5 0

B C 3 0

B D 3 0

B E 8 0

B F 4 0

B G 8 0

B H 2 0

B I 10 0
\end{multicols}
  • 1
    Welcome! Given that this works by default, I can only assume you are doing something to make it not work which you haven't shown. Always post complete minimal examples which we can copy-paste-compile to reproduce the issue. Code fragments are OK in explanations but hopeless for reproducing problems and trying to solve them. You know to put the text in the group, as well, I assume i.e. {\ttfamily whatever} – cfr Nov 20 '15 at 22:36
  • \ttfamily after ]? Not with braces, of course. – egreg Nov 20 '15 at 22:37
  • Works without braces and all that. – David Merinos Nov 20 '15 at 23:06
  • what was the actual problem solved?? (\texttt and \ttfamily both allow line breaking? even though an answer is accepted it may still be useful for the site if the question is clarified. – David Carlisle Nov 20 '15 at 23:13
  • The post marked as an answer solved the problem. I simply didn't know how to use Typewriter Text without using \texttt. @DavidCarlisle – David Merinos Nov 21 '15 at 0:54
3

There's no problem using \ttfamily in a multicols environment. This compares the default serif with the same text in typewriter:

roman and typewriter

\documentclass{article}
\usepackage{multicol}

\begin{document}
\begin{multicols}{3}[
 Example Text.
 ]
A B C D E F G H I J

A J


A B 7 0

A C 9 0

A D 7 0

A E 10 0

A F 7 0

A G 10 0

A H 6 0

A I 10 0

A J 5 0

B C 3 0

B D 3 0

B E 8 0

B F 4 0

B G 8 0

B H 2 0

B I 10 0
\end{multicols}

\begin{multicols}{3}[
 Example Text.
 ]
 \ttfamily
A B C D E F G H I J

A J


A B 7 0

A C 9 0

A D 7 0

A E 10 0

A F 7 0

A G 10 0

A H 6 0

A I 10 0

A J 5 0

B C 3 0

B D 3 0

B E 8 0

B F 4 0

B G 8 0

B H 2 0

B I 10 0
\end{multicols}
\end{document}

If you want to avoid paragraph indentation, you can set \parindent to 0pt either within the multicols group or inside a group including the entire multicols environment so that the header is aligned to the left:

{\setlength\parindent{0pt}
\begin{multicols}{3}[
 Example Text.
 ]
 \ttfamily
A B C D E F G H I J

A J


A B 7 0

A C 9 0

A D 7 0

A E 10 0

A F 7 0

A G 10 0

A H 6 0

A I 10 0

A J 5 0

B C 3 0

B D 3 0

B E 8 0

B F 4 0

B G 8 0

B H 2 0

B I 10 0
\end{multicols}}

shifting alignments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.