Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:12:35+00:00 2026-05-28T08:12:35+00:00

Sounds like it should be a common problem, but I didn’t find an obvious

  • 0

Sounds like it should be a common problem, but I didn’t find an obvious trick.
Consider the knitr Rnw file below,

\documentclass[twocolumn, 12pt]{article}
\usepackage{graphicx}
\begin{document}
%\SweaveOpts{dev=pdf, fig.align=center}
\begin{figure*}
<<aaa, fig.width=8, fig.height=5, fig.show=hold>>=
plot(1,1)
@
\end{figure*}
\end{document}

I would like this wide figure to span two columns, using a {figure*} LaTeX environment. Is there a hook for that?

EDIT: wrapping the chunk in figure* gives the following output.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:12:36+00:00Added an answer on May 28, 2026 at 8:12 am

    Two facts:

    1. knitr makes everything accessible for you, so LaTeX tricks are often unnecessary;
    2. there is a chunk hook with which you can wrap your chunk results;

    A simple-minded solutions is:

    knit_hooks$set(chunk = function(x, options) {
                           sprintf('\\begin{figure*}\n%s\n\\end{figure*}', x)
    })
    

    I leave the rest of work to you to take care of more details in options (e.g. when options$fig.keep == 'none', you should not wrap the output in figure*). You may want to see how the default chunk hook for LaTeX is defined in knitr to know better how the chunk hook works.

    However, in this case, I tend to write the LaTeX code by myself in the document instead of automatically creating it. After you have got figure*, you may start to think about \caption{} and \label{} (not hard, but I still want to see them in LaTeX).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This sounds like a look-up-in-the-manual question to me, but I can't find it. Suppose
I know this sounds like a really obvious question, but it's proving harder to
I don't know if this is possible but it sounds like something that should
This sounds like it should be easy but for some reason it's not work
Sounds like a weird question, but say I have something like this: $.post( /myajax.php,
Sounds like a stupid question, doesn't it? But the page on the Jettison project
Sounds like a stupid question with an obvious answer :) Still I've ventured to
This sounds like a really simple question, but I am new to PHP. If
Sorry if this sounds like a really stupid question, but I need to make
I'm sure this sounds like a n00b question, but how do I add sub

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.