3

I'm writing my homework and I would like to change the environment's dimensions of

\documentclass[10pt,spanish]{article}

% INICIO PAQUETES


\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[strict]{changepage} % para cambiar dimensiones (recomendado en la web)
\usepackage{fancyhdr}
\usepackage{mathrsfs}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm} % gracias a este paquete podemos enlistar los teoremas
\usepackage{hyperref} % permite agregar links

\let\UPproof\proof\def\proof{\small\UPproof}

\newtheorem{teo}{Teorema}[section]
\newtheorem{pro}{Proposici\'on}[section]
\newtheorem{cor}{Corolario}[section]
\newtheorem{lem}{Lema}[section]
\newtheorem{mydef}{Definici\'on}[section]

\textwidth 19cm
\topmargin -2cm
\textheight 23cm
\oddsidemargin -1,2cm
\parindent 0em
\parskip 2ex


\title{Un título}
\date{Una fecha}
\begin{pro} This tense is false.
\end{pro}
\begin{proof}
Because yes, yes.
\end{proof}
\end{document}

I want to make it (the "box" where the proof is being written) an x % smaller than the original "box" where the proposition is, but I don't know how to do it so if someone can help me, I'd be grateful.

15
  • 1
    Something like \let\UPproof\proof\def\proof{\small\UPproof} placed in the preamble should do. It would certainly be easier to answer your question if you provided a minimal working example (MWE).
    – yo'
    Oct 17, 2015 at 19:45
  • @yo' I said I don't know how to change it so, I don't know what to show you my "minimal working example". (I knew someone else was going to tell me something similar). I'm sorry :(
    – UnPerrito
    Oct 17, 2015 at 19:51
  • What do you mean by "x % smaller". You don't mean the actual font-size, but rather the width that the proof environment takes up with respect to the \textwidth or text block containing other text, correct
    – Werner
    Oct 17, 2015 at 19:56
  • yo', your code works pretty cool! @Werner yes I wanted to mean the lengths of the "box" where the proof is being written (it was my misstake, I'm sorry!)
    – UnPerrito
    Oct 17, 2015 at 19:59
  • Have a look at the changepage package :)
    – cmhughes
    Oct 17, 2015 at 20:02

2 Answers 2

1

Wrap the proof environment from amsthm inside an adjustwidth environment (from changepage) with suitable margin adjustments:

enter image description here

\documentclass{article}
\usepackage{amsthm,letltxmacro,changepage}
\usepackage{lipsum}% Just for this example

\LetLtxMacro\oldproof\proof
\let\endoldproof\endproof
\renewenvironment{proof}[1][\proofname]
  {\begin{adjustwidth}{2em}{2em}
   \oldproof[#1]}
  {\endoldproof
   \end{adjustwidth}}
\begin{document}

\lipsum[1]

\begin{proof}
\lipsum*[2]
\end{proof}

\lipsum[3]

\end{document}

The margin adjustments above are both 2em inward from the text block margins.

7
  • 1
    Just from a typographical point of view, it would look better with some vertical space above and below.
    – yo'
    Oct 17, 2015 at 20:58
  • @yo' can you, please, cite this?
    – touhami
    Oct 17, 2015 at 21:12
  • I have the following error "Too deeply nested"... googling for solve it.
    – UnPerrito
    Oct 17, 2015 at 21:16
  • DONE!! THANK YOU and THANKS to all for the help! I learned a lot of new things!
    – UnPerrito
    Oct 17, 2015 at 21:17
  • 1
    @touhami I can't cite any official source. But note that pull quotes, centered titles, displayed equations, lists etc. -- everything that gets a different horizontal alignment -- is in general separated by vertical space.
    – yo'
    Oct 17, 2015 at 21:24
0

I had the same need, but with an background color. This post is from 9 years ago but maybe someone could need too.

use mdframe, like the next example:

newcounter{definicion}[section]
\newenvironment{definicion}[1]
{
\begin{flushright}
\refstepcounter{definicion}\par\medskip \noindent \textbf
{\textit{#1}.} - Definición \thesection.\thedefinicion
\end{flushright}
\begin{center}
\begin{mdframed}[userdefinedwidth=0.75\textwidth, 
align=center, linewidth=0pt, backgroundcolor=lightgray]
\smallskip
}
{
\smallskip
\end{mdframed}
\end{center}
}

This is an screenshot from the pdf output:


enter image description here


You can defime widht, color background and more. even the centering, not of text but the frame. See the CTAN page mdframed.

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.