2

I have a problem in horozontal list. Namely,

\setlength{\itemindent}{5em} 

doesnt't work for inparaenum package. If you put enumerate instead inparaenum it works but list is then vertical. I need horizontal like this.

\documentclass[12pt,article,a4paper]{memoir}
\usepackage[croatian]{babel}
\usepackage[pdftex]{graphicx}
\usepackage[cp1250]{inputenc}
\usepackage{paralist}
\usepackage{tikz}
\usepackage[margin=.5in]{geometry}
\usepackage{amssymb,mathtools,amsmath,amsfonts,amsthm}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage[T1]{fontenc}
\renewcommand*\familydefault{\sfdefault}
\newcommand{\class}{Matematika 3 }

\pagestyle{empty}

\newenvironment{zad}[1]{\noindent \textsc{Problem} $\left[#1 \right]$}{\null\hfill$\qed$\hskip 2mm\vskip 2mm}


\begin{document}
\noindent

%\begin{tabular*}{\textwidth}{l @{\extracolsep{\fill}} r @{\extracolsep{6pt}} l}
%\textbf{\class} 4.školska zadaća \quad GRUPA A \\
%\end{tabular*}

\centering\textsc{Vectors}

\begin{enumerate}
\item \zad{1} 
\item \zad{3} For vectors $\vec{v}=2\vec{i}+3\vec{j},$ $\vec{w}=3\vec{i}-4\vec{j}$ calculate \\ \begin{inparaenum}[~ a)]\setlength{\itemindent}{5em}
    \item $2\vec{v}$
    \item $4\vec{v}-3\vec{w}$
    \item $|\vec{v}|$
  \end{inparaenum} 
\end{enumerate}

\end{document}
2

I would suggest using the enumitem package for inline lists instead of the paralist package. Use the package option [inline] and \begin{enumerate*} ... \end{enumerate*} for an inline list. It allows you to set the space between the inline items using the itemjoin parameter. But there are various other problems with the way you've set up your code, including the fact that you've defined an environment but are using it as a command, which means it doesn't work as you intend.

The basic problem you face, from what I can figure out from your sample is that you want to have an enumerated list where each list item has an arbitrary problem number. Furthermore, you want to end an answer with a $\qed$ symbol. I suggest, then the following:

First split your environment into two commands: a command which is the first part of your environment (which sets the problem number) and then a QED command.

Then instead of using that in your lists, define a custom \item command which then measures the space used by the item number and the problem number and passes that to the before parameter of the inline list. This ensures that no matter how big the problem number is, the inline list will line up in the correct place. Here's the whole code:

\documentclass[12pt,article,a4paper]{memoir}
\usepackage[inline]{enumitem}
\usepackage[T1]{fontenc}
\usepackage{mathtools,amsmath,amssymb,amsthm}
\usepackage{calc}
\usepackage[margin=.5in]{geometry}
\renewcommand*\familydefault{\sfdefault}

\pagestyle{empty}

\newcommand{\zad}[1]{\noindent\textsc{Problem} $\left[#1 \right]$}
\newcommand{\daz}{\hfill$\qed$}
\newlength{\zadlen}
\newcommand{\myitem}[1]{\item\zad{#1}\setlength{\zadlen}{\widthof{\zad{#1}}+\labelindent+\labelsep}}
\begin{document}
\noindent


\centering\textsc{Vectors}

\begin{enumerate}
\myitem{1} An answer \daz
\myitem{3} For vectors $\vec{v}=2\vec{i}+3\vec{j},$ $\vec{w}=3\vec{i}-4\vec{j}$ calculate\par
\begin{enumerate*}[label=\alph*),itemjoin=\hspace{5em},before=\hspace{\zadlen}]
    \item $2\vec{v}$
    \item $4\vec{v}-3\vec{w}$
    \item $|\vec{v}|$
\end{enumerate*} 
\daz
\end{enumerate}

\end{document}

output of code

  • How to make that first item a) starts below word "For" and not below "PROBLEM"? \setlength{\itemindent}{5em} doesn't work. Thanks – vejn Mar 22 '15 at 19:23
  • @vejn What you want to do, if you want to do it properly requires a calculated value, not a fixed value. I've modified the code to do that. – Alan Munn Mar 22 '15 at 19:38
  • Thanks! That's I've been looking for. Isn't there any easier soultion? I'm still figuring out how you do it with newcommand. – vejn Mar 22 '15 at 19:54
  • I figured out your code. Very sofisticated. I thought there is some shift command which does that without using \newcommand. – vejn Mar 22 '15 at 21:23
  • Thanks Alan Munn, could you solve my problem on tex.stackexchange.com/questions/234059/particular-exam-question if you have the time. – vejn Mar 23 '15 at 5:27

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.