9

I'm working on defining an environment that's further indented than the rest of the page.

This is my document so far:

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb}


\newenvironment{question}[2][Question]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}


\newenvironment{subq}[1]{\begin{trivlist}
\setlength\leftmargin{6cm}
\item[{\bfseries #1.}]}
{\end{trivlist}}

\begin{document}

\title{Title}
\author{Author}
\maketitle

 \begin{question}{6}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{question}

\begin{subq}{a}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{subq}

\end{document}

I'd expect this to indent the subq by 6cm, but that doesn't happen. It's totally aligned with everything else, except that the a. is a few extra points to the left. I've tried replacing leftmargin with parindent and leftmargini to no effect.

I've also tried moving leftmargin before the \begin{trivlist}, like so:

\newenvironment{subq}[1]{\setlength\leftmargin{10cm} \begin{trivlist}
\item[{\bfseries #1.}]}
{\end{trivlist}}

and that gives me exactly the same output.

Any suggestions?

1
  • Use list instead of trivlist
    – egreg
    Dec 15, 2013 at 14:56

2 Answers 2

8

You were nearly there, but the setting isn't trivial enough for trivlist, you want to use list

enter image description here

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb}


\newenvironment{question}[2][Question]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}


\newenvironment{subq}[1]{\begin{list}{}{%
\setlength\leftmargin{6cm}}%
\item[{\bfseries #1.}]}
{\end{list}}

\begin{document}

\title{Title}
\author{Author}
\maketitle

\noindent X\dotfill X

 \begin{question}{6}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{question}

\begin{subq}{a}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{subq}

\end{document}
0
1

Try using the low-level \parshape command. The answer to a question I asked a few weeks ago explains its use in list environments. The code below specifies a 6cm left indent for all of subq.

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb,lipsum}
\newenvironment{question}[2][Question]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
%%%%%%%%%%
\newenvironment{subq}[1]{\begin{trivlist}
        \dimen1=\the\textwidth
        \dimen2=6cm
        \advance\dimen1 by -\dimen2
        \parshape=1 \dimen2 \dimen1
\item[{\bfseries #1.}]}
{\end{trivlist}}
%%%%%%%
\begin{document}
 \begin{question}{6}
\lipsum[2]
\end{question}
\begin{subq}{a}
\lipsum[2]
\end{subq}
\end{document}
1
  • 2
    setting parshape inside a latex list is very brave:-) Dec 15, 2013 at 14:51

You must log in to answer this question.

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