2

for a questionaire where possible answers appear as enumerate entries, I'm trying to have one document with plain squares and one where the squares are filled with either W or F.

I tried

\renewcommand{\labelenumi}{{\framebox[1.5em][c]{\phantom{W}}} \hspace{2ex} \alph{enumi})}

but it doesn't work. It's kinda the other way around of this problem.

EDIT: Heres the LWE as asked for: \documentclass[a4paper,12pt]{article} % european article %Neue Deutsche Rechtschreibung und Silbentrennung \usepackage[ngerman]{babel} %Auswahl der deutschen Varianten aller Befehle, z.B. \blindtext \selectlanguage{ngerman} % Schreiben von Umlauten auf einem LINUX-System \usepackage[utf8]{inputenc} % Math-Paket der American Mathematical Society \usepackage{amsmath,amscd,amssymb,amsbsy,amsthm,amsxtra} % Geometrie und vor allem margins des Papier angleichen \usepackage[margin=2cm]{geometry} % Anzeige Seite n von m \usepackage{lastpage} % Anpassung von Kopf- und Fußzeile \usepackage{fancyhdr} % Schriftgröße variieren \usepackage{txfonts} % Änderung der Titel-Formatierung \usepackage{titlesec} % Änderung des Einzugs der Aufzählung \usepackage{enumitem}

% Linksbündig
\raggedright
% Horizontale Einrückung zu Beginn neuer Absätze
\setlength{\parindent}{0cm}
% Vertikaler Abstand zwischen Absätzen
\setlength{\parskip}{1ex}
% Formattierung der section-Titel auf die Aufgaben
\renewcommand{\thesection}{\textbf{Aufgabe~\arabic{section}}}
\titleformat*{\section}{\normalsize}
\titlespacing*{\section}{0pt}{1ex}{0ex}
% Änderung der enumerate-Labels auf kleine Buchstaben

\newcommand{\Witem}{%
\refstepcounter{enumi}% Step enumerate counter
\item[{\framebox[1.5em]{W}\hspace{2ex}\alph{enumi}})]}
\newcommand{\Fitem}{%
\refstepcounter{enumi}% Step enumerate counter
\item[{\framebox[1.5em]{F}\hspace{2ex}\alph{enumi}})]}
\newcommand{\Bitem}{%
\refstepcounter{enumi}% Step enumerate counter
\item[{\framebox[1.5em]{\phantom{W}}\hspace{2ex}\alph{enumi}})]}

\renewcommand{\labelenumi}{{\framebox[1.5em][c]{\phantom{W}}} \hspace{2ex}     \alph{enumi})}
\setlist[enumerate,1]{leftmargin=2cm}
%~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
\begin{document}

% ~=~=~ Frage 1 ~=~=~
\section{Abbildungen, Rang, Injektivität/Surjektivität/Bijektivität}
Sei $A=\begin{pmatrix}
1 & 2 & 3 \\
2 & 4 & 6
\end{pmatrix}$.\quad Zeige oder widerlege für $A$ folgende Aussagen\\

\begin{enumerate}
\item $\text{rang}(A)=2$
\Witem Die durch $A$ beschriebene lineare Abbildung ist injektiv.
\item Die durch $A$ beschriebene lineare Abbildung ist surjektiv.
\item Die durch $A$ beschriebene lineare Abbildung ist bijektiv.
\end{enumerate}

% ...

\end{document}

  • 2
    How about, instead of teasing us with little code snippets, you provide something more substantial in the form of a minimal working example (MWE) so we have something to play with? – Werner Jun 30 '14 at 22:15
  • 1
    Welcome to TeX.SE. Reiterating @Werner's suggestion: while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Jun 30 '14 at 22:42
  • In my article class document I use \renewcommand{\labelenumi}{{\Huge $\Box$} \hspace{2ex} \alph{enumi})} so far but it's ugly. I cannot change it locally via \item[{\framebox[1.5em][c]{W}}] itemtext – Yeru Jun 30 '14 at 22:53
  • 1
    @Yeru Please edit your question and provide an MWE as others have requested. – cfr Jul 1 '14 at 0:04
  • MWE added, strangely, an isolated one works, somehow my combination in the original file doesn't work – Yeru Jul 1 '14 at 15:13
3

I assume you're not really interested in an overlay specification. Then you can define a \Witem and \Fitem to draw the blocks you're after:

enter image description here

\documentclass{beamer}
\newcommand{\Witem}{%
  \refstepcounter{enumi}% Step enumerate counter
  \item[{\framebox[1.5em]{W}\hspace{2ex}\theenumi}.]}
\newcommand{\Fitem}{%
  \refstepcounter{enumi}% Step enumerate counter
  \item[{\framebox[1.5em]{F}\hspace{2ex}\theenumi}.]}
\newcommand{\Bitem}{%
  \refstepcounter{enumi}% Step enumerate counter
  \item[{\framebox[1.5em]{\phantom{W}}\hspace{2ex}\theenumi}.]}

\begin{document}

\begin{frame}
  \begin{enumerate}
    \item
      An regular item

    \Witem
      A \alert{true} item

    \item
      A regular item

    \Fitem
      A \alert{false} item

    \Bitem
      A \alert{block} item
  \end{enumerate}

\end{frame}

\end{document}
  • Dear Werner, thanks for the ideas with \newcommand, definitely will be useful. Yet, it works in beamer class but not in article! – Yeru Jul 1 '14 at 9:17
  • @Yeru: You will recall that your previous revision included an example using beamer. This goes to show that you should heed the suggestions of people on this site when it comes to producing a minimal example. Is the output what you want, but just in the article class? – Werner Jul 1 '14 at 16:15

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.