Image resizing #280
-
As discused in #49 about the image example. I have a lot of images in my markdown files but when I try to resize them the parser does nothing. Reading the documentation the parser only takes the name of the file and adjust the size to \textwidth. Is there any adittional option to include in order to resize any included image in markdown?
|
Beta Was this translation helpful? Give feedback.
Replies: 11 comments
-
As you discovered, there is currently no support for image resizing, although you can redefine the image renderer to extract additional information from the label, such as: ![250x250](example-image.png "An example image from Martin Scharrer's mwe package") Note that TeX does not deal in pixels, so the size only makes sense if you assume some depth per inch (such as 72 DPI, which is used on the web), and use this assumption to convert to units that TeX understands (250px at 72 DPI would be 3.47 inches or 8.81 cm, both of which are understood by TeX). There are many markdown syntax extensions that this package does not support, but I have not come across this one. Out of curiosity, which tool are you using that can resize images using this syntax? |
Beta Was this translation helpful? Give feedback.
-
My environment is Atom using the Markdown Preview package I also write in MacDown. My main OS is Mac OSX Mojave. Basically I just moved from MS Office and made my own latex template fed by markdown files. After a few online research I found this instructions in order to adjust the maximum size of any imported image.
Thanks for your fast reply, as far as I am understanding the markdown package I will write my own renderers in order to enhance this awesome package and I will post it. |
Beta Was this translation helpful? Give feedback.
-
Thank you for sharing your setup and your solution. The aim of the Markdown package is to allow the author to leverage both their knowledge of Markdown and their knowledge of (La)TeX. I am looking forward to seeing your renderers. As for the syntax extension, the Atom's Markdown Preview package seems to be using the Marked markdown parser. The documentation of Marked only claims the support of two Markdown flavors: CommonMark and GitHub Flavored Markdown. To my knowledge, neither flavor supports the above syntax for resizing images. However, if we manage to track down the origin (and the documentation) of this syntax extension, I am in favor of adding it to the Markdown package. |
Beta Was this translation helpful? Give feedback.
-
Any news on this, @rafaelzemog? |
Beta Was this translation helpful? Give feedback.
-
I'm compiling with pdflatex and include markdown like that:
I've tried it like that: But somehow text from markdown don't want to comply: But without markdown blocks it will work. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
@Migacz85 Not sure what kind of trick wrapfig uses that markdown breaks. Does it help to remove the |
Beta Was this translation helpful? Give feedback.
-
I should be more specific the last figure with correctly align picture is without tags |
Beta Was this translation helpful? Give feedback.
-
Here is what I meant: Enabling the |
Beta Was this translation helpful? Give feedback.
-
I just tested this, and unfortunately still doesn't work. I'm using hybrid
and when I pasted code for wrapping directly in Markdown the figure was on
the right, and the text was going on the figure.
…On Sat, 17 Dec 2022 at 20:45, Vít Novotný ***@***.***> wrote:
I should be more specific the last figure with correctly align picture is
without tags begin{markdown}, \end{markdown} .
Here is what I meant:
[image: 208254280-4e6124b7-35ae-4d1a-a7b6-448bd533a6e4.png]
<https://user-images.githubusercontent.com/603082/208265380-9dc08008-ec89-44c1-a2c3-4edf963db6dd.png>
Enabling the hybrid option should allow you to type LaTeX without
dropping out of the markdown environment.
—
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGEYMLOO7QTKOGLZTLP6KDTWNYQ63ANCNFSM4HLU3Q6A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
The \begin{wrapfigure}[20]{r}{0.4\textwidth} I am not sure how |
Beta Was this translation helpful? Give feedback.
-
Since #256 (to be released in version 2.22.0 of the Markdown package at the end of March), you can use the \documentclass{article}
\usepackage[linkAttributes]{markdown}
\begin{document}
\begin{markdown}
![example image](example-image.png "An example image from Martin Scharrer's mwe package"){width=250mm height=250mm}
\end{markdown}
\end{document} In the Markdown package for LaTeX, key-value attributes on images are passed to the |
Beta Was this translation helpful? Give feedback.
Since #256 (to be released in version 2.22.0 of the Markdown package at the end of March), you can use the
linkAttribute
option to specify attributes for links and images.In the Markdown package for LaTeX, key-value attributes on images are passed to the
\includegraphics
command by default, i.e. the above translates roughly to\includegraphics[width=250mm, height=250mm]{example-image.png}
.