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.

UnPerrito
  • 190
  • 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 '15 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 '15 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 '15 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 '15 at 19:59
  • Have a look at the changepage package :) – cmhughes Oct 17 '15 at 20:02
  • @UnPerrito: For this, the typical suggestion is to use adjustwidth from changepage. See Indenting a whole paragraph. What package do you use to provide the proof environment? – Werner Oct 17 '15 at 20:04
  • @UnPerrito Have you opened the link? I think it's pretty well explained there what MWE means. If you showed a code with one theorem and one proof, containing complete gibberish, and said "and I want the text of the proof to be smaller", it would be enough. But now, the problem is that amsthm, svjour, ntheorem and others implement proof, but each in a different way. – yo' Oct 17 '15 at 20:07
  • @Werner I don't know, I just know that a "proof" code exist and I use it, so I don't know how to answer that question.

    The followings are the packages I'm using: amsmath, fancyhdr, graphicx, mathrsfs, babel, inputenc, color, amsfonts, amssymb, amsthm.

    – UnPerrito Oct 17 '15 at 20:47
  • @yo' done already – UnPerrito Oct 17 '15 at 20:53
  • @UnPerrito Sorry to disturb you, but this is not a MWE. If I compile the code you provide, I get ! LaTeX Error: Environment prop undefined. Instead of listing which packages you use, you could simply construct a short working document which starts with \documentclass, contains \usepackage with the packages, then \begin{document}, then the short piece of code you show, and \end{document}. – yo' Oct 17 '15 at 20:55
  • @yo' It is now right? hehe – UnPerrito Oct 17 '15 at 21:02
  • @UnPerrito Much better! +1 – yo' Oct 17 '15 at 21:04
  • \let\UPproof\proof\def\proof{\small\UPproof} from @yo' answer should not be in the question. It's the answer. – touhami Oct 17 '15 at 21:08
  • I know that @Werner edit the question, but I think the title is Change environment's fontsize no? – touhami Oct 17 '15 at 21:10
  • @touhami No, it was a misstake from me... – UnPerrito Oct 17 '15 at 21:14

2 Answers2

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.

Werner
  • 603,163
  • 1
    Just from a typographical point of view, it would look better with some vertical space above and below. – yo' Oct 17 '15 at 20:58
  • @yo' can you, please, cite this? – touhami Oct 17 '15 at 21:12
  • I have the following error "Too deeply nested"... googling for solve it. – UnPerrito Oct 17 '15 at 21:16
  • DONE!! THANK YOU and THANKS to all for the help! I learned a lot of new things! – UnPerrito Oct 17 '15 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 '15 at 21:24
  • @yo' this is a good point. – touhami Oct 17 '15 at 21:30
  • Werner, how can I add the option of reduce the font size in the "proof" environmnent? If I add the code "\let\UPproof\proof\def\proof{\small\UPproof}" it makes an error call "too deeply nested" :( – UnPerrito Oct 17 '15 at 22: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.