Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

2.2: Adding WeBWorK Problems to LibreTexts

  • Page ID
    72463
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    Adding WeBWorK problems to check for student understanding at appropriate places in your LibreTexts can keep students engaged and help them work out the details of definitions, concepts, and theorems.

    Although Adapt can allow you to incorporate graded "summative" problems (WeBWorK, H5P, MyOpenMath, etc.) into your LibreTexts, this tutorial will focus on various ways to insert WeBWorK problems into LibreText pages for formative feedback, i.e., to help students check and refine their understanding.

     

    Browsing Available WeBWorK Problems

    Two methods to browse available WeBWorK problems are:

    1. Use the Library Browser in any WeBWorK course on a WeBWorK server
    2. Use the LibreTexts Query Library to locate WeBWorK problems

    Library Browser: Once logged into a WeBWorK course with appropriate permissions, you can use the Library Browser link to search the contents of this library for appropriate problems to insert in your LibreTexts.  Here you will need the OPL address to insert a WeBWorK problem into a LibreTexts page.  We'll discuss this more below.

    If you do not have access to a WeBWorK server, it is possible that you could use the LibreTexts WeBWorK server to explore the OPL in this way.  If you are interested in this possibility, please request access.

    You may find this page about the WeBWorK OPL (Open Problem Library) helpful:  https://webwork.maa.org/wiki/Open_Problem_Library 

    Browsing Query:  First, you will need to access the LibreTexts Query WeBWorK library page.  Then you can use the topical folder names to dig through the contents of the OPL (Open Problem Library) that are housed in Query.  Note that what you'll need to insert a WeBWorK problem from Query is its page ID.  We'll discuss this more below.  Also note that you do NOT need to be logged in to Query to browse problems.

    One other thing to consider is that browsing Query may allow you to find other types of problems as well (not just WeBWorK).  And these can be inserted into LibreTexts pages using the same method as we show for a WeBWorK problem below.

     

    Inserting Formative WeBWorK Problems into a LibreTexts Page

    Even when used formatively, there are currently three methods to insert WeBWorK problems into your LibreTexts pages.  Each method has its advantages and the method you choose may depend to some degree on how much experience you have with WeBWorK.

    Inserting a WeBWorK Problem Using its OPL (Open Problem Library) Address

    This method is great for those who have access to WeBWorK and either know which problems they wish to use from their own assignments or can use the Library Browser in WeBWorK to locate appropriate problems and obtain their OPL address.

    Say we found a problem in the OPL with the following address that we want to insert.

    Library/Michigan/Chap7Sec1/Q77.pg

    Select Elements > Templates > Template:QueryWebWork

    WeBWorK Template.png
    Figure \(\PageIndex{1}\): Selecting the WeBWorK template to use with an OPL address.

    Once the template is added to the page, all you have to do is change the address of the problem to the one you located in the previous step.  Note that you will need to click on the + sign on the DekiScript object to open the attributes for the template.  See Figures \(\PageIndex{2}\) and \(\PageIndex{3}\) below.

    WeBWorKtemplate-closed.png
    Figure \(\PageIndex{2}\): New QueryWeBWorK template 
    WeBWorKtemplate-open.png
    Figure \(\PageIndex{3}\): QueryWeBWorK template opened

    Replacing the default OPL address in the code with the OPL WeBWorK problem address we found above gives us:

    WeBWorKtemplate-updated.png
    Figure \(\PageIndex{4}\): QueryWeBWorK template with new OPL problem address

    Once the page is saved, this will render the problem as:

    Query \(\PageIndex{1}\)

    Note that this problem is labeled as a Query even though it did not come from the Query database.  This is intentional, as these types of interactive questions are being called Queries in LibreTexts.

     

    Inserting a WeBWorK Problem Using its Query ID

    This method may be easier for anyone who is not as familiar with WeBWorK and/or who does not have access to a WeBWorK course and the OPL Library Browser.  It uses the page ID for the corresponding problem in the LibreTexts Query problem database.

    As mentioned above, another advantage of this approach is that it can be used to insert problems of any type that you find in the Query problem database.  Just find the page ID and insert it in the template as we show below and the problem will render in your LibreTexts page.

    Now from the Query database, let's say we found the following problem:

    WWdiffeqProblemInQuery.png
    Figure \(\PageIndex{5}\): WeBWorK problem in Query

    Note the Page ID: 21088 just below the problem title.  We will need this number to identify this problem in the template.

    Now select Elements > Templates > Template:BoxQuery

    BoxQuery Template.png
    Figure \(\PageIndex{6}\): Selecting the BoxQuery template to use with a Page ID.

    Once the template is added to the page, all you have to do is change the Page ID of the problem to the one you located in the previous step.  Note that you will need to click on the + sign on the DekiScript object to open the attributes for the template.  See Figures \(\PageIndex{7}\) and \(\PageIndex{8}\) below.

    WeBWorKtemplate-closed.png
    Figure \(\PageIndex{7}\): New BoxQuery template 
    WeBWorKtemplate-open.png
    Figure \(\PageIndex{8}\): BoxQuery template opened

    Replacing the default Page ID in the code with the Page ID for the WeBWorK problem we found in the Query database (21088) above gives us:

    WeBWorKtemplate-updated.png
    Figure \(\PageIndex{9}\): BoxQuery template with new Page ID

    Once the page is saved, this will render the problem as:

    Query \(\PageIndex{2}\)

    Note that we can update the PageIndex appropriately as we insert new Query problems.

     

    Inserting a WeBWorK Problem from Your own WeBWorK Server

    This method is ideal for inserting your own created or customized problems in a LibreTexts page.  It is currently still the least polished in its presentation, although this should soon be standardized to look like the other two methods above, using a new Template.  This page will be updated once this is accomplished.

    At this point, there is not a template for this method.  We will be editing the HTML version of the page directly.

    While editing the LibreTexts page that you wish to add a WeBWorK problem to, click the </> HTML button in the upper-right corner.  This button toggles the editing mode between WYSIWYG and HTML.  We can accomplish most editing tasks in LibreTexts without worrying about the HTML, but for this WeBWorK problem option, we need it.

    You can copy-and-paste the following code to modify it appropriately to create your linked WeBWorK problem.  The base WeBWorK server URL has been formatted to show it is code, but the rest of it should copy-and-paste correctly.

    <div><iframe frameborder="1" height="250" src="https://demo.webwork.rochester.edu/webwork2/html2xml?
    &amp;answersSubmitted=0&amp;
    &amp;sourceFilePath=Problems/CalcIII/DivCurl/ur_vc_12_9.pg&amp;
    &amp;problemSeed=123567&amp;
    &amp;courseID=seeburger_course&amp;
    &amp;userID=daemon&amp;
    &amp;course_password=daemon&amp;
    &amp;showSummary=1&amp;
    &amp;displayMode=MathJax&amp;
    &amp;problemIdentifierPrefix=102&amp;
    &amp;language=en&amp;
    &amp;outputformat=sticky" width="100%"></iframe></div>

    This code will generate the following WeBWorK problem, served up from an external WeBWorK server.  Although it is not really a custom problem, it could be.

    Note that you can specify your desired WeBWorK server and the path to the problem inside the course you set up for serving these problems.  The courseID is the course name, and you need to create a user named “daemon” with password “daemon” and permission set to “login_proctor” in that course.  Alternatively, you could use "anonymous" instead of "daemon".  Just be consistent.

    The path can be a Library problem too, although we recommend you use the QueryWebWork template described above unless you wish to use custom problems.

    You can use the Library Browser in the WeBWorK course you use to locate any problem available there, even in your local customized problem sets.

     

    Putting these WeBWorK Problems in a Query Box

    If you wish it to look more like the other problems, we can use the BoxQuery template for that, although there may soon be a custom template for this feature as well with appropriate parameters.

    Query \(\PageIndex{3}\)

    To get the problem inside of a Query Box, I added the BoxQuery template, then switched to HTML mode and replaced the code:


    <p class="mt-script-comment">Embed QUERY Assessment</p></br>
    <pre class="script"></br>
    template('query',{'PageID':'35292'});</pre>

     

    with the HTML code for the desired WeBWorK problem.

     


    2.2: Adding WeBWorK Problems to LibreTexts is shared under a CC BY-SA license and was authored, remixed, and/or curated by Paul Seeburger.

    • Was this article helpful?