Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to scale images in markdown #15

Closed
httpete-ire opened this issue Oct 22, 2015 · 9 comments
Closed

ability to scale images in markdown #15

httpete-ire opened this issue Oct 22, 2015 · 9 comments

Comments

@httpete-ire
Copy link

When I insert a figure it scales to the width of the PDF, this makes some of my images too large. Is it possible to change the scale / size of the image using markdown or LaTex, although I'm not too familiar with LaTex.

Nice job setting this up, I hate word and am much more productive in markdown 👍

@tompollard
Copy link
Owner

Thanks Pete - I'm the same with markdown! As far as I know there's no clean way for specifying image size right now, but the functionality is imminent. I'll add this point to the readme to make it clear.

For more information, see: jgm/pandoc#261 (summary - the Pandoc fix is on a branch waiting to be merged). If it's urgent, we could work out a temporary fix in the meantime...

tompollard added a commit that referenced this issue Oct 22, 2015
@httpete-ire
Copy link
Author

Thanks Tom thats great, hopefully it gets sorted soon.

I tried inserting images this way https://www.sharelatex.com/learn/Inserting_Images but I get [pdf] Error 43 when I try to output the PDF. Do you know of a way I can manually insert the image and alter their size

@tompollard
Copy link
Owner

Hey Pete,

One option that works for me is replacing the pdf image with a resized jpg (for example, the following 200 x 200 pixel jpg):

example_figure

...and then updating the file type in the chunk that imports the figure:

\label{ref_a_figure}](source/figures/example_figure.jpg)

Not a perfect solution, but does this meet your needs for now?

@httpete-ire
Copy link
Author

thats awesome Tom, I never thought of that.

I'm sorry for asking so many questions but I dont know if this is a bug or an issue with my markup

I have the following markup

### Documentation platform

The platform \ref{platform_model} is composed of three main components: the client side application, a RESTful API and the database layer.

![Platform model \label{platform_model}](source/figures/platform_model.png)

#### Client side application

A client side application lets you decouple the presentation of data and business logic from the server to the client. It is responsible for displaying the user interface, handling user input and retrieving data from the RESTful API.

I would expect the 'platform_model' image to be above the Client side application section, however it is not (see image)

screen shot 2015-10-23 at 7 11 27 p m

I did find a quick solution using

![Platform model \label{platform_model}](source/figures/platform_model.png) \newline

however, the figure reference stopped working

Am I doing something wrong or is this a bug?

Sorry for the hassle

@tompollard
Copy link
Owner

Hi Pete,

Am I doing something wrong or is this a bug?

If you get an error when compiling, it's useful to add Pandoc's verbose flag to the Makefile:

pdf:
    pandoc "$(INPUTDIR)"/*.md \
        more stuff here... \
    --verbose

It looks like adding the \newline errors with "! LaTeX Error: There's no line here to end", the same error that you would get if you added newline on an empty line. Not really a bug, just not appropriate use of the command.

The problem is that your image doesn't fit between the sentence containing the citation and the end of the page. Either you have white space here or you allow the following sentence to flow before the image is placed. If you're happy with white space, you should be able to use "\newpage" to get the kind of layout that you're looking for.

One interesting side point is that it looks like Pandoc hard codes image placement with the htbp options. You can overwrite these options in the source/style/template.tex file if you want to play around with the float behaviour:

% Overwrite \begin{figure}[htbp] with \begin{figure}[H]
\usepackage{float}
\let\origfigure=\figure
\let\endorigfigure=\endfigure
\renewenvironment{figure}[1][]{%
\origfigure[b]
}{%
\endorigfigure
}

@httpete-ire
Copy link
Author

Hi Tom,

Got it working with your help, really appreciate it.

Sorry for being annoying but I have one more question (probably a stupid question), is it possible to sort the references by citation order?

I tried \bibliographystyle{unsrt} in the preamble file but that didnt seem to work.

@tompollard
Copy link
Owner

Hi Pete, glad to hear you worked it out.

The reference style is defined in the following file:
https://github.com/tompollard/phd_thesis_markdown/blob/master/style/ref_format.csl

If you'd like to change to a different style, just overwrite the content with an alternative CSL definition from: http://citationstyles.org/

The Vancouver style may be what you are looking for:
https://github.com/citation-style-language/styles/blob/master/vancouver.csl

Hope this helps,
Tom

@rudolfbyker
Copy link

For people arriving via Google, or from clicking through the readme:

![my_caption \label{my_label}](source/figures/my_image.pdf){ width=50% }

Source: http://pandoc.org/MANUAL.html#extension-link_attributes

tompollard added a commit that referenced this issue Dec 15, 2016
@tompollard
Copy link
Owner

thanks @rudolfbyker, I've added an example of this syntax to the template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants