0

I have created my first newenvironment! I had it working, and then I must have done something and it has stopped. The intent is to create an "aside" environment that puts a vertical space, then sets things in sans serif, then another space and normal font.

When I run the MWE below, it puts in the first space, and goes to sans serif, but doesn't put the second space or switch back. I've been staring at it for 30 minutes and I can't figure it out.

\documentclass[openany, final]{memoir}


\usepackage{dialogue}


\OnehalfSpacing

\makeatletter
\renewcommand\partnumberlinehook[1]{%
  \settowidth{\@tempdima}{\bfseries #1 }%
}
\makeatother



\newenvironment{aside}
    {
     \vspace{0.2in}
     \begin{sffamily}
    }
    {
    \end{sffamily}
    \vspace{0.2in}
    }

\begin{document}

Then they take the bandages off and, as expected, my vision hasn't changed but
my eyes look much better.

\aside{The car crash and the eye surgery happened at around the same time, but
\ldots I don't remember which happened first and, at this point, there's no one
left alive who can tell me. I sort of \emph{think} that the eye surgery was
first. But I don't really know. And my thinking this is based on thinking, not
on the sort of sense of time that most people seem to have.

I think this is related to my NLD, I've heard of this sort of thing in some
other people withe NLD, but it's not the center of the diagnosis. It happens
with more minor life events too. I don't remember when things happened, or in
what order they happened.}

I've survived being hit by a cab, having eye surgery, and 7th grade, but 8th
grade is even worse.

\end{document}

When I run it in my full document, I get a different error, of "begin{\sffamily} ended by \end{document} but I can't figure out a good MWE for that.

13
  • Thanks. I don't understand your first comment. I was using this overleaf.com/learn/latex/… as an example to modify, it doesn't define a command. I'm confused! I tried adding \par before each \vspace and nothing changed in the output.
    – Peter Flom
    Commented Aug 1, 2023 at 13:52
  • 1
    to see why you need \par see what happens if you do aaaaa \begin{aside} aside text here \end{aside} following text the vertical space will not be where you want Commented Aug 1, 2023 at 13:56
  • Thanks! That worked. (And sorry for being dense about this).
    – Peter Flom
    Commented Aug 1, 2023 at 14:01
  • 1
    sorry I mis-remembered and thought you'd mentioned overleaf, was a different question. I tried texlive 2020, 2021 2022 and 2023 and they all give same error if i uncomment dialog, what version are you running? Commented Aug 1, 2023 at 14:22
  • 1
    oh I see you pointed at the overleaf tutorial:-) Commented Aug 1, 2023 at 14:26

1 Answer 1

2

Environments use a syntax \begin{name}...\end{name} not \name{...}

Separately beware white space from ends of lines (avoided here by adding % and make sure to end the paragraph (\par) before adding vertical space.

The dialog package appears incompatible with the memoir class so I commented that out.

enter image description here

\documentclass[openany, final]{memoir}


%\usepackage{dialogue}


\OnehalfSpacing

\makeatletter
\renewcommand\partnumberlinehook[1]{%
  \settowidth{\@tempdima}{\bfseries #1 }%
}
\makeatother



\newenvironment{aside}
    {\par
     \vspace{0.2in}%
     \begin{sffamily}%
    }
    {%
    \end{sffamily}%
    \par
    \vspace{0.2in}%
    }

\begin{document}


Then they take the bandages off and, as expected, my vision hasn't changed but
my eyes look much better.

\begin{aside}
The car crash and the eye surgery happened at around the same time, but
\ldots I don't remember which happened first and, at this point, there's no one
left alive who can tell me. I sort of \emph{think} that the eye surgery was
first. But I don't really know. And my thinking this is based on thinking, not
on the sort of sense of time that most people seem to have.

I think this is related to my NLD, I've heard of this sort of thing in some
other people withe NLD, but it's not the center of the diagnosis. It happens
with more minor life events too. I don't remember when things happened, or in
what order they happened.
\end{aside}

I've survived being hit by a cab, having eye surgery, and 7th grade, but 8th
grade is even worse.

\end{document}

You must log in to answer this question.

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