0

i want to include image with a specific size inside the box in my document, enter image description here

\documentclass[a4paper,11pt]{article} % Article sur papier A4 en 11 pt
\usepackage{graphicx}                 % Pour afficher des fichiers images
\usepackage{siunitx}
\usepackage{multirow,tabularx}
\usepackage{wrapfig}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
%\usepackage{concil}
\usepackage[frenchb]{babel}           % Document en français
\usepackage{amssymb}
\usepackage{float}
\usepackage[skins,breakable,xparse]{tcolorbox}%
\begin{document} 

\section{Applications}
Soient $(\zeta)$ un cercle de centre $O$ et $(AT)$ sa tangente au point $A$, sachant que $\widehat{TAB}=20\si\degree$:

1- Déduire la mesure de l'angle $\widehat{AOB}$ ?

2- Déterminer les mesures de  $\widehat{ABO}$ et $\widehat{OAB}$ ?

 \begin{tcolorbox}[
     enhanced,clip upper,%<------------
     colframe=red,colback=gray,boxrule=2pt,arc=10pt,
     boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt]
\includegraphics[width=0.5\textwidth, height=0.6\textheight ]{exercice-application}
\end{tcolorbox}
\end{document}

when i use this code i get something, like:enter image description here Edit

I would like to reduce the size of the image in my document, I don't want to take a half-page for a figure if you see it's not professional to give a figure a half-page as shown in the following image enter image description here

  • 3
    It's really difficult to see what you're asking here. You want a "specific size"; what size? You've told LaTeX to set your image at half the textwidth, which is exactly what it's done. – dgoodmaniii Nov 15 '19 at 13:44
  • I want to remove the gray side in right in the picture – moradov Nov 15 '19 at 18:48
1

You've instructed TeX to make your image half of the \textwidth when you say width=0.5\textwidth; say width=\textwidth instead.

\documentclass[a4paper,11pt]{article} % Article sur papier A4 en 11 pt
\usepackage{graphicx}                 % Pour afficher des fichiers images
\usepackage[skins,breakable,xparse]{tcolorbox}%
\pagestyle{empty}
\begin{document} 
\begin{tcolorbox}[
    enhanced,clip upper,%<------------
    colframe=red,colback=gray,boxrule=2pt,arc=10pt,
    boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt]
\includegraphics[width=\textwidth, height=0.6\textheight]{examp.pdf}
\end{tcolorbox}
\end{document}

This gets you what you want:

Results

It's also worth noting that your example, while working, is far from minimal. Remove all the packages that you don't actually need to get the problem you're having; often they can complicate things, and it might be that it reveals what your problem is before you ask.

EDIT: Since your concern seems to be shrinking the entire image, including the tcolorbox, just give tcolorbox a width rule:

\documentclass[a4paper,11pt]{article} % Article sur papier A4 en 11 pt
\usepackage{graphicx}                 % Pour afficher des fichiers images
\usepackage[skins,breakable,xparse]{tcolorbox}%
\pagestyle{empty}
\begin{document} 
\begin{tcolorbox}[width=0.5\textwidth,
    enhanced,clip upper,%<------------
    colframe=red,colback=gray,boxrule=2pt,arc=10pt,
    boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt]
\includegraphics[width=\textwidth, height=0.6\textheight]{examp.pdf}
\end{tcolorbox}
\end{document}

Your image will then be half the width of the page. If you want it to be centered, surround it with \begin{center} and \end{center}; if you want it to be wrapped by surrounding text, take a look at the wrapfig package.

Hope that helps.

  • thank you for your reply, I edit my question to show you the size that I want to reduce in my document – moradov Nov 17 '19 at 10:32
  • Your edit doesn't clarify much to me. You want the figure to be smaller? Then make your tcolorbox smaller. – dgoodmaniii Nov 17 '19 at 12:52
  • yes, i want to reduce it to be smaller in my document, how can i do that with tcolorbox, thank you – moradov Nov 17 '19 at 12:59
  • thank you very much for your help – moradov Nov 17 '19 at 19:30

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.