4

The image below has a style for definition of options that I tried to replicate using \newenvironment. Basically, it has a fully indented paragraph with a word preceding it in the first line and with a different style.

The code I tried was

\newenvironment{optionDef}[1]%
    {\hangpara{0.3\textwidth}{1}\makebox{0.3\textwidth}{l}{\texttt{#1}}}%
    {\par}

\begin{document}
\begin{optionDef}[paperwidth]
    some text some text some text some text some text some text some text some text some text
\end{optionDef}

But it prints the arguments instead of processing them. Any ideas on how I might be able to do an environment for a style like that in the image?

enter image description here

1

Since you're setting the optionDefs one at a time, switching the margins seems sufficient and allows for content to flow easily form one page to the next. Margin adjustment is made possible using changepage's adjustwidth environment. It takes two arguments - the first is the left margin indent and the second is the right margin indent. Change this to suit your needs (currently set to 100pt).

enter image description here

\documentclass{article}

\usepackage{changepage}

\newenvironment{optionDef}[1][]
  {\begin{adjustwidth}{100pt}{0pt}
   \makebox[0pt][r]{\makebox[100pt][l]{\bfseries\ttfamily #1}}%
   \ignorespaces}%
  {\end{adjustwidth}}

\begin{document}

\sloppy% Just for this example

\begin{optionDef}[paperwidth]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum. 
Aliquam sed tellus vel magna imperdiet placerat in vel massa. Suspendisse gravida felis 
in maximus commodo. Donec pellentesque auctor suscipit. Proin tempus massa ut est accumsan 
porta. Quisque pulvinar est ac faucibus iaculis. Integer eget urna dapibus, sodales nisi 
eget, tincidunt leo. Vivamus quis gravida eros. Donec finibus eros leo, at posuere orci 
euismod eu. Integer a varius dui. Aliquam tincidunt, elit sed condimentum gravida, tortor 
leo vulputate nibh, ut sagittis mauris risus et metus. Sed nec faucibus tortor, non 
pulvinar lectus.
\end{optionDef}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum. 
Aliquam sed tellus vel magna imperdiet placerat in vel massa. Suspendisse gravida felis 
in maximus commodo. Donec pellentesque auctor suscipit. Proin tempus massa ut est accumsan 
porta. Quisque pulvinar est ac faucibus iaculis. Integer eget urna dapibus, sodales nisi 
eget, tincidunt leo. Vivamus quis gravida eros. Donec finibus eros leo, at posuere orci 
euismod eu. Integer a varius dui. Aliquam tincidunt, elit sed condimentum gravida, tortor 
leo vulputate nibh, ut sagittis mauris risus et metus. Sed nec faucibus tortor, non 
pulvinar lectus.

\begin{optionDef}[textwidth]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum. 
Aliquam sed tellus vel magna imperdiet placerat in vel massa. Suspendisse gravida felis 
in maximus commodo. Donec pellentesque auctor suscipit. Proin tempus massa ut est accumsan 
porta. Quisque pulvinar est ac faucibus iaculis. Integer eget urna dapibus, sodales nisi 
eget, tincidunt leo. Vivamus quis gravida eros. Donec finibus eros leo, at posuere orci 
euismod eu. Integer a varius dui. Aliquam tincidunt, elit sed condimentum gravida, tortor 
leo vulputate nibh, ut sagittis mauris risus et metus. Sed nec faucibus tortor, non 
pulvinar lectus.
\end{optionDef}

\end{document}

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.