0

At the most basic level I want to be able to do something like this:

\begin{quote}[5.5.2]
   This is some text that will come out like a quote.
\end{quote}

So that it will come out something like this.

5.5.2    This is some text that will
         come out like a quote.

I imagine I want to be able to do things like decrease the font of the 5.5.2, change the colour, maybe put a border line, stuff like that. I assume I want to do some sort of \newenvironment, but I have no idea what to put inside of it, looking through the help I don't know where to start.

 \newenvironment{aquote}[2]
{\begin{quote}}
{\end{quote}}

Or maybe It is easier to not start with quote inside there and just draw two boxes somehow?

UPDATE:

Thanks to the awesome pointers below, here is how to do it in its most basic form:

  \minipage[t]{2cm}{\textcolor{red}{Stuff}}\endminipage
  \minipage[t]{\textwidth}
  here is just some more text. Welcome to Overleaf  just edit your LaTeX on the left, and we'll compile it for you on the right. If you give
someone the link to this. Good bye.
  \endminipage

Or like this:

\makebox[2cm][r]{Stuff}
\minipage[t]{\textwidth}
Here is just some more text. Welcome to Overleaf  just edit your LaTeX on the left, and we'll compile it for you on the right. If you give
someone the link to this. Good bye.
  \endminipage
5
  • Can you specify more exactly what you want? Without, I would only suggest to use either package enumitem to configure a new kind of description environment or scrextend to use the labeling environment. But the "5.5.2" does also look like a section number, so maybe configuration of a new \subsubsection heading with hanging indent could also be wanted. Aug 17, 2017 at 9:10
  • Thanks. I really just want to know how to make two boxes that can sit next to each other. (So I can both solve an initial problem I have now, and learn how to do latex things more generally)
    – Jay
    Aug 17, 2017 at 9:32
  • That would be something completely different from using something like quote. You can place text or \mbox or \makebox and \parbox or minipage side by side. Use the optional vertical alignment parameter of \parbox or minipage to have the topmost text line in the box/minipage be aligned with the outer text or box. Aug 17, 2017 at 9:35
  • Thanks, so I need to google mbox, makebox parbox, and minpage. Thanks
    – Jay
    Aug 17, 2017 at 9:41
  • You should not google for LaTeX docu, because the results are often beyond the pale. Read a good introduction to LaTeX! If you want to search for information use the search button of this site not Google. Aug 17, 2017 at 9:44

1 Answer 1

2

With KOMA-Script (either a KOMA-Script class or KOMA-Script package scrextend) you could use, e.g., the labeling environment:

\documentclass{article}

\usepackage{xcolor}
\usepackage{scrextend}
\newenvironment{aquote}[1]{%
  \setkomafont{labelinglabel}{\color{blue}}%
  \small
  \labeling{#1}\item[#1]%
}{%
  \endlabeling
}
\usepackage{blindtext}

\begin{document}
\blindtext
\begin{aquote}{5.5.2}
  \blindtext
\end{aquote}
\blindtext
\end{document}

You could also use the addmargin environment:

\documentclass{article}

\usepackage{xcolor}
\usepackage{scrextend}
\newenvironment{aquote}[1]{%
  \addmargin[4em]{1.5em}%
  \small
  \makebox[0pt][r]{\textcolor{green}{#1}\quad}\ignorespaces
}{%
  \endaddmargin
}
\usepackage{blindtext}

\begin{document}
\blindtext
\begin{aquote}{5.5.2}
  \blindtext
\end{aquote}
\blindtext
\end{document}

Another suggestion would be to use enumitem to setup a new description environment:

\documentclass{article}

\usepackage{xcolor}
\usepackage{enumitem}
\newlist{aquote}{description}{1}
\setlist[aquote]{font=\color{green},align=right,labelindent=1em,labelwidth=*,leftmargin=3.5em,rightmargin=1.5em,before=\small}
\usepackage{blindtext}

\begin{document}
\blindtext
\begin{aquote}
  \item[5.5.2]
  \blindtext
\end{aquote}
\blindtext
\end{document}

An absolute minimal suggestion would be to use a minipage:

\documentclass{article}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{xcolor}
\newenvironment{aquote}[1]{%
  \textcolor{red}{#1}
  \minipage[t]{\linewidth-\widthof{#1 }}%
}{\endminipage}
\usepackage{blindtext}

\begin{document}
\blindtext
\begin{aquote}{5.5.2}
  \blindtext
\end{aquote}
\blindtext
\end{document}

But in this case page breaks inside aquote are not permitted.

1
  • Awesome, I am mucking around with minpage and the others, and learning how they work. This has solved it for me. Thanks!
    – Jay
    Aug 17, 2017 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .