Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
Use list instead of trivlist –  egreg Dec 15 '13 at 14:56
add comment

2 Answers

up vote 6 down vote accepted

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}
share|improve this answer
    
Thank you, this worked exactly as hoped! –  mikayla Dec 16 '13 at 19:55
add comment

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}
share|improve this answer
1  
setting parshape inside a latex list is very brave:-) –  David Carlisle Dec 15 '13 at 14:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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