- Questo topic ha 2 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 13 anni, 9 mesi fa da .
-
Topic
-
Ciao a tutti,Sto cercando di creare dei box contenenti testo. Dove aver dato un’occhiata a bclogo e mdframed, mi sono orientato verso quest’ultimo.
Ho cercato degli esempi da cui poter partire per creare un prototipo, e uno che mi piaciuto è l’esempio 6 che potete vedere qui: http://mirrors.ctan.org/macros/latex/contrib/mdframed/mdframed-example-default.pdf
Ora, probabilmente c’è qualcosa di ovvio che mi sfugge, ma io non riesco a farlo compilare, né nel mio documento, né in un documento minimo.
Esempio:
`
\documentclass[11pt,a4paper]{book}
\usepackage{tikz}
\usepackage[framemethod=default]{mdframed}
\usepackage{lipsum}
\usepackage[utf8]{inputenc}\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
\global\mdfdefinestyle{exampledefault}{%
linecolor=red,linewidth=3pt,%
leftmargin=1cm,rightmargin=1cm
}\newcounter{theo}[section]
\newenvironment{theo}[1][]{%
\stepcounter{theo}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut Theorem~\thetheo};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut Theorem~\thetheo:~#1};}}%
}%
\mdfsetup{innertopmargin=10pt,linecolor=blue!20,%
linewidth=2pt,topline=true,
frametitleaboveskip=\dimexpr−\ht\strutbox\relax,}
\begin{mdframed}[]\relax%
}{\end{mdframed}}\begin{document}
\chapter{Un Capitolo}
Testo testo testo
\begin{theo}[Inhomogeneous Linear]
\lipsum
\end{theo}\begin{theo}
\lipsum
\end{theo}\end{document}
`L’errore che mi viene fuori è in entrambi i casi:
`
! Missing number, treated as zero.
\protect
l.145 \begin{theo}[Inhomogeneous Linear]
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
\protect
l.145 \begin{theo}[Inhomogeneous Linear]
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)
`Sto compilando con TeXLive 2012 su una Debian Testing.
Grazie a chi avrà la pazienza di rispondermi!
- Devi essere connesso per rispondere a questo topic.