diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 75ae9cad..7f52a9cc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,11 +7,15 @@ spec-generate: - apt-get update -qq - apt-get install -y -qq gcc git python3 python3-termcolor python3-pytest ruby - apt-get install -y -qq cmake bison flex libffi-dev libxml2-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev ttf-lyx + # Force-install an older version of i18n so the 1.5.2 version, which + # won't work with ruby 2.1, doesn't abort the CI job when installing + # other gems which need it. + - gem install i18n -v 1.5.1 - gem install asciidoctor asciidoctor-mathematical coderay json-schema script: - - ./makeAllExts QUIET= -j${nproc} -Otarget html styleguide registry manhtmlpages checkinc checklinks validusage - # Internal self-test of the script + # Internal self-test of the check_spec_links script - ( cd xml && py.test-3 ) + - mkdir -p out/checks - xml/check_spec_links.py --html=out/checks/problems.html > /dev/null || true # Breaking the build if # of errors increases. We should manually ratchet ignore_count down as errors get fixed. # If there are unfixable errors, add '--ignore_count #' where '#' is the @@ -19,6 +23,8 @@ spec-generate: # errors" but simpler than the alternatives (running against master, # diff, etc) - xml/check_spec_links.py -Werror --ignore_count 0 + # Build the actual spec + - ./makeAllExts QUIET= -j${nproc} -Otarget checkinc checklinks validusage html styleguide registry manhtmlpages artifacts: when: always paths: diff --git a/ChangeLog.txt b/ChangeLog.txt index a90178c6..74fb9461 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -8,6 +8,54 @@ public pull requests that have been accepted. ----------------------------------------------------- +Change log for February 3, 2019 Vulkan 1.1.99 spec update: + + * Update release number to 99. + +Public Issues: + + * Add missing pname:pMemoryHostPointerProperties description to + flink:vkGetMemoryHostPointerPropertiesEXT.txt (public pull request 896). + * Minor markup fixes (public pull request 900). + * Minor update to `khronos.css` and markup fixes (originally proposed in + public pull request 901, but done via an internal MR). + +Internal Issues: + + * Document restrictions on image queries for Y'CbCr formats in the + <> table as well as + for slink:sname:VkImageFormatProperties and slink:VkImageCreateInfo + (internal issue 1361). + * Correct type of the code:FragSizeEXT built-in in the + <> section (internal + issue 1526). + * Clean up math in the <> chapter by + refactoring, using better naming conventions, updating diagrams to use + the correct orientation, etc. (internal merge request 2968). + * Fix minor typos for slink:VkImageCreateInfo and + slink:VkImageStencilUsageCreateInfoEXT. + * Add missing documentation for tlink:VkResolveModeFlagsKHR. + * Fix extension dependency of pname:scalarBlockLayout in the + <> section. + * Fix indexing math for shader binding table calculations in the + <> section, and use + spelling "`any-hit`" consistently. + * Reconcile valid usage statement and text for sampled image layouts in + slink:VkWriteDescriptorSet + (https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/551). + * Make SPIR-V code:OpConvertUToPtr and code:OpConvertPtrToU operations + require a 64-bit integer for physical storage buffer pointers in the + <> + section. + * Update to KaTeX 10.0. + +New Extensions: + + * `VK_EXT_filter_cubic` + * `VK_NV_dedicated_allocation_image_aliasing` + +----------------------------------------------------- + Change log for January 13, 2019 Vulkan 1.1.98 spec update: * Update release number to 98. diff --git a/Makefile b/Makefile index 2f7bd81e..a406d606 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ VERBOSE = # ADOCOPTS options for asciidoc->HTML5 output NOTEOPTS = -a editing-notes -a implementation-guide -PATCHVERSION = 98 +PATCHVERSION = 99 ifneq (,$(findstring VK_VERSION_1_1,$(VERSIONS))) SPECREVISION = 1.1.$(PATCHVERSION) else diff --git a/appendices/VK_EXT_filter_cubic.txt b/appendices/VK_EXT_filter_cubic.txt new file mode 100644 index 00000000..66e3926d --- /dev/null +++ b/appendices/VK_EXT_filter_cubic.txt @@ -0,0 +1,35 @@ +include::meta/VK_EXT_filter_cubic.txt[] + +*Last Modified Date*:: + 2019-01-24 +*Contact + - Bill Licea-Kane, Qualcomm Technologies, Inc. +*Contributors*:: + - Andrew Garrard, Samsung + - Daniel Koch, NVIDIA + - Donald Scorgie, Imagination Technologies + - Graeme Leese, Broadcom + - Jan-Herald Fredericksen, ARM + - Jeff Leger, Qualcomm Technologies, Inc. + - Tobias Hector, AMD + - Tom Olson, ARM + - Stuart Smith, Imagination Technologies + +`VK_EXT_filter_cubic` extends VK_IMG_filter_cubic. + +It documents cubic filtering of other image view types. +It adds new structures which may be added to the pname:pNext chain of +VkPhysicalDeviceImageFormatInfo2 and VkImageFormatProperties2 which can: be +used to determine which image types and which image view types support cubic +filtering. + +=== New Structures + + * slink:VkPhysicalDeviceImageViewImageFormatInfoEXT + * slink:VkFilterCubicImageViewImageFormatPropertiesEXT + + +=== Version History + + * Revision 1, 2019-01-24 (wwlk) + - Initial version diff --git a/appendices/VK_KHR_vulkan_memory_model.txt b/appendices/VK_KHR_vulkan_memory_model.txt old mode 100755 new mode 100644 diff --git a/appendices/VK_NV_dedicated_allocation_image_aliasing.txt b/appendices/VK_NV_dedicated_allocation_image_aliasing.txt new file mode 100644 index 00000000..372921a7 --- /dev/null +++ b/appendices/VK_NV_dedicated_allocation_image_aliasing.txt @@ -0,0 +1,48 @@ +include::meta/VK_NV_dedicated_allocation_image_aliasing.txt[] + +*Last Modified Date*:: + 2019-01-04 +*Contributors*:: + - Nuno Subtil, NVIDIA + - Jeff Bolz, NVIDIA + - Eric Werness, NVIDIA + - Axel Gneiting, id Software + + +This extension allows applications to alias images on dedicated allocations, +subject to specific restrictions: the extent and the number of layers in the +image being aliased must be smaller than or equal to those of the original +image for which the allocation was created, and every other image parameter +must match. + + +=== New Object Types + +None. + +=== New Enum Constants + + * Extending elink:VkStructureType + ** ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV + +=== New Enums + +None. + +=== New Structures + + * slink:VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV + +=== New Functions + +None. + +=== Issues + +None. + + +=== Version History + + * Revision 1, 2019-01-04 (Nuno Subtil) + - Internal revisions diff --git a/appendices/memorymodel.txt b/appendices/memorymodel.txt old mode 100755 new mode 100644 diff --git a/appendices/spirvenv.txt b/appendices/spirvenv.txt index 08960ef2..561b6d26 100644 --- a/appendices/spirvenv.txt +++ b/appendices/spirvenv.txt @@ -857,11 +857,11 @@ ifdef::VK_EXT_transform_feedback[] endif::VK_EXT_transform_feedback[] ifdef::VK_NV_ray_tracing[] * code:RayPayloadNV storage class must: only be used in ray generation, - any hit, closest hit or miss shaders. + any-hit, closest hit or miss shaders. * code:IncomingRayPayloadNV storage class must: only be used in closest - hit, any hit, or miss shaders. + hit, any-hit, or miss shaders. * code:HitAttributeNV storage class must: only be used in intersection, - any hit, or closest hit shaders. + any-hit, or closest hit shaders. * code:CallableDataNV storage class must: only be used in ray generation, closest hit, miss, and callable shaders. * code:IncomingCallableDataNV storage class must only be used in callable @@ -889,6 +889,8 @@ ifdef::VK_EXT_buffer_device_address[] ** Any access chain instruction that accesses into a code:RowMajor matrix must: only be used as the code:Pointer operand to code:OpLoad or code:OpStore. + ** code:OpConvertUToPtr and code:OpConvertPtrToU must: use an integer type + whose code:Width is 64. endif::VK_EXT_buffer_device_address[] diff --git a/chapters/VK_NVX_device_generated_commands/generation.txt b/chapters/VK_NVX_device_generated_commands/generation.txt index 58ab896f..13f77859 100644 --- a/chapters/VK_NVX_device_generated_commands/generation.txt +++ b/chapters/VK_NVX_device_generated_commands/generation.txt @@ -139,15 +139,15 @@ include::../../api/structs/VkCmdProcessCommandsInfoNVX.txt[] If pname:targetCommandBuffer is provided, the pname:maxSequencesCount must: not exceed the reservation's pname:maxSequencesCount * [[VUID-VkCmdProcessCommandsInfoNVX-sequencesCountBuffer-01338]] - If pname:sequencesCountBuffer is used, its usage flag must: have - the ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set + If pname:sequencesCountBuffer is used, its usage flag must: have the + ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set * [[VUID-VkCmdProcessCommandsInfoNVX-sequencesCountBuffer-01339]] If pname:sequencesCountBuffer is used, pname:sequencesCountOffset must: be aligned to sname:VkDeviceGeneratedCommandsLimitsNVX::pname:minSequenceCountBufferOffsetAlignment * [[VUID-VkCmdProcessCommandsInfoNVX-sequencesIndexBuffer-01340]] - If pname:sequencesIndexBuffer is used, its usage flag must: have - the ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set + If pname:sequencesIndexBuffer is used, its usage flag must: have the + ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set * [[VUID-VkCmdProcessCommandsInfoNVX-sequencesIndexBuffer-01341]] If pname:sequencesIndexBuffer is used, pname:sequencesIndexOffset must: be aligned to diff --git a/chapters/VK_NV_ray_tracing/raytracing-pipelines.txt b/chapters/VK_NV_ray_tracing/raytracing-pipelines.txt index dc978f82..67d6efb1 100644 --- a/chapters/VK_NV_ray_tracing/raytracing-pipelines.txt +++ b/chapters/VK_NV_ray_tracing/raytracing-pipelines.txt @@ -143,7 +143,7 @@ include::../../api/structs/VkRayTracingShaderGroupCreateInfoNV.txt[] ename:VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV or ename:VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV and ename:VK_SHADER_UNUSED_NV otherwise. - * pname:anyHitShader is the optional index of the any hit shader from + * pname:anyHitShader is the optional index of the any-hit shader from sname:VkRayTracingPipelineCreateInfoNV::pname:pStages in the group if the shader group has pname:type of ename:VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV or diff --git a/chapters/VK_NV_ray_tracing/raytracing-shaders.txt b/chapters/VK_NV_ray_tracing/raytracing-shaders.txt index cdc43b93..5bf40425 100644 --- a/chapters/VK_NV_ray_tracing/raytracing-shaders.txt +++ b/chapters/VK_NV_ray_tracing/raytracing-shaders.txt @@ -55,13 +55,13 @@ forcibly terminated. The any-hit shader is executed after the intersection shader reports an intersection that lies within the current [eq]#[tmin,tmax]# of the ray. -The main use of any hit shaders is to programmatically decide whether or not +The main use of any-hit shaders is to programmatically decide whether or not an intersection will be accepted. The intersection will be accepted unless the shader calls the code:OpIgnoreIntersectionNV instruction. [[shaders-any-hit-execution]] -=== Any Hit Shader Execution +=== Any-Hit Shader Execution The order in which intersections are found along a ray, and therefore the order in which any-hit shaders are executed, is unspecified. diff --git a/chapters/VK_NV_ray_tracing/raytracing.txt b/chapters/VK_NV_ray_tracing/raytracing.txt index d09052d0..f3f3ac14 100644 --- a/chapters/VK_NV_ray_tracing/raytracing.txt +++ b/chapters/VK_NV_ray_tracing/raytracing.txt @@ -319,37 +319,68 @@ The code:sbtRecordStride and code:sbtRecordOffset values are passed in as parameters to code:traceNV() calls made in the shaders. See Section 8.19 (Ray Tracing Functions) of the OpenGL Shading Language Specification for more details. +In SPIR-V, these correspond to the code:SBTOffset and code:SBTStride +parameters to the code:OpTraceNV instruction. The result of this computation is then added to -pname:hitProgramShaderBindingTableBaseIndex, a base index passed to +pname:hitShaderBindingOffset, a base offset passed to flink:vkCmdTraceRaysNV. -The complete rule to compute a hit shader binding table record index is: +The complete rule to compute a hit shader binding table record address in +the pname:hitShaderBindingTableBuffer is: - :: [eq]#code:instanceShaderBindingTableRecordOffset {plus} - code:hitProgramShaderBindingTableBaseIndex {plus} _geometryIndex_ - {times} code:sbtRecordStride {plus} code:sbtRecordOffset# + :: [eq]#pname:hitShaderBindingOffset {plus} pname:hitShaderBindingStride + {times} ( code:instanceShaderBindingTableRecordOffset {plus} + _geometryIndex_ {times} code:sbtRecordStride {plus} + code:sbtRecordOffset )# ==== Miss Shaders -A Miss shader is executed whenever a ray query fails to find an intersection +A miss shader is executed whenever a ray query fails to find an intersection for the given scene geometry. Multiple miss shaders may: be executed throughout a ray tracing dispatch. The base for the computation of miss shader locations is -code:missProgramShaderBindingTableBaseIndex, a base index passed into +pname:missShaderBindingOffset, a base offset passed into flink:vkCmdTraceRaysNV. The code:missIndex value is passed in as parameters to code:traceNV() calls made in the shaders. See Section 8.19 (Ray Tracing Functions) of the OpenGL Shading Language Specification for more details. +In SPIR-V, this corresponds to the code:MissIndex parameter to the +code:OpTraceNV instruction. -The complete rule to compute a miss shader binding table record address is: +The complete rule to compute a miss shader binding table record address in +the pname:missShaderBindingTableBuffer is: - :: [eq]#code:missProgramShaderBindingTableBaseIndex {times} - pname:missShaderBindingStride {plus} code:missIndex# + :: [eq]#pname:missShaderBindingOffset {plus} pname:missShaderBindingStride + {times} code:missIndex# + + +==== Callable Shaders + +A callable shader is executed when requested by a ray tracing shader. +Multiple callable shaders may: be executed throughout a ray tracing +dispatch. + +The base for the computation of callable shader locations is +code:callableShaderBindingOffset, a base offset passed into +flink:vkCmdTraceRaysNV. + +The code:sbtRecordIndex value is passed in as a parameter to +code:executeCallableNV() calls made in the shaders. +See Section 8.19 (Ray Tracing Functions) of the OpenGL Shading Language +Specification for more details. +In SPIR-V, this corresponds to the code:SBTIndex parameter to the +code:OpExecuteCallableNV instruction. + +The complete rule to compute a callable shader binding table record address +in the pname:callableShaderBindingTableBuffer is: + + :: [eq]#code:callableShaderBindingOffset {plus} + pname:callableShaderBindingStride {times} code:sbtRecordIndex# [[acceleration-structure]] diff --git a/chapters/copies.txt b/chapters/copies.txt index d999ae9d..655cf76b 100644 --- a/chapters/copies.txt +++ b/chapters/copies.txt @@ -1615,16 +1615,16 @@ endif::VK_KHR_shared_presentable_image[] If pname:filter is ename:VK_FILTER_LINEAR, then the <> of pname:srcImage must: contain ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdBlitImage-filter-02002]] - If pname:filter is ename:VK_FILTER_CUBIC_IMG, then the + If pname:filter is ename:VK_FILTER_CUBIC_EXT, then the <> of pname:srcImage must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT. * [[VUID-vkCmdBlitImage-filter-00237]] - If pname:filter is ename:VK_FILTER_CUBIC_IMG, pname:srcImage must: have + If pname:filter is ename:VK_FILTER_CUBIC_EXT, pname:srcImage must: have a elink:VkImageType of ename:VK_IMAGE_TYPE_2D -endif::VK_IMG_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1[] * [[VUID-vkCmdBlitImage-commandBuffer-01834]] If pname:commandBuffer is an unprotected command buffer, then diff --git a/chapters/descriptorsets.txt b/chapters/descriptorsets.txt index dafa3ff9..935c0755 100644 --- a/chapters/descriptorsets.txt +++ b/chapters/descriptorsets.txt @@ -2746,10 +2746,10 @@ endif::VULKAN_1_1,VK_KHR_sampler_ycbcr_conversion[] * [[VUID-VkWriteDescriptorSet-descriptorType-01403]] If pname:descriptorType is ename:VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE or ename:VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, the pname:imageLayout - member of each element of pname:pImageInfo must: be - ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, - ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL or - ename:VK_IMAGE_LAYOUT_GENERAL + member of each element of pname:pImageInfo must: be a member of the list + given in <> or + <>, + corresponding to its type * [[VUID-VkWriteDescriptorSet-descriptorType-00338]] If pname:descriptorType is ename:VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, the pname:imageView member of each element of pname:pImageInfo must: @@ -2871,8 +2871,8 @@ include::../api/structs/VkDescriptorBufferInfo.txt[] ==== When setting pname:range to ename:VK_WHOLE_SIZE, the effective range must: not be larger than the maximum range for the descriptor type -(<> or -<>). +(<> or +<>). This means that ename:VK_WHOLE_SIZE is not typically useful in the common case where uniform buffer descriptors are suballocated from a buffer that is much larger than pname:maxUniformBufferRange. diff --git a/chapters/dispatch.txt b/chapters/dispatch.txt index 10d9bc4a..162358b4 100644 --- a/chapters/dispatch.txt +++ b/chapters/dispatch.txt @@ -104,18 +104,36 @@ local workgroups is assembled. result of this command, then the image view's <> must: contain ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDispatch-None-02006]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT. +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDispatch-None-00400]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDispatch-filterCubic-02609]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDispatch-filterCubicMinmax-02610]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1[] * [[VUID-vkCmdDispatch-commandBuffer-01844]] If pname:commandBuffer is an unprotected command buffer, and any @@ -240,18 +258,36 @@ at pname:offset. result of this command, then the image view's <> must: contain ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDispatchIndirect-None-02008]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT. +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDispatchIndirect-None-00416]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDispatchIndirect-filterCubic-02611]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDispatchIndirect-filterCubicMinmax-02612]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1[] * [[VUID-vkCmdDispatchIndirect-commandBuffer-01847]] If pname:commandBuffer is an unprotected command buffer, and any diff --git a/chapters/drawing.txt b/chapters/drawing.txt index 84299b2b..39730c0e 100644 --- a/chapters/drawing.txt +++ b/chapters/drawing.txt @@ -632,18 +632,36 @@ The assembled primitives execute the bound graphics pipeline. result of this command, then the image view's <> must: contain ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDraw-None-02010]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDraw-None-00452]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDraw-filterCubic-02613]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDraw-filterCubicMinmax-02614]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDraw-maxMultiviewInstanceIndex-00453]] If the draw is recorded in a render pass instance with multiview @@ -777,9 +795,9 @@ The assembled primitives execute the bound graphics pipeline. ename:VK_PIPELINE_BIND_POINT_GRAPHICS requires any dynamic state, that state must: have been set on the current command buffer * [[VUID-vkCmdDrawIndexed-indexSize-00463]] - [eq]#(code:indexSize * (pname:firstIndex {plus} pname:indexCount) - {plus} pname:offset)# must: be less than or equal to the size of the - bound index buffer, with code:indexSize being based on the type specified by + [eq]#(code:indexSize * (pname:firstIndex {plus} pname:indexCount) {plus} + pname:offset)# must: be less than or equal to the size of the bound + index buffer, with code:indexSize being based on the type specified by pname:indexType, where the index buffer, pname:indexType, and pname:offset are specified via fname:vkCmdBindIndexBuffer * [[VUID-vkCmdDrawIndexed-None-00464]] @@ -826,18 +844,36 @@ The assembled primitives execute the bound graphics pipeline. * [[VUID-vkCmdDrawIndexed-None-01500]] Image subresources used as attachments in the current render pass must: not be accessed in any way other than as an attachment by this command. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndexed-None-02012]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndexed-None-00472]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDrawIndexed-filterCubic-02615]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDrawIndexed-filterCubicMinmax-02616]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDrawIndexed-maxMultiviewInstanceIndex-00473]] If the draw is recorded in a render pass instance with multiview @@ -1029,18 +1065,36 @@ If pname:drawCount is less than or equal to one, pname:stride is ignored. * [[VUID-vkCmdDrawIndirect-None-01501]] Image subresources used as attachments in the current render pass must: not be accessed in any way other than as an attachment by this command. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndirect-None-02014]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndirect-None-00498]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDrawIndirect-filterCubic-02617]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDrawIndirect-filterCubicMinmax-02618]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDrawIndirect-maxMultiviewInstanceIndex-00499]] If the draw is recorded in a render pass instance with multiview @@ -1277,18 +1331,36 @@ located at pname:countBufferOffset and use this as the draw count. * [[VUID-vkCmdDrawIndirectCountKHR-None-03131]] Image subresources used as attachments in the current render pass must: not be accessed in any way other than as an attachment by this command. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndirectCountKHR-None-02016]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndirectCountKHR-None-03170]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDrawIndirectCountKHR-filterCubic-02619]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDrawIndirectCountKHR-filterCubicMinmax-02620]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDrawIndirectCountKHR-maxMultiviewInstanceIndex-03132]] If the draw is recorded in a render pass instance with multiview @@ -1690,18 +1762,36 @@ If pname:drawCount is less than or equal to one, pname:stride is ignored. * [[VUID-vkCmdDrawIndexedIndirect-None-01503]] Image subresources used as attachments in the current render pass must: not be accessed in any way other than as an attachment by this command. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndexedIndirect-None-02019]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndexedIndirect-None-00550]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDrawIndexedIndirect-filterCubic-02621]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDrawIndexedIndirect-filterCubicMinmax-02622]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDrawIndexedIndirect-maxMultiviewInstanceIndex-00551]] If the draw is recorded in a render pass instance with multiview @@ -1773,11 +1863,11 @@ the similarly named parameters of flink:vkCmdDrawIndexed. entirely contained within the corresponding vertex buffer binding, as described in <> * [[VUID-VkDrawIndexedIndirectCommand-indexSize-00553]] - [eq]#(code:indexSize * (pname:firstIndex {plus} pname:indexCount) - {plus} pname:offset)# must: be less than or equal to the size of the - bound index buffer, with code:indexSize being based on the type - specified by pname:indexType, where the index buffer, pname:indexType, - and pname:offset are specified via fname:vkCmdBindIndexBuffer + [eq]#(code:indexSize * (pname:firstIndex {plus} pname:indexCount) {plus} + pname:offset)# must: be less than or equal to the size of the bound + index buffer, with code:indexSize being based on the type specified by + pname:indexType, where the index buffer, pname:indexType, and + pname:offset are specified via fname:vkCmdBindIndexBuffer * [[VUID-VkDrawIndexedIndirectCommand-firstInstance-00554]] If the <> @@ -1946,18 +2036,36 @@ located at pname:countBufferOffset and use this as the draw count. * [[VUID-vkCmdDrawIndexedIndirectCountKHR-None-03163]] Image subresources used as attachments in the current render pass must: not be accessed in any way other than as an attachment by this command. -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndexedIndirectCountKHR-None-02021]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG. + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndexedIndirectCountKHR-None-03173]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDrawIndexedIndirectCountKHR-filterCubic-02623]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDrawIndexedIndirectCountKHR-filterCubicMinmax-02624]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDrawIndexedIndirectCountKHR-maxMultiviewInstanceIndex-03164]] If the draw is recorded in a render pass instance with multiview @@ -2372,18 +2480,36 @@ The effective pname:firstVertex is zero. result of this command, then the image view's <> must: contain ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndirectByteCountEXT-None-02306]] - If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_IMG as a + If a sname:VkImageView is sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command, then the image view's <> must: contain - ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG + ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT +ifndef::VK_EXT_filter_cubic[] * [[VUID-vkCmdDrawIndirectByteCountEXT-None-02307]] - Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_IMG as a + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a result of this command must: not have a elink:VkImageViewType of ename:VK_IMAGE_VIEW_TYPE_3D, ename:VK_IMAGE_VIEW_TYPE_CUBE, or ename:VK_IMAGE_VIEW_TYPE_CUBE_ARRAY -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] + * [[VUID-vkCmdDrawIndirectByteCountEXT-filterCubic-02625]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT as a + result of this command must: have a elink:VkImageViewType and format + that supports cubic filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubic + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 + * [[VUID-vkCmdDrawIndirectByteCountEXT-filterCubicMinmax-02626]] + Any slink:VkImageView being sampled with ename:VK_FILTER_CUBIC_EXT with + a reduction mode of either VK_SAMPLER_REDUCTION_MODE_MIN_EXT or + VK_SAMPLER_REDUCTION_MODE_MAX_EXT as a result of this command must: have + a elink:VkImageViewType and format that supports cubic filtering + together with minmax filtering, as specified by + sname:VkFilterCubicImageViewImageFormatPropertiesEXT::pname:filterCubicMinmax + returned by fname:vkGetPhysicalDeviceImageFormatProperties2 +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] * [[VUID-vkCmdDrawIndirectByteCountEXT-maxMultiviewInstanceIndex-02308]] If the draw is recorded in a render pass instance with multiview diff --git a/chapters/features.txt b/chapters/features.txt old mode 100755 new mode 100644 index f23cd8ec..417a45d9 --- a/chapters/features.txt +++ b/chapters/features.txt @@ -1955,6 +1955,36 @@ include::../validity/structs/VkPhysicalDeviceBufferAddressFeaturesEXT.txt[] endif::VK_EXT_buffer_device_address[] +ifdef::VK_NV_dedicated_allocation_image_aliasing[] + +[open,refpage='VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV',desc='Structure describing dedicated allocation image aliasing features that can be supported by an implementation',type='structs'] +-- +The sname:VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV +structure is defined as: + +include::../api/structs/VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV.txt[] + +The members of the +sname:VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV structure +describe the following features: + + * [[features-features-dedicatedAllocationImageAliasing]] + pname:dedicatedAllocationImageAliasing indicates that the implementation + supports aliasing of compatible image objects on a dedicated allocation. + +If the sname:VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV +structure is included in the pname:pNext chain of +slink:VkPhysicalDeviceFeatures2KHR, it is filled with values indicating +whether each feature is supported. +sname:VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV can: also +be used in the pname:pNext chain of slink:VkDeviceCreateInfo to enable +features. + +include::../validity/structs/VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV.txt[] +-- + +endif::VK_NV_dedicated_allocation_image_aliasing[] + [[features-features-requirements]] === Feature Requirements @@ -2012,19 +2042,21 @@ ifdef::VK_EXT_descriptor_indexing[] pname:descriptorBindingPartiallyBound>> ** <> +endif::VK_EXT_descriptor_indexing[] ifdef::VK_EXT_inline_uniform_block[] * <>, if the `<>` extension is supported. +ifdef::VK_EXT_descriptor_indexing[] * <>, if the `<>` and `<>` extensions are both supported. +endif::VK_EXT_descriptor_indexing[] endif::VK_EXT_inline_uniform_block[] ifdef::VK_EXT_scalar_block_layout[] - * If the `<>` extension is supported: - ** <> + * <>, if the + `<>` extension is supported. endif::VK_EXT_scalar_block_layout[] -endif::VK_EXT_descriptor_indexing[] All other features defined in the Specification are optional:. @@ -2859,7 +2891,6 @@ endif::VK_KHR_push_descriptor[] ifdef::VK_VERSION_1_1,VK_KHR_multiview[] [open,refpage='VkPhysicalDeviceMultiviewProperties',desc='Structure describing multiview limits that can be supported by an implementation',type='structs'] - -- The sname:VkPhysicalDeviceMultiviewProperties structure is defined as: @@ -6965,17 +6996,17 @@ ifdef::VK_EXT_sampler_filter_minmax[] This bit must: only be exposed for formats that also support the ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT. endif::VK_EXT_sampler_filter_minmax[] -ifdef::VK_IMG_filter_cubic[] - * ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG specifies +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] + * ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT specifies that sname:VkImage can: be used with a sampler that has either of - pname:magFilter or pname:minFilter set to ename:VK_FILTER_CUBIC_IMG, or + pname:magFilter or pname:minFilter set to ename:VK_FILTER_CUBIC_EXT, or be the source image for a blit with pname:filter set to - ename:VK_FILTER_CUBIC_IMG. + ename:VK_FILTER_CUBIC_EXT. This bit must: only be exposed for formats that also support the ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT. If the format being queried is a depth/stencil format, this only specifies that the depth aspect is cubic filterable. -endif::VK_IMG_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] * ename:VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT specifies that an application can: define a <>, or <>. |==== -ifdef::VK_IMG_filter_cubic[] -ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG must: be -supported for the following formats: +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] +If cubic filtering is supported, +ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT must: be +supported for the following image view types: + + * ename:VK_IMAGE_VIEW_TYPE_1D + * ename:VK_IMAGE_VIEW_TYPE_1D_ARRAY + * ename:VK_IMAGE_VIEW_TYPE_2D + * ename:VK_IMAGE_VIEW_TYPE_2D_ARRAY + +for the following formats: * ename:VK_FORMAT_R4G4_UNORM_PACK8 * ename:VK_FORMAT_R4G4B4A4_UNORM_PACK16 @@ -7794,8 +7833,14 @@ supported for the following formats: * ename:VK_FORMAT_A8B8G8R8_SINT_PACK32 * ename:VK_FORMAT_A8B8G8R8_SRGB_PACK32 -If ETC2 compressed formats are supported, the following additional formats -must: support ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG: +If ETC compressed formats are supported, +ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT must: be +supported for the following image view types: + + * ename:VK_IMAGE_VIEW_TYPE_2D + * ename:VK_IMAGE_VIEW_TYPE_2D_ARRAY + +for the following additional formats: * ename:VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK * ename:VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK @@ -7803,7 +7848,21 @@ must: support ename:VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG: * ename:VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK * ename:VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK * ename:VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK -endif::VK_IMG_filter_cubic[] + +If cubic filtering is supported for any other uncompressed formats, the +following image view types must: be supported for those formats: + + * ename:VK_IMAGE_VIEW_TYPE_1D + * ename:VK_IMAGE_VIEW_TYPE_1D_ARRAY + * ename:VK_IMAGE_VIEW_TYPE_2D + * ename:VK_IMAGE_VIEW_TYPE_2D_ARRAY + +If cubic filtering is supported for any other compressed formats, the +following image view types must: be supported for those formats: + + * ename:VK_IMAGE_VIEW_TYPE_2D + * ename:VK_IMAGE_VIEW_TYPE_2D_ARRAY +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] @@ -7856,7 +7915,8 @@ s| Format s| Planes | ename:VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM | 3 | | | | | | | | | | | ename:VK_FORMAT_G16_B16R16_2PLANE_422_UNORM | 2 | | | | | | | | | | | ename:VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM | 3 | | | | | | | | | | -12+| Format features marked {sym1} must: be supported only if slink:VkPhysicalDeviceSamplerYcbcrConversionFeatures is enabled +12+| Format features marked {sym1} must: be supported only if slink:VkPhysicalDeviceSamplerYcbcrConversionFeatures is enabled, +and only with elink:VkImageType ename:VK_IMAGE_TYPE_2D |==== Implementations are not required to support the @@ -7980,16 +8040,17 @@ ifdef::VK_EXT_fragment_density_map[] ** pname:flags contains ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT endif::VK_EXT_fragment_density_map[] * pname:maxArrayLayers is the maximum number of array layers. - * If pname:tiling is ename:VK_IMAGE_TILING_LINEAR, then - pname:maxArrayLayers must: either be equal to 1 or be no less than - slink:VkPhysicalDeviceLimits::pname:maxImageArrayLayers. - * If pname:tiling is ename:VK_IMAGE_TILING_OPTIMAL and pname:type is - ename:VK_IMAGE_TYPE_3D, then pname:maxArrayLayers must: either be equal - to 1 or be no less than - slink:VkPhysicalDeviceLimits::pname:maxImageArrayLayers. - * If pname:tiling is ename:VK_IMAGE_TILING_OPTIMAL and pname:type is not - ename:VK_IMAGE_TYPE_3D, then pname:maxArrayLayers must: be no less than - slink:VkPhysicalDeviceLimits::pname:maxImageArrayLayers. + pname:maxArrayLayers must: be no less than + slink:VkPhysicalDeviceLimits::pname:maxImageArrayLayers, except when one + of the following conditions is true, in which case it may: instead be + `1`: + ** pname:tiling is ename:VK_IMAGE_TILING_LINEAR + ** pname:tiling is ename:VK_IMAGE_TILING_OPTIMAL and pname:type is + ename:VK_IMAGE_TYPE_3D +ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] + ** pname:format is one of those listed in + <> +endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] ifdef::VK_EXT_image_drm_format_modifier[] * If pname:tiling is ename:VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then pname:maxArrayLayers must: not be 0. @@ -8664,6 +8725,66 @@ include::../validity/structs/VkAndroidHardwareBufferUsageANDROID.txt[] endif::VK_ANDROID_external_memory_android_hardware_buffer[] +ifdef::VK_EXT_filter_cubic[] + + + +To determine if cubic filtering can be used with a given image format and a +given image view type add slink:VkPhysicalDeviceImageViewImageFormatInfoEXT +to the pname:pNext chain of the slink:VkPhysicalDeviceImageFormatInfo2 +structure and slink:VkFilterCubicImageViewImageFormatPropertiesEXT to the +pname:pNext chain of the slink:VkImageFormatProperties2 structure. + +[open,refpage='VkPhysicalDeviceImageViewImageFormatInfoEXT',desc='Structure for providing image view type',type='structs'] +-- + +The sname:VkPhysicalDeviceImageViewImageFormatInfoEXT structure is defined +as: + +include::../api/structs/VkPhysicalDeviceImageViewImageFormatInfoEXT.txt[] + + * pname:sType is the type of this structure. + * pname:pNext is `NULL` or a pointer to an extension-specific structure. + * pname:imageViewType is a elink:VkImageViewType value specifying the type + of the image view. + +include::../validity/structs/VkPhysicalDeviceImageViewImageFormatInfoEXT.txt[] +-- + +[open,refpage='VkFilterCubicImageViewImageFormatPropertiesEXT',desc='Structure for querying cubic filtering capabilities of an image view type',type='structs'] +-- +The sname:VkFilterCubicImageViewImageFormatPropertiesEXT structure is +defined as: + +include::../api/structs/VkFilterCubicImageViewImageFormatPropertiesEXT.txt[] + + * pname:sType is the type of this structure. + * pname:pNext is `NULL` or a pointer to an extension-specific structure. + * pname:filterCubic tells if image format, image type and image view type + can: be used with cubic filtering. + This field is set by the implementation. + User-specified value is ignored. + * pname:filterCubicMinmax tells if image format, image type and image view + type can: be used with cubic filtering and minmax filtering. + This field is set by the implementation. + User-specified value is ignored. + +include::../validity/structs/VkFilterCubicImageViewImageFormatPropertiesEXT.txt[] + +.Valid Usage +**** + * [[VUID-VkFilterCubicImageViewImageFormatPropertiesEXT-pNext-02627]] + If the pname:pNext chain of the slink:VkImageFormatProperties2 structure + contains an instance of + slink:VkFilterCubicImageViewImageFormatPropertiesEXT, the pname:pNext + chain of the slink:VkPhysicalDeviceImageFormatInfo2 structure must: + contain an instance of slink:VkPhysicalDeviceImageViewImageFormatInfoEXT + with an pname:imageViewType that is compatible with pname:imageType. +**** +-- + +endif::VK_EXT_filter_cubic[] + endif::VK_VERSION_1_1,VK_KHR_get_physical_device_properties2[] @@ -8688,6 +8809,10 @@ ifdef::VK_VERSION_1_1,VK_KHR_external_memory_capabilities[] external handle type for which multisampled image support is not required. endif::VK_VERSION_1_1,VK_KHR_external_memory_capabilities[] +ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] + * pname:format is one of those listed in + <> +endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] ifdef::VK_NV_shading_rate_image[] * pname:usage contains ename:VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV endif::VK_NV_shading_rate_image[] diff --git a/chapters/interfaces.txt b/chapters/interfaces.txt index 1edf20be..58c96281 100644 --- a/chapters/interfaces.txt +++ b/chapters/interfaces.txt @@ -1522,7 +1522,7 @@ The variable decorated with code:FragSizeEXT must: be declared using the code:Input storage class. + The variable decorated with code:FragSizeEXT must: be declared as a -two-component vector of 32-bit unsigned integer values. +two-component vector of 32-bit integers. endif::VK_EXT_fragment_density_map[] @@ -1685,7 +1685,7 @@ A variable decorated with the code:HitKindNV decoration will describe the intersection that triggered the execution of the current shader. The values are determined by the intersection shader. + -The code:HitKindNV decoration must: only be used in any hit and closest hit +The code:HitKindNV decoration must: only be used in any-hit and closest hit shaders. + Any variable decorated with code:HitKindNV must: be declared using the @@ -1700,7 +1700,7 @@ code:HitTNV:: A variable decorated with the code:HitTNV decoration is equivalent to a variable decorated with the code:RayTmaxNV decoration. + -The code:HitTNV decoration must: only be used in any hit and closest hit +The code:HitTNV decoration must: only be used in any-hit and closest hit shaders. + Any variable decorated with code:HitTNV must: be declared using the @@ -1716,7 +1716,7 @@ A variable with the code:IncomingRayFlagsNV decoration will contain the ray flags passed in to the trace call that invoked this particular shader. + The code:IncomingRayFlagsNV decoration must: only be used in the -intersection, any hit, closest hit, and miss shaders. +intersection, any-hit, closest hit, and miss shaders. + Any variable decorated with code:IncomingRayFlagsNV must: be declared using the code:Input storage class. @@ -1733,7 +1733,7 @@ current ray. Only the lower 24 bits are valid, the upper 8 bits will be ignored. + The code:InstanceCustomIndexNV decoration must: only be used in the -intersection, any hit, and closest hit shaders. +intersection, any-hit, and closest hit shaders. + Any variable decorated with code:InstanceCustomIndexNV must: be declared using the code:Input storage class. @@ -1836,7 +1836,7 @@ All shader invocations inherit the same value for variables decorated with code:LaunchIDNV. + The code:LaunchIDNV decoration must: only be used within the ray generation, -intersection, any hit, closest hit, and miss shaders. +intersection, any-hit, closest hit, and miss shaders. + Any variable decorated with code:LaunchIDNV must: be declared using the code:Input storage class. @@ -1854,7 +1854,7 @@ The pname:width is in the first component, the pname:height is in the second component, and the pname:depth is in the third component. + The code:LaunchSizeNV decoration must: only be used within ray generation, -intersection, any hit, closest hit, and miss shaders. +intersection, any-hit, closest hit, and miss shaders. + Any variable decorated with code:LaunchSizeNV must: be declared using the code:Input storage class. @@ -2099,7 +2099,7 @@ A variable decorated with the code:ObjectRayDirectionNV decoration will specify the direction of the ray being processed, in object space. + The code:ObjectRayDirectionNV decoration must: only be used within -intersection, any hit, closest hit, and miss shaders. +intersection, any-hit, closest hit, and miss shaders. + Any variable decorated with code:ObjectRayDirectionNV must: be declared using the code:Input storage class. @@ -2114,7 +2114,7 @@ A variable decorated with the code:ObjectRayOriginNV decoration will specify the origin of the ray being processed, in object space. + The code:ObjectRayOriginNV decoration must: only be used within -intersection, any hit, closest hit, and miss shaders. +intersection, any-hit, closest hit, and miss shaders. + Any variable decorated with code:ObjectRayOriginNV must: be declared using the code:Input storage class. @@ -2130,7 +2130,7 @@ the current object-to-world transformation matrix, which is determined by the instance of the current intersection. + The code:ObjectToWorldNV decoration must: only be used within intersection, -any hit, and closest hit shaders. +any-hit, and closest hit shaders. + Any variable decorated with code:ObjectToWorldNV must: be declared using the code:Input storage class. @@ -2352,7 +2352,7 @@ would have been presented as input to the geometry shader had it been present. ifdef::VK_NV_ray_tracing[] + -In an intersection, any hit, or closest hit shader, it will contain the +In an intersection, any-hit, or closest hit shader, it will contain the index of the triangle or bounding box being processed. endif::VK_NV_ray_tracing[] + @@ -2373,14 +2373,14 @@ ifdef::VK_NV_mesh_shader[] mesh, endif::VK_NV_mesh_shader[] ifdef::VK_NV_ray_tracing[] -intersection, any hit, closest hit, +intersection, any-hit, closest hit, endif::VK_NV_ray_tracing[] fragment, tessellation control, tessellation evaluation, and geometry shaders. + In ifdef::VK_NV_ray_tracing[] -an intersection, any hit, closest hit, +an intersection, any-hit, closest hit, endif::VK_NV_ray_tracing[] ifndef::VK_NV_ray_tracing[] a @@ -2460,18 +2460,18 @@ The pname:tmax value changes throughout the lifetime of the ray query that produced the intersection. In the closest hit shader, the value reflects the closest distance to the intersected primitive. -In the any hit shader, it reflects the distance to the primitive currently +In the any-hit shader, it reflects the distance to the primitive currently being intersected. In the intersection shader, it reflects the distance to the closest primitive intersected so far. The value can change in the intersection shader after calling -code:OpReportIntersectionNV if the corresponding any hit shader does not +code:OpReportIntersectionNV if the corresponding any-hit shader does not ignore the intersection. In a miss shader, the value is identical to the parameter passed into code:OpTraceNV. + -The code:RayTmaxNV decoration must: only be used with the intersection, any -hit, closest hit, and miss shaders. +The code:RayTmaxNV decoration must: only be used with the intersection, +any-hit, closest hit, and miss shaders. + Any variable decorated with code:RayTmaxNV must: be declared with the code:Input storage class. @@ -2488,8 +2488,8 @@ The values are independent of the space in which the ray and origin exist. + The code:tmin value remains constant for the duration of the ray query. + -The code:RayTminNV decoration must: only be used with the intersection, any -hit, closest hit, and miss shaders. +The code:RayTminNV decoration must: only be used with the intersection, +any-hit, closest hit, and miss shaders. + Any variable decorated with code:RayTminNV must: be declared with the code:Input storage class. @@ -3136,7 +3136,7 @@ A variable decorated with the code:WorldRayDirectionNV decoration will specify the direction of the ray being processed, in world space. + The code:WorldRayDirectionNV decoration must: only be used within -intersection, any hit, closest hit, and miss shaders. +intersection, any-hit, closest hit, and miss shaders. + Any variable decorated with code:WorldRayDirectionNV must: be declared using the code:Input storage class. @@ -3151,7 +3151,7 @@ A variable decorated with the code:WorldRayOriginNV decoration will specify the origin of the ray being processed, in world space. + The code:WorldRayOriginNV decoration must: only be used within intersection, -any hit, closest hit, and miss shaders. +any-hit, closest hit, and miss shaders. + Any variable decorated with code:WorldRayOriginNV must: be declared using the code:Input storage class. @@ -3167,7 +3167,7 @@ the current world-to-object transformation matrix, which is determined by the instance of the current intersection. + The code:WorldToObjectNV decoration must: only be used within intersection, -any hit, and closest hit shaders. +any-hit, and closest hit shaders. + Any variable decorated with code:WorldToObjectNV must: be declared using the code:Input storage class. diff --git a/chapters/pipelines.txt b/chapters/pipelines.txt index b43068bf..1089d806 100644 --- a/chapters/pipelines.txt +++ b/chapters/pipelines.txt @@ -424,7 +424,7 @@ endif::VK_NV_mesh_shader[] additional stages which are introduced by extensions. ifdef::VK_NV_ray_tracing[] * ename:VK_SHADER_STAGE_RAYGEN_BIT_NV specifies the ray generation stage. - * ename:VK_SHADER_STAGE_ANY_HIT_BIT_NV specifies the any hit stage. + * ename:VK_SHADER_STAGE_ANY_HIT_BIT_NV specifies the any-hit stage. * ename:VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV specifies the closest hit stage. * ename:VK_SHADER_STAGE_MISS_BIT_NV specifies the miss stage. diff --git a/chapters/renderpass.txt b/chapters/renderpass.txt index bc5a0d07..27f64004 100644 --- a/chapters/renderpass.txt +++ b/chapters/renderpass.txt @@ -1977,6 +1977,14 @@ include::../api/enums/VkResolveModeFlagBitsKHR.txt[] * ename:VK_RESOLVE_MODE_MAX_BIT_KHR indicates that result of the resolve operation is the maximum of the sample values. -- + +[open,refpage='VkResolveModeFlagsKHR',desc='Bitmask of VkResolveModeFlagBitsKHR',type='flags'] +-- +include::../api/flags/VkResolveModeFlagsKHR.txt[] + +tname:VkResolveModeFlagsKHR is a bitmask type for setting a mask of zero or +more elink:VkResolveModeFlagBitsKHR. +-- endif::VK_KHR_depth_stencil_resolve[] diff --git a/chapters/resources.txt b/chapters/resources.txt index 59ce4b33..6db8263c 100644 --- a/chapters/resources.txt +++ b/chapters/resources.txt @@ -702,6 +702,22 @@ supported unless other parameters meet all of the constraints: * pname:usage only includes ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT and/or ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT +ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] +Images created with a pname:format from one of those listed in +<> have further +restrictions on their limits and capabilities compared to images created +with other formats. +Creation of images with a format requiring +<> may: not be supported unless other parameters meet all of the +constraints: + + * pname:imageType is ename:VK_IMAGE_TYPE_2D + * pname:mipLevels is 1 + * pname:arrayLayers is 1 + * pname:samples is ename:VK_SAMPLE_COUNT_1_BIT +endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] + Implementations may: support additional limits and capabilities beyond those listed above. @@ -1266,7 +1282,7 @@ ifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] <>, pname:arrayLayers must: be 1 * [[VUID-VkImageCreateInfo-imageCreateFormatFeatures-02260]] - If pame:format is a _multi-planar_ format, and if + If pname:format is a _multi-planar_ format, and if pname:imageCreateFormatFeatures (as defined in <>) does not contain ename:VK_FORMAT_FEATURE_DISJOINT_BIT, then pname:flags must: not @@ -1436,13 +1452,13 @@ matches that of sname:VkImageCreateInfo::pname:usage. When this structure is present sname:VkImageCreateInfo::pname:usage specifies the intended usage of the depth aspect of the image and -sname:VkImageStencilUsageCreateInfoEXT::stencilUsage specifies the intended -usage of the stencil aspect of the image. +sname:VkImageStencilUsageCreateInfoEXT::pname:stencilUsage specifies the +intended usage of the stencil aspect of the image. However, for the purposes of determining image specific valid usage conditions, the image itself is considered to be created with a particular elink:VkImageUsageFlagBits value if either sname:VkImageCreateInfo::pname:usage or -sname:VkImageStencilUsageCreateInfoEXT::stencil usage includes that bit +sname:VkImageStencilUsageCreateInfoEXT::pname:stencilUsage includes that bit value. This structure can: also be included in the pname:pNext chain of @@ -3704,8 +3720,8 @@ include::../api/structs/VkImageViewASTCDecodeModeEXT.txt[] ename:VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 * [[VUID-VkImageViewASTCDecodeModeEXT-decodeMode-02231]] If the <> feature is not enabled, pname:decodeMode - must: not be ename:VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 + pname:decodeModeSharedExponent>> feature is not enabled, + pname:decodeMode must: not be ename:VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 * [[VUID-VkImageViewASTCDecodeModeEXT-decodeMode-02232]] If pname:decodeMode is ename:VK_FORMAT_R8G8B8A8_UNORM the image view must: not include blocks using any of the ASTC HDR modes @@ -4760,6 +4776,7 @@ ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] slink:VkMemoryDedicatedRequirements::requiresDedicatedAllocation for pname:image), pname:memory must: have been created with slink:VkMemoryDedicatedAllocateInfo::pname:image equal to pname:image +ifndef::VK_NV_dedicated_allocation_image_aliasing[] * [[VUID-vkBindImageMemory-memory-01509]] If the sname:VkMemoryAllocateInfo provided when pname:memory was allocated included an instance of slink:VkMemoryDedicatedAllocateInfo in @@ -4768,6 +4785,34 @@ ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] dlink:VK_NULL_HANDLE, then pname:image must: equal slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset must: be zero. +endif::VK_NV_dedicated_allocation_image_aliasing[] +ifdef::VK_NV_dedicated_allocation_image_aliasing[] + * [[VUID-vkBindImageMemory-memory-02628]] + If the <> feature is not enabled, and the + sname:VkMemoryAllocateInfo provided when pname:memory was allocated + included an instance of slink:VkMemoryDedicatedAllocateInfo in its + pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image + was not dlink:VK_NULL_HANDLE, then pname:image must: equal + slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset + must: be zero. + * [[VUID-vkBindImageMemory-memory-02629]] + If the <> feature is enabled, and the + sname:VkMemoryAllocateInfo provided when pname:memory was allocated + included an instance of slink:VkMemoryDedicatedAllocateInfo in its + pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image + was not dlink:VK_NULL_HANDLE, then pname:memoryOffset must: be zero, and + pname:image must: be either equal to + slink:VkMemoryDedicatedAllocateInfo::pname:image or an image that was + created using the same parameters in sname:VkImageCreateInfo, with the + exception that pname:extent and pname:arrayLayers may: differ subject to + the following restrictions: every dimension in the pname:extent + parameter of the image being bound must: be equal to or smaller than the + original image for which the allocation was created; and the + pname:arrayLayers parameter of the image being bound must: be equal to + or smaller than the original image for which the allocation was created. +endif::VK_NV_dedicated_allocation_image_aliasing[] endif::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] ifdef::VK_VERSION_1_1[] * [[VUID-vkBindImageMemory-None-01901]] @@ -4940,6 +4985,7 @@ ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] pname:image), pname:memory must: have been created with slink:VkMemoryDedicatedAllocateInfo::pname:image equal to pname:image and pname:memoryOffset must: be zero +ifndef::VK_NV_dedicated_allocation_image_aliasing[] * [[VUID-VkBindImageMemoryInfo-memory-01903]] If the sname:VkMemoryAllocateInfo provided when pname:memory was allocated included an instance of slink:VkMemoryDedicatedAllocateInfo in @@ -4948,6 +4994,34 @@ ifdef::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] dlink:VK_NULL_HANDLE, then pname:image must: equal slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset must: be zero. +endif::VK_NV_dedicated_allocation_image_aliasing[] +ifdef::VK_NV_dedicated_allocation_image_aliasing[] + * [[VUID-VkBindImageMemoryInfo-memory-02630]] + If the <> feature is not enabled, and the + sname:VkMemoryAllocateInfo provided when pname:memory was allocated + included an instance of slink:VkMemoryDedicatedAllocateInfo in its + pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image + was not dlink:VK_NULL_HANDLE, then pname:image must: equal + slink:VkMemoryDedicatedAllocateInfo::pname:image and pname:memoryOffset + must: be zero. + * [[VUID-VkBindImageMemoryInfo-memory-02631]] + If the <> feature is enabled, and the + sname:VkMemoryAllocateInfo provided when pname:memory was allocated + included an instance of slink:VkMemoryDedicatedAllocateInfo in its + pname:pNext chain, and slink:VkMemoryDedicatedAllocateInfo::pname:image + was not dlink:VK_NULL_HANDLE, then pname:memoryOffset must: be zero, and + pname:image must: be either equal to + slink:VkMemoryDedicatedAllocateInfo::pname:image or an image that was + created using the same parameters in sname:VkImageCreateInfo, with the + exception that pname:extent and pname:arrayLayers may: differ subject to + the following restrictions: every dimension in the pname:extent + parameter of the image being bound must: be equal to or smaller than the + original image for which the allocation was created; and the + pname:arrayLayers parameter of the image being bound must: be equal to + or smaller than the original image for which the allocation was created. +endif::VK_NV_dedicated_allocation_image_aliasing[] endif::VK_VERSION_1_1,VK_KHR_dedicated_allocation[] ifdef::VK_NV_dedicated_allocation[] * [[VUID-VkBindImageMemoryInfo-image-01623]] diff --git a/chapters/samplers.txt b/chapters/samplers.txt index 5c2d102c..0362a3a0 100644 --- a/chapters/samplers.txt +++ b/chapters/samplers.txt @@ -229,18 +229,20 @@ endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] * [[VUID-VkSamplerCreateInfo-compareEnable-01080]] If pname:compareEnable is ename:VK_TRUE, pname:compareOp must: be a valid elink:VkCompareOp value -ifdef::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] * [[VUID-VkSamplerCreateInfo-magFilter-01081]] If either pname:magFilter or pname:minFilter is - ename:VK_FILTER_CUBIC_IMG, pname:anisotropyEnable must: be + ename:VK_FILTER_CUBIC_EXT, pname:anisotropyEnable must: be ename:VK_FALSE -endif::VK_IMG_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] ifdef::VK_IMG_filter_cubic+VK_EXT_sampler_filter_minmax[] +ifndef::VK_EXT_filter_cubic[] * [[VUID-VkSamplerCreateInfo-magFilter-01422]] If either pname:magFilter or pname:minFilter is - ename:VK_FILTER_CUBIC_IMG, the pname:reductionMode member of + ename:VK_FILTER_CUBIC_EXT, the pname:reductionMode member of slink:VkSamplerReductionModeCreateInfoEXT must: be ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT +endif::VK_EXT_filter_cubic[] endif::VK_IMG_filter_cubic+VK_EXT_sampler_filter_minmax[] ifdef::VK_EXT_sampler_filter_minmax[] * [[VUID-VkSamplerCreateInfo-compareEnable-01423]] @@ -371,9 +373,9 @@ include::../api/enums/VkFilter.txt[] * ename:VK_FILTER_NEAREST specifies nearest filtering. * ename:VK_FILTER_LINEAR specifies linear filtering. -ifdef::VK_IMG_filter_cubic[] - * ename:VK_FILTER_CUBIC_IMG specifies cubic filtering. -endif::VK_IMG_filter_cubic[] +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] + * ename:VK_FILTER_CUBIC_EXT specifies cubic filtering. +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] These filters are described in detail in <>. diff --git a/chapters/textures.txt b/chapters/textures.txt index 66937fa6..07142100 100644 --- a/chapters/textures.txt +++ b/chapters/textures.txt @@ -95,11 +95,13 @@ coordinates having the following meanings: The coordinates are extracted from the SPIR-V operand based on the dimensionality of the image variable and type of instruction. -For code:Proj instructions, the components are in order (s, [t,] [r,] q) -with t and r being conditionally present based on the code:Dim of the image. -For non-code:Proj instructions, the coordinates are (s [,t] [,r] [,a]), with -t and r being conditionally present based on the code:Dim of the image and a -being conditionally present based on the code:Arrayed property of the image. +For code:Proj instructions, the components are in order [eq]#(s [,t] [,r] +q)#, with [eq]#t# and [eq]#r# being conditionally present based on the +code:Dim of the image. +For non-code:Proj instructions, the coordinates are [eq]#(s [,t] [,r] +[,a])#, with [eq]#t# and [eq]#r# being conditionally present based on the +code:Dim of the image and [eq]#a# being conditionally present based on the +code:Arrayed property of the image. Projective image instructions are not supported on code:Arrayed images. Unnormalized texel coordinates are referred to as [eq]#(u,v,w,a)#, with the @@ -118,44 +120,47 @@ present when the dimensionality is 2D. When normalized coordinates are converted to unnormalized coordinates, all four coordinates are used. -Integer texel coordinates are referred to as [eq]#(i,j,k,l,n)#, and the -first four in that order have the same meanings as unnormalized texel -coordinates. +Integer texel coordinates are referred to as [eq]#(i,j,k,l,n)#, with the +coordinates having the following meanings: + + * [eq]#i#: Coordinate in the first dimension of an image. + * [eq]#j#: Coordinate in the second dimension of an image. + * [eq]#k#: Coordinate in the third dimension of an image. + * [eq]#l#: Coordinate for array layer. + * [eq]#n#: Coordinate for the sample index. + They are extracted from the SPIR-V operand in order [eq]#(i, [,j], [,k], [,l])#, with [eq]#j# and [eq]#k# conditionally present based on the code:Dim -of the image, and l conditionally present based on the code:Arrayed property -of the image. -n is the sample index and is taken from the code:Sample image operand. +of the image, and [eq]#l# conditionally present based on the code:Arrayed +property of the image. +[eq]#n# is conditionally present and is taken from the code:Sample image +operand. For all coordinate types, unused coordinates are assigned a value of zero. [[textures-texel-coordinate-systems-diagrams]] -image::images/vulkantexture0.svg[align="center",title="Texel Coordinate Systems",opts="{imageopts}"] +image::images/vulkantexture0-ll.svg[align="center",title="Texel Coordinate Systems, Linear Filtering",opts="{imageopts}"] The Texel Coordinate Systems - For the example shown of an 8{times}4 texel two dimensional image. * Normalized texel coordinates: - ** The [eq]#s# coordinate goes from 0.0 to 1.0, left to right. - ** The [eq]#t# coordinate goes from 0.0 to 1.0, top to bottom. + ** The [eq]#s# coordinate goes from 0.0 to 1.0. + ** The [eq]#t# coordinate goes from 0.0 to 1.0. * Unnormalized texel coordinates: - ** The [eq]#u# coordinate goes from -1.0 to 9.0, left to right. - The [eq]#u# coordinate within the range 0.0 to 8.0 is within the image, - otherwise it is within the border. - ** The [eq]#v# coordinate goes from -1.0 to 5.0, top to bottom. - The [eq]#v# coordinate within the range 0.0 to 4.0 is within the image, - otherwise it is within the border. + ** The [eq]#u# coordinate within the range 0.0 to 8.0 is within the image, + otherwise it is outside the image. + ** The [eq]#v# coordinate within the range 0.0 to 4.0 is within the image, + otherwise it is outside the image. * Integer texel coordinates: - ** The [eq]#i# coordinate goes from -1 to 8, left to right. - The [eq]#i# coordinate within the range 0 to 7 addresses texels within - the image, otherwise it addresses a border texel. - ** The [eq]#j# coordinate goes from -1 to 5, top to bottom. - The [eq]#j# coordinate within the range 0 to 3 addresses texels within - the image, otherwise it addresses a border texel. + ** The [eq]#i# coordinate within the range 0 to 7 addresses texels within + the image, otherwise it is outside the image. + ** The [eq]#j# coordinate within the range 0 to 3 addresses texels within + the image, otherwise it outside the image. * Also shown for linear filtering: ** Given the unnormalized coordinates [eq]#(u,v)#, the four texels selected are [eq]#i~0~j~0~#, [eq]#i~1~j~0~#, [eq]#i~0~j~1~#, and [eq]#i~1~j~1~#. - ** The weights [eq]#{alpha}# and [eq]#{beta}#. + ** The fractions [eq]#{alpha}# and [eq]#{beta}#. ** Given the offset [eq]#{DeltaUpper}~i~# and [eq]#{DeltaUpper}~j~#, the four texels selected by the offset are [eq]#i~0~j'~0~#, [eq]#i~1~j'~0~#, [eq]#i~0~j'~1~#, and [eq]#i~1~j'~1~#. @@ -171,7 +176,7 @@ the unnormalized coordinate space of the lower-resolution channels. ==== endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] -image::images/vulkantexture1.svg[align="center",title="Texel Coordinate Systems",opts="{imageopts}"] +image::images/vulkantexture1-ll.svg[align="center",title="Texel Coordinate Systems, Nearest Filtering",opts="{imageopts}"] The Texel Coordinate Systems - For the example shown of an 8{times}4 texel two dimensional image. @@ -187,17 +192,10 @@ ifdef::VK_NV_corner_sampled_image[] For corner-sampled images, the texel samples are located at the grid intersections instead of the texel centers. -ifdef::editing-notes[] -[NOTE] -.editing-note -==== -(dgkoch) TODO add a diagram demonstrating this. -==== -endif::editing-notes[] +image::images/vulkantexture0-corner-alternative-a-ll.svg[align="center",title="Texel Coordinate Systems, Corner Sampling",opts={imageopts}"] endif::VK_NV_corner_sampled_image[] - == Conversion Formulas ifdef::editing-notes[] @@ -211,7 +209,6 @@ to RGB) ==== endif::editing-notes[] - [[textures-RGB-sexp]] === RGB to Shared Exponent Conversion @@ -226,7 +223,7 @@ First, the components [eq]#(red, green, blue)# are clamped to :: [eq]#green~clamped~ = max(0, min(sharedexp~max~, green))# :: [eq]#blue~clamped~ = max(0, min(sharedexp~max~, blue))# -Where: +where: [latexmath] +++++++++++++++++++ @@ -320,7 +317,7 @@ follows: :: latexmath:[green = green_{shared} \times {2^{(exp_{shared}-B-N)}}] :: latexmath:[blue = blue_{shared} \times {2^{(exp_{shared}-B-N)}}] -Where: +where: :: [eq]#N = 9# (number of mantissa bits per component) :: [eq]#B = 15# (exponent bias) @@ -373,7 +370,6 @@ or coordinates, and in certain circumstances cause the texel value to be replaced or become undefined:. There are a series of validations that the texel undergoes. - [[textures-operation-validation]] ==== Instruction/Sampler/Image View Validation @@ -543,41 +539,47 @@ replacement>> is performed. . Cube Map Edge or Corner + -Otherwise the texel coordinates lie on the borders along the edges and -corners of a cube map image, and <> is performed. +Otherwise the texel coordinates lie beyond the edges or corners of the +selected cube map face, and <> +is performed. [[textures-cubemapedge]] ==== Cube Map Edge Handling -If the texel coordinates lie on the borders along the edges and corners of a -cube map image, the following steps are performed. -Note that this only occurs when using ename:VK_FILTER_LINEAR filtering +If the texel coordinates lie beyond the edges or corners of the selected +cube map face, the following steps are performed. +Note that this does not occur when using ename:VK_FILTER_NEAREST filtering within a mip level, since ename:VK_FILTER_NEAREST is treated as using ename:VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE. * Cube Map Edge Texel + - ** If the texel lies along the border in either only [eq]#i# or only - [eq]#j# -+ -then the texel lies along an edge, so the coordinates [eq]#(i,j)# and the -array layer [eq]#l# are transformed to select the adjacent texel from the -appropriate neighboring face. + ** If the texel lies beyond the selected cube map face in either only + [eq]#i# or only [eq]#j#, then the coordinates [eq]#(i,j)# and the array + layer [eq]#l# are transformed to select the adjacent texel from the + appropriate neighboring face. * Cube Map Corner Texel + - ** If the texel lies along the border in both [eq]#i# and [eq]#j# -+ -then the texel lies at a corner and there is no unique neighboring face from -which to read that texel. -The texel should: be replaced by the average of the three values of the -adjacent texels in each incident face. -However, implementations may: replace the cube map corner texel by other -methods, subject to the constraint that if the three available samples have -the same value, the replacement texel also has that value. - + ** If the texel lies beyond the selected cube map face in both [eq]#i# and + [eq]#j#, then there is no unique neighboring face from which to read + that texel. + The texel should: be replaced by the average of the three values of the + adjacent texels in each incident face. + However, implementations may: replace the cube map corner texel by + other methods. +ifndef::VK_EXT_filter_cubic[] +The methods are subject to the constraint that if the three available texels +have the same value, the resulting filtered texel must: have that value. +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] +The methods are subject to the constraint that for linear filtering if the +three available texels have the same value, the resulting filtered texel +must: have that value, and for cubic filtering if the twelve available +samples have the same value, the resulting filtered texel must: have that +value. +endif::VK_EXT_filter_cubic[] [[textures-sparse-validation]] ==== Sparse Validation @@ -651,12 +653,12 @@ The border color is: [options="header",cols="60%,40%"] |==== | Sampler pname:borderColor | Corresponding Border Color -| ename:VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK | [eq]#B = (0.0, 0.0, 0.0, 0.0)# -| ename:VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK | [eq]#B = (0.0, 0.0, 0.0, 1.0)# -| ename:VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE | [eq]#B = (1.0, 1.0, 1.0, 1.0)# -| ename:VK_BORDER_COLOR_INT_TRANSPARENT_BLACK | [eq]#B = (0, 0, 0, 0)# -| ename:VK_BORDER_COLOR_INT_OPAQUE_BLACK | [eq]#B = (0, 0, 0, 1)# -| ename:VK_BORDER_COLOR_INT_OPAQUE_WHITE | [eq]#B = (1, 1, 1, 1)# +| ename:VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK | [eq]#[B~r~, B~g~, B~b~, B~a~] = [0.0, 0.0, 0.0, 0.0]# +| ename:VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK | [eq]#[B~r~, B~g~, B~b~, B~a~] = [0.0, 0.0, 0.0, 1.0]# +| ename:VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE | [eq]#[B~r~, B~g~, B~b~, B~a~] = [1.0, 1.0, 1.0, 1.0]# +| ename:VK_BORDER_COLOR_INT_TRANSPARENT_BLACK | [eq]#[B~r~, B~g~, B~b~, B~a~] = [0, 0, 0, 0]# +| ename:VK_BORDER_COLOR_INT_OPAQUE_BLACK | [eq]#[B~r~, B~g~, B~b~, B~a~] = [0, 0, 0, 1]# +| ename:VK_BORDER_COLOR_INT_OPAQUE_WHITE | [eq]#[B~r~, B~g~, B~b~, B~a~] = [1, 1, 1, 1]# |==== [NOTE] @@ -675,15 +677,15 @@ components in the image format [[textures-border-replacement-table]] .Border Texel Components After Replacement -[width="80%",options="header"] +[width="100%",options="header"] |==== | Texel Aspect or Format | Component Assignment -| Depth aspect | [eq]#D = B~r~# -| Stencil aspect | [eq]#S = B~r~# -| One component color format | [eq]#C~r~ = B~r~# -| Two component color format | [eq]#C~rg~ = (B~r~,B~g~)# -| Three component color format| [eq]#C~rgb~ = (B~r~,B~g~,B~b~)# -| Four component color format | [eq]#C~rgba~ = (B~r~,B~g~,B~b~,B~a~)# +| Depth aspect | [eq]#D = B~r~# +| Stencil aspect | [eq]#S = B~r~# +| One component color format | [eq]#Color~r~ = B~r~# +| Two component color format | [eq]#[Color~r~,Color~g~] = [B~r~,B~g~]# +| Three component color format| [eq]#[Color~r~,Color~g~,Color~b~] = [B~r~,B~g~,B~b~]# +| Four component color format | [eq]#[Color~r~,Color~g~,Color~b~,Color~a~] = [B~r~,B~g~,B~b~,B~a~]# |==== The value returned by a read of an invalid texel is undefined:, unless that @@ -740,20 +742,20 @@ where, in the depth comparison: [[textures-conversion-to-rgba]] === Conversion to RGBA -The texel is expanded from one, two, or three to four components based on -the image base color: +The texel is expanded from one, two, or three components to four components +based on the image base color: [[textures-texel-color-rgba-conversion-table]] .Texel Color After Conversion To RGBA -[options="header"] +[width="100%", options="header", cols="<4,<6"] |==== | Texel Aspect or Format | RGBA Color -| Depth aspect | [eq]#C~rgba~ = (D,0,0,one)# -| Stencil aspect | [eq]#C~rgba~ = (S,0,0,one)# -| One component color format | [eq]#C~rgba~ = (C~r~,0,0,one)# -| Two component color format | [eq]#C~rgba~ = (C~rg~,0,one)# -| Three component color format| [eq]#C~rgba~ = (C~rgb~,one)# -| Four component color format | [eq]#C~rgba~ = C~rgba~# +| Depth aspect | [eq]#[Color~r~,Color~g~,Color~b~, Color~a~] = [D,0,0,one]# +| Stencil aspect | [eq]#[Color~r~,Color~g~,Color~b~, Color~a~] = [S,0,0,one]# +| One component color format | [eq]#[Color~r~,Color~g~,Color~b~, Color~a~] = [Color~r~,0,0,one]# +| Two component color format | [eq]#[Color~r~,Color~g~,Color~b~, Color~a~] = [Color~r~,Color~g~,0,one]# +| Three component color format| [eq]#[Color~r~,Color~g~,Color~b~, Color~a~] = [Color~r~,Color~g~,Color~b~,one]# +| Four component color format | [eq]#[Color~r~,Color~g~,Color~b~, Color~a~] = [Color~r~,Color~g~,Color~b~,Color~a~]# |==== where [eq]#one = 1.0f# for floating-point formats and depth aspects, and @@ -783,24 +785,23 @@ All texel input instructions apply a _swizzle_ based on: endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] The swizzle can: rearrange the components of the texel, or substitute zero -and one for any components. -It is defined as follows for the R component, and operates similarly for the -other components. +or one for any components. +It is defined as follows for each color [eq]#component#: [latexmath] +++++++++++++++++++ \begin{aligned} -C'_{rgba}[R] & = - \begin{cases} - C_{rgba}[R] & \text{for RED swizzle} \\ - C_{rgba}[G] & \text{for GREEN swizzle} \\ - C_{rgba}[B] & \text{for BLUE swizzle} \\ - C_{rgba}[A] & \text{for ALPHA swizzle} \\ - 0 & \text{for ZERO swizzle} \\ - one & \text{for ONE swizzle} \\ - C_{rgba}[R] & \text{for IDENTITY swizzle} - \end{cases} +Color'_{component} & = +\begin{cases} +Color_r & \text{for RED swizzle} \\ +Color_g & \text{for GREEN swizzle} \\ +Color_b & \text{for BLUE swizzle} \\ +Color_a & \text{for ALPHA swizzle} \\ +0 & \text{for ZERO swizzle} \\ +one & \text{for ONE swizzle} \\ +identity & \text{for IDENTITY swizzle} +\end{cases} \end{aligned} +++++++++++++++++++ @@ -809,26 +810,28 @@ where: [latexmath] +++++++++++++++++++ \begin{aligned} -C_{rgba}[R] & \text{is the RED component} \\ -C_{rgba}[G] & \text{is the GREEN component} \\ -C_{rgba}[B] & \text{is the BLUE component} \\ -C_{rgba}[A] & \text{is the ALPHA component} \\ -one & = 1.0\text{f} & \text{for floating point components} \\ -one & = 1 & \text{for integer components} +one & = +\begin{cases} +& 1.0\text{f} & \text{for floating point components} \\ +& 1 & \text{for integer components} \\ +\end{cases} +\\ +identity & = +\begin{cases} +& Color_r & \text{for}\ component = r \\ +& Color_g & \text{for}\ component = g \\ +& Color_b & \text{for}\ component = b \\ +& Color_a & \text{for}\ component = a \\ +\end{cases} \end{aligned} +++++++++++++++++++ -For each component this is applied to, the -ename:VK_COMPONENT_SWIZZLE_IDENTITY swizzle selects the corresponding -component from [eq]#C~rgba~#. - If the border color is one of the etext:VK_BORDER_COLOR_*_OPAQUE_BLACK enums and the elink:VkComponentSwizzle is not ename:VK_COMPONENT_SWIZZLE_IDENTITY for all components (or the <>), the value of the texel after swizzle is undefined:. - [[textures-sparse-residency]] === Sparse Residency @@ -1352,7 +1355,7 @@ compute and endif::VK_NV_compute_shader_derivatives[] fragment shaders. -image::images/vulkantexture2.svg[align="center",title="Implicit Derivatives",opts="{imageopts}"] +image::images/vulkantexture2-ll.svg[align="center",title="Implicit Derivatives",opts="{imageopts}"] Derivatives are computed as if there is a 2{times}2 neighborhood of fragments for each fragment shader invocation. @@ -1364,16 +1367,33 @@ continuous, therefore derivatives in non-uniform control flow are undefined. [latexmath] +++++++++++++++++++ \begin{aligned} -dPdx_{i_1,j_0} & = dPdx_{i_0,j_0} & = P_{i_1,j_0} - P_{i_0,j_0} \\ -dPdx_{i_1,j_1} & = dPdx_{i_0,j_1} & = P_{i_1,j_1} - P_{i_0,j_1} \\ +dPdx_0 & = P_{i_1,j_0} - P_{i_0,j_0} \\ +dPdx_1 & = P_{i_1,j_1} - P_{i_0,j_1} \\ \\ -dPdy_{i_0,j_1} & = dPdy_{i_0,j_0} & = P_{i_0,j_1} - P_{i_0,j_0} \\ -dPdy_{i_1,j_1} & = dPdy_{i_1,j_0} & = P_{i_1,j_1} - P_{i_1,j_0} +dPdy_0 & = P_{i_0,j_1} - P_{i_0,j_0} \\ +dPdy_1 & = P_{i_1,j_1} - P_{i_1,j_0} +\end{aligned} ++++++++++++++++++++ + +For a 2{times}2 neighborhood, for the four fragments labled 0, 1, 2 and 3, +the code:Fine derivative instructions must: return: + +[latexmath] ++++++++++++++++++++ +\begin{aligned} +dPdx & = + \begin{cases} + dPdx_0 & \text{for fragments labeled 0 and 1}\\ + dPdx_1 & \text{for fragments labeled 2 and 3} + \end{cases} \\ +dPdy & = + \begin{cases} + dPdy_0 & \text{for fragments labeled 0 and 2}\\ + dPdy_1 & \text{for fragments labeled 1 and 3} + \end{cases} \end{aligned} +++++++++++++++++++ -The code:Fine derivative instructions must: return the values above, for a -group of fragments in a 2{times}2 neighborhood. Coarse derivatives may: return only two values. In this case, the values should: be: @@ -1382,13 +1402,13 @@ In this case, the values should: be: \begin{aligned} dPdx & = \begin{cases} - dPdx_{i_0,j_0} & \text{preferred}\\ - dPdx_{i_0,j_1} + dPdx_0 & \text{preferred}\\ + dPdx_1 \end{cases} \\ dPdy & = \begin{cases} - dPdy_{i_0,j_0} & \text{preferred}\\ - dPdy_{i_1,j_0} + dPdy_0 & \text{preferred}\\ + dPdy_1 \end{cases} \end{aligned} +++++++++++++++++++ @@ -1729,7 +1749,7 @@ where: :: [eq]#{partial}r/{partial}x = {partial}r/{partial}y = 0# (for 1D, 2D or Cube images) -and +and: :: [eq]#w~base~ = image.w# :: [eq]#h~base~ = image.h# @@ -1940,7 +1960,7 @@ nearest(d') & = \end{aligned} ++++++++++++++++++++++++ -and +and: :: [eq]#level~base~ = pname:baseMipLevel# :: [eq]#q = pname:levelCount - 1# @@ -1967,28 +1987,29 @@ d_{lo} & = min( d_{hi} + 1, q ) \\ <>, used for <> between levels. - [[textures-normalized-to-unnormalized]] === (s,t,r,q,a) to (u,v,w,a) Transformation The normalized texel coordinates are scaled by the image level dimensions and the array layer is selected. -This transformation is performed once for each level ([eq]#d# or [eq]#d~hi~# -and [eq]#d~lo~#) used in <>. + +This transformation is performed once for each level used in +<> (either [eq]#d#, or [eq]#d~hi~# and +[eq]#d~lo~#). [latexmath] ++++++++++++++++++++++++ \begin{aligned} -u(x,y) & = s(x,y) \times width_{scale} \\ +u(x,y) & = s(x,y) \times width_{scale} + \Delta_i\\ v(x,y) & = \begin{cases} 0 & \text{for 1D images} \\ - t(x,y) \times height_{scale} & \text{otherwise} + t(x,y) \times height_{scale} + \Delta_j & \text{otherwise} \end{cases} \\ w(x,y) & = \begin{cases} 0 & \text{for 2D or Cube images} \\ - r(x,y) \times depth_{scale} & \text{otherwise} + r(x,y) \times depth_{scale} + \Delta_k & \text{otherwise} \end{cases} \\ \\ a(x,y) & = @@ -1999,23 +2020,26 @@ a(x,y) & = \end{aligned} ++++++++++++++++++++++++ -where +where: :: [eq]#width~scale~ = width~level~# :: [eq]#height~scale~ = height~level~# :: [eq]#depth~scale~ = depth~level~# -for conventional images ifdef::VK_NV_corner_sampled_image[] -, and +for conventional images, and: :: [eq]#width~scale~ = width~level~ - 1# :: [eq]#height~scale~ = height~level~ - 1# :: [eq]#depth~scale~ = depth~level~ - 1# -for corner-sampled images +for corner-sampled images. endif::VK_NV_corner_sampled_image[] -. + +and where [eq]#({DeltaUpper}~i~, {DeltaUpper}~j~, {DeltaUpper}~k~)# are +taken from the image instruction if it includes a [eq]#ConstOffset# operand, +otherwise they are taken to be zero. + Operations then proceed to Unnormalized Texel Coordinate Operations. @@ -2062,19 +2086,17 @@ j &= \lfloor v + shift \rfloor \\ k &= \lfloor w + shift \rfloor \end{aligned} ++++++++++++++++++++++++ -where +where: :: [eq]#shift = 0.0# -for conventional images ifdef::VK_NV_corner_sampled_image[] -, and +for conventional images, and: :: [eq]#shift = 0.5# -for corner-sampled images +for corner-sampled images. endif::VK_NV_corner_sampled_image[] -. Linear filtering (ename:VK_FILTER_LINEAR) computes a set of neighboring coordinates which bound the unnormalized coordinates. @@ -2089,50 +2111,103 @@ i_0 &= \lfloor u - shift \rfloor \\ i_1 &= i_0 + 1 \\ j_0 &= \lfloor v - shift \rfloor \\ j_1 &= j_0 + 1 \\ -k_0 &= \lfloor w - shift \rfloor \\ -k_1 &= k_0 + 1 \\ -\alpha &= \left(u - shift\right) - i_0 \\ -\beta &= \left(v - shift\right) - j_0 \\ -\gamma &= \left(w - shift\right) - k_0 +k_0 &= \lfloor w - shift \rfloor +k_1 &= k_0 + 1 \end{aligned} ++++++++++++++++++++++++ -where - - :: [eq]#shift = 0.5# - -for conventional images -ifdef::VK_NV_corner_sampled_image[] -, and - - :: [eq]#shift = 0.0# - -for corner-sampled images -endif::VK_NV_corner_sampled_image[] -. - -ifdef::VK_IMG_filter_cubic[] -Cubic filtering (ename:VK_FILTER_CUBIC_IMG) computes a set of neighboring -coordinates which bound the unnormalized coordinates. -The integer texel coordinates are combinations of [eq]#i~0~#, [eq]#i~1~#, -[eq]#i~2~# or [eq]#i~3~#, [eq]#j~0~#, [eq]#j~1~#, [eq]#j~2~# or [eq]#j~3~#, -as well as weights [eq]#{alpha}# and [eq]#{beta}#. - [latexmath] ++++++++++++++++++++++++ \begin{aligned} -i_{0} & = \left \lfloor u - \frac{3}{2} \right \rfloor & i_{1} & = i_{0} + 1 & i_{2} & = i_{1} + 1 & i_{3} & = i_{2} + 1 \\[1em] -j_{0} & = \left \lfloor v - \frac{3}{2} \right \rfloor & j_{1} & = j_{0} + 1 & j_{2} & = j_{1} + 1 & j_{3} & = j_{2} + 1 \\ -\\ -\alpha & = \mathbin{frac} \left ( u - \frac{1}{2} \right ) \\[1em] -\beta & = \mathbin{frac} \left ( v - \frac{1}{2} \right ) +\alpha &= \mathbin{frac}\left(u - shift\right) \\[1em] +\beta &= \mathbin{frac}\left(v - shift\right) \\[1em] +\gamma &= \mathbin{frac}\left(w - shift\right) \end{aligned} ++++++++++++++++++++++++ -endif::VK_IMG_filter_cubic[] -If the image instruction includes a [eq]#ConstOffset# operand, the constant -offsets [eq]#({DeltaUpper}~i~, {DeltaUpper}~j~, {DeltaUpper}~k~)# are added -to [eq]#(i,j,k)# components of the integer texel coordinates. +where: + + :: [eq]#shift = 0.5# + +ifdef::VK_NV_corner_sampled_image[] +for conventional images, and: + + :: [eq]#shift = 0.0# + +for corner-sampled images, +endif::VK_NV_corner_sampled_image[] +and where: + +[latexmath] +++++++++++++++++++++++++ +\mathbin{frac}(x) = x - \lfloor x \rfloor +++++++++++++++++++++++++ +where the number of fraction bits retained is specified by +sname:VkPhysicalDeviceLimits::pname:subTexelPrecisionBits. + +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] +Cubic filtering (ename:VK_FILTER_CUBIC_EXT) computes a set of neighboring +coordinates which bound the unnormalized coordinates. +The integer texel coordinates are combinations of [eq]#i~0~#, [eq]#i~1~#, +[eq]#i~2~# or [eq]#i~3~#, [eq]#j~0~#, [eq]#j~1~#, [eq]#j~2~# or [eq]#j~3~#, +ifndef::VK_EXT_filter_cubic[] +as well as weights [eq]#{alpha}# and [eq]#{beta}#. +endif::VK_EXT_filter_cubic[] +ifdef::VK_EXT_filter_cubic[] +[eq]#k~0~#, [eq]#k~1~#, [eq]#k~2~# or [eq]#k~3~#, as well as weights +[eq]#{alpha}#, [eq]#{beta}#, and [eq]#{gamma}#. +endif::VK_EXT_filter_cubic[] + +ifndef::VK_EXT_filter_cubic[] +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} +i_{0} & = {\left \lfloor {u - \frac{3}{2}} \right \rfloor} & i_{1} & = i_{0} + 1 & i_{2} & = i_{1} + 1 & i_{3} & = i_{2} + 1 \\[1em] +j_{0} & = {\left \lfloor {v - \frac{3}{2}} \right \rfloor} & j_{1} & = j_{0} + 1 & j_{2} & = j_{1} + 1 & j_{3} & = j_{2} + 1 +\end{aligned} +++++++++++++++++++++++++ + +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} +alpha &= \mathbin{frac}\left(u - \frac{1}{2}\right) \\[1em] +\beta &= \mathbin{frac}\left(v - \frac{1}{2}\right) +\end{aligned} +++++++++++++++++++++++++ + +endif::VK_EXT_filter_cubic[] + +ifdef::VK_EXT_filter_cubic[] +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} +i_{0} & = {\left \lfloor {u - \frac{3}{2}} \right \rfloor} & i_{1} & = i_{0} + 1 & i_{2} & = i_{1} + 1 & i_{3} & = i_{2} + 1 \\[1em] +j_{0} & = {\left \lfloor {v - \frac{3}{2}} \right \rfloor} & j_{1} & = j_{0} + 1 & j_{2} & = j_{1} + 1 & j_{3} & = j_{2} + 1 \\[1em] +k_{0} & = {\left \lfloor {w - \frac{3}{2}} \right \rfloor} & k_{1} & = k_{0} + 1 & k_{2} & = k_{1} + 1 & k_{3} & = k_{2} + 1 +\end{aligned} +++++++++++++++++++++++++ + +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} +\alpha &= \mathbin{frac}\left(u - \frac{1}{2}\right) \\[1em] +\beta &= \mathbin{frac}\left(v - \frac{1}{2}\right) \\[1em] +\gamma &= \mathbin{frac}\left(w - \frac{1}{2}\right) +\end{aligned} +++++++++++++++++++++++++ + +endif::VK_EXT_filter_cubic[] + +where: + +[latexmath] +++++++++++++++++++++++++ +\mathbin{frac}(x) = x - \lfloor x \rfloor +++++++++++++++++++++++++ + +where the number of fraction bits retained is specified by +sname:VkPhysicalDeviceLimits::pname:subTexelPrecisionBits. +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] [[textures-integer-coordinate-operations]] @@ -2270,6 +2345,9 @@ endif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] [[textures-texel-filtering]] === Texel Filtering +Texel filtering is first performed for each level (either [eq]#d# or +[eq]#d~hi~# and [eq]#d~lo~#). + If [eq]#{lambda}# is less than or equal to zero, the texture is said to be _magnified_, and the filter mode within a mip level is selected by the pname:magFilter in the sampler. @@ -2277,6 +2355,9 @@ If [eq]#{lambda}# is greater than zero, the texture is said to be _minified_, and the filter mode within a mip level is selected by the pname:minFilter in the sampler. +[[textures-texel-nearest-filtering]] +==== Texel Nearest Filtering + Within a mip level, ename:VK_FILTER_NEAREST filtering selects a single value using the [eq]#(i, j, k)# texel coordinates, with all texels taken from layer l. @@ -2293,151 +2374,253 @@ layer l. \end{aligned} ++++++++++++++++++++++++ +[[textures-texel-linear-filtering]] +==== Texel Linear Filtering + Within a mip level, ename:VK_FILTER_LINEAR filtering combines 8 (for 3D), 4 -(for 2D or Cube), or 2 (for 1D) texel values, using the weights computed -earlier: +(for 2D or Cube), or 2 (for 1D) texel values, together with their linear +weights. +The linear weights are derived from the fractions computed earlier: [latexmath] + ++++++++++++++++++++++++ \begin{aligned} -\tau_{3D}[level] & = reduce((1-\alpha)(1-\beta)(1-\gamma),\tau_{i0j0k0}[level], \\ - & \, (\alpha)(1-\beta)(1-\gamma),\tau_{i1j0k0}[level], \\ - & \, (1-\alpha)(\beta)(1-\gamma),\tau_{i0j1k0}[level], \\ - & \, (\alpha)(\beta)(1-\gamma),\tau_{i1j1k0}[level], \\ - & \, (1-\alpha)(1-\beta)(\gamma),\tau_{i0j0k1}[level], \\ - & \, (\alpha)(1-\beta)(\gamma),\tau_{i1j0k1}[level], \\ - & \, (1-\alpha)(\beta)(\gamma),\tau_{i0j1k1}[level], \\ - & \, (\alpha)(\beta)(\gamma),\tau_{i1j1k1}[level]) +w_{i_0} &= (1-\alpha) \\ +w_{i_1} &= (\alpha) \\ +w_{j_0} &= (1-\beta) \\ +w_{j_1} &= (\beta) \\ +w_{k_0} &= (1-\gamma) \\ +w_{k_1} &= (\gamma) \end{aligned} ++++++++++++++++++++++++ -[latexmath] -++++++++++++++++++++++++ -\begin{aligned} -\tau_{2D}[level] & = reduce((1-\alpha)(1-\beta),\tau_{i0j0}[level], \\ - & \, (\alpha)(1-\beta),\tau_{i1j0}[level], \\ - & \, (1-\alpha)(\beta),\tau_{i0j1}[level], \\ - & \, (\alpha)(\beta),\tau_{i1j1}[level]) -\end{aligned} -++++++++++++++++++++++++ - -[latexmath] -++++++++++++++++++++++++ -\begin{aligned} -\tau_{1D}[level] & = reduce((1-\alpha),\tau_{i0}[level], \\ - & \, (\alpha),\tau_{i1}[level]) -\end{aligned} -++++++++++++++++++++++++ - -[latexmath] -++++++++++++++++++++++++ -\begin{aligned} -\tau[level] &= - \begin{cases} - \tau_{3D}[level], & \text{for 3D image} \\ - \tau_{2D}[level], & \text{for 2D or Cube image} \\ - \tau_{1D}[level], & \text{for 1D image} - \end{cases} -\end{aligned} -++++++++++++++++++++++++ - -The function [eq]#reduce()# is defined to operate on pairs of weights and -texel values as follows. -When using linear or anisotropic filtering, the values of multiple texels -are combined using a weighted average to produce a filtered texture value. -ifdef::VK_EXT_sampler_filter_minmax[] -However, a filtered texture value can: also be produced by computing -per-component minimum and maximum values over the set of texels that would -normally be averaged. -The slink:VkSamplerReductionModeCreateInfoEXT::pname:reductionMode controls -the process by which multiple texels are combined to produce a filtered -texture value. -When set to ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, a weighted -average is computed. -If the reduction mode is ename:VK_SAMPLER_REDUCTION_MODE_MIN_EXT or -ename:VK_SAMPLER_REDUCTION_MODE_MAX_EXT, [eq]#reduce()# computes a -component-wise minimum or maximum, respectively, of the components of the -set of provided texels with non-zero weights. +ifndef::VK_EXT_sampler_filter_minmax[] +The values of multiple texels, together with their weights, are combined +using a weighted average to produce a filtered value: endif::VK_EXT_sampler_filter_minmax[] -ifdef::VK_IMG_filter_cubic[] -Within a mip level, ename:VK_FILTER_CUBIC_IMG filtering computes a weighted -average of 16 (for 2D), or 4 (for 1D) texel values, using the weights -computed during texel selection. +ifdef::VK_EXT_sampler_filter_minmax[] +The values of multiple texels, together with their weights, are combined to +produce a filtered value. -Catmull-Rom Spine interpolation of four points is defined by the equation: +The slink:VkSamplerReductionModeCreateInfoEXT::pname:reductionMode can: +control the process by which multiple texels, together with their weights, +are combined to produce a filtered texture value. + +When the pname:reductionMode is set (explicitly or implicitly) to +ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, a weighted average is +computed: +endif::VK_EXT_sampler_filter_minmax[] [latexmath] ++++++++++++++++++++++++ \begin{aligned} -cinterp(\tau_0, \tau_1, \tau_2, \tau_3, \omega) = -\frac{1}{2} -\begin{bmatrix}1 & \omega & \omega^2 & \omega^3 \end{bmatrix} -\times +\tau_{3D} &= \sum_{k=k_0}^{k_1}\sum_{j=j_0}^{j_1}\sum_{i=i_0}^{i_1}(w_{i})(w_{j})(w_{k})\tau_{ijk} \\ +\tau_{2D} &= \sum_{j=j_0}^{j_1}\sum_{i=i_0}^{i_1}(w_{i})(w_{j})\tau_{ij} \\ +\tau_{1D} &= \sum_{i=i_0}^{i_1}(w_{i})\tau_{i} +\end{aligned} +++++++++++++++++++++++++ + +ifdef::VK_EXT_sampler_filter_minmax[] +However, if the reduction mode is ename:VK_SAMPLER_REDUCTION_MODE_MIN_EXT or +ename:VK_SAMPLER_REDUCTION_MODE_MAX_EXT, the process operates on the above +set of multiple texels, together with their weights, computing a +component-wise minimum or maximum, respectively, of the components of the +set of texels with non-zero weights. +endif::VK_EXT_sampler_filter_minmax[] + +ifdef::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] + +[[textures-texel-cubic-filtering]] +==== Texel Cubic Filtering + +Within a mip level, ename:VK_FILTER_CUBIC_EXT, filtering computes a weighted +average of +ifdef::VK_EXT_filter_cubic[] +64 (for 3D), +endif::VK_EXT_filter_cubic[] +16 (for 2D), or 4 (for 1D) texel values, together with their Catmull-Rom +weights. + +Catmull-Rom weights are derived from the fractions computed earlier. + +ifndef::VK_EXT_filter_cubic[] +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} \begin{bmatrix} - 0 & 2 & 0 & 0 \\ --1 & 0 & 1 & 0 \\ - 2 & -5 & 4 & 1 \\ --1 & 3 & -3 & 1 +w_{i_0}\phantom{,} w_{i_1}\phantom{,} w_{i_2}\phantom{,} w_{i_3} \end{bmatrix} -\times += \frac{1}{2} \begin{bmatrix} -\tau_0 \\ -\tau_1 \\ -\tau_2 \\ -\tau_3 +1 & \alpha & \alpha^2 & \alpha^3 +\end{bmatrix} +\begin{bmatrix} +\phantom{-}0 & \phantom{-}2 & \phantom{-}0 & \phantom{-}0 \\ +-1 & \phantom{-}0 & \phantom{-}1 & \phantom{-}0 \\ +\phantom{-}2 & -5 & \phantom{-}4 & \phantom{-}1 \\ +-1 & \phantom{-}3 & -3 & \phantom{-}1 +\end{bmatrix} +\\ +\begin{bmatrix} +w_{j_0}\phantom{,} w_{j_1}\phantom{,} w_{j_2}\phantom{,} w_{j_3} +\end{bmatrix} += \frac{1}{2} +\begin{bmatrix} +1 & \beta & \beta^2 & \beta^3 +\end{bmatrix} +\begin{bmatrix} +\phantom{-}0 & \phantom{-}2 & \phantom{-}0 & \phantom{-}0 \\ +-1 & \phantom{-}0 & \phantom{-}1 & \phantom{-}0 \\ +\phantom{-}2 & -5 & \phantom{-}4 & \phantom{-}1 \\ +-1 & \phantom{-}3 & -3 & \phantom{-}1 \end{bmatrix} \end{aligned} ++++++++++++++++++++++++ -Using the values calculated in texel selection, this equation is applied to -the four points in 1D images. -For 2D images, the this equation is evaluated first for each row, and the -result is then fed back into the equation and interpolated again: - - :: [eq]#{tau}~1D~[level] = cinterp({tau}~i0~[level], {tau}~i1~[level], - {tau}~i2~[level], {tau}~i3~[level], {alpha})# - - :: [eq]#{tau}~j0~[level] = cinterp({tau}~i0j0~[level], {tau}~i1j0~[level], - {tau}~i2j0~[level], {tau}~i3j0~[level], {alpha})# - :: [eq]#{tau}~j1~[level] = cinterp({tau}~i0j1~[level], {tau}~i1j1~[level], - {tau}~i2j1~[level], {tau}~i3j1~[level], {alpha})# - :: [eq]#{tau}~j2~[level] = cinterp({tau}~i0j2~[level], {tau}~i1j2~[level], - {tau}~i2j2~[level], {tau}~i3j2~[level], {alpha})# - :: [eq]#{tau}~j3~[level] = cinterp({tau}~i0j3~[level], {tau}~i1j3~[level], - {tau}~i2j3~[level], {tau}~i3j3~[level], {alpha})# - :: [eq]#{tau}~2D~[level] = cinterp({tau}~j0~[level], {tau}~j1~[level], - {tau}~j2~[level], {tau}~j3~[level], {beta})# +The values of multiple texels, together with their weights, are combined +using a weighted average to produce a filtered value: [latexmath] ++++++++++++++++++++++++ \begin{aligned} -\tau[level] &= - \begin{cases} - \tau_{2D}[level], & \text{for 2D image} \\ - \tau_{1D}[level], & \text{for 1D image} - \end{cases} +\tau_{2D} &= \sum_{j=j_0}^{j_3}\sum_{i=i_0}^{i_3}(w_{i})(w_{j})\tau_{ij} \\ +\tau_{1D} &= \sum_{i=i_0}^{i_3}(w_{i})\tau_{i} \end{aligned} ++++++++++++++++++++++++ -endif::VK_IMG_filter_cubic[] +endif::VK_EXT_filter_cubic[] -Finally, mipmap filtering either selects a value from one mip level or -computes a weighted average between neighboring mip levels: +ifdef::VK_EXT_filter_cubic[] [latexmath] ++++++++++++++++++++++++ \begin{aligned} -\tau &= - \begin{cases} - \tau[d], & \text{for mip mode BASE or NEAREST} \\ - reduce((1-\delta),\tau[d_{hi}],\delta,\tau[d_{lo}]), & \text{for mip mode LINEAR} - \end{cases} +\begin{bmatrix} +w_{i_0}\phantom{,} w_{i_1}\phantom{,} w_{i_2}\phantom{,} w_{i_3} +\end{bmatrix} += \frac{1}{2} +\begin{bmatrix} +1 & \alpha & \alpha^2 & \alpha^3 +\end{bmatrix} +\begin{bmatrix} +\phantom{-}0 & \phantom{-}2 & \phantom{-}0 & \phantom{-}0 \\ +-1 & \phantom{-}0 & \phantom{-}1 & \phantom{-}0 \\ +\phantom{-}2 & -5 & \phantom{-}4 & \phantom{-}1 \\ +-1 & \phantom{-}3 & -3 & \phantom{-}1 +\end{bmatrix} +\\ +\begin{bmatrix} +w_{j_0}\phantom{,} w_{j_1}\phantom{,} w_{j_2}\phantom{,} w_{j_3} +\end{bmatrix} += \frac{1}{2} +\begin{bmatrix} +1 & \beta & \beta^2 & \beta^3 +\end{bmatrix} +\begin{bmatrix} +\phantom{-}0 & \phantom{-}2 & \phantom{-}0 & \phantom{-}0 \\ +-1 & \phantom{-}0 & \phantom{-}1 & \phantom{-}0 \\ +\phantom{-}2 & -5 & \phantom{-}4 & \phantom{-}1 \\ +-1 & \phantom{-}3 & -3 & \phantom{-}1 +\end{bmatrix} +\\ +\begin{bmatrix} +w_{k_0}\phantom{,} w_{k_1}\phantom{,} w_{k_2}\phantom{,} w_{k_3} +\end{bmatrix} += \frac{1}{2} +\begin{bmatrix} +1 & \gamma & \gamma^2 & \gamma^3 +\end{bmatrix} +\begin{bmatrix} +\phantom{-}0 & \phantom{-}2 & \phantom{-}0 & \phantom{-}0 \\ +-1 & \phantom{-}0 & \phantom{-}1 & \phantom{-}0 \\ +\phantom{-}2 & -5 & \phantom{-}4 & \phantom{-}1 \\ +-1 & \phantom{-}3 & -3 & \phantom{-}1 +\end{bmatrix} \end{aligned} ++++++++++++++++++++++++ +The values of multiple texels, together with their weights, are combined to +produce a filtered value. + +The slink:VkSamplerReductionModeCreateInfoEXT::pname:reductionMode can: +control the process by which multiple texels, together with their weights, +are combined to produce a filtered texture value. + +When the pname:reductionMode is set (explicitly or implicitly) to +ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, a weighted average is +computed: + +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} +\tau_{3D} &= \sum_{k=j_0}^{k_3}\sum_{j=j_0}^{j_3}\sum_{i=i_0}^{i_3}(w_{i})(w_{j})(w_{k})\tau_{ijk} \\ +\tau_{2D} &= \sum_{j=j_0}^{j_3}\sum_{i=i_0}^{i_3}(w_{i})(w_{j})\tau_{ij} \\ +\tau_{1D} &= \sum_{i=i_0}^{i_3}(w_{i})\tau_{i} +\end{aligned} +++++++++++++++++++++++++ + +ifdef::VK_EXT_sampler_filter_minmax[] +However, if the reduction mode is ename:VK_SAMPLER_REDUCTION_MODE_MIN_EXT or +ename:VK_SAMPLER_REDUCTION_MODE_MAX_EXT, the process operates on the above +set of multiple texels, together with their weights, computing a +component-wise minimum or maximum, respectively, of the components of the +set of texels with non-zero weights. +endif::VK_EXT_sampler_filter_minmax[] + +endif::VK_EXT_filter_cubic[] +endif::VK_IMG_filter_cubic,VK_EXT_filter_cubic[] + +[[textures-texel-mipmap-filtering]] + +==== Texel Mipmap Filtering + +ename:VK_SAMPLER_MIPMAP_MODE_NEAREST filtering returns the value of a single +mipmap level, + +[eq]#{tau} = {tau}[d]#. + +ename:VK_SAMPLER_MIPMAP_MODE_LINEAR filtering combines the values of +multiple mipmap levels ({tau}[hi] and {tau}[lo]), together with their linear +weights. + +The linear weights are derived from the fraction computed earlier: + +[latexmath] + +++++++++++++++++++++++++ +\begin{aligned} +w_{hi} &= (1-\delta) \\ +w_{lo} &= (\delta) \\ +\end{aligned} +++++++++++++++++++++++++ + +ifndef::VK_EXT_sampler_filter_minmax[] +The values of multiple mipmap levels together with their linear weights, are +combined using a weighted average to produce a final filtered value: +endif::VK_EXT_sampler_filter_minmax[] +ifdef::VK_EXT_sampler_filter_minmax[] +The values of multiple mipmap levels, together with their weights, are +combined to produce a final filtered value. + +The slink:VkSamplerReductionModeCreateInfoEXT::pname:reductionMode can: +control the process by which multiple texels, together with their weights, +are combined to produce a filtered texture value. + +When the pname:reductionMode is set (explicitly or implicitly) to +ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, a weighted average is +computed: +endif::VK_EXT_sampler_filter_minmax[] + +[latexmath] +++++++++++++++++++++++++ +\begin{aligned} +\tau &= (w_{hi})\tau[hi]+(w_{lo})\tau[lo] +\end{aligned} +++++++++++++++++++++++++ [[textures-texel-anisotropic-filtering]] -=== Texel Anisotropic Filtering +==== Texel Anisotropic Filtering Anisotropic filtering is enabled by the pname:anisotropyEnable in the sampler. @@ -2487,18 +2670,16 @@ The sum [eq]#{tau}~2Daniso~# is defined using the single isotropic ++++++++++++++++++++++++ ifdef::VK_EXT_sampler_filter_minmax[] - When slink:VkSamplerReductionModeCreateInfoEXT::pname:reductionMode is set to ename:VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, the above summation is used. -If the reduction mode is ename:VK_SAMPLER_REDUCTION_MODE_MIN_EXT or -ename:VK_SAMPLER_REDUCTION_MODE_MAX_EXT, then the value is instead computed -as [eq]#{tau}~2Daniso~ = reduce({tau}~1~, {ldots}, {tau}~N~)#, combining all -texel values with non-zero weights. - +However, if the reduction mode is ename:VK_SAMPLER_REDUCTION_MODE_MIN_EXT or +ename:VK_SAMPLER_REDUCTION_MODE_MAX_EXT, the process operates on the above +values, together with their weights, computing a component-wise minimum or +maximum, respectively, of the components of the values with non-zero +weights. endif::VK_EXT_sampler_filter_minmax[] - ifdef::VK_NV_shader_image_footprint[] [[textures-footprint]] == Texel Footprint Evaluation @@ -2575,20 +2756,22 @@ local neighborhood of texel groups would have one or more texels accessed during texel filtering. In the mask, the texel group with local group coordinates latexmath:[(lgx,lgy)] is considered covered if and only if + [latexmath] +++++++++++++++++++ \begin{aligned} 0 \neq ((mask.x + (mask.y << 32)) \text{ \& } (1 << (lgy \times 8 + lgx))) \end{aligned} +++++++++++++++++++ -where + +where: * latexmath:[0<=lgx<8] and latexmath:[0<=lgy<8]; and * latexmath:[mask] is the returned two-component mask. The local group with coordinates latexmath:[(lgx,lgy)] in the mask is considered covered if and only if the texel filtering operation would access -one or more texels latexmath:[\tau_{ij}] in the returned miplevel where +one or more texels latexmath:[\tau_{ij}] in the returned miplevel where: [latexmath] +++++++++++++++++++ \begin{aligned} @@ -2626,7 +2809,7 @@ latexmath:[(lgx,lgy,lgz)], is considered covered if and only if: 0 \neq ((mask.x + (mask.y << 32)) \text{ \& } (1 << (lgz \times 16 + lgy \times 4 + lgx))) \end{aligned} +++++++++++++++++++ -where +where: * latexmath:[0<=lgx<4], latexmath:[0<=lgy<4], and latexmath:[0<=lgz<4]; and @@ -2634,7 +2817,7 @@ where The local group with coordinates latexmath:[(lgx,lgy,lgz)] in the mask is considered covered if and only if the texel filtering operation would access -one or more texels latexmath:[\tau_{ijk}] in the returned miplevel where +one or more texels latexmath:[\tau_{ijk}] in the returned miplevel where: [latexmath] +++++++++++++++++++ \begin{aligned} diff --git a/config/khronos.css b/config/khronos.css index 76d9f3b9..83a9a804 100644 --- a/config/khronos.css +++ b/config/khronos.css @@ -712,3 +712,6 @@ code { -webkit-border-radius: 4px; border-radius: 4px; } p.tableblock.header { color: #6d6e71; } .literalblock pre, .listingblock pre { background: #eee; } + +/* From https://github.com/KhronosGroup/Vulkan-Docs/pull/901 */ +a code { color: inherit; } diff --git a/copyright-spec.txt b/copyright-spec.txt index 6d43c3ed..036d7af4 100644 --- a/copyright-spec.txt +++ b/copyright-spec.txt @@ -77,7 +77,7 @@ endif::ratified_core_spec[] Vulkan and Khronos are registered trademarks of The Khronos Group Inc. ASTC is a trademark of ARM Holdings PLC; OpenCL is a trademark of Apple -Inc.; and OpenGL is a registered trademark of Silicon Graphics -International, all used under license by Khronos. All other product names, +Inc.; and OpenGL and OpenGL ES are registered trademarks of Hewlett Packard +Enterprise, all used under license by Khronos. All other product names, trademarks, and/or company names are used solely for identification and belong to their respective owners. diff --git a/images/raypipe.svg b/images/raypipe.svg index bbb30235..b210f0d1 100644 --- a/images/raypipe.svg +++ b/images/raypipe.svg @@ -204,7 +204,7 @@ x="0 5.7638516 11.039961 15.60358 17.642841 23.882374 26.157471" y="0" sodipodi:role="line" - id="tspan3815">Any Hit + id="tspan3815">Any-Hit yesno - \ No newline at end of file + diff --git a/images/vulkantexture0-corner-alternative-a-ll.svg b/images/vulkantexture0-corner-alternative-a-ll.svg new file mode 100644 index 00000000..c59d03de --- /dev/null +++ b/images/vulkantexture0-corner-alternative-a-ll.svg @@ -0,0 +1,1190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + i + 0.0 + 7.0 + + u + 0.0 + 1.0 + + s + + 3 + 2 + 1 + 0 + j + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i0j1 + i1j1 + i0j0 + i1j0 + + + + (u,v) + + + i0j1' + i1j1' + i0j0' + i1j0' + + 3.0 + 0.0 + + v + 1.0 + 0.0 + + t + + + diff --git a/images/vulkantexture0-ll.svg b/images/vulkantexture0-ll.svg new file mode 100644 index 00000000..d77d56b9 --- /dev/null +++ b/images/vulkantexture0-ll.svg @@ -0,0 +1,1205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + i + + + 0.0 + 8.0 + + u + + + 0.0 + 1.0 + + s + + + + + 3 + 2 + 1 + 0 + j + + + 4.0 + 0.0 + + v + + + 1.0 + 0.0 + + t + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + i0j1 + i1j1 + i0j0 + i1j0 + + + + + + (u-0.5,v-0.5) + + + + (u,v) + + + + i0j1' + i1j1' + i0j0' + i1j0' + + + + + diff --git a/images/vulkantexture1-ll.svg b/images/vulkantexture1-ll.svg new file mode 100644 index 00000000..64a7234c --- /dev/null +++ b/images/vulkantexture1-ll.svg @@ -0,0 +1,1019 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + 3 + 2 + 1 + 0 + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + j + i + + 0.0 + 8.0 + + u + + + 0.0 + 1.0 + + s + + + 4.0 + 0.0 + + v + + + + 1.0 + 0.0 + + t + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ij + + + + + + + + + + ij' + + (u,v) + + diff --git a/images/vulkantexture2-ll.svg b/images/vulkantexture2-ll.svg new file mode 100644 index 00000000..be41270a --- /dev/null +++ b/images/vulkantexture2-ll.svg @@ -0,0 +1,510 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + X + + Y + + + + + + + dPdx + 1 + + + + + dPdx + 0 + + + + + dPdy + 1 + + + + + dPdy + 0 + + + + + 2 + 3 + + + 0 + 1 + + + + diff --git a/include/vulkan/vulkan_core.h b/include/vulkan/vulkan_core.h index e0349bdc..b16863be 100644 --- a/include/vulkan/vulkan_core.h +++ b/include/vulkan/vulkan_core.h @@ -43,7 +43,7 @@ extern "C" { #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) // Version of this file -#define VK_HEADER_VERSION 98 +#define VK_HEADER_VERSION 99 #define VK_NULL_HANDLE 0 @@ -431,6 +431,8 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV = 1000165012, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV = 1000166000, VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV = 1000166001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT = 1000170000, + VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT = 1000170001, VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = 1000177000, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, @@ -466,6 +468,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT = 1000237000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT = 1000238000, VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT = 1000238001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV = 1000240000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT = 1000244000, VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT = 1000244001, VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT = 1000244002, @@ -1140,7 +1143,7 @@ typedef enum VkDynamicState { typedef enum VkFilter { VK_FILTER_NEAREST = 0, VK_FILTER_LINEAR = 1, - VK_FILTER_CUBIC_IMG = 1000015000, + VK_FILTER_CUBIC_EXT = 1000015000, VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST, VK_FILTER_END_RANGE = VK_FILTER_LINEAR, VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1), @@ -1340,7 +1343,7 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 0x00200000, VK_FORMAT_FEATURE_DISJOINT_BIT = 0x00400000, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 0x00800000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 0x00002000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 0x00010000, VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT, @@ -6382,6 +6385,10 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( #define VK_IMG_filter_cubic 1 #define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 #define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" +#define VK_FILTER_CUBIC_EXT 1000015000 +#define VK_FILTER_CUBIC_IMG VK_FILTER_CUBIC_EXT +#define VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT 0x00002000 +#define VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT #define VK_AMD_rasterization_order 1 @@ -8552,6 +8559,25 @@ typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV { +#define VK_EXT_filter_cubic 1 +#define VK_EXT_FILTER_CUBIC_SPEC_VERSION 1 +#define VK_EXT_FILTER_CUBIC_EXTENSION_NAME "VK_EXT_filter_cubic" + +typedef struct VkPhysicalDeviceImageViewImageFormatInfoEXT { + VkStructureType sType; + void* pNext; + VkImageViewType imageViewType; +} VkPhysicalDeviceImageViewImageFormatInfoEXT; + +typedef struct VkFilterCubicImageViewImageFormatPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 filterCubic; + VkBool32 filterCubicMinmax ; +} VkFilterCubicImageViewImageFormatPropertiesEXT; + + + #define VK_EXT_global_priority 1 #define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2 #define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority" @@ -9004,6 +9030,18 @@ typedef struct VkMemoryPriorityAllocateInfoEXT { +#define VK_NV_dedicated_allocation_image_aliasing 1 +#define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION 1 +#define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME "VK_NV_dedicated_allocation_image_aliasing" + +typedef struct VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 dedicatedAllocationImageAliasing; +} VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV; + + + #define VK_EXT_buffer_device_address 1 typedef uint64_t VkDeviceAddress; diff --git a/katex/README.md b/katex/README.md index 5f8caa8d..2c0c7a4c 100644 --- a/katex/README.md +++ b/katex/README.md @@ -1,63 +1,85 @@ -# [KaTeX](https://khan.github.io/KaTeX/) [![Build Status](https://travis-ci.org/Khan/KaTeX.svg?branch=master)](https://travis-ci.org/Khan/KaTeX) - -[![Join the chat at https://gitter.im/Khan/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Khan/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +# [KaTeX](https://katex.org/) +[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex) +[![CircleCI](https://circleci.com/gh/Khan/KaTeX.svg?style=shield)](https://circleci.com/gh/Khan/KaTeX) +[![codecov](https://codecov.io/gh/Khan/KaTeX/branch/master/graph/badge.svg)](https://codecov.io/gh/Khan/KaTeX) +[![Join the chat at https://gitter.im/Khan/KaTeX](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Khan/KaTeX?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Greenkeeper badge](https://badges.greenkeeper.io/Khan/KaTeX.svg)](https://greenkeeper.io/) +[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex) +![](https://img.badgesize.io/Khan/KaTeX/v0.10.0/dist/katex.min.js?compression=gzip) KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. - * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://jsperf.com/katex-vs-mathjax/). + * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](http://www.intmath.com/cg5/katex-mathjax-comparison.php). * **Print quality:** KaTeX’s layout is based on Donald Knuth’s TeX, the gold standard for math typesetting. * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources. * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML. -KaTeX supports all major browsers, including Chrome, Safari, Firefox, Opera, and IE 8 - IE 11. A list of supported commands can be on the [wiki](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX). +KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 9–11. -## Usage +KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html). -You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN: +Try out KaTeX [on the demo page](https://katex.org/#demo)! + +## Getting started + +### Starter template ```html - - + + + + + + + + + + + + + ... + ``` -#### In-browser rendering +You can also [download KaTeX](https://github.com/khan/katex/releases) and host it yourself. -Call `katex.render` with a TeX expression and a DOM element to render into: +For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html). -```js -katex.render("c = \\pm\\sqrt{a^2 + b^2}", element); -``` - -If KaTeX can't parse the expression, it throws a `katex.ParseError` error. - -#### Server side rendering or rendering to a string - -To generate HTML on the server or to generate an HTML string of the rendered math, you can use `katex.renderToString`: - -```js -var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}"); -// '...' -``` - -Make sure to include the CSS and font files, but there is no need to include the JavaScript. Like `render`, `renderToString` throws if it can't parse the expression. - -#### Rendering options - -You can provide an object of options as the last argument to `katex.render` and `katex.renderToString`. Available options are: - -- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`) -- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`) -- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`) +### API +Call `katex.render` to render a TeX expression directly into a DOM element. For example: ```js -katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { displayMode: true }); +katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { + throwOnError: false +}); ``` -#### Automatic rendering of math on a page +Call `katex.renderToString` to generate an HTML string of the rendered math, +e.g., for server-side rendering. For example: -Math on the page can be automatically rendered using the auto-render extension. See [the Auto-render README](contrib/auto-render/README.md) for more information. +```js +var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", { + throwOnError: false +}); +// '...' +``` + +Make sure to include the CSS and font files in both cases. +If you are doing all rendering on the server, there is no need to include the +JavaScript on the client. + +The examples above use the `throwOnError: false` option, which renders invalid +inputs as the TeX source code in red (by default), with the error message as +hover text. For other available options, see the +[API documentation](https://katex.org/docs/api.html), +[options documentation](https://katex.org/docs/options.html), and +[handling errors documentation](https://katex.org/docs/error.html). + +## Demo and Documentation + +Learn more about using KaTeX [on the website](https://katex.org)! ## Contributing diff --git a/katex/contrib/auto-render.js b/katex/contrib/auto-render.js new file mode 100644 index 00000000..a10d9f2f --- /dev/null +++ b/katex/contrib/auto-render.js @@ -0,0 +1,335 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("katex")); + else if(typeof define === 'function' && define.amd) + define(["katex"], factory); + else if(typeof exports === 'object') + exports["renderMathInElement"] = factory(require("katex")); + else + root["renderMathInElement"] = factory(root["katex"]); +})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__0__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 1); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__0__; + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); + +// EXTERNAL MODULE: external "katex" +var external_katex_ = __webpack_require__(0); +var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_); + +// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js +/* eslint no-constant-condition:0 */ +var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) { + // Adapted from + // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx + var index = startIndex; + var braceLevel = 0; + var delimLength = delimiter.length; + + while (index < text.length) { + var character = text[index]; + + if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) { + return index; + } else if (character === "\\") { + index++; + } else if (character === "{") { + braceLevel++; + } else if (character === "}") { + braceLevel--; + } + + index++; + } + + return -1; +}; + +var splitAtDelimiters = function splitAtDelimiters(startData, leftDelim, rightDelim, display) { + var finalData = []; + + for (var i = 0; i < startData.length; i++) { + if (startData[i].type === "text") { + var text = startData[i].data; + var lookingForLeft = true; + var currIndex = 0; + var nextIndex = void 0; + nextIndex = text.indexOf(leftDelim); + + if (nextIndex !== -1) { + currIndex = nextIndex; + finalData.push({ + type: "text", + data: text.slice(0, currIndex) + }); + lookingForLeft = false; + } + + while (true) { + if (lookingForLeft) { + nextIndex = text.indexOf(leftDelim, currIndex); + + if (nextIndex === -1) { + break; + } + + finalData.push({ + type: "text", + data: text.slice(currIndex, nextIndex) + }); + currIndex = nextIndex; + } else { + nextIndex = findEndOfMath(rightDelim, text, currIndex + leftDelim.length); + + if (nextIndex === -1) { + break; + } + + finalData.push({ + type: "math", + data: text.slice(currIndex + leftDelim.length, nextIndex), + rawData: text.slice(currIndex, nextIndex + rightDelim.length), + display: display + }); + currIndex = nextIndex + rightDelim.length; + } + + lookingForLeft = !lookingForLeft; + } + + finalData.push({ + type: "text", + data: text.slice(currIndex) + }); + } else { + finalData.push(startData[i]); + } + } + + return finalData; +}; + +/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters); +// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js +/* eslint no-console:0 */ + + + +var auto_render_splitWithDelimiters = function splitWithDelimiters(text, delimiters) { + var data = [{ + type: "text", + data: text + }]; + + for (var i = 0; i < delimiters.length; i++) { + var delimiter = delimiters[i]; + data = auto_render_splitAtDelimiters(data, delimiter.left, delimiter.right, delimiter.display || false); + } + + return data; +}; +/* Note: optionsCopy is mutated by this method. If it is ever exposed in the + * API, we should copy it before mutating. + */ + + +var auto_render_renderMathInText = function renderMathInText(text, optionsCopy) { + var data = auto_render_splitWithDelimiters(text, optionsCopy.delimiters); + var fragment = document.createDocumentFragment(); + + for (var i = 0; i < data.length; i++) { + if (data[i].type === "text") { + fragment.appendChild(document.createTextNode(data[i].data)); + } else { + var span = document.createElement("span"); + var math = data[i].data; // Override any display mode defined in the settings with that + // defined by the text itself + + optionsCopy.displayMode = data[i].display; + + try { + external_katex_default.a.render(math, span, optionsCopy); + } catch (e) { + if (!(e instanceof external_katex_default.a.ParseError)) { + throw e; + } + + optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e); + fragment.appendChild(document.createTextNode(data[i].rawData)); + continue; + } + + fragment.appendChild(span); + } + } + + return fragment; +}; + +var renderElem = function renderElem(elem, optionsCopy) { + for (var i = 0; i < elem.childNodes.length; i++) { + var childNode = elem.childNodes[i]; + + if (childNode.nodeType === 3) { + // Text node + var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy); + i += frag.childNodes.length - 1; + elem.replaceChild(frag, childNode); + } else if (childNode.nodeType === 1) { + (function () { + // Element node + var className = ' ' + childNode.className + ' '; + var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) { + return className.indexOf(' ' + x + ' ') === -1; + }); + + if (shouldRender) { + renderElem(childNode, optionsCopy); + } + })(); + } // Otherwise, it's something else, and ignore it. + + } +}; + +var renderMathInElement = function renderMathInElement(elem, options) { + if (!elem) { + throw new Error("No element provided to render"); + } + + var optionsCopy = {}; // Object.assign(optionsCopy, option) + + for (var option in options) { + if (options.hasOwnProperty(option)) { + optionsCopy[option] = options[option]; + } + } // default options + + + optionsCopy.delimiters = optionsCopy.delimiters || [{ + left: "$$", + right: "$$", + display: true + }, { + left: "\\(", + right: "\\)", + display: false + }, // LaTeX uses $…$, but it ruins the display of normal `$` in text: + // {left: "$", right: "$", display: false}, + // \[…\] must come last in this array. Otherwise, renderMathInElement + // will search for \[ before it searches for $$ or \( + // That makes it susceptible to finding a \\[0.3em] row delimiter and + // treating it as if it were the start of a KaTeX math zone. + { + left: "\\[", + right: "\\]", + display: true + }]; + optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code"]; + optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || []; + optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different + // math elements within a single call to `renderMathInElement`. + + optionsCopy.macros = optionsCopy.macros || {}; + renderElem(elem, optionsCopy); +}; + +/* harmony default export */ var auto_render = __webpack_exports__["default"] = (renderMathInElement); + +/***/ }) +/******/ ])["default"]; +}); \ No newline at end of file diff --git a/katex/contrib/auto-render.min.js b/katex/contrib/auto-render.min.js index 30cc3121..933a1304 100644 --- a/katex/contrib/auto-render.min.js +++ b/katex/contrib/auto-render.min.js @@ -1 +1 @@ -(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.renderMathInElement=e()}})(function(){var e,t,r;return function n(e,t,r){function a(o,l){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!l&&f)return f(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[o]={exports:{}};e[o][0].call(s.exports,function(t){var r=e[o][1][t];return a(r?r:t)},s,s.exports,n,e,t,r)}return t[o].exports}var i=typeof require=="function"&&require;for(var o=0;o element). +// Modifies fragment in-place. Useful for writing your own 'copy' handler, +// as in copy-tex.js. + +var katexReplaceWithTex = function katexReplaceWithTex(fragment, copyDelimiters) { + if (copyDelimiters === void 0) { + copyDelimiters = defaultCopyDelimiters; + } + + // Remove .katex-html blocks that are preceded by .katex-mathml blocks + // (which will get replaced below). + var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html'); + + for (var i = 0; i < katexHtml.length; i++) { + var element = katexHtml[i]; + + if (element.remove) { + element.remove(null); + } else { + element.parentNode.removeChild(element); + } + } // Replace .katex-mathml elements with their annotation (TeX source) + // descendant, with inline delimiters. + + + var katexMathml = fragment.querySelectorAll('.katex-mathml'); + + for (var _i = 0; _i < katexMathml.length; _i++) { + var _element = katexMathml[_i]; + + var texSource = _element.querySelector('annotation'); + + if (texSource) { + if (_element.replaceWith) { + _element.replaceWith(texSource); + } else { + _element.parentNode.replaceChild(texSource, _element); + } + + texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1]; + } + } // Switch display math to display delimiters. + + + var displays = fragment.querySelectorAll('.katex-display annotation'); + + for (var _i2 = 0; _i2 < displays.length; _i2++) { + var _element2 = displays[_i2]; + _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1]; + } + + return fragment; +}; +/* harmony default export */ var katex2tex = (katexReplaceWithTex); +// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js + + // Global copy handler to modify behavior on .katex elements. + +document.addEventListener('copy', function (event) { + var selection = window.getSelection(); + + if (selection.isCollapsed) { + return; // default action OK if selection is empty + } + + var fragment = selection.getRangeAt(0).cloneContents(); + + if (!fragment.querySelector('.katex-mathml')) { + return; // default action OK if no .katex-mathml elements + } // Preserve usual HTML copy/paste behavior. + + + var html = []; + + for (var i = 0; i < fragment.childNodes.length; i++) { + html.push(fragment.childNodes[i].outerHTML); + } + + event.clipboardData.setData('text/html', html.join('')); // Rewrite plain-text version. + + event.clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling. + + event.preventDefault(); +}); + +/***/ }) +/******/ ])["default"]; +}); \ No newline at end of file diff --git a/katex/contrib/copy-tex.min.css b/katex/contrib/copy-tex.min.css new file mode 100644 index 00000000..012c0d41 --- /dev/null +++ b/katex/contrib/copy-tex.min.css @@ -0,0 +1 @@ +.katex,.katex-display{-moz-user-select:all;-ms-user-select:all;-webkit-user-select:all;user-select:all} diff --git a/katex/contrib/copy-tex.min.js b/katex/contrib/copy-tex.min.js new file mode 100644 index 00000000..7c2dd1f9 --- /dev/null +++ b/katex/contrib/copy-tex.min.js @@ -0,0 +1 @@ +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=2)}([function(e,t,n){},,function(e,t,n){"use strict";n.r(t);n(0);var p={inline:["$","$"],display:["$$","$$"]},l=function(e,t){void 0===t&&(t=p);for(var n=e.querySelectorAll(".katex-mathml + .katex-html"),r=0;r .katex { - display: inline-block; - text-align: initial; -} .katex { font: normal 1.21em KaTeX_Main, Times New Roman, serif; line-height: 1.2; - white-space: nowrap; text-indent: 0; + text-rendering: auto; } -.katex .katex-html { - display: inline-block; +.katex * { + -ms-high-contrast-adjust: none !important; } .katex .katex-mathml { position: absolute; @@ -137,224 +137,106 @@ width: 1px; overflow: hidden; } +.katex .katex-html { + /* \newline is an empty block at top level, between .base elements */ +} +.katex .katex-html > .newline { + display: block; +} .katex .base { + position: relative; display: inline-block; + white-space: nowrap; + width: min-content; } .katex .strut { display: inline-block; } -.katex .mathrm { - font-style: normal; +.katex .textbf { + font-weight: bold; } .katex .textit { font-style: italic; } -.katex .mathit { +.katex .textrm { + font-family: KaTeX_Main; +} +.katex .textsf { + font-family: KaTeX_SansSerif; +} +.katex .texttt { + font-family: KaTeX_Typewriter; +} +.katex .mathdefault { font-family: KaTeX_Math; font-style: italic; } +.katex .mathit { + font-family: KaTeX_Main; + font-style: italic; +} +.katex .mathrm { + font-style: normal; +} .katex .mathbf { font-family: KaTeX_Main; font-weight: bold; } +.katex .boldsymbol { + font-family: KaTeX_Math; + font-weight: bold; + font-style: italic; +} .katex .amsrm { font-family: KaTeX_AMS; } -.katex .mathbb { +.katex .mathbb, +.katex .textbb { font-family: KaTeX_AMS; } .katex .mathcal { font-family: KaTeX_Caligraphic; } -.katex .mathfrak { +.katex .mathfrak, +.katex .textfrak { font-family: KaTeX_Fraktur; } .katex .mathtt { font-family: KaTeX_Typewriter; } -.katex .mathscr { +.katex .mathscr, +.katex .textscr { font-family: KaTeX_Script; } -.katex .mathsf { +.katex .mathsf, +.katex .textsf { font-family: KaTeX_SansSerif; } -.katex .mainit { - font-family: KaTeX_Main; +.katex .mathboldsf, +.katex .textboldsf { + font-family: KaTeX_SansSerif; + font-weight: bold; +} +.katex .mathitsf, +.katex .textitsf { + font-family: KaTeX_SansSerif; font-style: italic; } -.katex .mord + .mop { - margin-left: 0.16667em; +.katex .mainrm { + font-family: KaTeX_Main; + font-style: normal; } -.katex .mord + .mbin { - margin-left: 0.22222em; +.katex .vlist-t { + display: inline-table; + table-layout: fixed; } -.katex .mord + .mrel { - margin-left: 0.27778em; -} -.katex .mord + .minner { - margin-left: 0.16667em; -} -.katex .mop + .mord { - margin-left: 0.16667em; -} -.katex .mop + .mop { - margin-left: 0.16667em; -} -.katex .mop + .mrel { - margin-left: 0.27778em; -} -.katex .mop + .minner { - margin-left: 0.16667em; -} -.katex .mbin + .mord { - margin-left: 0.22222em; -} -.katex .mbin + .mop { - margin-left: 0.22222em; -} -.katex .mbin + .mopen { - margin-left: 0.22222em; -} -.katex .mbin + .minner { - margin-left: 0.22222em; -} -.katex .mrel + .mord { - margin-left: 0.27778em; -} -.katex .mrel + .mop { - margin-left: 0.27778em; -} -.katex .mrel + .mopen { - margin-left: 0.27778em; -} -.katex .mrel + .minner { - margin-left: 0.27778em; -} -.katex .mclose + .mop { - margin-left: 0.16667em; -} -.katex .mclose + .mbin { - margin-left: 0.22222em; -} -.katex .mclose + .mrel { - margin-left: 0.27778em; -} -.katex .mclose + .minner { - margin-left: 0.16667em; -} -.katex .mpunct + .mord { - margin-left: 0.16667em; -} -.katex .mpunct + .mop { - margin-left: 0.16667em; -} -.katex .mpunct + .mrel { - margin-left: 0.16667em; -} -.katex .mpunct + .mopen { - margin-left: 0.16667em; -} -.katex .mpunct + .mclose { - margin-left: 0.16667em; -} -.katex .mpunct + .mpunct { - margin-left: 0.16667em; -} -.katex .mpunct + .minner { - margin-left: 0.16667em; -} -.katex .minner + .mord { - margin-left: 0.16667em; -} -.katex .minner + .mop { - margin-left: 0.16667em; -} -.katex .minner + .mbin { - margin-left: 0.22222em; -} -.katex .minner + .mrel { - margin-left: 0.27778em; -} -.katex .minner + .mopen { - margin-left: 0.16667em; -} -.katex .minner + .mpunct { - margin-left: 0.16667em; -} -.katex .minner + .minner { - margin-left: 0.16667em; -} -.katex .mord.mtight { - margin-left: 0; -} -.katex .mop.mtight { - margin-left: 0; -} -.katex .mbin.mtight { - margin-left: 0; -} -.katex .mrel.mtight { - margin-left: 0; -} -.katex .mopen.mtight { - margin-left: 0; -} -.katex .mclose.mtight { - margin-left: 0; -} -.katex .mpunct.mtight { - margin-left: 0; -} -.katex .minner.mtight { - margin-left: 0; -} -.katex .mord + .mop.mtight { - margin-left: 0.16667em; -} -.katex .mop + .mord.mtight { - margin-left: 0.16667em; -} -.katex .mop + .mop.mtight { - margin-left: 0.16667em; -} -.katex .mclose + .mop.mtight { - margin-left: 0.16667em; -} -.katex .minner + .mop.mtight { - margin-left: 0.16667em; -} -.katex .reset-textstyle.textstyle { - font-size: 1em; -} -.katex .reset-textstyle.scriptstyle { - font-size: 0.7em; -} -.katex .reset-textstyle.scriptscriptstyle { - font-size: 0.5em; -} -.katex .reset-scriptstyle.textstyle { - font-size: 1.42857em; -} -.katex .reset-scriptstyle.scriptstyle { - font-size: 1em; -} -.katex .reset-scriptstyle.scriptscriptstyle { - font-size: 0.71429em; -} -.katex .reset-scriptscriptstyle.textstyle { - font-size: 2em; -} -.katex .reset-scriptscriptstyle.scriptstyle { - font-size: 1.4em; -} -.katex .reset-scriptscriptstyle.scriptscriptstyle { - font-size: 1em; -} -.katex .style-wrap { - position: relative; +.katex .vlist-r { + display: table-row; } .katex .vlist { - display: inline-block; + display: table-cell; + vertical-align: bottom; + position: relative; } .katex .vlist > span { display: block; @@ -364,9 +246,19 @@ .katex .vlist > span > span { display: inline-block; } -.katex .vlist .baseline-fix { - display: inline-table; - table-layout: fixed; +.katex .vlist > span > .pstrut { + overflow: hidden; + width: 0; +} +.katex .vlist-t2 { + margin-right: -2px; +} +.katex .vlist-s { + display: table-cell; + vertical-align: bottom; + font-size: 1px; + width: 2px; + min-width: 2px; } .katex .msupsub { text-align: left; @@ -375,92 +267,47 @@ text-align: center; } .katex .mfrac .frac-line { + display: inline-block; width: 100%; -} -.katex .mfrac .frac-line:before { border-bottom-style: solid; - border-bottom-width: 1px; - content: ""; - display: block; } -.katex .mfrac .frac-line:after { - border-bottom-style: solid; - border-bottom-width: 0.04em; - content: ""; - display: block; - margin-top: -1px; +.katex .mfrac .frac-line, +.katex .overline .overline-line, +.katex .underline .underline-line, +.katex .hline, +.katex .hdashline, +.katex .rule { + min-height: 1px; } .katex .mspace { display: inline-block; } -.katex .mspace.negativethinspace { - margin-left: -0.16667em; -} -.katex .mspace.thinspace { - width: 0.16667em; -} -.katex .mspace.negativemediumspace { - margin-left: -0.22222em; -} -.katex .mspace.mediumspace { - width: 0.22222em; -} -.katex .mspace.thickspace { - width: 0.27778em; -} -.katex .mspace.sixmuspace { - width: 0.333333em; -} -.katex .mspace.eightmuspace { - width: 0.444444em; -} -.katex .mspace.enspace { - width: 0.5em; -} -.katex .mspace.twelvemuspace { - width: 0.666667em; -} -.katex .mspace.quad { - width: 1em; -} -.katex .mspace.qquad { - width: 2em; -} .katex .llap, -.katex .rlap { +.katex .rlap, +.katex .clap { width: 0; position: relative; } .katex .llap > .inner, -.katex .rlap > .inner { +.katex .rlap > .inner, +.katex .clap > .inner { position: absolute; } .katex .llap > .fix, -.katex .rlap > .fix { +.katex .rlap > .fix, +.katex .clap > .fix { display: inline-block; } .katex .llap > .inner { right: 0; } -.katex .rlap > .inner { +.katex .rlap > .inner, +.katex .clap > .inner { left: 0; } -.katex .katex-logo .a { - font-size: 0.75em; - margin-left: -0.32em; - position: relative; - top: -0.2em; -} -.katex .katex-logo .t { - margin-left: -0.23em; -} -.katex .katex-logo .e { - margin-left: -0.1667em; - position: relative; - top: 0.2155em; -} -.katex .katex-logo .x { - margin-left: -0.125em; +.katex .clap > .inner > span { + margin-left: -50%; + margin-right: 50%; } .katex .rule { display: inline-block; @@ -468,42 +315,16 @@ position: relative; } .katex .overline .overline-line, -.katex .underline .underline-line { +.katex .underline .underline-line, +.katex .hline { + display: inline-block; width: 100%; -} -.katex .overline .overline-line:before, -.katex .underline .underline-line:before { border-bottom-style: solid; - border-bottom-width: 1px; - content: ""; - display: block; } -.katex .overline .overline-line:after, -.katex .underline .underline-line:after { - border-bottom-style: solid; - border-bottom-width: 0.04em; - content: ""; - display: block; - margin-top: -1px; -} -.katex .sqrt > .sqrt-sign { - position: relative; -} -.katex .sqrt .sqrt-line { +.katex .hdashline { + display: inline-block; width: 100%; -} -.katex .sqrt .sqrt-line:before { - border-bottom-style: solid; - border-bottom-width: 1px; - content: ""; - display: block; -} -.katex .sqrt .sqrt-line:after { - border-bottom-style: solid; - border-bottom-width: 0.04em; - content: ""; - display: block; - margin-top: -1px; + border-bottom-style: dashed; } .katex .sqrt > .root { margin-left: 0.27777778em; @@ -519,43 +340,47 @@ } .katex .sizing.reset-size1.size2, .katex .fontsize-ensurer.reset-size1.size2 { - font-size: 1.4em; + font-size: 1.2em; } .katex .sizing.reset-size1.size3, .katex .fontsize-ensurer.reset-size1.size3 { - font-size: 1.6em; + font-size: 1.4em; } .katex .sizing.reset-size1.size4, .katex .fontsize-ensurer.reset-size1.size4 { - font-size: 1.8em; + font-size: 1.6em; } .katex .sizing.reset-size1.size5, .katex .fontsize-ensurer.reset-size1.size5 { - font-size: 2em; + font-size: 1.8em; } .katex .sizing.reset-size1.size6, .katex .fontsize-ensurer.reset-size1.size6 { - font-size: 2.4em; + font-size: 2em; } .katex .sizing.reset-size1.size7, .katex .fontsize-ensurer.reset-size1.size7 { - font-size: 2.88em; + font-size: 2.4em; } .katex .sizing.reset-size1.size8, .katex .fontsize-ensurer.reset-size1.size8 { - font-size: 3.46em; + font-size: 2.88em; } .katex .sizing.reset-size1.size9, .katex .fontsize-ensurer.reset-size1.size9 { - font-size: 4.14em; + font-size: 3.456em; } .katex .sizing.reset-size1.size10, .katex .fontsize-ensurer.reset-size1.size10 { - font-size: 4.98em; + font-size: 4.148em; +} +.katex .sizing.reset-size1.size11, +.katex .fontsize-ensurer.reset-size1.size11 { + font-size: 4.976em; } .katex .sizing.reset-size2.size1, .katex .fontsize-ensurer.reset-size2.size1 { - font-size: 0.71428571em; + font-size: 0.83333333em; } .katex .sizing.reset-size2.size2, .katex .fontsize-ensurer.reset-size2.size2 { @@ -563,43 +388,47 @@ } .katex .sizing.reset-size2.size3, .katex .fontsize-ensurer.reset-size2.size3 { - font-size: 1.14285714em; + font-size: 1.16666667em; } .katex .sizing.reset-size2.size4, .katex .fontsize-ensurer.reset-size2.size4 { - font-size: 1.28571429em; + font-size: 1.33333333em; } .katex .sizing.reset-size2.size5, .katex .fontsize-ensurer.reset-size2.size5 { - font-size: 1.42857143em; + font-size: 1.5em; } .katex .sizing.reset-size2.size6, .katex .fontsize-ensurer.reset-size2.size6 { - font-size: 1.71428571em; + font-size: 1.66666667em; } .katex .sizing.reset-size2.size7, .katex .fontsize-ensurer.reset-size2.size7 { - font-size: 2.05714286em; + font-size: 2em; } .katex .sizing.reset-size2.size8, .katex .fontsize-ensurer.reset-size2.size8 { - font-size: 2.47142857em; + font-size: 2.4em; } .katex .sizing.reset-size2.size9, .katex .fontsize-ensurer.reset-size2.size9 { - font-size: 2.95714286em; + font-size: 2.88em; } .katex .sizing.reset-size2.size10, .katex .fontsize-ensurer.reset-size2.size10 { - font-size: 3.55714286em; + font-size: 3.45666667em; +} +.katex .sizing.reset-size2.size11, +.katex .fontsize-ensurer.reset-size2.size11 { + font-size: 4.14666667em; } .katex .sizing.reset-size3.size1, .katex .fontsize-ensurer.reset-size3.size1 { - font-size: 0.625em; + font-size: 0.71428571em; } .katex .sizing.reset-size3.size2, .katex .fontsize-ensurer.reset-size3.size2 { - font-size: 0.875em; + font-size: 0.85714286em; } .katex .sizing.reset-size3.size3, .katex .fontsize-ensurer.reset-size3.size3 { @@ -607,43 +436,47 @@ } .katex .sizing.reset-size3.size4, .katex .fontsize-ensurer.reset-size3.size4 { - font-size: 1.125em; + font-size: 1.14285714em; } .katex .sizing.reset-size3.size5, .katex .fontsize-ensurer.reset-size3.size5 { - font-size: 1.25em; + font-size: 1.28571429em; } .katex .sizing.reset-size3.size6, .katex .fontsize-ensurer.reset-size3.size6 { - font-size: 1.5em; + font-size: 1.42857143em; } .katex .sizing.reset-size3.size7, .katex .fontsize-ensurer.reset-size3.size7 { - font-size: 1.8em; + font-size: 1.71428571em; } .katex .sizing.reset-size3.size8, .katex .fontsize-ensurer.reset-size3.size8 { - font-size: 2.1625em; + font-size: 2.05714286em; } .katex .sizing.reset-size3.size9, .katex .fontsize-ensurer.reset-size3.size9 { - font-size: 2.5875em; + font-size: 2.46857143em; } .katex .sizing.reset-size3.size10, .katex .fontsize-ensurer.reset-size3.size10 { - font-size: 3.1125em; + font-size: 2.96285714em; +} +.katex .sizing.reset-size3.size11, +.katex .fontsize-ensurer.reset-size3.size11 { + font-size: 3.55428571em; } .katex .sizing.reset-size4.size1, .katex .fontsize-ensurer.reset-size4.size1 { - font-size: 0.55555556em; + font-size: 0.625em; } .katex .sizing.reset-size4.size2, .katex .fontsize-ensurer.reset-size4.size2 { - font-size: 0.77777778em; + font-size: 0.75em; } .katex .sizing.reset-size4.size3, .katex .fontsize-ensurer.reset-size4.size3 { - font-size: 0.88888889em; + font-size: 0.875em; } .katex .sizing.reset-size4.size4, .katex .fontsize-ensurer.reset-size4.size4 { @@ -651,43 +484,47 @@ } .katex .sizing.reset-size4.size5, .katex .fontsize-ensurer.reset-size4.size5 { - font-size: 1.11111111em; + font-size: 1.125em; } .katex .sizing.reset-size4.size6, .katex .fontsize-ensurer.reset-size4.size6 { - font-size: 1.33333333em; + font-size: 1.25em; } .katex .sizing.reset-size4.size7, .katex .fontsize-ensurer.reset-size4.size7 { - font-size: 1.6em; + font-size: 1.5em; } .katex .sizing.reset-size4.size8, .katex .fontsize-ensurer.reset-size4.size8 { - font-size: 1.92222222em; + font-size: 1.8em; } .katex .sizing.reset-size4.size9, .katex .fontsize-ensurer.reset-size4.size9 { - font-size: 2.3em; + font-size: 2.16em; } .katex .sizing.reset-size4.size10, .katex .fontsize-ensurer.reset-size4.size10 { - font-size: 2.76666667em; + font-size: 2.5925em; +} +.katex .sizing.reset-size4.size11, +.katex .fontsize-ensurer.reset-size4.size11 { + font-size: 3.11em; } .katex .sizing.reset-size5.size1, .katex .fontsize-ensurer.reset-size5.size1 { - font-size: 0.5em; + font-size: 0.55555556em; } .katex .sizing.reset-size5.size2, .katex .fontsize-ensurer.reset-size5.size2 { - font-size: 0.7em; + font-size: 0.66666667em; } .katex .sizing.reset-size5.size3, .katex .fontsize-ensurer.reset-size5.size3 { - font-size: 0.8em; + font-size: 0.77777778em; } .katex .sizing.reset-size5.size4, .katex .fontsize-ensurer.reset-size5.size4 { - font-size: 0.9em; + font-size: 0.88888889em; } .katex .sizing.reset-size5.size5, .katex .fontsize-ensurer.reset-size5.size5 { @@ -695,43 +532,47 @@ } .katex .sizing.reset-size5.size6, .katex .fontsize-ensurer.reset-size5.size6 { - font-size: 1.2em; + font-size: 1.11111111em; } .katex .sizing.reset-size5.size7, .katex .fontsize-ensurer.reset-size5.size7 { - font-size: 1.44em; + font-size: 1.33333333em; } .katex .sizing.reset-size5.size8, .katex .fontsize-ensurer.reset-size5.size8 { - font-size: 1.73em; + font-size: 1.6em; } .katex .sizing.reset-size5.size9, .katex .fontsize-ensurer.reset-size5.size9 { - font-size: 2.07em; + font-size: 1.92em; } .katex .sizing.reset-size5.size10, .katex .fontsize-ensurer.reset-size5.size10 { - font-size: 2.49em; + font-size: 2.30444444em; +} +.katex .sizing.reset-size5.size11, +.katex .fontsize-ensurer.reset-size5.size11 { + font-size: 2.76444444em; } .katex .sizing.reset-size6.size1, .katex .fontsize-ensurer.reset-size6.size1 { - font-size: 0.41666667em; + font-size: 0.5em; } .katex .sizing.reset-size6.size2, .katex .fontsize-ensurer.reset-size6.size2 { - font-size: 0.58333333em; + font-size: 0.6em; } .katex .sizing.reset-size6.size3, .katex .fontsize-ensurer.reset-size6.size3 { - font-size: 0.66666667em; + font-size: 0.7em; } .katex .sizing.reset-size6.size4, .katex .fontsize-ensurer.reset-size6.size4 { - font-size: 0.75em; + font-size: 0.8em; } .katex .sizing.reset-size6.size5, .katex .fontsize-ensurer.reset-size6.size5 { - font-size: 0.83333333em; + font-size: 0.9em; } .katex .sizing.reset-size6.size6, .katex .fontsize-ensurer.reset-size6.size6 { @@ -743,35 +584,39 @@ } .katex .sizing.reset-size6.size8, .katex .fontsize-ensurer.reset-size6.size8 { - font-size: 1.44166667em; + font-size: 1.44em; } .katex .sizing.reset-size6.size9, .katex .fontsize-ensurer.reset-size6.size9 { - font-size: 1.725em; + font-size: 1.728em; } .katex .sizing.reset-size6.size10, .katex .fontsize-ensurer.reset-size6.size10 { - font-size: 2.075em; + font-size: 2.074em; +} +.katex .sizing.reset-size6.size11, +.katex .fontsize-ensurer.reset-size6.size11 { + font-size: 2.488em; } .katex .sizing.reset-size7.size1, .katex .fontsize-ensurer.reset-size7.size1 { - font-size: 0.34722222em; + font-size: 0.41666667em; } .katex .sizing.reset-size7.size2, .katex .fontsize-ensurer.reset-size7.size2 { - font-size: 0.48611111em; + font-size: 0.5em; } .katex .sizing.reset-size7.size3, .katex .fontsize-ensurer.reset-size7.size3 { - font-size: 0.55555556em; + font-size: 0.58333333em; } .katex .sizing.reset-size7.size4, .katex .fontsize-ensurer.reset-size7.size4 { - font-size: 0.625em; + font-size: 0.66666667em; } .katex .sizing.reset-size7.size5, .katex .fontsize-ensurer.reset-size7.size5 { - font-size: 0.69444444em; + font-size: 0.75em; } .katex .sizing.reset-size7.size6, .katex .fontsize-ensurer.reset-size7.size6 { @@ -783,43 +628,47 @@ } .katex .sizing.reset-size7.size8, .katex .fontsize-ensurer.reset-size7.size8 { - font-size: 1.20138889em; + font-size: 1.2em; } .katex .sizing.reset-size7.size9, .katex .fontsize-ensurer.reset-size7.size9 { - font-size: 1.4375em; + font-size: 1.44em; } .katex .sizing.reset-size7.size10, .katex .fontsize-ensurer.reset-size7.size10 { - font-size: 1.72916667em; + font-size: 1.72833333em; +} +.katex .sizing.reset-size7.size11, +.katex .fontsize-ensurer.reset-size7.size11 { + font-size: 2.07333333em; } .katex .sizing.reset-size8.size1, .katex .fontsize-ensurer.reset-size8.size1 { - font-size: 0.28901734em; + font-size: 0.34722222em; } .katex .sizing.reset-size8.size2, .katex .fontsize-ensurer.reset-size8.size2 { - font-size: 0.40462428em; + font-size: 0.41666667em; } .katex .sizing.reset-size8.size3, .katex .fontsize-ensurer.reset-size8.size3 { - font-size: 0.46242775em; + font-size: 0.48611111em; } .katex .sizing.reset-size8.size4, .katex .fontsize-ensurer.reset-size8.size4 { - font-size: 0.52023121em; + font-size: 0.55555556em; } .katex .sizing.reset-size8.size5, .katex .fontsize-ensurer.reset-size8.size5 { - font-size: 0.57803468em; + font-size: 0.625em; } .katex .sizing.reset-size8.size6, .katex .fontsize-ensurer.reset-size8.size6 { - font-size: 0.69364162em; + font-size: 0.69444444em; } .katex .sizing.reset-size8.size7, .katex .fontsize-ensurer.reset-size8.size7 { - font-size: 0.83236994em; + font-size: 0.83333333em; } .katex .sizing.reset-size8.size8, .katex .fontsize-ensurer.reset-size8.size8 { @@ -827,43 +676,47 @@ } .katex .sizing.reset-size8.size9, .katex .fontsize-ensurer.reset-size8.size9 { - font-size: 1.19653179em; + font-size: 1.2em; } .katex .sizing.reset-size8.size10, .katex .fontsize-ensurer.reset-size8.size10 { - font-size: 1.43930636em; + font-size: 1.44027778em; +} +.katex .sizing.reset-size8.size11, +.katex .fontsize-ensurer.reset-size8.size11 { + font-size: 1.72777778em; } .katex .sizing.reset-size9.size1, .katex .fontsize-ensurer.reset-size9.size1 { - font-size: 0.24154589em; + font-size: 0.28935185em; } .katex .sizing.reset-size9.size2, .katex .fontsize-ensurer.reset-size9.size2 { - font-size: 0.33816425em; + font-size: 0.34722222em; } .katex .sizing.reset-size9.size3, .katex .fontsize-ensurer.reset-size9.size3 { - font-size: 0.38647343em; + font-size: 0.40509259em; } .katex .sizing.reset-size9.size4, .katex .fontsize-ensurer.reset-size9.size4 { - font-size: 0.43478261em; + font-size: 0.46296296em; } .katex .sizing.reset-size9.size5, .katex .fontsize-ensurer.reset-size9.size5 { - font-size: 0.48309179em; + font-size: 0.52083333em; } .katex .sizing.reset-size9.size6, .katex .fontsize-ensurer.reset-size9.size6 { - font-size: 0.57971014em; + font-size: 0.5787037em; } .katex .sizing.reset-size9.size7, .katex .fontsize-ensurer.reset-size9.size7 { - font-size: 0.69565217em; + font-size: 0.69444444em; } .katex .sizing.reset-size9.size8, .katex .fontsize-ensurer.reset-size9.size8 { - font-size: 0.83574879em; + font-size: 0.83333333em; } .katex .sizing.reset-size9.size9, .katex .fontsize-ensurer.reset-size9.size9 { @@ -871,48 +724,100 @@ } .katex .sizing.reset-size9.size10, .katex .fontsize-ensurer.reset-size9.size10 { - font-size: 1.20289855em; + font-size: 1.20023148em; +} +.katex .sizing.reset-size9.size11, +.katex .fontsize-ensurer.reset-size9.size11 { + font-size: 1.43981481em; } .katex .sizing.reset-size10.size1, .katex .fontsize-ensurer.reset-size10.size1 { - font-size: 0.20080321em; + font-size: 0.24108004em; } .katex .sizing.reset-size10.size2, .katex .fontsize-ensurer.reset-size10.size2 { - font-size: 0.2811245em; + font-size: 0.28929605em; } .katex .sizing.reset-size10.size3, .katex .fontsize-ensurer.reset-size10.size3 { - font-size: 0.32128514em; + font-size: 0.33751205em; } .katex .sizing.reset-size10.size4, .katex .fontsize-ensurer.reset-size10.size4 { - font-size: 0.36144578em; + font-size: 0.38572806em; } .katex .sizing.reset-size10.size5, .katex .fontsize-ensurer.reset-size10.size5 { - font-size: 0.40160643em; + font-size: 0.43394407em; } .katex .sizing.reset-size10.size6, .katex .fontsize-ensurer.reset-size10.size6 { - font-size: 0.48192771em; + font-size: 0.48216008em; } .katex .sizing.reset-size10.size7, .katex .fontsize-ensurer.reset-size10.size7 { - font-size: 0.57831325em; + font-size: 0.57859209em; } .katex .sizing.reset-size10.size8, .katex .fontsize-ensurer.reset-size10.size8 { - font-size: 0.69477912em; + font-size: 0.69431051em; } .katex .sizing.reset-size10.size9, .katex .fontsize-ensurer.reset-size10.size9 { - font-size: 0.8313253em; + font-size: 0.83317261em; } .katex .sizing.reset-size10.size10, .katex .fontsize-ensurer.reset-size10.size10 { font-size: 1em; } +.katex .sizing.reset-size10.size11, +.katex .fontsize-ensurer.reset-size10.size11 { + font-size: 1.19961427em; +} +.katex .sizing.reset-size11.size1, +.katex .fontsize-ensurer.reset-size11.size1 { + font-size: 0.20096463em; +} +.katex .sizing.reset-size11.size2, +.katex .fontsize-ensurer.reset-size11.size2 { + font-size: 0.24115756em; +} +.katex .sizing.reset-size11.size3, +.katex .fontsize-ensurer.reset-size11.size3 { + font-size: 0.28135048em; +} +.katex .sizing.reset-size11.size4, +.katex .fontsize-ensurer.reset-size11.size4 { + font-size: 0.32154341em; +} +.katex .sizing.reset-size11.size5, +.katex .fontsize-ensurer.reset-size11.size5 { + font-size: 0.36173633em; +} +.katex .sizing.reset-size11.size6, +.katex .fontsize-ensurer.reset-size11.size6 { + font-size: 0.40192926em; +} +.katex .sizing.reset-size11.size7, +.katex .fontsize-ensurer.reset-size11.size7 { + font-size: 0.48231511em; +} +.katex .sizing.reset-size11.size8, +.katex .fontsize-ensurer.reset-size11.size8 { + font-size: 0.57877814em; +} +.katex .sizing.reset-size11.size9, +.katex .fontsize-ensurer.reset-size11.size9 { + font-size: 0.69453376em; +} +.katex .sizing.reset-size11.size10, +.katex .fontsize-ensurer.reset-size11.size10 { + font-size: 0.83360129em; +} +.katex .sizing.reset-size11.size11, +.katex .fontsize-ensurer.reset-size11.size11 { + font-size: 1em; +} .katex .delimsizing.size1 { font-family: KaTeX_Size1; } @@ -935,6 +840,9 @@ display: inline-block; width: 0.12em; } +.katex .delimcenter { + position: relative; +} .katex .op-symbol { position: relative; } @@ -944,33 +852,156 @@ .katex .op-symbol.large-op { font-family: KaTeX_Size2; } -.katex .op-limits > .vlist > span { +.katex .op-limits > .vlist-t { text-align: center; } -.katex .accent > .vlist > span { +.katex .accent > .vlist-t { text-align: center; } -.katex .accent .accent-body > span { +.katex .accent .accent-body { + position: relative; +} +.katex .accent .accent-body:not(.accent-full) { width: 0; } -.katex .accent .accent-body.accent-vec > span { - position: relative; - left: 0.326em; +.katex .overlay { + display: block; } .katex .mtable .vertical-separator { display: inline-block; margin: 0 -0.025em; - border-right: 0.05em solid black; + border-right: 0.05em solid; + min-width: 1px; +} +.katex .mtable .vs-dashed { + border-right: 0.05em dashed; } .katex .mtable .arraycolsep { display: inline-block; } -.katex .mtable .col-align-c > .vlist { +.katex .mtable .col-align-c > .vlist-t { text-align: center; } -.katex .mtable .col-align-l > .vlist { +.katex .mtable .col-align-l > .vlist-t { text-align: left; } -.katex .mtable .col-align-r > .vlist { +.katex .mtable .col-align-r > .vlist-t { text-align: right; } +.katex .svg-align { + text-align: left; +} +.katex svg { + display: block; + position: absolute; + width: 100%; + height: inherit; + fill: currentColor; + stroke: currentColor; + fill-rule: nonzero; + fill-opacity: 1; + stroke-width: 1; + stroke-linecap: butt; + stroke-linejoin: miter; + stroke-miterlimit: 4; + stroke-dasharray: none; + stroke-dashoffset: 0; + stroke-opacity: 1; +} +.katex svg path { + stroke: none; +} +.katex .stretchy { + width: 100%; + display: block; + position: relative; + overflow: hidden; +} +.katex .stretchy::before, +.katex .stretchy::after { + content: ""; +} +.katex .hide-tail { + width: 100%; + position: relative; + overflow: hidden; +} +.katex .halfarrow-left { + position: absolute; + left: 0; + width: 50.2%; + overflow: hidden; +} +.katex .halfarrow-right { + position: absolute; + right: 0; + width: 50.2%; + overflow: hidden; +} +.katex .brace-left { + position: absolute; + left: 0; + width: 25.1%; + overflow: hidden; +} +.katex .brace-center { + position: absolute; + left: 25%; + width: 50%; + overflow: hidden; +} +.katex .brace-right { + position: absolute; + right: 0; + width: 25.1%; + overflow: hidden; +} +.katex .x-arrow-pad { + padding: 0 0.5em; +} +.katex .x-arrow, +.katex .mover, +.katex .munder { + text-align: center; +} +.katex .boxpad { + padding: 0 0.3em 0 0.3em; +} +.katex .fbox { + box-sizing: border-box; + border: 0.04em solid black; +} +.katex .fcolorbox { + box-sizing: border-box; + border: 0.04em solid; +} +.katex .cancel-pad { + padding: 0 0.2em 0 0.2em; +} +.katex .cancel-lap { + margin-left: -0.2em; + margin-right: -0.2em; +} +.katex .sout { + border-bottom-style: solid; + border-bottom-width: 0.08em; +} +.katex-display { + display: block; + margin: 1em 0; + text-align: center; +} +.katex-display > .katex { + display: block; + text-align: center; + white-space: nowrap; +} +.katex-display > .katex > .katex-html { + display: block; + position: relative; +} +.katex-display > .katex > .katex-html > .tag { + position: absolute; + right: 0; +} + diff --git a/katex/katex.js b/katex/katex.js index e104be9b..aec67a1e 100644 --- a/katex/katex.js +++ b/katex/katex.js @@ -1,145 +1,172 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.katex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 15) { - left = "…" + input.slice(start - 15, start); - } else { - left = input.slice(0, start); - } - var right; - if (end + 15 < input.length) { - right = input.slice(end, end + 15) + "…"; - } else { - right = input.slice(end); - } - error += left + underlined + right; + var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error + + var left; + + if (start > 15) { + left = "…" + input.slice(start - 15, start); + } else { + left = input.slice(0, start); } - // Some hackery to make ParseError a prototype of Error - // See http://stackoverflow.com/a/8460753 - var self = new Error(error); - self.name = "ParseError"; - self.__proto__ = ParseError.prototype; + var right; + + if (end + 15 < input.length) { + right = input.slice(end, end + 15) + "…"; + } else { + right = input.slice(end); + } + + error += left + underlined + right; + } // Some hackery to make ParseError a prototype of Error + // See http://stackoverflow.com/a/8460753 + + + var self = new Error(error); + self.name = "ParseError"; // $FlowFixMe + + self.__proto__ = ParseError.prototype; // $FlowFixMe + + self.position = start; + return self; +}; // $FlowFixMe More hackery - self.position = start; - return self; -} -// More hackery ParseError.prototype.__proto__ = Error.prototype; - -module.exports = ParseError; - -},{}],7:[function(require,module,exports){ -/* eslint no-constant-condition:0 */ -var functions = require("./functions"); -var environments = require("./environments"); -var MacroExpander = require("./MacroExpander"); -var symbols = require("./symbols"); -var utils = require("./utils"); -var cjkRegex = require("./unicodeRegexes").cjkRegex; - -var parseData = require("./parseData"); -var ParseError = require("./ParseError"); - +/* harmony default export */ var src_ParseError = (ParseError); +// CONCATENATED MODULE: ./src/utils.js /** - * This file contains the parser used to parse out a TeX expression from the - * input. Since TeX isn't context-free, standard parsers don't work particularly - * well. - * - * The strategy of this parser is as such: - * - * The main functions (the `.parse...` ones) take a position in the current - * parse string to parse tokens from. The lexer (found in Lexer.js, stored at - * this.lexer) also supports pulling out tokens at arbitrary places. When - * individual tokens are needed at a position, the lexer is called to pull out a - * token, which is then used. - * - * The parser has a property called "mode" indicating the mode that - * the parser is currently in. Currently it has to be one of "math" or - * "text", which denotes whether the current environment is a math-y - * one or a text-y one (e.g. inside \text). Currently, this serves to - * limit the functions which can be used in text mode. - * - * The main functions then return an object which contains the useful data that - * was parsed at its given point, and a new position at the end of the parsed - * data. The main functions can call each other and continue the parsing by - * using the returned position as a new starting point. - * - * There are also extra `.handle...` functions, which pull out some reused - * functionality into self-contained functions. - * - * The earlier functions return ParseNodes. - * The later functions (which are called deeper in the parse) sometimes return - * ParseFuncOrArgument, which contain a ParseNode as well as some data about - * whether the parsed object is a function which is missing some arguments, or a - * standalone object which can be used as an argument to another function. + * This file contains a list of utility functions which are useful in other + * files. */ /** - * Main Parser class + * Return whether an element is contained in a list */ -function Parser(input, settings) { - // Create a new macro expander (gullet) and (indirectly via that) also a - // new lexer (mouth) for this parser (stomach, in the language of TeX) - this.gullet = new MacroExpander(input, settings.macros); - // Store the settings for use in parsing - this.settings = settings; - // Count leftright depth (for \middle errors) - this.leftrightDepth = 0; +var contains = function contains(list, elem) { + return list.indexOf(elem) !== -1; +}; +/** + * Provide a default value if a setting is undefined + * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. + */ + + +var deflt = function deflt(setting, defaultIfUndefined) { + return setting === undefined ? defaultIfUndefined : setting; +}; // hyphenate and escape adapted from Facebook's React under Apache 2 license + + +var uppercase = /([A-Z])/g; + +var hyphenate = function hyphenate(str) { + return str.replace(uppercase, "-$1").toLowerCase(); +}; + +var ESCAPE_LOOKUP = { + "&": "&", + ">": ">", + "<": "<", + "\"": """, + "'": "'" +}; +var ESCAPE_REGEX = /[&><"']/g; +/** + * Escapes text to prevent scripting attacks. + */ + +function utils_escape(text) { + return String(text).replace(ESCAPE_REGEX, function (match) { + return ESCAPE_LOOKUP[match]; + }); } - -var ParseNode = parseData.ParseNode; - /** - * An initial function (without its arguments), or an argument to a function. - * The `result` argument should be a ParseNode. + * Sometimes we want to pull out the innermost element of a group. In most + * cases, this will just be the group itself, but when ordgroups and colors have + * a single element, we want to pull that out. */ -function ParseFuncOrArgument(result, isFunction, token) { - this.result = result; - // Is this a function (i.e. is it something defined in functions.js)? - this.isFunction = isFunction; - this.token = token; -} -/** - * Checks a result to make sure it has the right type, and throws an - * appropriate error otherwise. - * - * @param {boolean=} consume whether to consume the expected token, - * defaults to true - */ -Parser.prototype.expect = function(text, consume) { - if (this.nextToken.text !== text) { - throw new ParseError( - "Expected '" + text + "', got '" + this.nextToken.text + "'", - this.nextToken - ); - } - if (consume !== false) { - this.consume(); - } -}; -/** - * Considers the current look ahead token as consumed, - * and fetches the one after that as the new look ahead. - */ -Parser.prototype.consume = function() { - this.nextToken = this.gullet.get(this.mode === "math"); -}; - -Parser.prototype.switchMode = function(newMode) { - this.gullet.unget(this.nextToken); - this.mode = newMode; - this.consume(); -}; - -/** - * Main parsing function, which parses an entire input. - * - * @return {?Array.} - */ -Parser.prototype.parse = function() { - // Try to parse the input - this.mode = "math"; - this.consume(); - var parse = this.parseInput(); - return parse; -}; - -/** - * Parses an entire input tree. - */ -Parser.prototype.parseInput = function() { - // Parse an expression - var expression = this.parseExpression(false); - // If we succeeded, make sure there's an EOF at the end - this.expect("EOF", false); - return expression; -}; - -var endOfExpression = ["}", "\\end", "\\right", "&", "\\\\", "\\cr"]; - -/** - * Parses an "expression", which is a list of atoms. - * - * @param {boolean} breakOnInfix Should the parsing stop when we hit infix - * nodes? This happens when functions have higher precendence - * than infix nodes in implicit parses. - * - * @param {?string} breakOnTokenText The text of the token that the expression - * should end with, or `null` if something else should end the - * expression. - * - * @return {ParseNode} - */ -Parser.prototype.parseExpression = function(breakOnInfix, breakOnTokenText) { - var body = []; - // Keep adding atoms to the body until we can't parse any more atoms (either - // we reached the end, a }, or a \right) - while (true) { - var lex = this.nextToken; - if (endOfExpression.indexOf(lex.text) !== -1) { - break; - } - if (breakOnTokenText && lex.text === breakOnTokenText) { - break; - } - if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) { - break; - } - var atom = this.parseAtom(); - if (!atom) { - if (!this.settings.throwOnError && lex.text[0] === "\\") { - var errorNode = this.handleUnsupportedCmd(); - body.push(errorNode); - continue; - } - - break; - } - body.push(atom); - } - return this.handleInfixNodes(body); -}; - -/** - * Rewrites infix operators such as \over with corresponding commands such - * as \frac. - * - * There can only be one infix operator per group. If there's more than one - * then the expression is ambiguous. This can be resolved by adding {}. - * - * @returns {Array} - */ -Parser.prototype.handleInfixNodes = function(body) { - var overIndex = -1; - var funcName; - - for (var i = 0; i < body.length; i++) { - var node = body[i]; - if (node.type === "infix") { - if (overIndex !== -1) { - throw new ParseError( - "only one infix operator per group", - node.value.token); - } - overIndex = i; - funcName = node.value.replaceWith; - } - } - - if (overIndex !== -1) { - var numerNode; - var denomNode; - - var numerBody = body.slice(0, overIndex); - var denomBody = body.slice(overIndex + 1); - - if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { - numerNode = numerBody[0]; - } else { - numerNode = new ParseNode("ordgroup", numerBody, this.mode); - } - - if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { - denomNode = denomBody[0]; - } else { - denomNode = new ParseNode("ordgroup", denomBody, this.mode); - } - - var value = this.callFunction( - funcName, [numerNode, denomNode], null); - return [new ParseNode(value.type, value, this.mode)]; +var getBaseElem = function getBaseElem(group) { + if (group.type === "ordgroup") { + if (group.body.length === 1) { + return getBaseElem(group.body[0]); } else { - return body; + return group; } -}; - -// The greediness of a superscript or subscript -var SUPSUB_GREEDINESS = 1; - -/** - * Handle a subscript or superscript with nice errors. - */ -Parser.prototype.handleSupSubscript = function(name) { - var symbolToken = this.nextToken; - var symbol = symbolToken.text; - this.consume(); - var group = this.parseGroup(); - - if (!group) { - if (!this.settings.throwOnError && this.nextToken.text[0] === "\\") { - return this.handleUnsupportedCmd(); - } else { - throw new ParseError( - "Expected group after '" + symbol + "'", - symbolToken - ); - } - } else if (group.isFunction) { - // ^ and _ have a greediness, so handle interactions with functions' - // greediness - var funcGreediness = functions[group.result].greediness; - if (funcGreediness > SUPSUB_GREEDINESS) { - return this.parseFunction(group); - } else { - throw new ParseError( - "Got function '" + group.result + "' with no arguments " + - "as " + name, symbolToken); - } + } else if (group.type === "color") { + if (group.body.length === 1) { + return getBaseElem(group.body[0]); } else { - return group.result; + return group; } + } else if (group.type === "font") { + return getBaseElem(group.body); + } else { + return group; + } }; - /** - * Converts the textual input of an unsupported command into a text node - * contained within a color node whose color is determined by errorColor + * TeXbook algorithms often reference "character boxes", which are simply groups + * with a single character in them. To decide if something is a character box, + * we find its innermost group, and see if it is a single character. */ -Parser.prototype.handleUnsupportedCmd = function() { - var text = this.nextToken.text; - var textordArray = []; - for (var i = 0; i < text.length; i++) { - textordArray.push(new ParseNode("textord", text[i], "text")); - } - var textNode = new ParseNode( - "text", - { - body: textordArray, - type: "text" - }, - this.mode); +var utils_isCharacterBox = function isCharacterBox(group) { + var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters - var colorNode = new ParseNode( - "color", - { - color: this.settings.errorColor, - value: [textNode], - type: "color" - }, - this.mode); - - this.consume(); - return colorNode; + return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; }; -/** - * Parses a group with optional super/subscripts. - * - * @return {?ParseNode} - */ -Parser.prototype.parseAtom = function() { - // The body of an atom is an implicit group, so that things like - // \left(x\right)^2 work correctly. - var base = this.parseImplicitGroup(); +var assert = function assert(value) { + if (!value) { + throw new Error('Expected non-null, but got ' + String(value)); + } - // In text mode, we don't have superscripts or subscripts - if (this.mode === "text") { - return base; - } - - // Note that base may be empty (i.e. null) at this point. - - var superscript; - var subscript; - while (true) { - // Lex the first token - var lex = this.nextToken; - - if (lex.text === "\\limits" || lex.text === "\\nolimits") { - // We got a limit control - if (!base || base.type !== "op") { - throw new ParseError( - "Limit controls must follow a math operator", - lex); - } else { - var limits = lex.text === "\\limits"; - base.value.limits = limits; - base.value.alwaysHandleSupSub = true; - } - this.consume(); - } else if (lex.text === "^") { - // We got a superscript start - if (superscript) { - throw new ParseError("Double superscript", lex); - } - superscript = this.handleSupSubscript("superscript"); - } else if (lex.text === "_") { - // We got a subscript start - if (subscript) { - throw new ParseError("Double subscript", lex); - } - subscript = this.handleSupSubscript("subscript"); - } else if (lex.text === "'") { - // We got a prime - var prime = new ParseNode("textord", "\\prime", this.mode); - - // Many primes can be grouped together, so we handle this here - var primes = [prime]; - this.consume(); - // Keep lexing tokens until we get something that's not a prime - while (this.nextToken.text === "'") { - // For each one, add another prime to the list - primes.push(prime); - this.consume(); - } - // Put them into an ordgroup as the superscript - superscript = new ParseNode("ordgroup", primes, this.mode); - } else { - // If it wasn't ^, _, or ', stop parsing super/subscripts - break; - } - } - - if (superscript || subscript) { - // If we got either a superscript or subscript, create a supsub - return new ParseNode("supsub", { - base: base, - sup: superscript, - sub: subscript - }, this.mode); - } else { - // Otherwise return the original body - return base; - } + return value; }; +/* harmony default export */ var utils = ({ + contains: contains, + deflt: deflt, + escape: utils_escape, + hyphenate: hyphenate, + getBaseElem: getBaseElem, + isCharacterBox: utils_isCharacterBox +}); +// CONCATENATED MODULE: ./src/Settings.js +/* eslint no-console:0 */ -// A list of the size-changing functions, for use in parseImplicitGroup -var sizeFuncs = [ - "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", - "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge" -]; - -// A list of the style-changing functions, for use in parseImplicitGroup -var styleFuncs = [ - "\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle" -]; - -/** - * Parses an implicit group, which is a group that starts at the end of a - * specified, and ends right before a higher explicit group ends, or at EOL. It - * is used for functions that appear to affect the current style, like \Large or - * \textrm, where instead of keeping a style we just pretend that there is an - * implicit grouping after it until the end of the group. E.g. - * small text {\Large large text} small text again - * It is also used for \left and \right to get the correct grouping. - * - * @return {?ParseNode} - */ -Parser.prototype.parseImplicitGroup = function() { - var start = this.parseSymbol(); - - if (start == null) { - // If we didn't get anything we handle, fall back to parseFunction - return this.parseFunction(); - } - - var func = start.result; - var body; - - if (func === "\\left") { - // If we see a left: - // Parse the entire left function (including the delimiter) - var left = this.parseFunction(start); - // Parse out the implicit body - ++this.leftrightDepth; - body = this.parseExpression(false); - --this.leftrightDepth; - // Check the next token - this.expect("\\right", false); - var right = this.parseFunction(); - return new ParseNode("leftright", { - body: body, - left: left.value.value, - right: right.value.value - }, this.mode); - } else if (func === "\\begin") { - // begin...end is similar to left...right - var begin = this.parseFunction(start); - var envName = begin.value.name; - if (!environments.hasOwnProperty(envName)) { - throw new ParseError( - "No such environment: " + envName, begin.value.nameGroup); - } - // Build the environment object. Arguments and other information will - // be made available to the begin and end methods using properties. - var env = environments[envName]; - var args = this.parseArguments("\\begin{" + envName + "}", env); - var context = { - mode: this.mode, - envName: envName, - parser: this, - positions: args.pop() - }; - var result = env.handler(context, args); - this.expect("\\end", false); - var endNameToken = this.nextToken; - var end = this.parseFunction(); - if (end.value.name !== envName) { - throw new ParseError( - "Mismatch: \\begin{" + envName + "} matched " + - "by \\end{" + end.value.name + "}", - endNameToken); - } - result.position = end.position; - return result; - } else if (utils.contains(sizeFuncs, func)) { - // If we see a sizing function, parse out the implict body - body = this.parseExpression(false); - return new ParseNode("sizing", { - // Figure out what size to use based on the list of functions above - size: "size" + (utils.indexOf(sizeFuncs, func) + 1), - value: body - }, this.mode); - } else if (utils.contains(styleFuncs, func)) { - // If we see a styling function, parse out the implict body - body = this.parseExpression(true); - return new ParseNode("styling", { - // Figure out what style to use by pulling out the style from - // the function name - style: func.slice(1, func.length - 5), - value: body - }, this.mode); - } else { - // Defer to parseFunction if it's not a function we handle - return this.parseFunction(start); - } -}; - -/** - * Parses an entire function, including its base and all of its arguments. - * The base might either have been parsed already, in which case - * it is provided as an argument, or it's the next group in the input. - * - * @param {ParseFuncOrArgument=} baseGroup optional as described above - * @return {?ParseNode} - */ -Parser.prototype.parseFunction = function(baseGroup) { - if (!baseGroup) { - baseGroup = this.parseGroup(); - } - - if (baseGroup) { - if (baseGroup.isFunction) { - var func = baseGroup.result; - var funcData = functions[func]; - if (this.mode === "text" && !funcData.allowedInText) { - throw new ParseError( - "Can't use function '" + func + "' in text mode", - baseGroup.token); - } - - var args = this.parseArguments(func, funcData); - var token = baseGroup.token; - var result = this.callFunction(func, args, args.pop(), token); - return new ParseNode(result.type, result, this.mode); - } else { - return baseGroup.result; - } - } else { - return null; - } -}; - -/** - * Call a function handler with a suitable context and arguments. - */ -Parser.prototype.callFunction = function(name, args, positions, token) { - var context = { - funcName: name, - parser: this, - positions: positions, - token: token - }; - return functions[name].handler(context, args); -}; - -/** - * Parses the arguments of a function or environment - * - * @param {string} func "\name" or "\begin{name}" - * @param {{numArgs:number,numOptionalArgs:number|undefined}} funcData - * @return the array of arguments, with the list of positions as last element - */ -Parser.prototype.parseArguments = function(func, funcData) { - var totalArgs = funcData.numArgs + funcData.numOptionalArgs; - if (totalArgs === 0) { - return [[this.pos]]; - } - - var baseGreediness = funcData.greediness; - var positions = [this.pos]; - var args = []; - - for (var i = 0; i < totalArgs; i++) { - var nextToken = this.nextToken; - var argType = funcData.argTypes && funcData.argTypes[i]; - var arg; - if (i < funcData.numOptionalArgs) { - if (argType) { - arg = this.parseGroupOfType(argType, true); - } else { - arg = this.parseGroup(true); - } - if (!arg) { - args.push(null); - positions.push(this.pos); - continue; - } - } else { - if (argType) { - arg = this.parseGroupOfType(argType); - } else { - arg = this.parseGroup(); - } - if (!arg) { - if (!this.settings.throwOnError && - this.nextToken.text[0] === "\\") { - arg = new ParseFuncOrArgument( - this.handleUnsupportedCmd(this.nextToken.text), - false); - } else { - throw new ParseError( - "Expected group after '" + func + "'", nextToken); - } - } - } - var argNode; - if (arg.isFunction) { - var argGreediness = - functions[arg.result].greediness; - if (argGreediness > baseGreediness) { - argNode = this.parseFunction(arg); - } else { - throw new ParseError( - "Got function '" + arg.result + "' as " + - "argument to '" + func + "'", nextToken); - } - } else { - argNode = arg.result; - } - args.push(argNode); - positions.push(this.pos); - } - - args.push(positions); - - return args; -}; - - -/** - * Parses a group when the mode is changing. - * - * @return {?ParseFuncOrArgument} - */ -Parser.prototype.parseGroupOfType = function(innerMode, optional) { - var outerMode = this.mode; - // Handle `original` argTypes - if (innerMode === "original") { - innerMode = outerMode; - } - - if (innerMode === "color") { - return this.parseColorGroup(optional); - } - if (innerMode === "size") { - return this.parseSizeGroup(optional); - } - - this.switchMode(innerMode); - if (innerMode === "text") { - // text mode is special because it should ignore the whitespace before - // it - while (this.nextToken.text === " ") { - this.consume(); - } - } - // By the time we get here, innerMode is one of "text" or "math". - // We switch the mode of the parser, recurse, then restore the old mode. - var res = this.parseGroup(optional); - this.switchMode(outerMode); - return res; -}; - -/** - * Parses a group, essentially returning the string formed by the - * brace-enclosed tokens plus some position information. - * - * @param {string} modeName Used to describe the mode in error messages - * @param {boolean=} optional Whether the group is optional or required - */ -Parser.prototype.parseStringGroup = function(modeName, optional) { - if (optional && this.nextToken.text !== "[") { - return null; - } - var outerMode = this.mode; - this.mode = "text"; - this.expect(optional ? "[" : "{"); - var str = ""; - var firstToken = this.nextToken; - var lastToken = firstToken; - while (this.nextToken.text !== (optional ? "]" : "}")) { - if (this.nextToken.text === "EOF") { - throw new ParseError( - "Unexpected end of input in " + modeName, - firstToken.range(this.nextToken, str)); - } - lastToken = this.nextToken; - str += lastToken.text; - this.consume(); - } - this.mode = outerMode; - this.expect(optional ? "]" : "}"); - return firstToken.range(lastToken, str); -}; - -/** - * Parses a regex-delimited group: the largest sequence of tokens - * whose concatenated strings match `regex`. Returns the string - * formed by the tokens plus some position information. - * - * @param {RegExp} regex - * @param {string} modeName Used to describe the mode in error messages - */ -Parser.prototype.parseRegexGroup = function(regex, modeName) { - var outerMode = this.mode; - this.mode = "text"; - var firstToken = this.nextToken; - var lastToken = firstToken; - var str = ""; - while (this.nextToken.text !== "EOF" - && regex.test(str + this.nextToken.text)) { - lastToken = this.nextToken; - str += lastToken.text; - this.consume(); - } - if (str === "") { - throw new ParseError( - "Invalid " + modeName + ": '" + firstToken.text + "'", - firstToken); - } - this.mode = outerMode; - return firstToken.range(lastToken, str); -}; - -/** - * Parses a color description. - */ -Parser.prototype.parseColorGroup = function(optional) { - var res = this.parseStringGroup("color", optional); - if (!res) { - return null; - } - var match = (/^(#[a-z0-9]+|[a-z]+)$/i).exec(res.text); - if (!match) { - throw new ParseError("Invalid color: '" + res.text + "'", res); - } - return new ParseFuncOrArgument( - new ParseNode("color", match[0], this.mode), - false); -}; - -/** - * Parses a size specification, consisting of magnitude and unit. - */ -Parser.prototype.parseSizeGroup = function(optional) { - var res; - if (!optional && this.nextToken.text !== "{") { - res = this.parseRegexGroup( - /^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2}$/, "size"); - } else { - res = this.parseStringGroup("size", optional); - } - if (!res) { - return null; - } - var match = (/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/).exec(res.text); - if (!match) { - throw new ParseError("Invalid size: '" + res.text + "'", res); - } - var data = { - number: +(match[1] + match[2]), // sign + magnitude, cast to number - unit: match[3] - }; - if (data.unit !== "em" && data.unit !== "ex" && data.unit !== "mu") { - throw new ParseError("Invalid unit: '" + data.unit + "'", res); - } - return new ParseFuncOrArgument( - new ParseNode("color", data, this.mode), - false); -}; - -/** - * If the argument is false or absent, this parses an ordinary group, - * which is either a single nucleus (like "x") or an expression - * in braces (like "{x+y}"). - * If the argument is true, it parses either a bracket-delimited expression - * (like "[x+y]") or returns null to indicate the absence of a - * bracket-enclosed group. - * - * @param {boolean=} optional Whether the group is optional or required - * @return {?ParseFuncOrArgument} - */ -Parser.prototype.parseGroup = function(optional) { - var firstToken = this.nextToken; - // Try to parse an open brace - if (this.nextToken.text === (optional ? "[" : "{")) { - // If we get a brace, parse an expression - this.consume(); - var expression = this.parseExpression(false, optional ? "]" : null); - var lastToken = this.nextToken; - // Make sure we get a close brace - this.expect(optional ? "]" : "}"); - if (this.mode === "text") { - this.formLigatures(expression); - } - return new ParseFuncOrArgument( - new ParseNode("ordgroup", expression, this.mode, - firstToken, lastToken), - false); - } else { - // Otherwise, just return a nucleus, or nothing for an optional group - return optional ? null : this.parseSymbol(); - } -}; - -/** - * Form ligature-like combinations of characters for text mode. - * This includes inputs like "--", "---", "``" and "''". - * The result will simply replace multiple textord nodes with a single - * character in each value by a single textord node having multiple - * characters in its value. The representation is still ASCII source. - * - * @param {Array.} group the nodes of this group, - * list will be moified in place - */ -Parser.prototype.formLigatures = function(group) { - var i; - var n = group.length - 1; - for (i = 0; i < n; ++i) { - var a = group[i]; - var v = a.value; - if (v === "-" && group[i + 1].value === "-") { - if (i + 1 < n && group[i + 2].value === "-") { - group.splice(i, 3, new ParseNode( - "textord", "---", "text", a, group[i + 2])); - n -= 2; - } else { - group.splice(i, 2, new ParseNode( - "textord", "--", "text", a, group[i + 1])); - n -= 1; - } - } - if ((v === "'" || v === "`") && group[i + 1].value === v) { - group.splice(i, 2, new ParseNode( - "textord", v + v, "text", a, group[i + 1])); - n -= 1; - } - } -}; - -/** - * Parse a single symbol out of the string. Here, we handle both the functions - * we have defined, as well as the single character symbols - * - * @return {?ParseFuncOrArgument} - */ -Parser.prototype.parseSymbol = function() { - var nucleus = this.nextToken; - - if (functions[nucleus.text]) { - this.consume(); - // If there exists a function with this name, we return the function and - // say that it is a function. - return new ParseFuncOrArgument( - nucleus.text, - true, nucleus); - } else if (symbols[this.mode][nucleus.text]) { - this.consume(); - // Otherwise if this is a no-argument function, find the type it - // corresponds to in the symbols map - return new ParseFuncOrArgument( - new ParseNode(symbols[this.mode][nucleus.text].group, - nucleus.text, this.mode, nucleus), - false, nucleus); - } else if (this.mode === "text" && cjkRegex.test(nucleus.text)) { - this.consume(); - return new ParseFuncOrArgument( - new ParseNode("textord", nucleus.text, this.mode, nucleus), - false, nucleus); - } else { - return null; - } -}; - -Parser.prototype.ParseNode = ParseNode; - -module.exports = Parser; - -},{"./MacroExpander":4,"./ParseError":6,"./environments":16,"./functions":19,"./parseData":21,"./symbols":23,"./unicodeRegexes":24,"./utils":25}],8:[function(require,module,exports){ /** * This is a module for storing settings passed into KaTeX. It correctly handles * default settings. */ -/** - * Helper function for getting a default value if the value is undefined - */ -function get(option, defaultValue) { - return option === undefined ? defaultValue : option; -} + + /** * The main Settings object * * The current options stored are: - * - displayMode: Whether the expression should be typeset by default in - * textstyle or displaystyle (default false) + * - displayMode: Whether the expression should be typeset as inline math + * (false, the default), meaning that the math starts in + * \textstyle and is placed in an inline-block); or as display + * math (true), meaning that the math starts in \displaystyle + * and is placed in a block with vertical margin. */ -function Settings(options) { +var Settings_Settings = +/*#__PURE__*/ +function () { + function Settings(options) { + this.displayMode = void 0; + this.throwOnError = void 0; + this.errorColor = void 0; + this.macros = void 0; + this.colorIsTextColor = void 0; + this.strict = void 0; + this.maxSize = void 0; + this.maxExpand = void 0; + this.allowedProtocols = void 0; // allow null options options = options || {}; - this.displayMode = get(options.displayMode, false); - this.throwOnError = get(options.throwOnError, true); - this.errorColor = get(options.errorColor, "#cc0000"); + this.displayMode = utils.deflt(options.displayMode, false); + this.throwOnError = utils.deflt(options.throwOnError, true); + this.errorColor = utils.deflt(options.errorColor, "#cc0000"); this.macros = options.macros || {}; -} + this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); + this.strict = utils.deflt(options.strict, "warn"); + this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity)); + this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000)); + this.allowedProtocols = utils.deflt(options.allowedProtocols, ["http", "https", "mailto", "_relative"]); + } + /** + * Report nonstrict (non-LaTeX-compatible) input. + * Can safely not be called if `this.strict` is false in JavaScript. + */ -module.exports = Settings; -},{}],9:[function(require,module,exports){ + var _proto = Settings.prototype; + + _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) { + var strict = this.strict; + + if (typeof strict === "function") { + // Allow return value of strict function to be boolean or string + // (or null/undefined, meaning no further processing). + strict = strict(errorCode, errorMsg, token); + } + + if (!strict || strict === "ignore") { + return; + } else if (strict === true || strict === "error") { + throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token); + } else if (strict === "warn") { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); + } else { + // won't happen in type-safe code + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); + } + }; + /** + * Check whether to apply strict (LaTeX-adhering) behavior for unusual + * input (like `\\`). Unlike `nonstrict`, will not throw an error; + * instead, "error" translates to a return value of `true`, while "ignore" + * translates to a return value of `false`. May still print a warning: + * "warn" prints a warning and returns `false`. + * This is for the second category of `errorCode`s listed in the README. + */ + + + _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) { + var strict = this.strict; + + if (typeof strict === "function") { + // Allow return value of strict function to be boolean or string + // (or null/undefined, meaning no further processing). + // But catch any exceptions thrown by function, treating them + // like "error". + try { + strict = strict(errorCode, errorMsg, token); + } catch (error) { + strict = "error"; + } + } + + if (!strict || strict === "ignore") { + return false; + } else if (strict === true || strict === "error") { + return true; + } else if (strict === "warn") { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); + return false; + } else { + // won't happen in type-safe code + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); + return false; + } + }; + + return Settings; +}(); + +/* harmony default export */ var src_Settings = (Settings_Settings); +// CONCATENATED MODULE: ./src/Style.js /** * This file contains information and classes for the various kinds of styles * used in TeX. It provides a generic `Style` class, which holds information @@ -1448,93 +503,87 @@ module.exports = Settings; * information about them. */ -var sigmas = require("./fontMetrics.js").sigmas; - -var metrics = [{}, {}, {}]; -var i; -for (var key in sigmas) { - if (sigmas.hasOwnProperty(key)) { - for (i = 0; i < 3; i++) { - metrics[i][key] = sigmas[key][i]; - } - } -} -for (i = 0; i < 3; i++) { - metrics[i].emPerEx = sigmas.xHeight[i] / sigmas.quad[i]; -} - /** * The main style class. Contains a unique id for the style, a size (which is - * the same for cramped and uncramped version of a style), a cramped flag, and a - * size multiplier, which gives the size difference between a style and - * textstyle. + * the same for cramped and uncramped version of a style), and a cramped flag. */ -function Style(id, size, multiplier, cramped) { +var Style = +/*#__PURE__*/ +function () { + function Style(id, size, cramped) { + this.id = void 0; + this.size = void 0; + this.cramped = void 0; this.id = id; this.size = size; this.cramped = cramped; - this.sizeMultiplier = multiplier; - this.metrics = metrics[size > 0 ? size - 1 : 0]; -} + } + /** + * Get the style of a superscript given a base in the current style. + */ -/** - * Get the style of a superscript given a base in the current style. - */ -Style.prototype.sup = function() { - return styles[sup[this.id]]; -}; -/** - * Get the style of a subscript given a base in the current style. - */ -Style.prototype.sub = function() { - return styles[sub[this.id]]; -}; + var _proto = Style.prototype; -/** - * Get the style of a fraction numerator given the fraction in the current - * style. - */ -Style.prototype.fracNum = function() { - return styles[fracNum[this.id]]; -}; + _proto.sup = function sup() { + return Style_styles[_sup[this.id]]; + }; + /** + * Get the style of a subscript given a base in the current style. + */ -/** - * Get the style of a fraction denominator given the fraction in the current - * style. - */ -Style.prototype.fracDen = function() { - return styles[fracDen[this.id]]; -}; -/** - * Get the cramped version of a style (in particular, cramping a cramped style - * doesn't change the style). - */ -Style.prototype.cramp = function() { - return styles[cramp[this.id]]; -}; + _proto.sub = function sub() { + return Style_styles[_sub[this.id]]; + }; + /** + * Get the style of a fraction numerator given the fraction in the current + * style. + */ -/** - * HTML class name, like "displaystyle cramped" - */ -Style.prototype.cls = function() { - return sizeNames[this.size] + (this.cramped ? " cramped" : " uncramped"); -}; -/** - * HTML Reset class name, like "reset-textstyle" - */ -Style.prototype.reset = function() { - return resetNames[this.size]; -}; + _proto.fracNum = function fracNum() { + return Style_styles[_fracNum[this.id]]; + }; + /** + * Get the style of a fraction denominator given the fraction in the current + * style. + */ -/** - * Return if this style is tightly spaced (scriptstyle/scriptscriptstyle) - */ -Style.prototype.isTight = function() { + + _proto.fracDen = function fracDen() { + return Style_styles[_fracDen[this.id]]; + }; + /** + * Get the cramped version of a style (in particular, cramping a cramped style + * doesn't change the style). + */ + + + _proto.cramp = function cramp() { + return Style_styles[_cramp[this.id]]; + }; + /** + * Get a text or display version of this style. + */ + + + _proto.text = function text() { + return Style_styles[_text[this.id]]; + }; + /** + * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) + */ + + + _proto.isTight = function isTight() { return this.size >= 2; -}; + }; + + return Style; +}(); // Export an interface for type checking, but don't expose the implementation. +// This way, no more styles can be generated. + // IDs of the different styles var D = 0; @@ -1544,85 +593,4695 @@ var Tc = 3; var S = 4; var Sc = 5; var SS = 6; -var SSc = 7; +var SSc = 7; // Instances of the different styles -// String names for the different sizes -var sizeNames = [ - "displaystyle textstyle", - "textstyle", - "scriptstyle", - "scriptscriptstyle" -]; +var Style_styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another -// Reset names for the different sizes -var resetNames = [ - "reset-textstyle", - "reset-textstyle", - "reset-scriptstyle", - "reset-scriptscriptstyle" -]; +var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; +var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; +var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; +var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; +var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; +var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. -// Instances of the different styles -var styles = [ - new Style(D, 0, 1.0, false), - new Style(Dc, 0, 1.0, true), - new Style(T, 1, 1.0, false), - new Style(Tc, 1, 1.0, true), - new Style(S, 2, 0.7, false), - new Style(Sc, 2, 0.7, true), - new Style(SS, 3, 0.5, false), - new Style(SSc, 3, 0.5, true) -]; +/* harmony default export */ var src_Style = ({ + DISPLAY: Style_styles[D], + TEXT: Style_styles[T], + SCRIPT: Style_styles[S], + SCRIPTSCRIPT: Style_styles[SS] +}); +// CONCATENATED MODULE: ./src/unicodeScripts.js +/* + * This file defines the Unicode scripts and script families that we + * support. To add new scripts or families, just add a new entry to the + * scriptData array below. Adding scripts to the scriptData array allows + * characters from that script to appear in \text{} environments. + */ -// Lookup tables for switching from one style to another -var sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; -var sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; -var fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; -var fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; -var cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; +/** + * Each script or script family has a name and an array of blocks. + * Each block is an array of two numbers which specify the start and + * end points (inclusive) of a block of Unicode codepoints. + */ -// We only export some of the styles. Also, we don't export the `Style` class so -// no more styles can be generated. -module.exports = { - DISPLAY: styles[D], - TEXT: styles[T], - SCRIPT: styles[S], - SCRIPTSCRIPT: styles[SS] +/** + * Unicode block data for the families of scripts we support in \text{}. + * Scripts only need to appear here if they do not have font metrics. + */ +var scriptData = [{ + // Latin characters beyond the Latin-1 characters we have metrics for. + // Needed for Czech, Hungarian and Turkish text, for example. + name: 'latin', + blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B + [0x0300, 0x036f]] +}, { + // The Cyrillic script used by Russian and related languages. + // A Cyrillic subset used to be supported as explicitly defined + // symbols in symbols.js + name: 'cyrillic', + blocks: [[0x0400, 0x04ff]] +}, { + // The Brahmic scripts of South and Southeast Asia + // Devanagari (0900–097F) + // Bengali (0980–09FF) + // Gurmukhi (0A00–0A7F) + // Gujarati (0A80–0AFF) + // Oriya (0B00–0B7F) + // Tamil (0B80–0BFF) + // Telugu (0C00–0C7F) + // Kannada (0C80–0CFF) + // Malayalam (0D00–0D7F) + // Sinhala (0D80–0DFF) + // Thai (0E00–0E7F) + // Lao (0E80–0EFF) + // Tibetan (0F00–0FFF) + // Myanmar (1000–109F) + name: 'brahmic', + blocks: [[0x0900, 0x109F]] +}, { + name: 'georgian', + blocks: [[0x10A0, 0x10ff]] +}, { + // Chinese and Japanese. + // The "k" in cjk is for Korean, but we've separated Korean out + name: "cjk", + blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana + [0x4E00, 0x9FAF], // CJK ideograms + [0xFF00, 0xFF60]] +}, { + // Korean + name: 'hangul', + blocks: [[0xAC00, 0xD7AF]] +}]; +/** + * Given a codepoint, return the name of the script or script family + * it is from, or null if it is not part of a known block + */ + +function scriptFromCodepoint(codepoint) { + for (var i = 0; i < scriptData.length; i++) { + var script = scriptData[i]; + + for (var _i = 0; _i < script.blocks.length; _i++) { + var block = script.blocks[_i]; + + if (codepoint >= block[0] && codepoint <= block[1]) { + return script.name; + } + } + } + + return null; +} +/** + * A flattened version of all the supported blocks in a single array. + * This is an optimization to make supportedCodepoint() fast. + */ + +var allBlocks = []; +scriptData.forEach(function (s) { + return s.blocks.forEach(function (b) { + return allBlocks.push.apply(allBlocks, b); + }); +}); +/** + * Given a codepoint, return true if it falls within one of the + * scripts or script families defined above and false otherwise. + * + * Micro benchmarks shows that this is faster than + * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test() + * in Firefox, Chrome and Node. + */ + +function supportedCodepoint(codepoint) { + for (var i = 0; i < allBlocks.length; i += 2) { + if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { + return true; + } + } + + return false; +} +// CONCATENATED MODULE: ./src/svgGeometry.js +/** + * This file provides support to domTree.js + * It's a storehouse of path geometry for SVG images. + */ +// In all paths below, the viewBox-to-em scale is 1000:1. +var hLinePad = 80; // padding above a sqrt viniculum. + +var svgGeometry_path = { + // sqrtMain path geometry is from glyph U221A in the font KaTeX Main + // All surds have 80 units padding above the viniculumn. + sqrtMain: "M95," + (622 + hLinePad) + "c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,\n-10,-9.5,-14c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54c44.2,-33.3,65.8,\n-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10s173,378,173,378c0.7,0,\n35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429c69,-144,104.5,-217.7,106.5,\n-221c5.3,-9.3,12,-14,20,-14H400000v40H845.2724s-225.272,467,-225.272,467\ns-235,486,-235,486c-2.7,4.7,-9,7,-19,7c-6,0,-10,-1,-12,-3s-194,-422,-194,-422\ns-65,47,-65,47z M834 " + hLinePad + "H400000v40H845z", + // size1 is from glyph U221A in the font KaTeX_Size1-Regular + sqrtSize1: "M263," + (601 + hLinePad) + "c0.7,0,18,39.7,52,119c34,79.3,68.167,\n158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120c340,-704.7,510.7,-1060.3,512,-1067\nc4.7,-7.3,11,-11,19,-11H40000v40H1012.3s-271.3,567,-271.3,567c-38.7,80.7,-84,\n175,-136,283c-52,108,-89.167,185.3,-111.5,232c-22.3,46.7,-33.8,70.3,-34.5,71\nc-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1s-109,-253,-109,-253c-72.7,-168,-109.3,\n-252,-110,-252c-10.7,8,-22,16.7,-34,26c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26\ns76,-59,76,-59s76,-60,76,-60z M1001 " + hLinePad + "H40000v40H1012z", + // size2 is from glyph U221A in the font KaTeX_Size2-Regular + // The 80 units padding is most obvious here. Note start node at M1001 80. + sqrtSize2: "M1001," + hLinePad + "H400000v40H1013.1s-83.4,268,-264.1,840c-180.7,\n572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,\n-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744c-10,12,-21,25,-33,39s-32,39,-32,39\nc-6,-5.3,-15,-14,-27,-26s25,-30,25,-30c26.7,-32.7,52,-63,76,-91s52,-60,52,-60\ns208,722,208,722c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,\n-658.5c53.7,-170.3,84.5,-266.8,92.5,-289.5c4,-6.7,10,-10,18,-10z\nM1001 " + hLinePad + "H400000v40H1013z", + // size3 is from glyph U221A in the font KaTeX_Size3-Regular + sqrtSize3: "M424," + (2398 + hLinePad) + "c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,\n-342,-109.8,-513.3,-110.5,-514c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,\n25c-5.7,9.3,-9.8,16,-12.5,20s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,\n-13s76,-122,76,-122s77,-121,77,-121s209,968,209,968c0,-2,84.7,-361.7,254,-1079\nc169.3,-717.3,254.7,-1077.7,256,-1081c4,-6.7,10,-10,18,-10H400000v40H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M1001 " + hLinePad + "H400000v40H1014z", + // size4 is from glyph U221A in the font KaTeX_Size4-Regular + sqrtSize4: "M473," + (2713 + hLinePad) + "c339.3,-1799.3,509.3,-2700,510,-2702\nc3.3,-7.3,9.3,-11,18,-11H400000v40H1017.7s-90.5,478,-276.2,1466c-185.7,988,\n-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,\n-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200c0,-1.3,-5.3,8.7,-16,30c-10.7,\n21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26s76,-153,76,-153s77,-151,\n77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,606z\nM1001 " + hLinePad + "H400000v40H1017z", + // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main + doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z", + // doublerightarrow is from glyph U+21D2 in font KaTeX Main + doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z", + // leftarrow is from glyph U+2190 in font KaTeX Main + leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z", + // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular + leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z", + leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z", + // overgroup is from the MnSymbol package (public domain) + leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z", + leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z", + // Harpoons are from glyph U+21BD in font KaTeX Main + leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z", + leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z", + leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z", + leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z", + // hook is from glyph U+21A9 in font KaTeX Main + lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z", + leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", + leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", + // tofrom is from glyph U+21C4 in font KaTeX AMS Regular + leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z", + longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", + midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z", + midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z", + oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z", + oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z", + oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z", + oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z", + rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z", + rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z", + rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z", + rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z", + rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z", + rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z", + rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z", + rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z", + rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z", + righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z", + rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z", + rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z", + // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular + twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z", + twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z", + // tilde1 is a modified version of a glyph from the MnSymbol package + tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z", + // ditto tilde2, tilde3, & tilde4 + tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z", + tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z", + tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z", + // vec is from glyph U+20D7 in font KaTeX Main + vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", + // widehat1 is a modified version of a glyph from the MnSymbol package + widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z", + // ditto widehat2, widehat3, & widehat4 + widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", + widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", + widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", + // widecheck paths are all inverted versions of widehat + widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z", + widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + // The next ten paths support reaction arrows from the mhchem package. + // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX + // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main + baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 241v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", + // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main + rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", + // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. + // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em + baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", + rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z", + shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z", + shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z" +}; +/* harmony default export */ var svgGeometry = ({ + path: svgGeometry_path +}); +// CONCATENATED MODULE: ./src/tree.js + + +/** + * This node represents a document fragment, which contains elements, but when + * placed into the DOM doesn't have any representation itself. It only contains + * children and doesn't have any DOM node properties. + */ +var tree_DocumentFragment = +/*#__PURE__*/ +function () { + // HtmlDomNode + // Never used; needed for satisfying interface. + function DocumentFragment(children) { + this.children = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + this.children = children; + this.classes = []; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = {}; + } + + var _proto = DocumentFragment.prototype; + + _proto.hasClass = function hasClass(className) { + return utils.contains(this.classes, className); + }; + /** Convert the fragment into a node. */ + + + _proto.toNode = function toNode() { + var frag = document.createDocumentFragment(); + + for (var i = 0; i < this.children.length; i++) { + frag.appendChild(this.children[i].toNode()); + } + + return frag; + }; + /** Convert the fragment into HTML markup. */ + + + _proto.toMarkup = function toMarkup() { + var markup = ""; // Simply concatenate the markup for the children together. + + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + return markup; + }; + /** + * Converts the math node into a string, similar to innerText. Applies to + * MathDomNode's only. + */ + + + _proto.toText = function toText() { + // To avoid this, we would subclass documentFragment separately for + // MathML, but polyfills for subclassing is expensive per PR 1469. + // $FlowFixMe: Only works for ChildType = MathDomNode. + var toText = function toText(child) { + return child.toText(); + }; + + return this.children.map(toText).join(""); + }; + + return DocumentFragment; +}(); +// CONCATENATED MODULE: ./src/domTree.js +/** + * These objects store the data about the DOM nodes we create, as well as some + * extra data. They can then be transformed into real DOM nodes with the + * `toNode` function or HTML markup using `toMarkup`. They are useful for both + * storing extra properties on the nodes, as well as providing a way to easily + * work with the DOM. + * + * Similar functions for working with MathML nodes exist in mathMLTree.js. + * + * TODO: refactor `span` and `anchor` into common superclass when + * target environments support class inheritance + */ + + + + + +/** + * Create an HTML className based on a list of classes. In addition to joining + * with spaces, we also remove empty classes. + */ +var createClass = function createClass(classes) { + return classes.filter(function (cls) { + return cls; + }).join(" "); }; -},{"./fontMetrics.js":17}],10:[function(require,module,exports){ +var initNode = function initNode(classes, options, style) { + this.classes = classes || []; + this.attributes = {}; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = style || {}; + + if (options) { + if (options.style.isTight()) { + this.classes.push("mtight"); + } + + var color = options.getColor(); + + if (color) { + this.style.color = color; + } + } +}; +/** + * Convert into an HTML node + */ + + +var _toNode = function toNode(tagName) { + var node = document.createElement(tagName); // Apply the class + + node.className = createClass(this.classes); // Apply inline styles + + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + // $FlowFixMe Flow doesn't seem to understand span.style's type. + node.style[style] = this.style[style]; + } + } // Apply attributes + + + for (var attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } // Append the children, also as HTML nodes + + + for (var i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + + return node; +}; +/** + * Convert into an HTML markup string + */ + + +var _toMarkup = function toMarkup(tagName) { + var markup = "<" + tagName; // Add the class + + if (this.classes.length) { + markup += " class=\"" + utils.escape(createClass(this.classes)) + "\""; + } + + var styles = ""; // Add the styles, after hyphenation + + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; + } + } + + if (styles) { + markup += " style=\"" + utils.escape(styles) + "\""; + } // Add the attributes + + + for (var attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\""; + } + } + + markup += ">"; // Add the markup of the children, also as markup + + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + markup += ""; + return markup; +}; // Making the type below exact with all optional fields doesn't work due to +// - https://github.com/facebook/flow/issues/4582 +// - https://github.com/facebook/flow/issues/5688 +// However, since *all* fields are optional, $Shape<> works as suggested in 5688 +// above. +// This type does not include all CSS properties. Additional properties should +// be added as needed. + + +/** + * This node represents a span node, with a className, a list of children, and + * an inline style. It also contains information about its height, depth, and + * maxFontSize. + * + * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan + * otherwise. This typesafety is important when HTML builders access a span's + * children. + */ +var domTree_Span = +/*#__PURE__*/ +function () { + function Span(classes, children, options, style) { + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.width = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes, options, style); + this.children = children || []; + } + /** + * Sets an arbitrary attribute on the span. Warning: use this wisely. Not + * all browsers support attributes the same, and having too many custom + * attributes is probably bad. + */ + + + var _proto = Span.prototype; + + _proto.setAttribute = function setAttribute(attribute, value) { + this.attributes[attribute] = value; + }; + + _proto.hasClass = function hasClass(className) { + return utils.contains(this.classes, className); + }; + + _proto.toNode = function toNode() { + return _toNode.call(this, "span"); + }; + + _proto.toMarkup = function toMarkup() { + return _toMarkup.call(this, "span"); + }; + + return Span; +}(); +/** + * This node represents an anchor () element with a hyperlink. See `span` + * for further details. + */ + +var domTree_Anchor = +/*#__PURE__*/ +function () { + function Anchor(href, classes, children, options) { + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes, options); + this.children = children || []; + this.setAttribute('href', href); + } + + var _proto2 = Anchor.prototype; + + _proto2.setAttribute = function setAttribute(attribute, value) { + this.attributes[attribute] = value; + }; + + _proto2.hasClass = function hasClass(className) { + return utils.contains(this.classes, className); + }; + + _proto2.toNode = function toNode() { + return _toNode.call(this, "a"); + }; + + _proto2.toMarkup = function toMarkup() { + return _toMarkup.call(this, "a"); + }; + + return Anchor; +}(); +var iCombinations = { + 'î': "\u0131\u0302", + 'ï': "\u0131\u0308", + 'í': "\u0131\u0301", + // 'ī': '\u0131\u0304', // enable when we add Extended Latin + 'ì': "\u0131\u0300" +}; +/** + * A symbol node contains information about a single symbol. It either renders + * to a single text node, or a span with a single text node in it, depending on + * whether it has CSS classes, styles, or needs italic correction. + */ + +var domTree_SymbolNode = +/*#__PURE__*/ +function () { + function SymbolNode(text, height, depth, italic, skew, width, classes, style) { + this.text = void 0; + this.height = void 0; + this.depth = void 0; + this.italic = void 0; + this.skew = void 0; + this.width = void 0; + this.maxFontSize = void 0; + this.classes = void 0; + this.style = void 0; + this.text = text; + this.height = height || 0; + this.depth = depth || 0; + this.italic = italic || 0; + this.skew = skew || 0; + this.width = width || 0; + this.classes = classes || []; + this.style = style || {}; + this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we + // can specify which fonts to use. This allows us to render these + // characters with a serif font in situations where the browser would + // either default to a sans serif or render a placeholder character. + // We use CSS class names like cjk_fallback, hangul_fallback and + // brahmic_fallback. See ./unicodeScripts.js for the set of possible + // script names + + var script = scriptFromCodepoint(this.text.charCodeAt(0)); + + if (script) { + this.classes.push(script + "_fallback"); + } + + if (/[îïíì]/.test(this.text)) { + // add ī when we add Extended Latin + this.text = iCombinations[this.text]; + } + } + + var _proto3 = SymbolNode.prototype; + + _proto3.hasClass = function hasClass(className) { + return utils.contains(this.classes, className); + }; + /** + * Creates a text node or span from a symbol node. Note that a span is only + * created if it is needed. + */ + + + _proto3.toNode = function toNode() { + var node = document.createTextNode(this.text); + var span = null; + + if (this.italic > 0) { + span = document.createElement("span"); + span.style.marginRight = this.italic + "em"; + } + + if (this.classes.length > 0) { + span = span || document.createElement("span"); + span.className = createClass(this.classes); + } + + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type. + + span.style[style] = this.style[style]; + } + } + + if (span) { + span.appendChild(node); + return span; + } else { + return node; + } + }; + /** + * Creates markup for a symbol node. + */ + + + _proto3.toMarkup = function toMarkup() { + // TODO(alpert): More duplication than I'd like from + // span.prototype.toMarkup and symbolNode.prototype.toNode... + var needsSpan = false; + var markup = " 0) { + styles += "margin-right:" + this.italic + "em;"; + } + + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; + } + } + + if (styles) { + needsSpan = true; + markup += " style=\"" + utils.escape(styles) + "\""; + } + + var escaped = utils.escape(this.text); + + if (needsSpan) { + markup += ">"; + markup += escaped; + markup += ""; + return markup; + } else { + return escaped; + } + }; + + return SymbolNode; +}(); +/** + * SVG nodes are used to render stretchy wide elements. + */ + +var SvgNode = +/*#__PURE__*/ +function () { + function SvgNode(children, attributes) { + this.children = void 0; + this.attributes = void 0; + this.children = children || []; + this.attributes = attributes || {}; + } + + var _proto4 = SvgNode.prototype; + + _proto4.toNode = function toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "svg"); // Apply attributes + + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + for (var i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + + return node; + }; + + _proto4.toMarkup = function toMarkup() { + var markup = ""; + } else { + return ""; + } + }; + + return PathNode; +}(); +var LineNode = +/*#__PURE__*/ +function () { + function LineNode(attributes) { + this.attributes = void 0; + this.attributes = attributes || {}; + } + + var _proto6 = LineNode.prototype; + + _proto6.toNode = function toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "line"); // Apply attributes + + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + return node; + }; + + _proto6.toMarkup = function toMarkup() { + var markup = " but got " + String(group) + "."); + } +} +// CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js +// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. +/* harmony default export */ var fontMetricsData = ({ + "AMS-Regular": { + "65": [0, 0.68889, 0, 0, 0.72222], + "66": [0, 0.68889, 0, 0, 0.66667], + "67": [0, 0.68889, 0, 0, 0.72222], + "68": [0, 0.68889, 0, 0, 0.72222], + "69": [0, 0.68889, 0, 0, 0.66667], + "70": [0, 0.68889, 0, 0, 0.61111], + "71": [0, 0.68889, 0, 0, 0.77778], + "72": [0, 0.68889, 0, 0, 0.77778], + "73": [0, 0.68889, 0, 0, 0.38889], + "74": [0.16667, 0.68889, 0, 0, 0.5], + "75": [0, 0.68889, 0, 0, 0.77778], + "76": [0, 0.68889, 0, 0, 0.66667], + "77": [0, 0.68889, 0, 0, 0.94445], + "78": [0, 0.68889, 0, 0, 0.72222], + "79": [0.16667, 0.68889, 0, 0, 0.77778], + "80": [0, 0.68889, 0, 0, 0.61111], + "81": [0.16667, 0.68889, 0, 0, 0.77778], + "82": [0, 0.68889, 0, 0, 0.72222], + "83": [0, 0.68889, 0, 0, 0.55556], + "84": [0, 0.68889, 0, 0, 0.66667], + "85": [0, 0.68889, 0, 0, 0.72222], + "86": [0, 0.68889, 0, 0, 0.72222], + "87": [0, 0.68889, 0, 0, 1.0], + "88": [0, 0.68889, 0, 0, 0.72222], + "89": [0, 0.68889, 0, 0, 0.72222], + "90": [0, 0.68889, 0, 0, 0.66667], + "107": [0, 0.68889, 0, 0, 0.55556], + "165": [0, 0.675, 0.025, 0, 0.75], + "174": [0.15559, 0.69224, 0, 0, 0.94666], + "240": [0, 0.68889, 0, 0, 0.55556], + "295": [0, 0.68889, 0, 0, 0.54028], + "710": [0, 0.825, 0, 0, 2.33334], + "732": [0, 0.9, 0, 0, 2.33334], + "770": [0, 0.825, 0, 0, 2.33334], + "771": [0, 0.9, 0, 0, 2.33334], + "989": [0.08167, 0.58167, 0, 0, 0.77778], + "1008": [0, 0.43056, 0.04028, 0, 0.66667], + "8245": [0, 0.54986, 0, 0, 0.275], + "8463": [0, 0.68889, 0, 0, 0.54028], + "8487": [0, 0.68889, 0, 0, 0.72222], + "8498": [0, 0.68889, 0, 0, 0.55556], + "8502": [0, 0.68889, 0, 0, 0.66667], + "8503": [0, 0.68889, 0, 0, 0.44445], + "8504": [0, 0.68889, 0, 0, 0.66667], + "8513": [0, 0.68889, 0, 0, 0.63889], + "8592": [-0.03598, 0.46402, 0, 0, 0.5], + "8594": [-0.03598, 0.46402, 0, 0, 0.5], + "8602": [-0.13313, 0.36687, 0, 0, 1.0], + "8603": [-0.13313, 0.36687, 0, 0, 1.0], + "8606": [0.01354, 0.52239, 0, 0, 1.0], + "8608": [0.01354, 0.52239, 0, 0, 1.0], + "8610": [0.01354, 0.52239, 0, 0, 1.11111], + "8611": [0.01354, 0.52239, 0, 0, 1.11111], + "8619": [0, 0.54986, 0, 0, 1.0], + "8620": [0, 0.54986, 0, 0, 1.0], + "8621": [-0.13313, 0.37788, 0, 0, 1.38889], + "8622": [-0.13313, 0.36687, 0, 0, 1.0], + "8624": [0, 0.69224, 0, 0, 0.5], + "8625": [0, 0.69224, 0, 0, 0.5], + "8630": [0, 0.43056, 0, 0, 1.0], + "8631": [0, 0.43056, 0, 0, 1.0], + "8634": [0.08198, 0.58198, 0, 0, 0.77778], + "8635": [0.08198, 0.58198, 0, 0, 0.77778], + "8638": [0.19444, 0.69224, 0, 0, 0.41667], + "8639": [0.19444, 0.69224, 0, 0, 0.41667], + "8642": [0.19444, 0.69224, 0, 0, 0.41667], + "8643": [0.19444, 0.69224, 0, 0, 0.41667], + "8644": [0.1808, 0.675, 0, 0, 1.0], + "8646": [0.1808, 0.675, 0, 0, 1.0], + "8647": [0.1808, 0.675, 0, 0, 1.0], + "8648": [0.19444, 0.69224, 0, 0, 0.83334], + "8649": [0.1808, 0.675, 0, 0, 1.0], + "8650": [0.19444, 0.69224, 0, 0, 0.83334], + "8651": [0.01354, 0.52239, 0, 0, 1.0], + "8652": [0.01354, 0.52239, 0, 0, 1.0], + "8653": [-0.13313, 0.36687, 0, 0, 1.0], + "8654": [-0.13313, 0.36687, 0, 0, 1.0], + "8655": [-0.13313, 0.36687, 0, 0, 1.0], + "8666": [0.13667, 0.63667, 0, 0, 1.0], + "8667": [0.13667, 0.63667, 0, 0, 1.0], + "8669": [-0.13313, 0.37788, 0, 0, 1.0], + "8672": [-0.064, 0.437, 0, 0, 1.334], + "8674": [-0.064, 0.437, 0, 0, 1.334], + "8705": [0, 0.825, 0, 0, 0.5], + "8708": [0, 0.68889, 0, 0, 0.55556], + "8709": [0.08167, 0.58167, 0, 0, 0.77778], + "8717": [0, 0.43056, 0, 0, 0.42917], + "8722": [-0.03598, 0.46402, 0, 0, 0.5], + "8724": [0.08198, 0.69224, 0, 0, 0.77778], + "8726": [0.08167, 0.58167, 0, 0, 0.77778], + "8733": [0, 0.69224, 0, 0, 0.77778], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8737": [0, 0.69224, 0, 0, 0.72222], + "8738": [0.03517, 0.52239, 0, 0, 0.72222], + "8739": [0.08167, 0.58167, 0, 0, 0.22222], + "8740": [0.25142, 0.74111, 0, 0, 0.27778], + "8741": [0.08167, 0.58167, 0, 0, 0.38889], + "8742": [0.25142, 0.74111, 0, 0, 0.5], + "8756": [0, 0.69224, 0, 0, 0.66667], + "8757": [0, 0.69224, 0, 0, 0.66667], + "8764": [-0.13313, 0.36687, 0, 0, 0.77778], + "8765": [-0.13313, 0.37788, 0, 0, 0.77778], + "8769": [-0.13313, 0.36687, 0, 0, 0.77778], + "8770": [-0.03625, 0.46375, 0, 0, 0.77778], + "8774": [0.30274, 0.79383, 0, 0, 0.77778], + "8776": [-0.01688, 0.48312, 0, 0, 0.77778], + "8778": [0.08167, 0.58167, 0, 0, 0.77778], + "8782": [0.06062, 0.54986, 0, 0, 0.77778], + "8783": [0.06062, 0.54986, 0, 0, 0.77778], + "8785": [0.08198, 0.58198, 0, 0, 0.77778], + "8786": [0.08198, 0.58198, 0, 0, 0.77778], + "8787": [0.08198, 0.58198, 0, 0, 0.77778], + "8790": [0, 0.69224, 0, 0, 0.77778], + "8791": [0.22958, 0.72958, 0, 0, 0.77778], + "8796": [0.08198, 0.91667, 0, 0, 0.77778], + "8806": [0.25583, 0.75583, 0, 0, 0.77778], + "8807": [0.25583, 0.75583, 0, 0, 0.77778], + "8808": [0.25142, 0.75726, 0, 0, 0.77778], + "8809": [0.25142, 0.75726, 0, 0, 0.77778], + "8812": [0.25583, 0.75583, 0, 0, 0.5], + "8814": [0.20576, 0.70576, 0, 0, 0.77778], + "8815": [0.20576, 0.70576, 0, 0, 0.77778], + "8816": [0.30274, 0.79383, 0, 0, 0.77778], + "8817": [0.30274, 0.79383, 0, 0, 0.77778], + "8818": [0.22958, 0.72958, 0, 0, 0.77778], + "8819": [0.22958, 0.72958, 0, 0, 0.77778], + "8822": [0.1808, 0.675, 0, 0, 0.77778], + "8823": [0.1808, 0.675, 0, 0, 0.77778], + "8828": [0.13667, 0.63667, 0, 0, 0.77778], + "8829": [0.13667, 0.63667, 0, 0, 0.77778], + "8830": [0.22958, 0.72958, 0, 0, 0.77778], + "8831": [0.22958, 0.72958, 0, 0, 0.77778], + "8832": [0.20576, 0.70576, 0, 0, 0.77778], + "8833": [0.20576, 0.70576, 0, 0, 0.77778], + "8840": [0.30274, 0.79383, 0, 0, 0.77778], + "8841": [0.30274, 0.79383, 0, 0, 0.77778], + "8842": [0.13597, 0.63597, 0, 0, 0.77778], + "8843": [0.13597, 0.63597, 0, 0, 0.77778], + "8847": [0.03517, 0.54986, 0, 0, 0.77778], + "8848": [0.03517, 0.54986, 0, 0, 0.77778], + "8858": [0.08198, 0.58198, 0, 0, 0.77778], + "8859": [0.08198, 0.58198, 0, 0, 0.77778], + "8861": [0.08198, 0.58198, 0, 0, 0.77778], + "8862": [0, 0.675, 0, 0, 0.77778], + "8863": [0, 0.675, 0, 0, 0.77778], + "8864": [0, 0.675, 0, 0, 0.77778], + "8865": [0, 0.675, 0, 0, 0.77778], + "8872": [0, 0.69224, 0, 0, 0.61111], + "8873": [0, 0.69224, 0, 0, 0.72222], + "8874": [0, 0.69224, 0, 0, 0.88889], + "8876": [0, 0.68889, 0, 0, 0.61111], + "8877": [0, 0.68889, 0, 0, 0.61111], + "8878": [0, 0.68889, 0, 0, 0.72222], + "8879": [0, 0.68889, 0, 0, 0.72222], + "8882": [0.03517, 0.54986, 0, 0, 0.77778], + "8883": [0.03517, 0.54986, 0, 0, 0.77778], + "8884": [0.13667, 0.63667, 0, 0, 0.77778], + "8885": [0.13667, 0.63667, 0, 0, 0.77778], + "8888": [0, 0.54986, 0, 0, 1.11111], + "8890": [0.19444, 0.43056, 0, 0, 0.55556], + "8891": [0.19444, 0.69224, 0, 0, 0.61111], + "8892": [0.19444, 0.69224, 0, 0, 0.61111], + "8901": [0, 0.54986, 0, 0, 0.27778], + "8903": [0.08167, 0.58167, 0, 0, 0.77778], + "8905": [0.08167, 0.58167, 0, 0, 0.77778], + "8906": [0.08167, 0.58167, 0, 0, 0.77778], + "8907": [0, 0.69224, 0, 0, 0.77778], + "8908": [0, 0.69224, 0, 0, 0.77778], + "8909": [-0.03598, 0.46402, 0, 0, 0.77778], + "8910": [0, 0.54986, 0, 0, 0.76042], + "8911": [0, 0.54986, 0, 0, 0.76042], + "8912": [0.03517, 0.54986, 0, 0, 0.77778], + "8913": [0.03517, 0.54986, 0, 0, 0.77778], + "8914": [0, 0.54986, 0, 0, 0.66667], + "8915": [0, 0.54986, 0, 0, 0.66667], + "8916": [0, 0.69224, 0, 0, 0.66667], + "8918": [0.0391, 0.5391, 0, 0, 0.77778], + "8919": [0.0391, 0.5391, 0, 0, 0.77778], + "8920": [0.03517, 0.54986, 0, 0, 1.33334], + "8921": [0.03517, 0.54986, 0, 0, 1.33334], + "8922": [0.38569, 0.88569, 0, 0, 0.77778], + "8923": [0.38569, 0.88569, 0, 0, 0.77778], + "8926": [0.13667, 0.63667, 0, 0, 0.77778], + "8927": [0.13667, 0.63667, 0, 0, 0.77778], + "8928": [0.30274, 0.79383, 0, 0, 0.77778], + "8929": [0.30274, 0.79383, 0, 0, 0.77778], + "8934": [0.23222, 0.74111, 0, 0, 0.77778], + "8935": [0.23222, 0.74111, 0, 0, 0.77778], + "8936": [0.23222, 0.74111, 0, 0, 0.77778], + "8937": [0.23222, 0.74111, 0, 0, 0.77778], + "8938": [0.20576, 0.70576, 0, 0, 0.77778], + "8939": [0.20576, 0.70576, 0, 0, 0.77778], + "8940": [0.30274, 0.79383, 0, 0, 0.77778], + "8941": [0.30274, 0.79383, 0, 0, 0.77778], + "8994": [0.19444, 0.69224, 0, 0, 0.77778], + "8995": [0.19444, 0.69224, 0, 0, 0.77778], + "9416": [0.15559, 0.69224, 0, 0, 0.90222], + "9484": [0, 0.69224, 0, 0, 0.5], + "9488": [0, 0.69224, 0, 0, 0.5], + "9492": [0, 0.37788, 0, 0, 0.5], + "9496": [0, 0.37788, 0, 0, 0.5], + "9585": [0.19444, 0.68889, 0, 0, 0.88889], + "9586": [0.19444, 0.74111, 0, 0, 0.88889], + "9632": [0, 0.675, 0, 0, 0.77778], + "9633": [0, 0.675, 0, 0, 0.77778], + "9650": [0, 0.54986, 0, 0, 0.72222], + "9651": [0, 0.54986, 0, 0, 0.72222], + "9654": [0.03517, 0.54986, 0, 0, 0.77778], + "9660": [0, 0.54986, 0, 0, 0.72222], + "9661": [0, 0.54986, 0, 0, 0.72222], + "9664": [0.03517, 0.54986, 0, 0, 0.77778], + "9674": [0.11111, 0.69224, 0, 0, 0.66667], + "9733": [0.19444, 0.69224, 0, 0, 0.94445], + "10003": [0, 0.69224, 0, 0, 0.83334], + "10016": [0, 0.69224, 0, 0, 0.83334], + "10731": [0.11111, 0.69224, 0, 0, 0.66667], + "10846": [0.19444, 0.75583, 0, 0, 0.61111], + "10877": [0.13667, 0.63667, 0, 0, 0.77778], + "10878": [0.13667, 0.63667, 0, 0, 0.77778], + "10885": [0.25583, 0.75583, 0, 0, 0.77778], + "10886": [0.25583, 0.75583, 0, 0, 0.77778], + "10887": [0.13597, 0.63597, 0, 0, 0.77778], + "10888": [0.13597, 0.63597, 0, 0, 0.77778], + "10889": [0.26167, 0.75726, 0, 0, 0.77778], + "10890": [0.26167, 0.75726, 0, 0, 0.77778], + "10891": [0.48256, 0.98256, 0, 0, 0.77778], + "10892": [0.48256, 0.98256, 0, 0, 0.77778], + "10901": [0.13667, 0.63667, 0, 0, 0.77778], + "10902": [0.13667, 0.63667, 0, 0, 0.77778], + "10933": [0.25142, 0.75726, 0, 0, 0.77778], + "10934": [0.25142, 0.75726, 0, 0, 0.77778], + "10935": [0.26167, 0.75726, 0, 0, 0.77778], + "10936": [0.26167, 0.75726, 0, 0, 0.77778], + "10937": [0.26167, 0.75726, 0, 0, 0.77778], + "10938": [0.26167, 0.75726, 0, 0, 0.77778], + "10949": [0.25583, 0.75583, 0, 0, 0.77778], + "10950": [0.25583, 0.75583, 0, 0, 0.77778], + "10955": [0.28481, 0.79383, 0, 0, 0.77778], + "10956": [0.28481, 0.79383, 0, 0, 0.77778], + "57350": [0.08167, 0.58167, 0, 0, 0.22222], + "57351": [0.08167, 0.58167, 0, 0, 0.38889], + "57352": [0.08167, 0.58167, 0, 0, 0.77778], + "57353": [0, 0.43056, 0.04028, 0, 0.66667], + "57356": [0.25142, 0.75726, 0, 0, 0.77778], + "57357": [0.25142, 0.75726, 0, 0, 0.77778], + "57358": [0.41951, 0.91951, 0, 0, 0.77778], + "57359": [0.30274, 0.79383, 0, 0, 0.77778], + "57360": [0.30274, 0.79383, 0, 0, 0.77778], + "57361": [0.41951, 0.91951, 0, 0, 0.77778], + "57366": [0.25142, 0.75726, 0, 0, 0.77778], + "57367": [0.25142, 0.75726, 0, 0, 0.77778], + "57368": [0.25142, 0.75726, 0, 0, 0.77778], + "57369": [0.25142, 0.75726, 0, 0, 0.77778], + "57370": [0.13597, 0.63597, 0, 0, 0.77778], + "57371": [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Caligraphic-Regular": { + "48": [0, 0.43056, 0, 0, 0.5], + "49": [0, 0.43056, 0, 0, 0.5], + "50": [0, 0.43056, 0, 0, 0.5], + "51": [0.19444, 0.43056, 0, 0, 0.5], + "52": [0.19444, 0.43056, 0, 0, 0.5], + "53": [0.19444, 0.43056, 0, 0, 0.5], + "54": [0, 0.64444, 0, 0, 0.5], + "55": [0.19444, 0.43056, 0, 0, 0.5], + "56": [0, 0.64444, 0, 0, 0.5], + "57": [0.19444, 0.43056, 0, 0, 0.5], + "65": [0, 0.68333, 0, 0.19445, 0.79847], + "66": [0, 0.68333, 0.03041, 0.13889, 0.65681], + "67": [0, 0.68333, 0.05834, 0.13889, 0.52653], + "68": [0, 0.68333, 0.02778, 0.08334, 0.77139], + "69": [0, 0.68333, 0.08944, 0.11111, 0.52778], + "70": [0, 0.68333, 0.09931, 0.11111, 0.71875], + "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], + "72": [0, 0.68333, 0.00965, 0.11111, 0.84452], + "73": [0, 0.68333, 0.07382, 0, 0.54452], + "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], + "75": [0, 0.68333, 0.01445, 0.05556, 0.76195], + "76": [0, 0.68333, 0, 0.13889, 0.68972], + "77": [0, 0.68333, 0, 0.13889, 1.2009], + "78": [0, 0.68333, 0.14736, 0.08334, 0.82049], + "79": [0, 0.68333, 0.02778, 0.11111, 0.79611], + "80": [0, 0.68333, 0.08222, 0.08334, 0.69556], + "81": [0.09722, 0.68333, 0, 0.11111, 0.81667], + "82": [0, 0.68333, 0, 0.08334, 0.8475], + "83": [0, 0.68333, 0.075, 0.13889, 0.60556], + "84": [0, 0.68333, 0.25417, 0, 0.54464], + "85": [0, 0.68333, 0.09931, 0.08334, 0.62583], + "86": [0, 0.68333, 0.08222, 0, 0.61278], + "87": [0, 0.68333, 0.08222, 0.08334, 0.98778], + "88": [0, 0.68333, 0.14643, 0.13889, 0.7133], + "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], + "90": [0, 0.68333, 0.07944, 0.13889, 0.72473] + }, + "Fraktur-Regular": { + "33": [0, 0.69141, 0, 0, 0.29574], + "34": [0, 0.69141, 0, 0, 0.21471], + "38": [0, 0.69141, 0, 0, 0.73786], + "39": [0, 0.69141, 0, 0, 0.21201], + "40": [0.24982, 0.74947, 0, 0, 0.38865], + "41": [0.24982, 0.74947, 0, 0, 0.38865], + "42": [0, 0.62119, 0, 0, 0.27764], + "43": [0.08319, 0.58283, 0, 0, 0.75623], + "44": [0, 0.10803, 0, 0, 0.27764], + "45": [0.08319, 0.58283, 0, 0, 0.75623], + "46": [0, 0.10803, 0, 0, 0.27764], + "47": [0.24982, 0.74947, 0, 0, 0.50181], + "48": [0, 0.47534, 0, 0, 0.50181], + "49": [0, 0.47534, 0, 0, 0.50181], + "50": [0, 0.47534, 0, 0, 0.50181], + "51": [0.18906, 0.47534, 0, 0, 0.50181], + "52": [0.18906, 0.47534, 0, 0, 0.50181], + "53": [0.18906, 0.47534, 0, 0, 0.50181], + "54": [0, 0.69141, 0, 0, 0.50181], + "55": [0.18906, 0.47534, 0, 0, 0.50181], + "56": [0, 0.69141, 0, 0, 0.50181], + "57": [0.18906, 0.47534, 0, 0, 0.50181], + "58": [0, 0.47534, 0, 0, 0.21606], + "59": [0.12604, 0.47534, 0, 0, 0.21606], + "61": [-0.13099, 0.36866, 0, 0, 0.75623], + "63": [0, 0.69141, 0, 0, 0.36245], + "65": [0, 0.69141, 0, 0, 0.7176], + "66": [0, 0.69141, 0, 0, 0.88397], + "67": [0, 0.69141, 0, 0, 0.61254], + "68": [0, 0.69141, 0, 0, 0.83158], + "69": [0, 0.69141, 0, 0, 0.66278], + "70": [0.12604, 0.69141, 0, 0, 0.61119], + "71": [0, 0.69141, 0, 0, 0.78539], + "72": [0.06302, 0.69141, 0, 0, 0.7203], + "73": [0, 0.69141, 0, 0, 0.55448], + "74": [0.12604, 0.69141, 0, 0, 0.55231], + "75": [0, 0.69141, 0, 0, 0.66845], + "76": [0, 0.69141, 0, 0, 0.66602], + "77": [0, 0.69141, 0, 0, 1.04953], + "78": [0, 0.69141, 0, 0, 0.83212], + "79": [0, 0.69141, 0, 0, 0.82699], + "80": [0.18906, 0.69141, 0, 0, 0.82753], + "81": [0.03781, 0.69141, 0, 0, 0.82699], + "82": [0, 0.69141, 0, 0, 0.82807], + "83": [0, 0.69141, 0, 0, 0.82861], + "84": [0, 0.69141, 0, 0, 0.66899], + "85": [0, 0.69141, 0, 0, 0.64576], + "86": [0, 0.69141, 0, 0, 0.83131], + "87": [0, 0.69141, 0, 0, 1.04602], + "88": [0, 0.69141, 0, 0, 0.71922], + "89": [0.18906, 0.69141, 0, 0, 0.83293], + "90": [0.12604, 0.69141, 0, 0, 0.60201], + "91": [0.24982, 0.74947, 0, 0, 0.27764], + "93": [0.24982, 0.74947, 0, 0, 0.27764], + "94": [0, 0.69141, 0, 0, 0.49965], + "97": [0, 0.47534, 0, 0, 0.50046], + "98": [0, 0.69141, 0, 0, 0.51315], + "99": [0, 0.47534, 0, 0, 0.38946], + "100": [0, 0.62119, 0, 0, 0.49857], + "101": [0, 0.47534, 0, 0, 0.40053], + "102": [0.18906, 0.69141, 0, 0, 0.32626], + "103": [0.18906, 0.47534, 0, 0, 0.5037], + "104": [0.18906, 0.69141, 0, 0, 0.52126], + "105": [0, 0.69141, 0, 0, 0.27899], + "106": [0, 0.69141, 0, 0, 0.28088], + "107": [0, 0.69141, 0, 0, 0.38946], + "108": [0, 0.69141, 0, 0, 0.27953], + "109": [0, 0.47534, 0, 0, 0.76676], + "110": [0, 0.47534, 0, 0, 0.52666], + "111": [0, 0.47534, 0, 0, 0.48885], + "112": [0.18906, 0.52396, 0, 0, 0.50046], + "113": [0.18906, 0.47534, 0, 0, 0.48912], + "114": [0, 0.47534, 0, 0, 0.38919], + "115": [0, 0.47534, 0, 0, 0.44266], + "116": [0, 0.62119, 0, 0, 0.33301], + "117": [0, 0.47534, 0, 0, 0.5172], + "118": [0, 0.52396, 0, 0, 0.5118], + "119": [0, 0.52396, 0, 0, 0.77351], + "120": [0.18906, 0.47534, 0, 0, 0.38865], + "121": [0.18906, 0.47534, 0, 0, 0.49884], + "122": [0.18906, 0.47534, 0, 0, 0.39054], + "8216": [0, 0.69141, 0, 0, 0.21471], + "8217": [0, 0.69141, 0, 0, 0.21471], + "58112": [0, 0.62119, 0, 0, 0.49749], + "58113": [0, 0.62119, 0, 0, 0.4983], + "58114": [0.18906, 0.69141, 0, 0, 0.33328], + "58115": [0.18906, 0.69141, 0, 0, 0.32923], + "58116": [0.18906, 0.47534, 0, 0, 0.50343], + "58117": [0, 0.69141, 0, 0, 0.33301], + "58118": [0, 0.62119, 0, 0, 0.33409], + "58119": [0, 0.47534, 0, 0, 0.50073] + }, + "Main-Bold": { + "33": [0, 0.69444, 0, 0, 0.35], + "34": [0, 0.69444, 0, 0, 0.60278], + "35": [0.19444, 0.69444, 0, 0, 0.95833], + "36": [0.05556, 0.75, 0, 0, 0.575], + "37": [0.05556, 0.75, 0, 0, 0.95833], + "38": [0, 0.69444, 0, 0, 0.89444], + "39": [0, 0.69444, 0, 0, 0.31944], + "40": [0.25, 0.75, 0, 0, 0.44722], + "41": [0.25, 0.75, 0, 0, 0.44722], + "42": [0, 0.75, 0, 0, 0.575], + "43": [0.13333, 0.63333, 0, 0, 0.89444], + "44": [0.19444, 0.15556, 0, 0, 0.31944], + "45": [0, 0.44444, 0, 0, 0.38333], + "46": [0, 0.15556, 0, 0, 0.31944], + "47": [0.25, 0.75, 0, 0, 0.575], + "48": [0, 0.64444, 0, 0, 0.575], + "49": [0, 0.64444, 0, 0, 0.575], + "50": [0, 0.64444, 0, 0, 0.575], + "51": [0, 0.64444, 0, 0, 0.575], + "52": [0, 0.64444, 0, 0, 0.575], + "53": [0, 0.64444, 0, 0, 0.575], + "54": [0, 0.64444, 0, 0, 0.575], + "55": [0, 0.64444, 0, 0, 0.575], + "56": [0, 0.64444, 0, 0, 0.575], + "57": [0, 0.64444, 0, 0, 0.575], + "58": [0, 0.44444, 0, 0, 0.31944], + "59": [0.19444, 0.44444, 0, 0, 0.31944], + "60": [0.08556, 0.58556, 0, 0, 0.89444], + "61": [-0.10889, 0.39111, 0, 0, 0.89444], + "62": [0.08556, 0.58556, 0, 0, 0.89444], + "63": [0, 0.69444, 0, 0, 0.54305], + "64": [0, 0.69444, 0, 0, 0.89444], + "65": [0, 0.68611, 0, 0, 0.86944], + "66": [0, 0.68611, 0, 0, 0.81805], + "67": [0, 0.68611, 0, 0, 0.83055], + "68": [0, 0.68611, 0, 0, 0.88194], + "69": [0, 0.68611, 0, 0, 0.75555], + "70": [0, 0.68611, 0, 0, 0.72361], + "71": [0, 0.68611, 0, 0, 0.90416], + "72": [0, 0.68611, 0, 0, 0.9], + "73": [0, 0.68611, 0, 0, 0.43611], + "74": [0, 0.68611, 0, 0, 0.59444], + "75": [0, 0.68611, 0, 0, 0.90138], + "76": [0, 0.68611, 0, 0, 0.69166], + "77": [0, 0.68611, 0, 0, 1.09166], + "78": [0, 0.68611, 0, 0, 0.9], + "79": [0, 0.68611, 0, 0, 0.86388], + "80": [0, 0.68611, 0, 0, 0.78611], + "81": [0.19444, 0.68611, 0, 0, 0.86388], + "82": [0, 0.68611, 0, 0, 0.8625], + "83": [0, 0.68611, 0, 0, 0.63889], + "84": [0, 0.68611, 0, 0, 0.8], + "85": [0, 0.68611, 0, 0, 0.88472], + "86": [0, 0.68611, 0.01597, 0, 0.86944], + "87": [0, 0.68611, 0.01597, 0, 1.18888], + "88": [0, 0.68611, 0, 0, 0.86944], + "89": [0, 0.68611, 0.02875, 0, 0.86944], + "90": [0, 0.68611, 0, 0, 0.70277], + "91": [0.25, 0.75, 0, 0, 0.31944], + "92": [0.25, 0.75, 0, 0, 0.575], + "93": [0.25, 0.75, 0, 0, 0.31944], + "94": [0, 0.69444, 0, 0, 0.575], + "95": [0.31, 0.13444, 0.03194, 0, 0.575], + "97": [0, 0.44444, 0, 0, 0.55902], + "98": [0, 0.69444, 0, 0, 0.63889], + "99": [0, 0.44444, 0, 0, 0.51111], + "100": [0, 0.69444, 0, 0, 0.63889], + "101": [0, 0.44444, 0, 0, 0.52708], + "102": [0, 0.69444, 0.10903, 0, 0.35139], + "103": [0.19444, 0.44444, 0.01597, 0, 0.575], + "104": [0, 0.69444, 0, 0, 0.63889], + "105": [0, 0.69444, 0, 0, 0.31944], + "106": [0.19444, 0.69444, 0, 0, 0.35139], + "107": [0, 0.69444, 0, 0, 0.60694], + "108": [0, 0.69444, 0, 0, 0.31944], + "109": [0, 0.44444, 0, 0, 0.95833], + "110": [0, 0.44444, 0, 0, 0.63889], + "111": [0, 0.44444, 0, 0, 0.575], + "112": [0.19444, 0.44444, 0, 0, 0.63889], + "113": [0.19444, 0.44444, 0, 0, 0.60694], + "114": [0, 0.44444, 0, 0, 0.47361], + "115": [0, 0.44444, 0, 0, 0.45361], + "116": [0, 0.63492, 0, 0, 0.44722], + "117": [0, 0.44444, 0, 0, 0.63889], + "118": [0, 0.44444, 0.01597, 0, 0.60694], + "119": [0, 0.44444, 0.01597, 0, 0.83055], + "120": [0, 0.44444, 0, 0, 0.60694], + "121": [0.19444, 0.44444, 0.01597, 0, 0.60694], + "122": [0, 0.44444, 0, 0, 0.51111], + "123": [0.25, 0.75, 0, 0, 0.575], + "124": [0.25, 0.75, 0, 0, 0.31944], + "125": [0.25, 0.75, 0, 0, 0.575], + "126": [0.35, 0.34444, 0, 0, 0.575], + "168": [0, 0.69444, 0, 0, 0.575], + "172": [0, 0.44444, 0, 0, 0.76666], + "176": [0, 0.69444, 0, 0, 0.86944], + "177": [0.13333, 0.63333, 0, 0, 0.89444], + "184": [0.17014, 0, 0, 0, 0.51111], + "198": [0, 0.68611, 0, 0, 1.04166], + "215": [0.13333, 0.63333, 0, 0, 0.89444], + "216": [0.04861, 0.73472, 0, 0, 0.89444], + "223": [0, 0.69444, 0, 0, 0.59722], + "230": [0, 0.44444, 0, 0, 0.83055], + "247": [0.13333, 0.63333, 0, 0, 0.89444], + "248": [0.09722, 0.54167, 0, 0, 0.575], + "305": [0, 0.44444, 0, 0, 0.31944], + "338": [0, 0.68611, 0, 0, 1.16944], + "339": [0, 0.44444, 0, 0, 0.89444], + "567": [0.19444, 0.44444, 0, 0, 0.35139], + "710": [0, 0.69444, 0, 0, 0.575], + "711": [0, 0.63194, 0, 0, 0.575], + "713": [0, 0.59611, 0, 0, 0.575], + "714": [0, 0.69444, 0, 0, 0.575], + "715": [0, 0.69444, 0, 0, 0.575], + "728": [0, 0.69444, 0, 0, 0.575], + "729": [0, 0.69444, 0, 0, 0.31944], + "730": [0, 0.69444, 0, 0, 0.86944], + "732": [0, 0.69444, 0, 0, 0.575], + "733": [0, 0.69444, 0, 0, 0.575], + "824": [0.19444, 0.69444, 0, 0, 0], + "915": [0, 0.68611, 0, 0, 0.69166], + "916": [0, 0.68611, 0, 0, 0.95833], + "920": [0, 0.68611, 0, 0, 0.89444], + "923": [0, 0.68611, 0, 0, 0.80555], + "926": [0, 0.68611, 0, 0, 0.76666], + "928": [0, 0.68611, 0, 0, 0.9], + "931": [0, 0.68611, 0, 0, 0.83055], + "933": [0, 0.68611, 0, 0, 0.89444], + "934": [0, 0.68611, 0, 0, 0.83055], + "936": [0, 0.68611, 0, 0, 0.89444], + "937": [0, 0.68611, 0, 0, 0.83055], + "8211": [0, 0.44444, 0.03194, 0, 0.575], + "8212": [0, 0.44444, 0.03194, 0, 1.14999], + "8216": [0, 0.69444, 0, 0, 0.31944], + "8217": [0, 0.69444, 0, 0, 0.31944], + "8220": [0, 0.69444, 0, 0, 0.60278], + "8221": [0, 0.69444, 0, 0, 0.60278], + "8224": [0.19444, 0.69444, 0, 0, 0.51111], + "8225": [0.19444, 0.69444, 0, 0, 0.51111], + "8242": [0, 0.55556, 0, 0, 0.34444], + "8407": [0, 0.72444, 0.15486, 0, 0.575], + "8463": [0, 0.69444, 0, 0, 0.66759], + "8465": [0, 0.69444, 0, 0, 0.83055], + "8467": [0, 0.69444, 0, 0, 0.47361], + "8472": [0.19444, 0.44444, 0, 0, 0.74027], + "8476": [0, 0.69444, 0, 0, 0.83055], + "8501": [0, 0.69444, 0, 0, 0.70277], + "8592": [-0.10889, 0.39111, 0, 0, 1.14999], + "8593": [0.19444, 0.69444, 0, 0, 0.575], + "8594": [-0.10889, 0.39111, 0, 0, 1.14999], + "8595": [0.19444, 0.69444, 0, 0, 0.575], + "8596": [-0.10889, 0.39111, 0, 0, 1.14999], + "8597": [0.25, 0.75, 0, 0, 0.575], + "8598": [0.19444, 0.69444, 0, 0, 1.14999], + "8599": [0.19444, 0.69444, 0, 0, 1.14999], + "8600": [0.19444, 0.69444, 0, 0, 1.14999], + "8601": [0.19444, 0.69444, 0, 0, 1.14999], + "8636": [-0.10889, 0.39111, 0, 0, 1.14999], + "8637": [-0.10889, 0.39111, 0, 0, 1.14999], + "8640": [-0.10889, 0.39111, 0, 0, 1.14999], + "8641": [-0.10889, 0.39111, 0, 0, 1.14999], + "8656": [-0.10889, 0.39111, 0, 0, 1.14999], + "8657": [0.19444, 0.69444, 0, 0, 0.70277], + "8658": [-0.10889, 0.39111, 0, 0, 1.14999], + "8659": [0.19444, 0.69444, 0, 0, 0.70277], + "8660": [-0.10889, 0.39111, 0, 0, 1.14999], + "8661": [0.25, 0.75, 0, 0, 0.70277], + "8704": [0, 0.69444, 0, 0, 0.63889], + "8706": [0, 0.69444, 0.06389, 0, 0.62847], + "8707": [0, 0.69444, 0, 0, 0.63889], + "8709": [0.05556, 0.75, 0, 0, 0.575], + "8711": [0, 0.68611, 0, 0, 0.95833], + "8712": [0.08556, 0.58556, 0, 0, 0.76666], + "8715": [0.08556, 0.58556, 0, 0, 0.76666], + "8722": [0.13333, 0.63333, 0, 0, 0.89444], + "8723": [0.13333, 0.63333, 0, 0, 0.89444], + "8725": [0.25, 0.75, 0, 0, 0.575], + "8726": [0.25, 0.75, 0, 0, 0.575], + "8727": [-0.02778, 0.47222, 0, 0, 0.575], + "8728": [-0.02639, 0.47361, 0, 0, 0.575], + "8729": [-0.02639, 0.47361, 0, 0, 0.575], + "8730": [0.18, 0.82, 0, 0, 0.95833], + "8733": [0, 0.44444, 0, 0, 0.89444], + "8734": [0, 0.44444, 0, 0, 1.14999], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8739": [0.25, 0.75, 0, 0, 0.31944], + "8741": [0.25, 0.75, 0, 0, 0.575], + "8743": [0, 0.55556, 0, 0, 0.76666], + "8744": [0, 0.55556, 0, 0, 0.76666], + "8745": [0, 0.55556, 0, 0, 0.76666], + "8746": [0, 0.55556, 0, 0, 0.76666], + "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875], + "8764": [-0.10889, 0.39111, 0, 0, 0.89444], + "8768": [0.19444, 0.69444, 0, 0, 0.31944], + "8771": [0.00222, 0.50222, 0, 0, 0.89444], + "8776": [0.02444, 0.52444, 0, 0, 0.89444], + "8781": [0.00222, 0.50222, 0, 0, 0.89444], + "8801": [0.00222, 0.50222, 0, 0, 0.89444], + "8804": [0.19667, 0.69667, 0, 0, 0.89444], + "8805": [0.19667, 0.69667, 0, 0, 0.89444], + "8810": [0.08556, 0.58556, 0, 0, 1.14999], + "8811": [0.08556, 0.58556, 0, 0, 1.14999], + "8826": [0.08556, 0.58556, 0, 0, 0.89444], + "8827": [0.08556, 0.58556, 0, 0, 0.89444], + "8834": [0.08556, 0.58556, 0, 0, 0.89444], + "8835": [0.08556, 0.58556, 0, 0, 0.89444], + "8838": [0.19667, 0.69667, 0, 0, 0.89444], + "8839": [0.19667, 0.69667, 0, 0, 0.89444], + "8846": [0, 0.55556, 0, 0, 0.76666], + "8849": [0.19667, 0.69667, 0, 0, 0.89444], + "8850": [0.19667, 0.69667, 0, 0, 0.89444], + "8851": [0, 0.55556, 0, 0, 0.76666], + "8852": [0, 0.55556, 0, 0, 0.76666], + "8853": [0.13333, 0.63333, 0, 0, 0.89444], + "8854": [0.13333, 0.63333, 0, 0, 0.89444], + "8855": [0.13333, 0.63333, 0, 0, 0.89444], + "8856": [0.13333, 0.63333, 0, 0, 0.89444], + "8857": [0.13333, 0.63333, 0, 0, 0.89444], + "8866": [0, 0.69444, 0, 0, 0.70277], + "8867": [0, 0.69444, 0, 0, 0.70277], + "8868": [0, 0.69444, 0, 0, 0.89444], + "8869": [0, 0.69444, 0, 0, 0.89444], + "8900": [-0.02639, 0.47361, 0, 0, 0.575], + "8901": [-0.02639, 0.47361, 0, 0, 0.31944], + "8902": [-0.02778, 0.47222, 0, 0, 0.575], + "8968": [0.25, 0.75, 0, 0, 0.51111], + "8969": [0.25, 0.75, 0, 0, 0.51111], + "8970": [0.25, 0.75, 0, 0, 0.51111], + "8971": [0.25, 0.75, 0, 0, 0.51111], + "8994": [-0.13889, 0.36111, 0, 0, 1.14999], + "8995": [-0.13889, 0.36111, 0, 0, 1.14999], + "9651": [0.19444, 0.69444, 0, 0, 1.02222], + "9657": [-0.02778, 0.47222, 0, 0, 0.575], + "9661": [0.19444, 0.69444, 0, 0, 1.02222], + "9667": [-0.02778, 0.47222, 0, 0, 0.575], + "9711": [0.19444, 0.69444, 0, 0, 1.14999], + "9824": [0.12963, 0.69444, 0, 0, 0.89444], + "9825": [0.12963, 0.69444, 0, 0, 0.89444], + "9826": [0.12963, 0.69444, 0, 0, 0.89444], + "9827": [0.12963, 0.69444, 0, 0, 0.89444], + "9837": [0, 0.75, 0, 0, 0.44722], + "9838": [0.19444, 0.69444, 0, 0, 0.44722], + "9839": [0.19444, 0.69444, 0, 0, 0.44722], + "10216": [0.25, 0.75, 0, 0, 0.44722], + "10217": [0.25, 0.75, 0, 0, 0.44722], + "10815": [0, 0.68611, 0, 0, 0.9], + "10927": [0.19667, 0.69667, 0, 0, 0.89444], + "10928": [0.19667, 0.69667, 0, 0, 0.89444] + }, + "Main-BoldItalic": { + "33": [0, 0.69444, 0.11417, 0, 0.38611], + "34": [0, 0.69444, 0.07939, 0, 0.62055], + "35": [0.19444, 0.69444, 0.06833, 0, 0.94444], + "37": [0.05556, 0.75, 0.12861, 0, 0.94444], + "38": [0, 0.69444, 0.08528, 0, 0.88555], + "39": [0, 0.69444, 0.12945, 0, 0.35555], + "40": [0.25, 0.75, 0.15806, 0, 0.47333], + "41": [0.25, 0.75, 0.03306, 0, 0.47333], + "42": [0, 0.75, 0.14333, 0, 0.59111], + "43": [0.10333, 0.60333, 0.03306, 0, 0.88555], + "44": [0.19444, 0.14722, 0, 0, 0.35555], + "45": [0, 0.44444, 0.02611, 0, 0.41444], + "46": [0, 0.14722, 0, 0, 0.35555], + "47": [0.25, 0.75, 0.15806, 0, 0.59111], + "48": [0, 0.64444, 0.13167, 0, 0.59111], + "49": [0, 0.64444, 0.13167, 0, 0.59111], + "50": [0, 0.64444, 0.13167, 0, 0.59111], + "51": [0, 0.64444, 0.13167, 0, 0.59111], + "52": [0.19444, 0.64444, 0.13167, 0, 0.59111], + "53": [0, 0.64444, 0.13167, 0, 0.59111], + "54": [0, 0.64444, 0.13167, 0, 0.59111], + "55": [0.19444, 0.64444, 0.13167, 0, 0.59111], + "56": [0, 0.64444, 0.13167, 0, 0.59111], + "57": [0, 0.64444, 0.13167, 0, 0.59111], + "58": [0, 0.44444, 0.06695, 0, 0.35555], + "59": [0.19444, 0.44444, 0.06695, 0, 0.35555], + "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555], + "63": [0, 0.69444, 0.11472, 0, 0.59111], + "64": [0, 0.69444, 0.09208, 0, 0.88555], + "65": [0, 0.68611, 0, 0, 0.86555], + "66": [0, 0.68611, 0.0992, 0, 0.81666], + "67": [0, 0.68611, 0.14208, 0, 0.82666], + "68": [0, 0.68611, 0.09062, 0, 0.87555], + "69": [0, 0.68611, 0.11431, 0, 0.75666], + "70": [0, 0.68611, 0.12903, 0, 0.72722], + "71": [0, 0.68611, 0.07347, 0, 0.89527], + "72": [0, 0.68611, 0.17208, 0, 0.8961], + "73": [0, 0.68611, 0.15681, 0, 0.47166], + "74": [0, 0.68611, 0.145, 0, 0.61055], + "75": [0, 0.68611, 0.14208, 0, 0.89499], + "76": [0, 0.68611, 0, 0, 0.69777], + "77": [0, 0.68611, 0.17208, 0, 1.07277], + "78": [0, 0.68611, 0.17208, 0, 0.8961], + "79": [0, 0.68611, 0.09062, 0, 0.85499], + "80": [0, 0.68611, 0.0992, 0, 0.78721], + "81": [0.19444, 0.68611, 0.09062, 0, 0.85499], + "82": [0, 0.68611, 0.02559, 0, 0.85944], + "83": [0, 0.68611, 0.11264, 0, 0.64999], + "84": [0, 0.68611, 0.12903, 0, 0.7961], + "85": [0, 0.68611, 0.17208, 0, 0.88083], + "86": [0, 0.68611, 0.18625, 0, 0.86555], + "87": [0, 0.68611, 0.18625, 0, 1.15999], + "88": [0, 0.68611, 0.15681, 0, 0.86555], + "89": [0, 0.68611, 0.19803, 0, 0.86555], + "90": [0, 0.68611, 0.14208, 0, 0.70888], + "91": [0.25, 0.75, 0.1875, 0, 0.35611], + "93": [0.25, 0.75, 0.09972, 0, 0.35611], + "94": [0, 0.69444, 0.06709, 0, 0.59111], + "95": [0.31, 0.13444, 0.09811, 0, 0.59111], + "97": [0, 0.44444, 0.09426, 0, 0.59111], + "98": [0, 0.69444, 0.07861, 0, 0.53222], + "99": [0, 0.44444, 0.05222, 0, 0.53222], + "100": [0, 0.69444, 0.10861, 0, 0.59111], + "101": [0, 0.44444, 0.085, 0, 0.53222], + "102": [0.19444, 0.69444, 0.21778, 0, 0.4], + "103": [0.19444, 0.44444, 0.105, 0, 0.53222], + "104": [0, 0.69444, 0.09426, 0, 0.59111], + "105": [0, 0.69326, 0.11387, 0, 0.35555], + "106": [0.19444, 0.69326, 0.1672, 0, 0.35555], + "107": [0, 0.69444, 0.11111, 0, 0.53222], + "108": [0, 0.69444, 0.10861, 0, 0.29666], + "109": [0, 0.44444, 0.09426, 0, 0.94444], + "110": [0, 0.44444, 0.09426, 0, 0.64999], + "111": [0, 0.44444, 0.07861, 0, 0.59111], + "112": [0.19444, 0.44444, 0.07861, 0, 0.59111], + "113": [0.19444, 0.44444, 0.105, 0, 0.53222], + "114": [0, 0.44444, 0.11111, 0, 0.50167], + "115": [0, 0.44444, 0.08167, 0, 0.48694], + "116": [0, 0.63492, 0.09639, 0, 0.385], + "117": [0, 0.44444, 0.09426, 0, 0.62055], + "118": [0, 0.44444, 0.11111, 0, 0.53222], + "119": [0, 0.44444, 0.11111, 0, 0.76777], + "120": [0, 0.44444, 0.12583, 0, 0.56055], + "121": [0.19444, 0.44444, 0.105, 0, 0.56166], + "122": [0, 0.44444, 0.13889, 0, 0.49055], + "126": [0.35, 0.34444, 0.11472, 0, 0.59111], + "163": [0, 0.69444, 0, 0, 0.86853], + "168": [0, 0.69444, 0.11473, 0, 0.59111], + "176": [0, 0.69444, 0, 0, 0.94888], + "184": [0.17014, 0, 0, 0, 0.53222], + "198": [0, 0.68611, 0.11431, 0, 1.02277], + "216": [0.04861, 0.73472, 0.09062, 0, 0.88555], + "223": [0.19444, 0.69444, 0.09736, 0, 0.665], + "230": [0, 0.44444, 0.085, 0, 0.82666], + "248": [0.09722, 0.54167, 0.09458, 0, 0.59111], + "305": [0, 0.44444, 0.09426, 0, 0.35555], + "338": [0, 0.68611, 0.11431, 0, 1.14054], + "339": [0, 0.44444, 0.085, 0, 0.82666], + "567": [0.19444, 0.44444, 0.04611, 0, 0.385], + "710": [0, 0.69444, 0.06709, 0, 0.59111], + "711": [0, 0.63194, 0.08271, 0, 0.59111], + "713": [0, 0.59444, 0.10444, 0, 0.59111], + "714": [0, 0.69444, 0.08528, 0, 0.59111], + "715": [0, 0.69444, 0, 0, 0.59111], + "728": [0, 0.69444, 0.10333, 0, 0.59111], + "729": [0, 0.69444, 0.12945, 0, 0.35555], + "730": [0, 0.69444, 0, 0, 0.94888], + "732": [0, 0.69444, 0.11472, 0, 0.59111], + "733": [0, 0.69444, 0.11472, 0, 0.59111], + "915": [0, 0.68611, 0.12903, 0, 0.69777], + "916": [0, 0.68611, 0, 0, 0.94444], + "920": [0, 0.68611, 0.09062, 0, 0.88555], + "923": [0, 0.68611, 0, 0, 0.80666], + "926": [0, 0.68611, 0.15092, 0, 0.76777], + "928": [0, 0.68611, 0.17208, 0, 0.8961], + "931": [0, 0.68611, 0.11431, 0, 0.82666], + "933": [0, 0.68611, 0.10778, 0, 0.88555], + "934": [0, 0.68611, 0.05632, 0, 0.82666], + "936": [0, 0.68611, 0.10778, 0, 0.88555], + "937": [0, 0.68611, 0.0992, 0, 0.82666], + "8211": [0, 0.44444, 0.09811, 0, 0.59111], + "8212": [0, 0.44444, 0.09811, 0, 1.18221], + "8216": [0, 0.69444, 0.12945, 0, 0.35555], + "8217": [0, 0.69444, 0.12945, 0, 0.35555], + "8220": [0, 0.69444, 0.16772, 0, 0.62055], + "8221": [0, 0.69444, 0.07939, 0, 0.62055] + }, + "Main-Italic": { + "33": [0, 0.69444, 0.12417, 0, 0.30667], + "34": [0, 0.69444, 0.06961, 0, 0.51444], + "35": [0.19444, 0.69444, 0.06616, 0, 0.81777], + "37": [0.05556, 0.75, 0.13639, 0, 0.81777], + "38": [0, 0.69444, 0.09694, 0, 0.76666], + "39": [0, 0.69444, 0.12417, 0, 0.30667], + "40": [0.25, 0.75, 0.16194, 0, 0.40889], + "41": [0.25, 0.75, 0.03694, 0, 0.40889], + "42": [0, 0.75, 0.14917, 0, 0.51111], + "43": [0.05667, 0.56167, 0.03694, 0, 0.76666], + "44": [0.19444, 0.10556, 0, 0, 0.30667], + "45": [0, 0.43056, 0.02826, 0, 0.35778], + "46": [0, 0.10556, 0, 0, 0.30667], + "47": [0.25, 0.75, 0.16194, 0, 0.51111], + "48": [0, 0.64444, 0.13556, 0, 0.51111], + "49": [0, 0.64444, 0.13556, 0, 0.51111], + "50": [0, 0.64444, 0.13556, 0, 0.51111], + "51": [0, 0.64444, 0.13556, 0, 0.51111], + "52": [0.19444, 0.64444, 0.13556, 0, 0.51111], + "53": [0, 0.64444, 0.13556, 0, 0.51111], + "54": [0, 0.64444, 0.13556, 0, 0.51111], + "55": [0.19444, 0.64444, 0.13556, 0, 0.51111], + "56": [0, 0.64444, 0.13556, 0, 0.51111], + "57": [0, 0.64444, 0.13556, 0, 0.51111], + "58": [0, 0.43056, 0.0582, 0, 0.30667], + "59": [0.19444, 0.43056, 0.0582, 0, 0.30667], + "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666], + "63": [0, 0.69444, 0.1225, 0, 0.51111], + "64": [0, 0.69444, 0.09597, 0, 0.76666], + "65": [0, 0.68333, 0, 0, 0.74333], + "66": [0, 0.68333, 0.10257, 0, 0.70389], + "67": [0, 0.68333, 0.14528, 0, 0.71555], + "68": [0, 0.68333, 0.09403, 0, 0.755], + "69": [0, 0.68333, 0.12028, 0, 0.67833], + "70": [0, 0.68333, 0.13305, 0, 0.65277], + "71": [0, 0.68333, 0.08722, 0, 0.77361], + "72": [0, 0.68333, 0.16389, 0, 0.74333], + "73": [0, 0.68333, 0.15806, 0, 0.38555], + "74": [0, 0.68333, 0.14028, 0, 0.525], + "75": [0, 0.68333, 0.14528, 0, 0.76888], + "76": [0, 0.68333, 0, 0, 0.62722], + "77": [0, 0.68333, 0.16389, 0, 0.89666], + "78": [0, 0.68333, 0.16389, 0, 0.74333], + "79": [0, 0.68333, 0.09403, 0, 0.76666], + "80": [0, 0.68333, 0.10257, 0, 0.67833], + "81": [0.19444, 0.68333, 0.09403, 0, 0.76666], + "82": [0, 0.68333, 0.03868, 0, 0.72944], + "83": [0, 0.68333, 0.11972, 0, 0.56222], + "84": [0, 0.68333, 0.13305, 0, 0.71555], + "85": [0, 0.68333, 0.16389, 0, 0.74333], + "86": [0, 0.68333, 0.18361, 0, 0.74333], + "87": [0, 0.68333, 0.18361, 0, 0.99888], + "88": [0, 0.68333, 0.15806, 0, 0.74333], + "89": [0, 0.68333, 0.19383, 0, 0.74333], + "90": [0, 0.68333, 0.14528, 0, 0.61333], + "91": [0.25, 0.75, 0.1875, 0, 0.30667], + "93": [0.25, 0.75, 0.10528, 0, 0.30667], + "94": [0, 0.69444, 0.06646, 0, 0.51111], + "95": [0.31, 0.12056, 0.09208, 0, 0.51111], + "97": [0, 0.43056, 0.07671, 0, 0.51111], + "98": [0, 0.69444, 0.06312, 0, 0.46], + "99": [0, 0.43056, 0.05653, 0, 0.46], + "100": [0, 0.69444, 0.10333, 0, 0.51111], + "101": [0, 0.43056, 0.07514, 0, 0.46], + "102": [0.19444, 0.69444, 0.21194, 0, 0.30667], + "103": [0.19444, 0.43056, 0.08847, 0, 0.46], + "104": [0, 0.69444, 0.07671, 0, 0.51111], + "105": [0, 0.65536, 0.1019, 0, 0.30667], + "106": [0.19444, 0.65536, 0.14467, 0, 0.30667], + "107": [0, 0.69444, 0.10764, 0, 0.46], + "108": [0, 0.69444, 0.10333, 0, 0.25555], + "109": [0, 0.43056, 0.07671, 0, 0.81777], + "110": [0, 0.43056, 0.07671, 0, 0.56222], + "111": [0, 0.43056, 0.06312, 0, 0.51111], + "112": [0.19444, 0.43056, 0.06312, 0, 0.51111], + "113": [0.19444, 0.43056, 0.08847, 0, 0.46], + "114": [0, 0.43056, 0.10764, 0, 0.42166], + "115": [0, 0.43056, 0.08208, 0, 0.40889], + "116": [0, 0.61508, 0.09486, 0, 0.33222], + "117": [0, 0.43056, 0.07671, 0, 0.53666], + "118": [0, 0.43056, 0.10764, 0, 0.46], + "119": [0, 0.43056, 0.10764, 0, 0.66444], + "120": [0, 0.43056, 0.12042, 0, 0.46389], + "121": [0.19444, 0.43056, 0.08847, 0, 0.48555], + "122": [0, 0.43056, 0.12292, 0, 0.40889], + "126": [0.35, 0.31786, 0.11585, 0, 0.51111], + "163": [0, 0.69444, 0, 0, 0.76909], + "168": [0, 0.66786, 0.10474, 0, 0.51111], + "176": [0, 0.69444, 0, 0, 0.83129], + "184": [0.17014, 0, 0, 0, 0.46], + "198": [0, 0.68333, 0.12028, 0, 0.88277], + "216": [0.04861, 0.73194, 0.09403, 0, 0.76666], + "223": [0.19444, 0.69444, 0.10514, 0, 0.53666], + "230": [0, 0.43056, 0.07514, 0, 0.71555], + "248": [0.09722, 0.52778, 0.09194, 0, 0.51111], + "305": [0, 0.43056, 0, 0.02778, 0.32246], + "338": [0, 0.68333, 0.12028, 0, 0.98499], + "339": [0, 0.43056, 0.07514, 0, 0.71555], + "567": [0.19444, 0.43056, 0, 0.08334, 0.38403], + "710": [0, 0.69444, 0.06646, 0, 0.51111], + "711": [0, 0.62847, 0.08295, 0, 0.51111], + "713": [0, 0.56167, 0.10333, 0, 0.51111], + "714": [0, 0.69444, 0.09694, 0, 0.51111], + "715": [0, 0.69444, 0, 0, 0.51111], + "728": [0, 0.69444, 0.10806, 0, 0.51111], + "729": [0, 0.66786, 0.11752, 0, 0.30667], + "730": [0, 0.69444, 0, 0, 0.83129], + "732": [0, 0.66786, 0.11585, 0, 0.51111], + "733": [0, 0.69444, 0.1225, 0, 0.51111], + "915": [0, 0.68333, 0.13305, 0, 0.62722], + "916": [0, 0.68333, 0, 0, 0.81777], + "920": [0, 0.68333, 0.09403, 0, 0.76666], + "923": [0, 0.68333, 0, 0, 0.69222], + "926": [0, 0.68333, 0.15294, 0, 0.66444], + "928": [0, 0.68333, 0.16389, 0, 0.74333], + "931": [0, 0.68333, 0.12028, 0, 0.71555], + "933": [0, 0.68333, 0.11111, 0, 0.76666], + "934": [0, 0.68333, 0.05986, 0, 0.71555], + "936": [0, 0.68333, 0.11111, 0, 0.76666], + "937": [0, 0.68333, 0.10257, 0, 0.71555], + "8211": [0, 0.43056, 0.09208, 0, 0.51111], + "8212": [0, 0.43056, 0.09208, 0, 1.02222], + "8216": [0, 0.69444, 0.12417, 0, 0.30667], + "8217": [0, 0.69444, 0.12417, 0, 0.30667], + "8220": [0, 0.69444, 0.1685, 0, 0.51444], + "8221": [0, 0.69444, 0.06961, 0, 0.51444], + "8463": [0, 0.68889, 0, 0, 0.54028] + }, + "Main-Regular": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0, 0, 0.27778], + "34": [0, 0.69444, 0, 0, 0.5], + "35": [0.19444, 0.69444, 0, 0, 0.83334], + "36": [0.05556, 0.75, 0, 0, 0.5], + "37": [0.05556, 0.75, 0, 0, 0.83334], + "38": [0, 0.69444, 0, 0, 0.77778], + "39": [0, 0.69444, 0, 0, 0.27778], + "40": [0.25, 0.75, 0, 0, 0.38889], + "41": [0.25, 0.75, 0, 0, 0.38889], + "42": [0, 0.75, 0, 0, 0.5], + "43": [0.08333, 0.58333, 0, 0, 0.77778], + "44": [0.19444, 0.10556, 0, 0, 0.27778], + "45": [0, 0.43056, 0, 0, 0.33333], + "46": [0, 0.10556, 0, 0, 0.27778], + "47": [0.25, 0.75, 0, 0, 0.5], + "48": [0, 0.64444, 0, 0, 0.5], + "49": [0, 0.64444, 0, 0, 0.5], + "50": [0, 0.64444, 0, 0, 0.5], + "51": [0, 0.64444, 0, 0, 0.5], + "52": [0, 0.64444, 0, 0, 0.5], + "53": [0, 0.64444, 0, 0, 0.5], + "54": [0, 0.64444, 0, 0, 0.5], + "55": [0, 0.64444, 0, 0, 0.5], + "56": [0, 0.64444, 0, 0, 0.5], + "57": [0, 0.64444, 0, 0, 0.5], + "58": [0, 0.43056, 0, 0, 0.27778], + "59": [0.19444, 0.43056, 0, 0, 0.27778], + "60": [0.0391, 0.5391, 0, 0, 0.77778], + "61": [-0.13313, 0.36687, 0, 0, 0.77778], + "62": [0.0391, 0.5391, 0, 0, 0.77778], + "63": [0, 0.69444, 0, 0, 0.47222], + "64": [0, 0.69444, 0, 0, 0.77778], + "65": [0, 0.68333, 0, 0, 0.75], + "66": [0, 0.68333, 0, 0, 0.70834], + "67": [0, 0.68333, 0, 0, 0.72222], + "68": [0, 0.68333, 0, 0, 0.76389], + "69": [0, 0.68333, 0, 0, 0.68056], + "70": [0, 0.68333, 0, 0, 0.65278], + "71": [0, 0.68333, 0, 0, 0.78472], + "72": [0, 0.68333, 0, 0, 0.75], + "73": [0, 0.68333, 0, 0, 0.36111], + "74": [0, 0.68333, 0, 0, 0.51389], + "75": [0, 0.68333, 0, 0, 0.77778], + "76": [0, 0.68333, 0, 0, 0.625], + "77": [0, 0.68333, 0, 0, 0.91667], + "78": [0, 0.68333, 0, 0, 0.75], + "79": [0, 0.68333, 0, 0, 0.77778], + "80": [0, 0.68333, 0, 0, 0.68056], + "81": [0.19444, 0.68333, 0, 0, 0.77778], + "82": [0, 0.68333, 0, 0, 0.73611], + "83": [0, 0.68333, 0, 0, 0.55556], + "84": [0, 0.68333, 0, 0, 0.72222], + "85": [0, 0.68333, 0, 0, 0.75], + "86": [0, 0.68333, 0.01389, 0, 0.75], + "87": [0, 0.68333, 0.01389, 0, 1.02778], + "88": [0, 0.68333, 0, 0, 0.75], + "89": [0, 0.68333, 0.025, 0, 0.75], + "90": [0, 0.68333, 0, 0, 0.61111], + "91": [0.25, 0.75, 0, 0, 0.27778], + "92": [0.25, 0.75, 0, 0, 0.5], + "93": [0.25, 0.75, 0, 0, 0.27778], + "94": [0, 0.69444, 0, 0, 0.5], + "95": [0.31, 0.12056, 0.02778, 0, 0.5], + "97": [0, 0.43056, 0, 0, 0.5], + "98": [0, 0.69444, 0, 0, 0.55556], + "99": [0, 0.43056, 0, 0, 0.44445], + "100": [0, 0.69444, 0, 0, 0.55556], + "101": [0, 0.43056, 0, 0, 0.44445], + "102": [0, 0.69444, 0.07778, 0, 0.30556], + "103": [0.19444, 0.43056, 0.01389, 0, 0.5], + "104": [0, 0.69444, 0, 0, 0.55556], + "105": [0, 0.66786, 0, 0, 0.27778], + "106": [0.19444, 0.66786, 0, 0, 0.30556], + "107": [0, 0.69444, 0, 0, 0.52778], + "108": [0, 0.69444, 0, 0, 0.27778], + "109": [0, 0.43056, 0, 0, 0.83334], + "110": [0, 0.43056, 0, 0, 0.55556], + "111": [0, 0.43056, 0, 0, 0.5], + "112": [0.19444, 0.43056, 0, 0, 0.55556], + "113": [0.19444, 0.43056, 0, 0, 0.52778], + "114": [0, 0.43056, 0, 0, 0.39167], + "115": [0, 0.43056, 0, 0, 0.39445], + "116": [0, 0.61508, 0, 0, 0.38889], + "117": [0, 0.43056, 0, 0, 0.55556], + "118": [0, 0.43056, 0.01389, 0, 0.52778], + "119": [0, 0.43056, 0.01389, 0, 0.72222], + "120": [0, 0.43056, 0, 0, 0.52778], + "121": [0.19444, 0.43056, 0.01389, 0, 0.52778], + "122": [0, 0.43056, 0, 0, 0.44445], + "123": [0.25, 0.75, 0, 0, 0.5], + "124": [0.25, 0.75, 0, 0, 0.27778], + "125": [0.25, 0.75, 0, 0, 0.5], + "126": [0.35, 0.31786, 0, 0, 0.5], + "160": [0, 0, 0, 0, 0.25], + "167": [0.19444, 0.69444, 0, 0, 0.44445], + "168": [0, 0.66786, 0, 0, 0.5], + "172": [0, 0.43056, 0, 0, 0.66667], + "176": [0, 0.69444, 0, 0, 0.75], + "177": [0.08333, 0.58333, 0, 0, 0.77778], + "182": [0.19444, 0.69444, 0, 0, 0.61111], + "184": [0.17014, 0, 0, 0, 0.44445], + "198": [0, 0.68333, 0, 0, 0.90278], + "215": [0.08333, 0.58333, 0, 0, 0.77778], + "216": [0.04861, 0.73194, 0, 0, 0.77778], + "223": [0, 0.69444, 0, 0, 0.5], + "230": [0, 0.43056, 0, 0, 0.72222], + "247": [0.08333, 0.58333, 0, 0, 0.77778], + "248": [0.09722, 0.52778, 0, 0, 0.5], + "305": [0, 0.43056, 0, 0, 0.27778], + "338": [0, 0.68333, 0, 0, 1.01389], + "339": [0, 0.43056, 0, 0, 0.77778], + "567": [0.19444, 0.43056, 0, 0, 0.30556], + "710": [0, 0.69444, 0, 0, 0.5], + "711": [0, 0.62847, 0, 0, 0.5], + "713": [0, 0.56778, 0, 0, 0.5], + "714": [0, 0.69444, 0, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0, 0, 0.5], + "729": [0, 0.66786, 0, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.75], + "732": [0, 0.66786, 0, 0, 0.5], + "733": [0, 0.69444, 0, 0, 0.5], + "824": [0.19444, 0.69444, 0, 0, 0], + "915": [0, 0.68333, 0, 0, 0.625], + "916": [0, 0.68333, 0, 0, 0.83334], + "920": [0, 0.68333, 0, 0, 0.77778], + "923": [0, 0.68333, 0, 0, 0.69445], + "926": [0, 0.68333, 0, 0, 0.66667], + "928": [0, 0.68333, 0, 0, 0.75], + "931": [0, 0.68333, 0, 0, 0.72222], + "933": [0, 0.68333, 0, 0, 0.77778], + "934": [0, 0.68333, 0, 0, 0.72222], + "936": [0, 0.68333, 0, 0, 0.77778], + "937": [0, 0.68333, 0, 0, 0.72222], + "8211": [0, 0.43056, 0.02778, 0, 0.5], + "8212": [0, 0.43056, 0.02778, 0, 1.0], + "8216": [0, 0.69444, 0, 0, 0.27778], + "8217": [0, 0.69444, 0, 0, 0.27778], + "8220": [0, 0.69444, 0, 0, 0.5], + "8221": [0, 0.69444, 0, 0, 0.5], + "8224": [0.19444, 0.69444, 0, 0, 0.44445], + "8225": [0.19444, 0.69444, 0, 0, 0.44445], + "8230": [0, 0.12, 0, 0, 1.172], + "8242": [0, 0.55556, 0, 0, 0.275], + "8407": [0, 0.71444, 0.15382, 0, 0.5], + "8463": [0, 0.68889, 0, 0, 0.54028], + "8465": [0, 0.69444, 0, 0, 0.72222], + "8467": [0, 0.69444, 0, 0.11111, 0.41667], + "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646], + "8476": [0, 0.69444, 0, 0, 0.72222], + "8501": [0, 0.69444, 0, 0, 0.61111], + "8592": [-0.13313, 0.36687, 0, 0, 1.0], + "8593": [0.19444, 0.69444, 0, 0, 0.5], + "8594": [-0.13313, 0.36687, 0, 0, 1.0], + "8595": [0.19444, 0.69444, 0, 0, 0.5], + "8596": [-0.13313, 0.36687, 0, 0, 1.0], + "8597": [0.25, 0.75, 0, 0, 0.5], + "8598": [0.19444, 0.69444, 0, 0, 1.0], + "8599": [0.19444, 0.69444, 0, 0, 1.0], + "8600": [0.19444, 0.69444, 0, 0, 1.0], + "8601": [0.19444, 0.69444, 0, 0, 1.0], + "8614": [0.011, 0.511, 0, 0, 1.0], + "8617": [0.011, 0.511, 0, 0, 1.126], + "8618": [0.011, 0.511, 0, 0, 1.126], + "8636": [-0.13313, 0.36687, 0, 0, 1.0], + "8637": [-0.13313, 0.36687, 0, 0, 1.0], + "8640": [-0.13313, 0.36687, 0, 0, 1.0], + "8641": [-0.13313, 0.36687, 0, 0, 1.0], + "8652": [0.011, 0.671, 0, 0, 1.0], + "8656": [-0.13313, 0.36687, 0, 0, 1.0], + "8657": [0.19444, 0.69444, 0, 0, 0.61111], + "8658": [-0.13313, 0.36687, 0, 0, 1.0], + "8659": [0.19444, 0.69444, 0, 0, 0.61111], + "8660": [-0.13313, 0.36687, 0, 0, 1.0], + "8661": [0.25, 0.75, 0, 0, 0.61111], + "8704": [0, 0.69444, 0, 0, 0.55556], + "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309], + "8707": [0, 0.69444, 0, 0, 0.55556], + "8709": [0.05556, 0.75, 0, 0, 0.5], + "8711": [0, 0.68333, 0, 0, 0.83334], + "8712": [0.0391, 0.5391, 0, 0, 0.66667], + "8715": [0.0391, 0.5391, 0, 0, 0.66667], + "8722": [0.08333, 0.58333, 0, 0, 0.77778], + "8723": [0.08333, 0.58333, 0, 0, 0.77778], + "8725": [0.25, 0.75, 0, 0, 0.5], + "8726": [0.25, 0.75, 0, 0, 0.5], + "8727": [-0.03472, 0.46528, 0, 0, 0.5], + "8728": [-0.05555, 0.44445, 0, 0, 0.5], + "8729": [-0.05555, 0.44445, 0, 0, 0.5], + "8730": [0.2, 0.8, 0, 0, 0.83334], + "8733": [0, 0.43056, 0, 0, 0.77778], + "8734": [0, 0.43056, 0, 0, 1.0], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8739": [0.25, 0.75, 0, 0, 0.27778], + "8741": [0.25, 0.75, 0, 0, 0.5], + "8743": [0, 0.55556, 0, 0, 0.66667], + "8744": [0, 0.55556, 0, 0, 0.66667], + "8745": [0, 0.55556, 0, 0, 0.66667], + "8746": [0, 0.55556, 0, 0, 0.66667], + "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667], + "8764": [-0.13313, 0.36687, 0, 0, 0.77778], + "8768": [0.19444, 0.69444, 0, 0, 0.27778], + "8771": [-0.03625, 0.46375, 0, 0, 0.77778], + "8773": [-0.022, 0.589, 0, 0, 1.0], + "8776": [-0.01688, 0.48312, 0, 0, 0.77778], + "8781": [-0.03625, 0.46375, 0, 0, 0.77778], + "8784": [-0.133, 0.67, 0, 0, 0.778], + "8800": [0.215, 0.716, 0, 0, 0.778], + "8801": [-0.03625, 0.46375, 0, 0, 0.77778], + "8804": [0.13597, 0.63597, 0, 0, 0.77778], + "8805": [0.13597, 0.63597, 0, 0, 0.77778], + "8810": [0.0391, 0.5391, 0, 0, 1.0], + "8811": [0.0391, 0.5391, 0, 0, 1.0], + "8826": [0.0391, 0.5391, 0, 0, 0.77778], + "8827": [0.0391, 0.5391, 0, 0, 0.77778], + "8834": [0.0391, 0.5391, 0, 0, 0.77778], + "8835": [0.0391, 0.5391, 0, 0, 0.77778], + "8838": [0.13597, 0.63597, 0, 0, 0.77778], + "8839": [0.13597, 0.63597, 0, 0, 0.77778], + "8846": [0, 0.55556, 0, 0, 0.66667], + "8849": [0.13597, 0.63597, 0, 0, 0.77778], + "8850": [0.13597, 0.63597, 0, 0, 0.77778], + "8851": [0, 0.55556, 0, 0, 0.66667], + "8852": [0, 0.55556, 0, 0, 0.66667], + "8853": [0.08333, 0.58333, 0, 0, 0.77778], + "8854": [0.08333, 0.58333, 0, 0, 0.77778], + "8855": [0.08333, 0.58333, 0, 0, 0.77778], + "8856": [0.08333, 0.58333, 0, 0, 0.77778], + "8857": [0.08333, 0.58333, 0, 0, 0.77778], + "8866": [0, 0.69444, 0, 0, 0.61111], + "8867": [0, 0.69444, 0, 0, 0.61111], + "8868": [0, 0.69444, 0, 0, 0.77778], + "8869": [0, 0.69444, 0, 0, 0.77778], + "8872": [0.249, 0.75, 0, 0, 0.867], + "8900": [-0.05555, 0.44445, 0, 0, 0.5], + "8901": [-0.05555, 0.44445, 0, 0, 0.27778], + "8902": [-0.03472, 0.46528, 0, 0, 0.5], + "8904": [0.005, 0.505, 0, 0, 0.9], + "8942": [0.03, 0.9, 0, 0, 0.278], + "8943": [-0.19, 0.31, 0, 0, 1.172], + "8945": [-0.1, 0.82, 0, 0, 1.282], + "8968": [0.25, 0.75, 0, 0, 0.44445], + "8969": [0.25, 0.75, 0, 0, 0.44445], + "8970": [0.25, 0.75, 0, 0, 0.44445], + "8971": [0.25, 0.75, 0, 0, 0.44445], + "8994": [-0.14236, 0.35764, 0, 0, 1.0], + "8995": [-0.14236, 0.35764, 0, 0, 1.0], + "9136": [0.244, 0.744, 0, 0, 0.412], + "9137": [0.244, 0.744, 0, 0, 0.412], + "9651": [0.19444, 0.69444, 0, 0, 0.88889], + "9657": [-0.03472, 0.46528, 0, 0, 0.5], + "9661": [0.19444, 0.69444, 0, 0, 0.88889], + "9667": [-0.03472, 0.46528, 0, 0, 0.5], + "9711": [0.19444, 0.69444, 0, 0, 1.0], + "9824": [0.12963, 0.69444, 0, 0, 0.77778], + "9825": [0.12963, 0.69444, 0, 0, 0.77778], + "9826": [0.12963, 0.69444, 0, 0, 0.77778], + "9827": [0.12963, 0.69444, 0, 0, 0.77778], + "9837": [0, 0.75, 0, 0, 0.38889], + "9838": [0.19444, 0.69444, 0, 0, 0.38889], + "9839": [0.19444, 0.69444, 0, 0, 0.38889], + "10216": [0.25, 0.75, 0, 0, 0.38889], + "10217": [0.25, 0.75, 0, 0, 0.38889], + "10222": [0.244, 0.744, 0, 0, 0.412], + "10223": [0.244, 0.744, 0, 0, 0.412], + "10229": [0.011, 0.511, 0, 0, 1.609], + "10230": [0.011, 0.511, 0, 0, 1.638], + "10231": [0.011, 0.511, 0, 0, 1.859], + "10232": [0.024, 0.525, 0, 0, 1.609], + "10233": [0.024, 0.525, 0, 0, 1.638], + "10234": [0.024, 0.525, 0, 0, 1.858], + "10236": [0.011, 0.511, 0, 0, 1.638], + "10815": [0, 0.68333, 0, 0, 0.75], + "10927": [0.13597, 0.63597, 0, 0, 0.77778], + "10928": [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Math-BoldItalic": { + "47": [0.19444, 0.69444, 0, 0, 0], + "65": [0, 0.68611, 0, 0, 0.86944], + "66": [0, 0.68611, 0.04835, 0, 0.8664], + "67": [0, 0.68611, 0.06979, 0, 0.81694], + "68": [0, 0.68611, 0.03194, 0, 0.93812], + "69": [0, 0.68611, 0.05451, 0, 0.81007], + "70": [0, 0.68611, 0.15972, 0, 0.68889], + "71": [0, 0.68611, 0, 0, 0.88673], + "72": [0, 0.68611, 0.08229, 0, 0.98229], + "73": [0, 0.68611, 0.07778, 0, 0.51111], + "74": [0, 0.68611, 0.10069, 0, 0.63125], + "75": [0, 0.68611, 0.06979, 0, 0.97118], + "76": [0, 0.68611, 0, 0, 0.75555], + "77": [0, 0.68611, 0.11424, 0, 1.14201], + "78": [0, 0.68611, 0.11424, 0, 0.95034], + "79": [0, 0.68611, 0.03194, 0, 0.83666], + "80": [0, 0.68611, 0.15972, 0, 0.72309], + "81": [0.19444, 0.68611, 0, 0, 0.86861], + "82": [0, 0.68611, 0.00421, 0, 0.87235], + "83": [0, 0.68611, 0.05382, 0, 0.69271], + "84": [0, 0.68611, 0.15972, 0, 0.63663], + "85": [0, 0.68611, 0.11424, 0, 0.80027], + "86": [0, 0.68611, 0.25555, 0, 0.67778], + "87": [0, 0.68611, 0.15972, 0, 1.09305], + "88": [0, 0.68611, 0.07778, 0, 0.94722], + "89": [0, 0.68611, 0.25555, 0, 0.67458], + "90": [0, 0.68611, 0.06979, 0, 0.77257], + "97": [0, 0.44444, 0, 0, 0.63287], + "98": [0, 0.69444, 0, 0, 0.52083], + "99": [0, 0.44444, 0, 0, 0.51342], + "100": [0, 0.69444, 0, 0, 0.60972], + "101": [0, 0.44444, 0, 0, 0.55361], + "102": [0.19444, 0.69444, 0.11042, 0, 0.56806], + "103": [0.19444, 0.44444, 0.03704, 0, 0.5449], + "104": [0, 0.69444, 0, 0, 0.66759], + "105": [0, 0.69326, 0, 0, 0.4048], + "106": [0.19444, 0.69326, 0.0622, 0, 0.47083], + "107": [0, 0.69444, 0.01852, 0, 0.6037], + "108": [0, 0.69444, 0.0088, 0, 0.34815], + "109": [0, 0.44444, 0, 0, 1.0324], + "110": [0, 0.44444, 0, 0, 0.71296], + "111": [0, 0.44444, 0, 0, 0.58472], + "112": [0.19444, 0.44444, 0, 0, 0.60092], + "113": [0.19444, 0.44444, 0.03704, 0, 0.54213], + "114": [0, 0.44444, 0.03194, 0, 0.5287], + "115": [0, 0.44444, 0, 0, 0.53125], + "116": [0, 0.63492, 0, 0, 0.41528], + "117": [0, 0.44444, 0, 0, 0.68102], + "118": [0, 0.44444, 0.03704, 0, 0.56666], + "119": [0, 0.44444, 0.02778, 0, 0.83148], + "120": [0, 0.44444, 0, 0, 0.65903], + "121": [0.19444, 0.44444, 0.03704, 0, 0.59028], + "122": [0, 0.44444, 0.04213, 0, 0.55509], + "915": [0, 0.68611, 0.15972, 0, 0.65694], + "916": [0, 0.68611, 0, 0, 0.95833], + "920": [0, 0.68611, 0.03194, 0, 0.86722], + "923": [0, 0.68611, 0, 0, 0.80555], + "926": [0, 0.68611, 0.07458, 0, 0.84125], + "928": [0, 0.68611, 0.08229, 0, 0.98229], + "931": [0, 0.68611, 0.05451, 0, 0.88507], + "933": [0, 0.68611, 0.15972, 0, 0.67083], + "934": [0, 0.68611, 0, 0, 0.76666], + "936": [0, 0.68611, 0.11653, 0, 0.71402], + "937": [0, 0.68611, 0.04835, 0, 0.8789], + "945": [0, 0.44444, 0, 0, 0.76064], + "946": [0.19444, 0.69444, 0.03403, 0, 0.65972], + "947": [0.19444, 0.44444, 0.06389, 0, 0.59003], + "948": [0, 0.69444, 0.03819, 0, 0.52222], + "949": [0, 0.44444, 0, 0, 0.52882], + "950": [0.19444, 0.69444, 0.06215, 0, 0.50833], + "951": [0.19444, 0.44444, 0.03704, 0, 0.6], + "952": [0, 0.69444, 0.03194, 0, 0.5618], + "953": [0, 0.44444, 0, 0, 0.41204], + "954": [0, 0.44444, 0, 0, 0.66759], + "955": [0, 0.69444, 0, 0, 0.67083], + "956": [0.19444, 0.44444, 0, 0, 0.70787], + "957": [0, 0.44444, 0.06898, 0, 0.57685], + "958": [0.19444, 0.69444, 0.03021, 0, 0.50833], + "959": [0, 0.44444, 0, 0, 0.58472], + "960": [0, 0.44444, 0.03704, 0, 0.68241], + "961": [0.19444, 0.44444, 0, 0, 0.6118], + "962": [0.09722, 0.44444, 0.07917, 0, 0.42361], + "963": [0, 0.44444, 0.03704, 0, 0.68588], + "964": [0, 0.44444, 0.13472, 0, 0.52083], + "965": [0, 0.44444, 0.03704, 0, 0.63055], + "966": [0.19444, 0.44444, 0, 0, 0.74722], + "967": [0.19444, 0.44444, 0, 0, 0.71805], + "968": [0.19444, 0.69444, 0.03704, 0, 0.75833], + "969": [0, 0.44444, 0.03704, 0, 0.71782], + "977": [0, 0.69444, 0, 0, 0.69155], + "981": [0.19444, 0.69444, 0, 0, 0.7125], + "982": [0, 0.44444, 0.03194, 0, 0.975], + "1009": [0.19444, 0.44444, 0, 0, 0.6118], + "1013": [0, 0.44444, 0, 0, 0.48333] + }, + "Math-Italic": { + "47": [0.19444, 0.69444, 0, 0, 0], + "65": [0, 0.68333, 0, 0.13889, 0.75], + "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], + "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], + "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], + "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], + "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], + "71": [0, 0.68333, 0, 0.08334, 0.78625], + "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], + "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], + "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], + "76": [0, 0.68333, 0, 0.02778, 0.68056], + "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], + "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], + "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], + "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], + "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], + "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], + "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], + "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], + "86": [0, 0.68333, 0.22222, 0, 0.58333], + "87": [0, 0.68333, 0.13889, 0, 0.94445], + "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], + "89": [0, 0.68333, 0.22222, 0, 0.58056], + "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], + "97": [0, 0.43056, 0, 0, 0.52859], + "98": [0, 0.69444, 0, 0, 0.42917], + "99": [0, 0.43056, 0, 0.05556, 0.43276], + "100": [0, 0.69444, 0, 0.16667, 0.52049], + "101": [0, 0.43056, 0, 0.05556, 0.46563], + "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + "104": [0, 0.69444, 0, 0, 0.57616], + "105": [0, 0.65952, 0, 0, 0.34451], + "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], + "107": [0, 0.69444, 0.03148, 0, 0.5206], + "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], + "109": [0, 0.43056, 0, 0, 0.87801], + "110": [0, 0.43056, 0, 0, 0.60023], + "111": [0, 0.43056, 0, 0.05556, 0.48472], + "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], + "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], + "115": [0, 0.43056, 0, 0.05556, 0.46875], + "116": [0, 0.61508, 0, 0.08334, 0.36111], + "117": [0, 0.43056, 0, 0.02778, 0.57246], + "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], + "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], + "120": [0, 0.43056, 0, 0.02778, 0.57153], + "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], + "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], + "916": [0, 0.68333, 0, 0.16667, 0.83334], + "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "923": [0, 0.68333, 0, 0.16667, 0.69445], + "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], + "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], + "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], + "934": [0, 0.68333, 0, 0.08334, 0.66667], + "936": [0, 0.68333, 0.11, 0.05556, 0.61222], + "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], + "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], + "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], + "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], + "949": [0, 0.43056, 0, 0.08334, 0.46632], + "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], + "953": [0, 0.43056, 0, 0.05556, 0.35394], + "954": [0, 0.43056, 0, 0, 0.57616], + "955": [0, 0.69444, 0, 0, 0.58334], + "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], + "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], + "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + "959": [0, 0.43056, 0, 0.05556, 0.48472], + "960": [0, 0.43056, 0.03588, 0, 0.57003], + "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + "963": [0, 0.43056, 0.03588, 0, 0.57141], + "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], + "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], + "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], + "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], + "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + "969": [0, 0.43056, 0.03588, 0, 0.62245], + "977": [0, 0.69444, 0, 0.08334, 0.59144], + "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], + "982": [0, 0.43056, 0.02778, 0, 0.82813], + "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "1013": [0, 0.43056, 0, 0.05556, 0.4059] + }, + "Math-Regular": { + "65": [0, 0.68333, 0, 0.13889, 0.75], + "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], + "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], + "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], + "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], + "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], + "71": [0, 0.68333, 0, 0.08334, 0.78625], + "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], + "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], + "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], + "76": [0, 0.68333, 0, 0.02778, 0.68056], + "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], + "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], + "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], + "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], + "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], + "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], + "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], + "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], + "86": [0, 0.68333, 0.22222, 0, 0.58333], + "87": [0, 0.68333, 0.13889, 0, 0.94445], + "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], + "89": [0, 0.68333, 0.22222, 0, 0.58056], + "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], + "97": [0, 0.43056, 0, 0, 0.52859], + "98": [0, 0.69444, 0, 0, 0.42917], + "99": [0, 0.43056, 0, 0.05556, 0.43276], + "100": [0, 0.69444, 0, 0.16667, 0.52049], + "101": [0, 0.43056, 0, 0.05556, 0.46563], + "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + "104": [0, 0.69444, 0, 0, 0.57616], + "105": [0, 0.65952, 0, 0, 0.34451], + "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], + "107": [0, 0.69444, 0.03148, 0, 0.5206], + "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], + "109": [0, 0.43056, 0, 0, 0.87801], + "110": [0, 0.43056, 0, 0, 0.60023], + "111": [0, 0.43056, 0, 0.05556, 0.48472], + "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], + "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], + "115": [0, 0.43056, 0, 0.05556, 0.46875], + "116": [0, 0.61508, 0, 0.08334, 0.36111], + "117": [0, 0.43056, 0, 0.02778, 0.57246], + "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], + "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], + "120": [0, 0.43056, 0, 0.02778, 0.57153], + "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], + "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], + "916": [0, 0.68333, 0, 0.16667, 0.83334], + "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "923": [0, 0.68333, 0, 0.16667, 0.69445], + "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], + "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], + "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], + "934": [0, 0.68333, 0, 0.08334, 0.66667], + "936": [0, 0.68333, 0.11, 0.05556, 0.61222], + "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], + "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], + "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], + "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], + "949": [0, 0.43056, 0, 0.08334, 0.46632], + "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], + "953": [0, 0.43056, 0, 0.05556, 0.35394], + "954": [0, 0.43056, 0, 0, 0.57616], + "955": [0, 0.69444, 0, 0, 0.58334], + "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], + "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], + "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + "959": [0, 0.43056, 0, 0.05556, 0.48472], + "960": [0, 0.43056, 0.03588, 0, 0.57003], + "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + "963": [0, 0.43056, 0.03588, 0, 0.57141], + "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], + "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], + "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], + "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], + "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + "969": [0, 0.43056, 0.03588, 0, 0.62245], + "977": [0, 0.69444, 0, 0.08334, 0.59144], + "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], + "982": [0, 0.43056, 0.02778, 0, 0.82813], + "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "1013": [0, 0.43056, 0, 0.05556, 0.4059] + }, + "SansSerif-Bold": { + "33": [0, 0.69444, 0, 0, 0.36667], + "34": [0, 0.69444, 0, 0, 0.55834], + "35": [0.19444, 0.69444, 0, 0, 0.91667], + "36": [0.05556, 0.75, 0, 0, 0.55], + "37": [0.05556, 0.75, 0, 0, 1.02912], + "38": [0, 0.69444, 0, 0, 0.83056], + "39": [0, 0.69444, 0, 0, 0.30556], + "40": [0.25, 0.75, 0, 0, 0.42778], + "41": [0.25, 0.75, 0, 0, 0.42778], + "42": [0, 0.75, 0, 0, 0.55], + "43": [0.11667, 0.61667, 0, 0, 0.85556], + "44": [0.10556, 0.13056, 0, 0, 0.30556], + "45": [0, 0.45833, 0, 0, 0.36667], + "46": [0, 0.13056, 0, 0, 0.30556], + "47": [0.25, 0.75, 0, 0, 0.55], + "48": [0, 0.69444, 0, 0, 0.55], + "49": [0, 0.69444, 0, 0, 0.55], + "50": [0, 0.69444, 0, 0, 0.55], + "51": [0, 0.69444, 0, 0, 0.55], + "52": [0, 0.69444, 0, 0, 0.55], + "53": [0, 0.69444, 0, 0, 0.55], + "54": [0, 0.69444, 0, 0, 0.55], + "55": [0, 0.69444, 0, 0, 0.55], + "56": [0, 0.69444, 0, 0, 0.55], + "57": [0, 0.69444, 0, 0, 0.55], + "58": [0, 0.45833, 0, 0, 0.30556], + "59": [0.10556, 0.45833, 0, 0, 0.30556], + "61": [-0.09375, 0.40625, 0, 0, 0.85556], + "63": [0, 0.69444, 0, 0, 0.51945], + "64": [0, 0.69444, 0, 0, 0.73334], + "65": [0, 0.69444, 0, 0, 0.73334], + "66": [0, 0.69444, 0, 0, 0.73334], + "67": [0, 0.69444, 0, 0, 0.70278], + "68": [0, 0.69444, 0, 0, 0.79445], + "69": [0, 0.69444, 0, 0, 0.64167], + "70": [0, 0.69444, 0, 0, 0.61111], + "71": [0, 0.69444, 0, 0, 0.73334], + "72": [0, 0.69444, 0, 0, 0.79445], + "73": [0, 0.69444, 0, 0, 0.33056], + "74": [0, 0.69444, 0, 0, 0.51945], + "75": [0, 0.69444, 0, 0, 0.76389], + "76": [0, 0.69444, 0, 0, 0.58056], + "77": [0, 0.69444, 0, 0, 0.97778], + "78": [0, 0.69444, 0, 0, 0.79445], + "79": [0, 0.69444, 0, 0, 0.79445], + "80": [0, 0.69444, 0, 0, 0.70278], + "81": [0.10556, 0.69444, 0, 0, 0.79445], + "82": [0, 0.69444, 0, 0, 0.70278], + "83": [0, 0.69444, 0, 0, 0.61111], + "84": [0, 0.69444, 0, 0, 0.73334], + "85": [0, 0.69444, 0, 0, 0.76389], + "86": [0, 0.69444, 0.01528, 0, 0.73334], + "87": [0, 0.69444, 0.01528, 0, 1.03889], + "88": [0, 0.69444, 0, 0, 0.73334], + "89": [0, 0.69444, 0.0275, 0, 0.73334], + "90": [0, 0.69444, 0, 0, 0.67223], + "91": [0.25, 0.75, 0, 0, 0.34306], + "93": [0.25, 0.75, 0, 0, 0.34306], + "94": [0, 0.69444, 0, 0, 0.55], + "95": [0.35, 0.10833, 0.03056, 0, 0.55], + "97": [0, 0.45833, 0, 0, 0.525], + "98": [0, 0.69444, 0, 0, 0.56111], + "99": [0, 0.45833, 0, 0, 0.48889], + "100": [0, 0.69444, 0, 0, 0.56111], + "101": [0, 0.45833, 0, 0, 0.51111], + "102": [0, 0.69444, 0.07639, 0, 0.33611], + "103": [0.19444, 0.45833, 0.01528, 0, 0.55], + "104": [0, 0.69444, 0, 0, 0.56111], + "105": [0, 0.69444, 0, 0, 0.25556], + "106": [0.19444, 0.69444, 0, 0, 0.28611], + "107": [0, 0.69444, 0, 0, 0.53056], + "108": [0, 0.69444, 0, 0, 0.25556], + "109": [0, 0.45833, 0, 0, 0.86667], + "110": [0, 0.45833, 0, 0, 0.56111], + "111": [0, 0.45833, 0, 0, 0.55], + "112": [0.19444, 0.45833, 0, 0, 0.56111], + "113": [0.19444, 0.45833, 0, 0, 0.56111], + "114": [0, 0.45833, 0.01528, 0, 0.37222], + "115": [0, 0.45833, 0, 0, 0.42167], + "116": [0, 0.58929, 0, 0, 0.40417], + "117": [0, 0.45833, 0, 0, 0.56111], + "118": [0, 0.45833, 0.01528, 0, 0.5], + "119": [0, 0.45833, 0.01528, 0, 0.74445], + "120": [0, 0.45833, 0, 0, 0.5], + "121": [0.19444, 0.45833, 0.01528, 0, 0.5], + "122": [0, 0.45833, 0, 0, 0.47639], + "126": [0.35, 0.34444, 0, 0, 0.55], + "168": [0, 0.69444, 0, 0, 0.55], + "176": [0, 0.69444, 0, 0, 0.73334], + "180": [0, 0.69444, 0, 0, 0.55], + "184": [0.17014, 0, 0, 0, 0.48889], + "305": [0, 0.45833, 0, 0, 0.25556], + "567": [0.19444, 0.45833, 0, 0, 0.28611], + "710": [0, 0.69444, 0, 0, 0.55], + "711": [0, 0.63542, 0, 0, 0.55], + "713": [0, 0.63778, 0, 0, 0.55], + "728": [0, 0.69444, 0, 0, 0.55], + "729": [0, 0.69444, 0, 0, 0.30556], + "730": [0, 0.69444, 0, 0, 0.73334], + "732": [0, 0.69444, 0, 0, 0.55], + "733": [0, 0.69444, 0, 0, 0.55], + "915": [0, 0.69444, 0, 0, 0.58056], + "916": [0, 0.69444, 0, 0, 0.91667], + "920": [0, 0.69444, 0, 0, 0.85556], + "923": [0, 0.69444, 0, 0, 0.67223], + "926": [0, 0.69444, 0, 0, 0.73334], + "928": [0, 0.69444, 0, 0, 0.79445], + "931": [0, 0.69444, 0, 0, 0.79445], + "933": [0, 0.69444, 0, 0, 0.85556], + "934": [0, 0.69444, 0, 0, 0.79445], + "936": [0, 0.69444, 0, 0, 0.85556], + "937": [0, 0.69444, 0, 0, 0.79445], + "8211": [0, 0.45833, 0.03056, 0, 0.55], + "8212": [0, 0.45833, 0.03056, 0, 1.10001], + "8216": [0, 0.69444, 0, 0, 0.30556], + "8217": [0, 0.69444, 0, 0, 0.30556], + "8220": [0, 0.69444, 0, 0, 0.55834], + "8221": [0, 0.69444, 0, 0, 0.55834] + }, + "SansSerif-Italic": { + "33": [0, 0.69444, 0.05733, 0, 0.31945], + "34": [0, 0.69444, 0.00316, 0, 0.5], + "35": [0.19444, 0.69444, 0.05087, 0, 0.83334], + "36": [0.05556, 0.75, 0.11156, 0, 0.5], + "37": [0.05556, 0.75, 0.03126, 0, 0.83334], + "38": [0, 0.69444, 0.03058, 0, 0.75834], + "39": [0, 0.69444, 0.07816, 0, 0.27778], + "40": [0.25, 0.75, 0.13164, 0, 0.38889], + "41": [0.25, 0.75, 0.02536, 0, 0.38889], + "42": [0, 0.75, 0.11775, 0, 0.5], + "43": [0.08333, 0.58333, 0.02536, 0, 0.77778], + "44": [0.125, 0.08333, 0, 0, 0.27778], + "45": [0, 0.44444, 0.01946, 0, 0.33333], + "46": [0, 0.08333, 0, 0, 0.27778], + "47": [0.25, 0.75, 0.13164, 0, 0.5], + "48": [0, 0.65556, 0.11156, 0, 0.5], + "49": [0, 0.65556, 0.11156, 0, 0.5], + "50": [0, 0.65556, 0.11156, 0, 0.5], + "51": [0, 0.65556, 0.11156, 0, 0.5], + "52": [0, 0.65556, 0.11156, 0, 0.5], + "53": [0, 0.65556, 0.11156, 0, 0.5], + "54": [0, 0.65556, 0.11156, 0, 0.5], + "55": [0, 0.65556, 0.11156, 0, 0.5], + "56": [0, 0.65556, 0.11156, 0, 0.5], + "57": [0, 0.65556, 0.11156, 0, 0.5], + "58": [0, 0.44444, 0.02502, 0, 0.27778], + "59": [0.125, 0.44444, 0.02502, 0, 0.27778], + "61": [-0.13, 0.37, 0.05087, 0, 0.77778], + "63": [0, 0.69444, 0.11809, 0, 0.47222], + "64": [0, 0.69444, 0.07555, 0, 0.66667], + "65": [0, 0.69444, 0, 0, 0.66667], + "66": [0, 0.69444, 0.08293, 0, 0.66667], + "67": [0, 0.69444, 0.11983, 0, 0.63889], + "68": [0, 0.69444, 0.07555, 0, 0.72223], + "69": [0, 0.69444, 0.11983, 0, 0.59722], + "70": [0, 0.69444, 0.13372, 0, 0.56945], + "71": [0, 0.69444, 0.11983, 0, 0.66667], + "72": [0, 0.69444, 0.08094, 0, 0.70834], + "73": [0, 0.69444, 0.13372, 0, 0.27778], + "74": [0, 0.69444, 0.08094, 0, 0.47222], + "75": [0, 0.69444, 0.11983, 0, 0.69445], + "76": [0, 0.69444, 0, 0, 0.54167], + "77": [0, 0.69444, 0.08094, 0, 0.875], + "78": [0, 0.69444, 0.08094, 0, 0.70834], + "79": [0, 0.69444, 0.07555, 0, 0.73611], + "80": [0, 0.69444, 0.08293, 0, 0.63889], + "81": [0.125, 0.69444, 0.07555, 0, 0.73611], + "82": [0, 0.69444, 0.08293, 0, 0.64584], + "83": [0, 0.69444, 0.09205, 0, 0.55556], + "84": [0, 0.69444, 0.13372, 0, 0.68056], + "85": [0, 0.69444, 0.08094, 0, 0.6875], + "86": [0, 0.69444, 0.1615, 0, 0.66667], + "87": [0, 0.69444, 0.1615, 0, 0.94445], + "88": [0, 0.69444, 0.13372, 0, 0.66667], + "89": [0, 0.69444, 0.17261, 0, 0.66667], + "90": [0, 0.69444, 0.11983, 0, 0.61111], + "91": [0.25, 0.75, 0.15942, 0, 0.28889], + "93": [0.25, 0.75, 0.08719, 0, 0.28889], + "94": [0, 0.69444, 0.0799, 0, 0.5], + "95": [0.35, 0.09444, 0.08616, 0, 0.5], + "97": [0, 0.44444, 0.00981, 0, 0.48056], + "98": [0, 0.69444, 0.03057, 0, 0.51667], + "99": [0, 0.44444, 0.08336, 0, 0.44445], + "100": [0, 0.69444, 0.09483, 0, 0.51667], + "101": [0, 0.44444, 0.06778, 0, 0.44445], + "102": [0, 0.69444, 0.21705, 0, 0.30556], + "103": [0.19444, 0.44444, 0.10836, 0, 0.5], + "104": [0, 0.69444, 0.01778, 0, 0.51667], + "105": [0, 0.67937, 0.09718, 0, 0.23889], + "106": [0.19444, 0.67937, 0.09162, 0, 0.26667], + "107": [0, 0.69444, 0.08336, 0, 0.48889], + "108": [0, 0.69444, 0.09483, 0, 0.23889], + "109": [0, 0.44444, 0.01778, 0, 0.79445], + "110": [0, 0.44444, 0.01778, 0, 0.51667], + "111": [0, 0.44444, 0.06613, 0, 0.5], + "112": [0.19444, 0.44444, 0.0389, 0, 0.51667], + "113": [0.19444, 0.44444, 0.04169, 0, 0.51667], + "114": [0, 0.44444, 0.10836, 0, 0.34167], + "115": [0, 0.44444, 0.0778, 0, 0.38333], + "116": [0, 0.57143, 0.07225, 0, 0.36111], + "117": [0, 0.44444, 0.04169, 0, 0.51667], + "118": [0, 0.44444, 0.10836, 0, 0.46111], + "119": [0, 0.44444, 0.10836, 0, 0.68334], + "120": [0, 0.44444, 0.09169, 0, 0.46111], + "121": [0.19444, 0.44444, 0.10836, 0, 0.46111], + "122": [0, 0.44444, 0.08752, 0, 0.43472], + "126": [0.35, 0.32659, 0.08826, 0, 0.5], + "168": [0, 0.67937, 0.06385, 0, 0.5], + "176": [0, 0.69444, 0, 0, 0.73752], + "184": [0.17014, 0, 0, 0, 0.44445], + "305": [0, 0.44444, 0.04169, 0, 0.23889], + "567": [0.19444, 0.44444, 0.04169, 0, 0.26667], + "710": [0, 0.69444, 0.0799, 0, 0.5], + "711": [0, 0.63194, 0.08432, 0, 0.5], + "713": [0, 0.60889, 0.08776, 0, 0.5], + "714": [0, 0.69444, 0.09205, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0.09483, 0, 0.5], + "729": [0, 0.67937, 0.07774, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.73752], + "732": [0, 0.67659, 0.08826, 0, 0.5], + "733": [0, 0.69444, 0.09205, 0, 0.5], + "915": [0, 0.69444, 0.13372, 0, 0.54167], + "916": [0, 0.69444, 0, 0, 0.83334], + "920": [0, 0.69444, 0.07555, 0, 0.77778], + "923": [0, 0.69444, 0, 0, 0.61111], + "926": [0, 0.69444, 0.12816, 0, 0.66667], + "928": [0, 0.69444, 0.08094, 0, 0.70834], + "931": [0, 0.69444, 0.11983, 0, 0.72222], + "933": [0, 0.69444, 0.09031, 0, 0.77778], + "934": [0, 0.69444, 0.04603, 0, 0.72222], + "936": [0, 0.69444, 0.09031, 0, 0.77778], + "937": [0, 0.69444, 0.08293, 0, 0.72222], + "8211": [0, 0.44444, 0.08616, 0, 0.5], + "8212": [0, 0.44444, 0.08616, 0, 1.0], + "8216": [0, 0.69444, 0.07816, 0, 0.27778], + "8217": [0, 0.69444, 0.07816, 0, 0.27778], + "8220": [0, 0.69444, 0.14205, 0, 0.5], + "8221": [0, 0.69444, 0.00316, 0, 0.5] + }, + "SansSerif-Regular": { + "33": [0, 0.69444, 0, 0, 0.31945], + "34": [0, 0.69444, 0, 0, 0.5], + "35": [0.19444, 0.69444, 0, 0, 0.83334], + "36": [0.05556, 0.75, 0, 0, 0.5], + "37": [0.05556, 0.75, 0, 0, 0.83334], + "38": [0, 0.69444, 0, 0, 0.75834], + "39": [0, 0.69444, 0, 0, 0.27778], + "40": [0.25, 0.75, 0, 0, 0.38889], + "41": [0.25, 0.75, 0, 0, 0.38889], + "42": [0, 0.75, 0, 0, 0.5], + "43": [0.08333, 0.58333, 0, 0, 0.77778], + "44": [0.125, 0.08333, 0, 0, 0.27778], + "45": [0, 0.44444, 0, 0, 0.33333], + "46": [0, 0.08333, 0, 0, 0.27778], + "47": [0.25, 0.75, 0, 0, 0.5], + "48": [0, 0.65556, 0, 0, 0.5], + "49": [0, 0.65556, 0, 0, 0.5], + "50": [0, 0.65556, 0, 0, 0.5], + "51": [0, 0.65556, 0, 0, 0.5], + "52": [0, 0.65556, 0, 0, 0.5], + "53": [0, 0.65556, 0, 0, 0.5], + "54": [0, 0.65556, 0, 0, 0.5], + "55": [0, 0.65556, 0, 0, 0.5], + "56": [0, 0.65556, 0, 0, 0.5], + "57": [0, 0.65556, 0, 0, 0.5], + "58": [0, 0.44444, 0, 0, 0.27778], + "59": [0.125, 0.44444, 0, 0, 0.27778], + "61": [-0.13, 0.37, 0, 0, 0.77778], + "63": [0, 0.69444, 0, 0, 0.47222], + "64": [0, 0.69444, 0, 0, 0.66667], + "65": [0, 0.69444, 0, 0, 0.66667], + "66": [0, 0.69444, 0, 0, 0.66667], + "67": [0, 0.69444, 0, 0, 0.63889], + "68": [0, 0.69444, 0, 0, 0.72223], + "69": [0, 0.69444, 0, 0, 0.59722], + "70": [0, 0.69444, 0, 0, 0.56945], + "71": [0, 0.69444, 0, 0, 0.66667], + "72": [0, 0.69444, 0, 0, 0.70834], + "73": [0, 0.69444, 0, 0, 0.27778], + "74": [0, 0.69444, 0, 0, 0.47222], + "75": [0, 0.69444, 0, 0, 0.69445], + "76": [0, 0.69444, 0, 0, 0.54167], + "77": [0, 0.69444, 0, 0, 0.875], + "78": [0, 0.69444, 0, 0, 0.70834], + "79": [0, 0.69444, 0, 0, 0.73611], + "80": [0, 0.69444, 0, 0, 0.63889], + "81": [0.125, 0.69444, 0, 0, 0.73611], + "82": [0, 0.69444, 0, 0, 0.64584], + "83": [0, 0.69444, 0, 0, 0.55556], + "84": [0, 0.69444, 0, 0, 0.68056], + "85": [0, 0.69444, 0, 0, 0.6875], + "86": [0, 0.69444, 0.01389, 0, 0.66667], + "87": [0, 0.69444, 0.01389, 0, 0.94445], + "88": [0, 0.69444, 0, 0, 0.66667], + "89": [0, 0.69444, 0.025, 0, 0.66667], + "90": [0, 0.69444, 0, 0, 0.61111], + "91": [0.25, 0.75, 0, 0, 0.28889], + "93": [0.25, 0.75, 0, 0, 0.28889], + "94": [0, 0.69444, 0, 0, 0.5], + "95": [0.35, 0.09444, 0.02778, 0, 0.5], + "97": [0, 0.44444, 0, 0, 0.48056], + "98": [0, 0.69444, 0, 0, 0.51667], + "99": [0, 0.44444, 0, 0, 0.44445], + "100": [0, 0.69444, 0, 0, 0.51667], + "101": [0, 0.44444, 0, 0, 0.44445], + "102": [0, 0.69444, 0.06944, 0, 0.30556], + "103": [0.19444, 0.44444, 0.01389, 0, 0.5], + "104": [0, 0.69444, 0, 0, 0.51667], + "105": [0, 0.67937, 0, 0, 0.23889], + "106": [0.19444, 0.67937, 0, 0, 0.26667], + "107": [0, 0.69444, 0, 0, 0.48889], + "108": [0, 0.69444, 0, 0, 0.23889], + "109": [0, 0.44444, 0, 0, 0.79445], + "110": [0, 0.44444, 0, 0, 0.51667], + "111": [0, 0.44444, 0, 0, 0.5], + "112": [0.19444, 0.44444, 0, 0, 0.51667], + "113": [0.19444, 0.44444, 0, 0, 0.51667], + "114": [0, 0.44444, 0.01389, 0, 0.34167], + "115": [0, 0.44444, 0, 0, 0.38333], + "116": [0, 0.57143, 0, 0, 0.36111], + "117": [0, 0.44444, 0, 0, 0.51667], + "118": [0, 0.44444, 0.01389, 0, 0.46111], + "119": [0, 0.44444, 0.01389, 0, 0.68334], + "120": [0, 0.44444, 0, 0, 0.46111], + "121": [0.19444, 0.44444, 0.01389, 0, 0.46111], + "122": [0, 0.44444, 0, 0, 0.43472], + "126": [0.35, 0.32659, 0, 0, 0.5], + "168": [0, 0.67937, 0, 0, 0.5], + "176": [0, 0.69444, 0, 0, 0.66667], + "184": [0.17014, 0, 0, 0, 0.44445], + "305": [0, 0.44444, 0, 0, 0.23889], + "567": [0.19444, 0.44444, 0, 0, 0.26667], + "710": [0, 0.69444, 0, 0, 0.5], + "711": [0, 0.63194, 0, 0, 0.5], + "713": [0, 0.60889, 0, 0, 0.5], + "714": [0, 0.69444, 0, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0, 0, 0.5], + "729": [0, 0.67937, 0, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.66667], + "732": [0, 0.67659, 0, 0, 0.5], + "733": [0, 0.69444, 0, 0, 0.5], + "915": [0, 0.69444, 0, 0, 0.54167], + "916": [0, 0.69444, 0, 0, 0.83334], + "920": [0, 0.69444, 0, 0, 0.77778], + "923": [0, 0.69444, 0, 0, 0.61111], + "926": [0, 0.69444, 0, 0, 0.66667], + "928": [0, 0.69444, 0, 0, 0.70834], + "931": [0, 0.69444, 0, 0, 0.72222], + "933": [0, 0.69444, 0, 0, 0.77778], + "934": [0, 0.69444, 0, 0, 0.72222], + "936": [0, 0.69444, 0, 0, 0.77778], + "937": [0, 0.69444, 0, 0, 0.72222], + "8211": [0, 0.44444, 0.02778, 0, 0.5], + "8212": [0, 0.44444, 0.02778, 0, 1.0], + "8216": [0, 0.69444, 0, 0, 0.27778], + "8217": [0, 0.69444, 0, 0, 0.27778], + "8220": [0, 0.69444, 0, 0, 0.5], + "8221": [0, 0.69444, 0, 0, 0.5] + }, + "Script-Regular": { + "65": [0, 0.7, 0.22925, 0, 0.80253], + "66": [0, 0.7, 0.04087, 0, 0.90757], + "67": [0, 0.7, 0.1689, 0, 0.66619], + "68": [0, 0.7, 0.09371, 0, 0.77443], + "69": [0, 0.7, 0.18583, 0, 0.56162], + "70": [0, 0.7, 0.13634, 0, 0.89544], + "71": [0, 0.7, 0.17322, 0, 0.60961], + "72": [0, 0.7, 0.29694, 0, 0.96919], + "73": [0, 0.7, 0.19189, 0, 0.80907], + "74": [0.27778, 0.7, 0.19189, 0, 1.05159], + "75": [0, 0.7, 0.31259, 0, 0.91364], + "76": [0, 0.7, 0.19189, 0, 0.87373], + "77": [0, 0.7, 0.15981, 0, 1.08031], + "78": [0, 0.7, 0.3525, 0, 0.9015], + "79": [0, 0.7, 0.08078, 0, 0.73787], + "80": [0, 0.7, 0.08078, 0, 1.01262], + "81": [0, 0.7, 0.03305, 0, 0.88282], + "82": [0, 0.7, 0.06259, 0, 0.85], + "83": [0, 0.7, 0.19189, 0, 0.86767], + "84": [0, 0.7, 0.29087, 0, 0.74697], + "85": [0, 0.7, 0.25815, 0, 0.79996], + "86": [0, 0.7, 0.27523, 0, 0.62204], + "87": [0, 0.7, 0.27523, 0, 0.80532], + "88": [0, 0.7, 0.26006, 0, 0.94445], + "89": [0, 0.7, 0.2939, 0, 0.70961], + "90": [0, 0.7, 0.24037, 0, 0.8212] + }, + "Size1-Regular": { + "40": [0.35001, 0.85, 0, 0, 0.45834], + "41": [0.35001, 0.85, 0, 0, 0.45834], + "47": [0.35001, 0.85, 0, 0, 0.57778], + "91": [0.35001, 0.85, 0, 0, 0.41667], + "92": [0.35001, 0.85, 0, 0, 0.57778], + "93": [0.35001, 0.85, 0, 0, 0.41667], + "123": [0.35001, 0.85, 0, 0, 0.58334], + "125": [0.35001, 0.85, 0, 0, 0.58334], + "710": [0, 0.72222, 0, 0, 0.55556], + "732": [0, 0.72222, 0, 0, 0.55556], + "770": [0, 0.72222, 0, 0, 0.55556], + "771": [0, 0.72222, 0, 0, 0.55556], + "8214": [-0.00099, 0.601, 0, 0, 0.77778], + "8593": [1e-05, 0.6, 0, 0, 0.66667], + "8595": [1e-05, 0.6, 0, 0, 0.66667], + "8657": [1e-05, 0.6, 0, 0, 0.77778], + "8659": [1e-05, 0.6, 0, 0, 0.77778], + "8719": [0.25001, 0.75, 0, 0, 0.94445], + "8720": [0.25001, 0.75, 0, 0, 0.94445], + "8721": [0.25001, 0.75, 0, 0, 1.05556], + "8730": [0.35001, 0.85, 0, 0, 1.0], + "8739": [-0.00599, 0.606, 0, 0, 0.33333], + "8741": [-0.00599, 0.606, 0, 0, 0.55556], + "8747": [0.30612, 0.805, 0.19445, 0, 0.47222], + "8748": [0.306, 0.805, 0.19445, 0, 0.47222], + "8749": [0.306, 0.805, 0.19445, 0, 0.47222], + "8750": [0.30612, 0.805, 0.19445, 0, 0.47222], + "8896": [0.25001, 0.75, 0, 0, 0.83334], + "8897": [0.25001, 0.75, 0, 0, 0.83334], + "8898": [0.25001, 0.75, 0, 0, 0.83334], + "8899": [0.25001, 0.75, 0, 0, 0.83334], + "8968": [0.35001, 0.85, 0, 0, 0.47222], + "8969": [0.35001, 0.85, 0, 0, 0.47222], + "8970": [0.35001, 0.85, 0, 0, 0.47222], + "8971": [0.35001, 0.85, 0, 0, 0.47222], + "9168": [-0.00099, 0.601, 0, 0, 0.66667], + "10216": [0.35001, 0.85, 0, 0, 0.47222], + "10217": [0.35001, 0.85, 0, 0, 0.47222], + "10752": [0.25001, 0.75, 0, 0, 1.11111], + "10753": [0.25001, 0.75, 0, 0, 1.11111], + "10754": [0.25001, 0.75, 0, 0, 1.11111], + "10756": [0.25001, 0.75, 0, 0, 0.83334], + "10758": [0.25001, 0.75, 0, 0, 0.83334] + }, + "Size2-Regular": { + "40": [0.65002, 1.15, 0, 0, 0.59722], + "41": [0.65002, 1.15, 0, 0, 0.59722], + "47": [0.65002, 1.15, 0, 0, 0.81111], + "91": [0.65002, 1.15, 0, 0, 0.47222], + "92": [0.65002, 1.15, 0, 0, 0.81111], + "93": [0.65002, 1.15, 0, 0, 0.47222], + "123": [0.65002, 1.15, 0, 0, 0.66667], + "125": [0.65002, 1.15, 0, 0, 0.66667], + "710": [0, 0.75, 0, 0, 1.0], + "732": [0, 0.75, 0, 0, 1.0], + "770": [0, 0.75, 0, 0, 1.0], + "771": [0, 0.75, 0, 0, 1.0], + "8719": [0.55001, 1.05, 0, 0, 1.27778], + "8720": [0.55001, 1.05, 0, 0, 1.27778], + "8721": [0.55001, 1.05, 0, 0, 1.44445], + "8730": [0.65002, 1.15, 0, 0, 1.0], + "8747": [0.86225, 1.36, 0.44445, 0, 0.55556], + "8748": [0.862, 1.36, 0.44445, 0, 0.55556], + "8749": [0.862, 1.36, 0.44445, 0, 0.55556], + "8750": [0.86225, 1.36, 0.44445, 0, 0.55556], + "8896": [0.55001, 1.05, 0, 0, 1.11111], + "8897": [0.55001, 1.05, 0, 0, 1.11111], + "8898": [0.55001, 1.05, 0, 0, 1.11111], + "8899": [0.55001, 1.05, 0, 0, 1.11111], + "8968": [0.65002, 1.15, 0, 0, 0.52778], + "8969": [0.65002, 1.15, 0, 0, 0.52778], + "8970": [0.65002, 1.15, 0, 0, 0.52778], + "8971": [0.65002, 1.15, 0, 0, 0.52778], + "10216": [0.65002, 1.15, 0, 0, 0.61111], + "10217": [0.65002, 1.15, 0, 0, 0.61111], + "10752": [0.55001, 1.05, 0, 0, 1.51112], + "10753": [0.55001, 1.05, 0, 0, 1.51112], + "10754": [0.55001, 1.05, 0, 0, 1.51112], + "10756": [0.55001, 1.05, 0, 0, 1.11111], + "10758": [0.55001, 1.05, 0, 0, 1.11111] + }, + "Size3-Regular": { + "40": [0.95003, 1.45, 0, 0, 0.73611], + "41": [0.95003, 1.45, 0, 0, 0.73611], + "47": [0.95003, 1.45, 0, 0, 1.04445], + "91": [0.95003, 1.45, 0, 0, 0.52778], + "92": [0.95003, 1.45, 0, 0, 1.04445], + "93": [0.95003, 1.45, 0, 0, 0.52778], + "123": [0.95003, 1.45, 0, 0, 0.75], + "125": [0.95003, 1.45, 0, 0, 0.75], + "710": [0, 0.75, 0, 0, 1.44445], + "732": [0, 0.75, 0, 0, 1.44445], + "770": [0, 0.75, 0, 0, 1.44445], + "771": [0, 0.75, 0, 0, 1.44445], + "8730": [0.95003, 1.45, 0, 0, 1.0], + "8968": [0.95003, 1.45, 0, 0, 0.58334], + "8969": [0.95003, 1.45, 0, 0, 0.58334], + "8970": [0.95003, 1.45, 0, 0, 0.58334], + "8971": [0.95003, 1.45, 0, 0, 0.58334], + "10216": [0.95003, 1.45, 0, 0, 0.75], + "10217": [0.95003, 1.45, 0, 0, 0.75] + }, + "Size4-Regular": { + "40": [1.25003, 1.75, 0, 0, 0.79167], + "41": [1.25003, 1.75, 0, 0, 0.79167], + "47": [1.25003, 1.75, 0, 0, 1.27778], + "91": [1.25003, 1.75, 0, 0, 0.58334], + "92": [1.25003, 1.75, 0, 0, 1.27778], + "93": [1.25003, 1.75, 0, 0, 0.58334], + "123": [1.25003, 1.75, 0, 0, 0.80556], + "125": [1.25003, 1.75, 0, 0, 0.80556], + "710": [0, 0.825, 0, 0, 1.8889], + "732": [0, 0.825, 0, 0, 1.8889], + "770": [0, 0.825, 0, 0, 1.8889], + "771": [0, 0.825, 0, 0, 1.8889], + "8730": [1.25003, 1.75, 0, 0, 1.0], + "8968": [1.25003, 1.75, 0, 0, 0.63889], + "8969": [1.25003, 1.75, 0, 0, 0.63889], + "8970": [1.25003, 1.75, 0, 0, 0.63889], + "8971": [1.25003, 1.75, 0, 0, 0.63889], + "9115": [0.64502, 1.155, 0, 0, 0.875], + "9116": [1e-05, 0.6, 0, 0, 0.875], + "9117": [0.64502, 1.155, 0, 0, 0.875], + "9118": [0.64502, 1.155, 0, 0, 0.875], + "9119": [1e-05, 0.6, 0, 0, 0.875], + "9120": [0.64502, 1.155, 0, 0, 0.875], + "9121": [0.64502, 1.155, 0, 0, 0.66667], + "9122": [-0.00099, 0.601, 0, 0, 0.66667], + "9123": [0.64502, 1.155, 0, 0, 0.66667], + "9124": [0.64502, 1.155, 0, 0, 0.66667], + "9125": [-0.00099, 0.601, 0, 0, 0.66667], + "9126": [0.64502, 1.155, 0, 0, 0.66667], + "9127": [1e-05, 0.9, 0, 0, 0.88889], + "9128": [0.65002, 1.15, 0, 0, 0.88889], + "9129": [0.90001, 0, 0, 0, 0.88889], + "9130": [0, 0.3, 0, 0, 0.88889], + "9131": [1e-05, 0.9, 0, 0, 0.88889], + "9132": [0.65002, 1.15, 0, 0, 0.88889], + "9133": [0.90001, 0, 0, 0, 0.88889], + "9143": [0.88502, 0.915, 0, 0, 1.05556], + "10216": [1.25003, 1.75, 0, 0, 0.80556], + "10217": [1.25003, 1.75, 0, 0, 0.80556], + "57344": [-0.00499, 0.605, 0, 0, 1.05556], + "57345": [-0.00499, 0.605, 0, 0, 1.05556], + "57680": [0, 0.12, 0, 0, 0.45], + "57681": [0, 0.12, 0, 0, 0.45], + "57682": [0, 0.12, 0, 0, 0.45], + "57683": [0, 0.12, 0, 0, 0.45] + }, + "Typewriter-Regular": { + "32": [0, 0, 0, 0, 0.525], + "33": [0, 0.61111, 0, 0, 0.525], + "34": [0, 0.61111, 0, 0, 0.525], + "35": [0, 0.61111, 0, 0, 0.525], + "36": [0.08333, 0.69444, 0, 0, 0.525], + "37": [0.08333, 0.69444, 0, 0, 0.525], + "38": [0, 0.61111, 0, 0, 0.525], + "39": [0, 0.61111, 0, 0, 0.525], + "40": [0.08333, 0.69444, 0, 0, 0.525], + "41": [0.08333, 0.69444, 0, 0, 0.525], + "42": [0, 0.52083, 0, 0, 0.525], + "43": [-0.08056, 0.53055, 0, 0, 0.525], + "44": [0.13889, 0.125, 0, 0, 0.525], + "45": [-0.08056, 0.53055, 0, 0, 0.525], + "46": [0, 0.125, 0, 0, 0.525], + "47": [0.08333, 0.69444, 0, 0, 0.525], + "48": [0, 0.61111, 0, 0, 0.525], + "49": [0, 0.61111, 0, 0, 0.525], + "50": [0, 0.61111, 0, 0, 0.525], + "51": [0, 0.61111, 0, 0, 0.525], + "52": [0, 0.61111, 0, 0, 0.525], + "53": [0, 0.61111, 0, 0, 0.525], + "54": [0, 0.61111, 0, 0, 0.525], + "55": [0, 0.61111, 0, 0, 0.525], + "56": [0, 0.61111, 0, 0, 0.525], + "57": [0, 0.61111, 0, 0, 0.525], + "58": [0, 0.43056, 0, 0, 0.525], + "59": [0.13889, 0.43056, 0, 0, 0.525], + "60": [-0.05556, 0.55556, 0, 0, 0.525], + "61": [-0.19549, 0.41562, 0, 0, 0.525], + "62": [-0.05556, 0.55556, 0, 0, 0.525], + "63": [0, 0.61111, 0, 0, 0.525], + "64": [0, 0.61111, 0, 0, 0.525], + "65": [0, 0.61111, 0, 0, 0.525], + "66": [0, 0.61111, 0, 0, 0.525], + "67": [0, 0.61111, 0, 0, 0.525], + "68": [0, 0.61111, 0, 0, 0.525], + "69": [0, 0.61111, 0, 0, 0.525], + "70": [0, 0.61111, 0, 0, 0.525], + "71": [0, 0.61111, 0, 0, 0.525], + "72": [0, 0.61111, 0, 0, 0.525], + "73": [0, 0.61111, 0, 0, 0.525], + "74": [0, 0.61111, 0, 0, 0.525], + "75": [0, 0.61111, 0, 0, 0.525], + "76": [0, 0.61111, 0, 0, 0.525], + "77": [0, 0.61111, 0, 0, 0.525], + "78": [0, 0.61111, 0, 0, 0.525], + "79": [0, 0.61111, 0, 0, 0.525], + "80": [0, 0.61111, 0, 0, 0.525], + "81": [0.13889, 0.61111, 0, 0, 0.525], + "82": [0, 0.61111, 0, 0, 0.525], + "83": [0, 0.61111, 0, 0, 0.525], + "84": [0, 0.61111, 0, 0, 0.525], + "85": [0, 0.61111, 0, 0, 0.525], + "86": [0, 0.61111, 0, 0, 0.525], + "87": [0, 0.61111, 0, 0, 0.525], + "88": [0, 0.61111, 0, 0, 0.525], + "89": [0, 0.61111, 0, 0, 0.525], + "90": [0, 0.61111, 0, 0, 0.525], + "91": [0.08333, 0.69444, 0, 0, 0.525], + "92": [0.08333, 0.69444, 0, 0, 0.525], + "93": [0.08333, 0.69444, 0, 0, 0.525], + "94": [0, 0.61111, 0, 0, 0.525], + "95": [0.09514, 0, 0, 0, 0.525], + "96": [0, 0.61111, 0, 0, 0.525], + "97": [0, 0.43056, 0, 0, 0.525], + "98": [0, 0.61111, 0, 0, 0.525], + "99": [0, 0.43056, 0, 0, 0.525], + "100": [0, 0.61111, 0, 0, 0.525], + "101": [0, 0.43056, 0, 0, 0.525], + "102": [0, 0.61111, 0, 0, 0.525], + "103": [0.22222, 0.43056, 0, 0, 0.525], + "104": [0, 0.61111, 0, 0, 0.525], + "105": [0, 0.61111, 0, 0, 0.525], + "106": [0.22222, 0.61111, 0, 0, 0.525], + "107": [0, 0.61111, 0, 0, 0.525], + "108": [0, 0.61111, 0, 0, 0.525], + "109": [0, 0.43056, 0, 0, 0.525], + "110": [0, 0.43056, 0, 0, 0.525], + "111": [0, 0.43056, 0, 0, 0.525], + "112": [0.22222, 0.43056, 0, 0, 0.525], + "113": [0.22222, 0.43056, 0, 0, 0.525], + "114": [0, 0.43056, 0, 0, 0.525], + "115": [0, 0.43056, 0, 0, 0.525], + "116": [0, 0.55358, 0, 0, 0.525], + "117": [0, 0.43056, 0, 0, 0.525], + "118": [0, 0.43056, 0, 0, 0.525], + "119": [0, 0.43056, 0, 0, 0.525], + "120": [0, 0.43056, 0, 0, 0.525], + "121": [0.22222, 0.43056, 0, 0, 0.525], + "122": [0, 0.43056, 0, 0, 0.525], + "123": [0.08333, 0.69444, 0, 0, 0.525], + "124": [0.08333, 0.69444, 0, 0, 0.525], + "125": [0.08333, 0.69444, 0, 0, 0.525], + "126": [0, 0.61111, 0, 0, 0.525], + "127": [0, 0.61111, 0, 0, 0.525], + "160": [0, 0, 0, 0, 0.525], + "176": [0, 0.61111, 0, 0, 0.525], + "184": [0.19445, 0, 0, 0, 0.525], + "305": [0, 0.43056, 0, 0, 0.525], + "567": [0.22222, 0.43056, 0, 0, 0.525], + "711": [0, 0.56597, 0, 0, 0.525], + "713": [0, 0.56555, 0, 0, 0.525], + "714": [0, 0.61111, 0, 0, 0.525], + "715": [0, 0.61111, 0, 0, 0.525], + "728": [0, 0.61111, 0, 0, 0.525], + "730": [0, 0.61111, 0, 0, 0.525], + "770": [0, 0.61111, 0, 0, 0.525], + "771": [0, 0.61111, 0, 0, 0.525], + "776": [0, 0.61111, 0, 0, 0.525], + "915": [0, 0.61111, 0, 0, 0.525], + "916": [0, 0.61111, 0, 0, 0.525], + "920": [0, 0.61111, 0, 0, 0.525], + "923": [0, 0.61111, 0, 0, 0.525], + "926": [0, 0.61111, 0, 0, 0.525], + "928": [0, 0.61111, 0, 0, 0.525], + "931": [0, 0.61111, 0, 0, 0.525], + "933": [0, 0.61111, 0, 0, 0.525], + "934": [0, 0.61111, 0, 0, 0.525], + "936": [0, 0.61111, 0, 0, 0.525], + "937": [0, 0.61111, 0, 0, 0.525], + "8216": [0, 0.61111, 0, 0, 0.525], + "8217": [0, 0.61111, 0, 0, 0.525], + "8242": [0, 0.61111, 0, 0, 0.525], + "9251": [0.11111, 0.21944, 0, 0, 0.525] + } +}); +// CONCATENATED MODULE: ./src/fontMetrics.js + + +/** + * This file contains metrics regarding fonts and individual symbols. The sigma + * and xi variables, as well as the metricMap map contain data extracted from + * TeX, TeX font metrics, and the TTF files. These data are then exposed via the + * `metrics` variable and the getCharacterMetrics function. + */ +// In TeX, there are actually three sets of dimensions, one for each of +// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: +// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are +// provided in the the arrays below, in that order. +// +// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. +// This was determined by running the following script: +// +// latex -interaction=nonstopmode \ +// '\documentclass{article}\usepackage{amsmath}\begin{document}' \ +// '$a$ \expandafter\show\the\textfont2' \ +// '\expandafter\show\the\scriptfont2' \ +// '\expandafter\show\the\scriptscriptfont2' \ +// '\stop' +// +// The metrics themselves were retreived using the following commands: +// +// tftopl cmsy10 +// tftopl cmsy7 +// tftopl cmsy5 +// +// The output of each of these commands is quite lengthy. The only part we +// care about is the FONTDIMEN section. Each value is measured in EMs. +var sigmasAndXis = { + slant: [0.250, 0.250, 0.250], + // sigma1 + space: [0.000, 0.000, 0.000], + // sigma2 + stretch: [0.000, 0.000, 0.000], + // sigma3 + shrink: [0.000, 0.000, 0.000], + // sigma4 + xHeight: [0.431, 0.431, 0.431], + // sigma5 + quad: [1.000, 1.171, 1.472], + // sigma6 + extraSpace: [0.000, 0.000, 0.000], + // sigma7 + num1: [0.677, 0.732, 0.925], + // sigma8 + num2: [0.394, 0.384, 0.387], + // sigma9 + num3: [0.444, 0.471, 0.504], + // sigma10 + denom1: [0.686, 0.752, 1.025], + // sigma11 + denom2: [0.345, 0.344, 0.532], + // sigma12 + sup1: [0.413, 0.503, 0.504], + // sigma13 + sup2: [0.363, 0.431, 0.404], + // sigma14 + sup3: [0.289, 0.286, 0.294], + // sigma15 + sub1: [0.150, 0.143, 0.200], + // sigma16 + sub2: [0.247, 0.286, 0.400], + // sigma17 + supDrop: [0.386, 0.353, 0.494], + // sigma18 + subDrop: [0.050, 0.071, 0.100], + // sigma19 + delim1: [2.390, 1.700, 1.980], + // sigma20 + delim2: [1.010, 1.157, 1.420], + // sigma21 + axisHeight: [0.250, 0.250, 0.250], + // sigma22 + // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; + // they correspond to the font parameters of the extension fonts (family 3). + // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to + // match cmex7, we'd use cmex7.tfm values for script and scriptscript + // values. + defaultRuleThickness: [0.04, 0.049, 0.049], + // xi8; cmex7: 0.049 + bigOpSpacing1: [0.111, 0.111, 0.111], + // xi9 + bigOpSpacing2: [0.166, 0.166, 0.166], + // xi10 + bigOpSpacing3: [0.2, 0.2, 0.2], + // xi11 + bigOpSpacing4: [0.6, 0.611, 0.611], + // xi12; cmex7: 0.611 + bigOpSpacing5: [0.1, 0.143, 0.143], + // xi13; cmex7: 0.143 + // The \sqrt rule width is taken from the height of the surd character. + // Since we use the same font at all sizes, this thickness doesn't scale. + sqrtRuleThickness: [0.04, 0.04, 0.04], + // This value determines how large a pt is, for metrics which are defined + // in terms of pts. + // This value is also used in katex.less; if you change it make sure the + // values match. + ptPerEm: [10.0, 10.0, 10.0], + // The space between adjacent `|` columns in an array definition. From + // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. + doubleRuleSep: [0.2, 0.2, 0.2] +}; // This map contains a mapping from font name and character code to character +// metrics, including height, depth, italic correction, and skew (kern from the +// character to the corresponding \skewchar) +// This map is generated via `make metrics`. It should not be changed manually. + + // These are very rough approximations. We default to Times New Roman which +// should have Latin-1 and Cyrillic characters, but may not depending on the +// operating system. The metrics do not account for extra height from the +// accents. In the case of Cyrillic characters which have both ascenders and +// descenders we prefer approximations with ascenders, primarily to prevent +// the fraction bar or root line from intersecting the glyph. +// TODO(kevinb) allow union of multiple glyph metrics for better accuracy. + +var extraCharacterMap = { + // Latin-1 + 'Å': 'A', + 'Ç': 'C', + 'Ð': 'D', + 'Þ': 'o', + 'å': 'a', + 'ç': 'c', + 'ð': 'd', + 'þ': 'o', + // Cyrillic + 'А': 'A', + 'Б': 'B', + 'В': 'B', + 'Г': 'F', + 'Д': 'A', + 'Е': 'E', + 'Ж': 'K', + 'З': '3', + 'И': 'N', + 'Й': 'N', + 'К': 'K', + 'Л': 'N', + 'М': 'M', + 'Н': 'H', + 'О': 'O', + 'П': 'N', + 'Р': 'P', + 'С': 'C', + 'Т': 'T', + 'У': 'y', + 'Ф': 'O', + 'Х': 'X', + 'Ц': 'U', + 'Ч': 'h', + 'Ш': 'W', + 'Щ': 'W', + 'Ъ': 'B', + 'Ы': 'X', + 'Ь': 'B', + 'Э': '3', + 'Ю': 'X', + 'Я': 'R', + 'а': 'a', + 'б': 'b', + 'в': 'a', + 'г': 'r', + 'д': 'y', + 'е': 'e', + 'ж': 'm', + 'з': 'e', + 'и': 'n', + 'й': 'n', + 'к': 'n', + 'л': 'n', + 'м': 'm', + 'н': 'n', + 'о': 'o', + 'п': 'n', + 'р': 'p', + 'с': 'c', + 'т': 'o', + 'у': 'y', + 'ф': 'b', + 'х': 'x', + 'ц': 'n', + 'ч': 'n', + 'ш': 'w', + 'щ': 'w', + 'ъ': 'a', + 'ы': 'm', + 'ь': 'a', + 'э': 'e', + 'ю': 'm', + 'я': 'r' +}; + +/** + * This function adds new font metrics to default metricMap + * It can also override existing metrics + */ +function setFontMetrics(fontName, metrics) { + fontMetricsData[fontName] = metrics; +} +/** + * This function is a convenience function for looking up information in the + * metricMap table. It takes a character as a string, and a font. + * + * Note: the `width` property may be undefined if fontMetricsData.js wasn't + * built using `Make extended_metrics`. + */ + +function getCharacterMetrics(character, font, mode) { + if (!fontMetricsData[font]) { + throw new Error("Font metrics not found for font: " + font + "."); + } + + var ch = character.charCodeAt(0); + + if (character[0] in extraCharacterMap) { + ch = extraCharacterMap[character[0]].charCodeAt(0); + } + + var metrics = fontMetricsData[font][ch]; + + if (!metrics && mode === 'text') { + // We don't typically have font metrics for Asian scripts. + // But since we support them in text mode, we need to return + // some sort of metrics. + // So if the character is in a script we support but we + // don't have metrics for it, just use the metrics for + // the Latin capital letter M. This is close enough because + // we (currently) only care about the height of the glpyh + // not its width. + if (supportedCodepoint(ch)) { + metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M' + } + } + + if (metrics) { + return { + depth: metrics[0], + height: metrics[1], + italic: metrics[2], + skew: metrics[3], + width: metrics[4] + }; + } +} +var fontMetricsBySizeIndex = {}; +/** + * Get the font metrics for a given size. + */ + +function getGlobalMetrics(size) { + var sizeIndex; + + if (size >= 5) { + sizeIndex = 0; + } else if (size >= 3) { + sizeIndex = 1; + } else { + sizeIndex = 2; + } + + if (!fontMetricsBySizeIndex[sizeIndex]) { + var metrics = fontMetricsBySizeIndex[sizeIndex] = { + cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 + }; + + for (var key in sigmasAndXis) { + if (sigmasAndXis.hasOwnProperty(key)) { + metrics[key] = sigmasAndXis[key][sizeIndex]; + } + } + } + + return fontMetricsBySizeIndex[sizeIndex]; +} +// CONCATENATED MODULE: ./src/symbols.js +/** + * This file holds a list of all no-argument functions and single-character + * symbols (like 'a' or ';'). + * + * For each of the symbols, there are three properties they can have: + * - font (required): the font to be used for this symbol. Either "main" (the + normal font), or "ams" (the ams fonts). + * - group (required): the ParseNode group type the symbol should have (i.e. + "textord", "mathord", etc). + See https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types + * - replace: the character that this symbol or function should be + * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi + * character in the main font). + * + * The outermost map in the table indicates what mode the symbols should be + * accepted in (e.g. "math" or "text"). + */ +// Some of these have a "-token" suffix since these are also used as `ParseNode` +// types for raw text tokens, and we want to avoid conflicts with higher-level +// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by +// looking up the `symbols` map. +var ATOMS = { + "bin": 1, + "close": 1, + "inner": 1, + "open": 1, + "punct": 1, + "rel": 1 +}; +var NON_ATOMS = { + "accent-token": 1, + "mathord": 1, + "op-token": 1, + "spacing": 1, + "textord": 1 +}; +var symbols = { + "math": {}, + "text": {} +}; +/* harmony default export */ var src_symbols = (symbols); +/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ + +function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { + symbols[mode][name] = { + font: font, + group: group, + replace: replace + }; + + if (acceptUnicodeChar && replace) { + symbols[mode][replace] = symbols[mode][name]; + } +} // Some abbreviations for commonly used strings. +// This helps minify the code, and also spotting typos using jshint. +// modes: + +var symbols_math = "math"; +var symbols_text = "text"; // fonts: + +var main = "main"; +var ams = "ams"; // groups: + +var symbols_accent = "accent-token"; +var bin = "bin"; +var symbols_close = "close"; +var symbols_inner = "inner"; +var mathord = "mathord"; +var op = "op-token"; +var symbols_open = "open"; +var punct = "punct"; +var rel = "rel"; +var spacing = "spacing"; +var symbols_textord = "textord"; // Now comes the symbol table +// Relation Symbols + +defineSymbol(symbols_math, main, rel, "\u2261", "\\equiv", true); +defineSymbol(symbols_math, main, rel, "\u227A", "\\prec", true); +defineSymbol(symbols_math, main, rel, "\u227B", "\\succ", true); +defineSymbol(symbols_math, main, rel, "\u223C", "\\sim", true); +defineSymbol(symbols_math, main, rel, "\u22A5", "\\perp"); +defineSymbol(symbols_math, main, rel, "\u2AAF", "\\preceq", true); +defineSymbol(symbols_math, main, rel, "\u2AB0", "\\succeq", true); +defineSymbol(symbols_math, main, rel, "\u2243", "\\simeq", true); +defineSymbol(symbols_math, main, rel, "\u2223", "\\mid", true); +defineSymbol(symbols_math, main, rel, "\u226A", "\\ll", true); +defineSymbol(symbols_math, main, rel, "\u226B", "\\gg", true); +defineSymbol(symbols_math, main, rel, "\u224D", "\\asymp", true); +defineSymbol(symbols_math, main, rel, "\u2225", "\\parallel"); +defineSymbol(symbols_math, main, rel, "\u22C8", "\\bowtie", true); +defineSymbol(symbols_math, main, rel, "\u2323", "\\smile", true); +defineSymbol(symbols_math, main, rel, "\u2291", "\\sqsubseteq", true); +defineSymbol(symbols_math, main, rel, "\u2292", "\\sqsupseteq", true); +defineSymbol(symbols_math, main, rel, "\u2250", "\\doteq", true); +defineSymbol(symbols_math, main, rel, "\u2322", "\\frown", true); +defineSymbol(symbols_math, main, rel, "\u220B", "\\ni", true); +defineSymbol(symbols_math, main, rel, "\u221D", "\\propto", true); +defineSymbol(symbols_math, main, rel, "\u22A2", "\\vdash", true); +defineSymbol(symbols_math, main, rel, "\u22A3", "\\dashv", true); +defineSymbol(symbols_math, main, rel, "\u220B", "\\owns"); // Punctuation + +defineSymbol(symbols_math, main, punct, ".", "\\ldotp"); +defineSymbol(symbols_math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols + +defineSymbol(symbols_math, main, symbols_textord, "#", "\\#"); +defineSymbol(symbols_text, main, symbols_textord, "#", "\\#"); +defineSymbol(symbols_math, main, symbols_textord, "&", "\\&"); +defineSymbol(symbols_text, main, symbols_textord, "&", "\\&"); +defineSymbol(symbols_math, main, symbols_textord, "\u2135", "\\aleph", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2200", "\\forall", true); +defineSymbol(symbols_math, main, symbols_textord, "\u210F", "\\hbar", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2203", "\\exists", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2207", "\\nabla", true); +defineSymbol(symbols_math, main, symbols_textord, "\u266D", "\\flat", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2113", "\\ell", true); +defineSymbol(symbols_math, main, symbols_textord, "\u266E", "\\natural", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2663", "\\clubsuit", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2118", "\\wp", true); +defineSymbol(symbols_math, main, symbols_textord, "\u266F", "\\sharp", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2662", "\\diamondsuit", true); +defineSymbol(symbols_math, main, symbols_textord, "\u211C", "\\Re", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2661", "\\heartsuit", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2111", "\\Im", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2660", "\\spadesuit", true); +defineSymbol(symbols_text, main, symbols_textord, "\xA7", "\\S", true); +defineSymbol(symbols_text, main, symbols_textord, "\xB6", "\\P", true); // Math and Text + +defineSymbol(symbols_math, main, symbols_textord, "\u2020", "\\dag"); +defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\dag"); +defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\textdagger"); +defineSymbol(symbols_math, main, symbols_textord, "\u2021", "\\ddag"); +defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\ddag"); +defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters + +defineSymbol(symbols_math, main, symbols_close, "\u23B1", "\\rmoustache", true); +defineSymbol(symbols_math, main, symbols_open, "\u23B0", "\\lmoustache", true); +defineSymbol(symbols_math, main, symbols_close, "\u27EF", "\\rgroup", true); +defineSymbol(symbols_math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators + +defineSymbol(symbols_math, main, bin, "\u2213", "\\mp", true); +defineSymbol(symbols_math, main, bin, "\u2296", "\\ominus", true); +defineSymbol(symbols_math, main, bin, "\u228E", "\\uplus", true); +defineSymbol(symbols_math, main, bin, "\u2293", "\\sqcap", true); +defineSymbol(symbols_math, main, bin, "\u2217", "\\ast"); +defineSymbol(symbols_math, main, bin, "\u2294", "\\sqcup", true); +defineSymbol(symbols_math, main, bin, "\u25EF", "\\bigcirc"); +defineSymbol(symbols_math, main, bin, "\u2219", "\\bullet"); +defineSymbol(symbols_math, main, bin, "\u2021", "\\ddagger"); +defineSymbol(symbols_math, main, bin, "\u2240", "\\wr", true); +defineSymbol(symbols_math, main, bin, "\u2A3F", "\\amalg"); +defineSymbol(symbols_math, main, bin, "&", "\\And"); // from amsmath +// Arrow Symbols + +defineSymbol(symbols_math, main, rel, "\u27F5", "\\longleftarrow", true); +defineSymbol(symbols_math, main, rel, "\u21D0", "\\Leftarrow", true); +defineSymbol(symbols_math, main, rel, "\u27F8", "\\Longleftarrow", true); +defineSymbol(symbols_math, main, rel, "\u27F6", "\\longrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u21D2", "\\Rightarrow", true); +defineSymbol(symbols_math, main, rel, "\u27F9", "\\Longrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u2194", "\\leftrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u27F7", "\\longleftrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u21D4", "\\Leftrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u27FA", "\\Longleftrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u21A6", "\\mapsto", true); +defineSymbol(symbols_math, main, rel, "\u27FC", "\\longmapsto", true); +defineSymbol(symbols_math, main, rel, "\u2197", "\\nearrow", true); +defineSymbol(symbols_math, main, rel, "\u21A9", "\\hookleftarrow", true); +defineSymbol(symbols_math, main, rel, "\u21AA", "\\hookrightarrow", true); +defineSymbol(symbols_math, main, rel, "\u2198", "\\searrow", true); +defineSymbol(symbols_math, main, rel, "\u21BC", "\\leftharpoonup", true); +defineSymbol(symbols_math, main, rel, "\u21C0", "\\rightharpoonup", true); +defineSymbol(symbols_math, main, rel, "\u2199", "\\swarrow", true); +defineSymbol(symbols_math, main, rel, "\u21BD", "\\leftharpoondown", true); +defineSymbol(symbols_math, main, rel, "\u21C1", "\\rightharpoondown", true); +defineSymbol(symbols_math, main, rel, "\u2196", "\\nwarrow", true); +defineSymbol(symbols_math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations + +defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true); +defineSymbol(symbols_math, ams, rel, "\uE010", "\\nleqslant"); +defineSymbol(symbols_math, ams, rel, "\uE011", "\\nleqq"); +defineSymbol(symbols_math, ams, rel, "\u2A87", "\\lneq", true); +defineSymbol(symbols_math, ams, rel, "\u2268", "\\lneqq", true); +defineSymbol(symbols_math, ams, rel, "\uE00C", "\\lvertneqq"); +defineSymbol(symbols_math, ams, rel, "\u22E6", "\\lnsim", true); +defineSymbol(symbols_math, ams, rel, "\u2A89", "\\lnapprox", true); +defineSymbol(symbols_math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. + +defineSymbol(symbols_math, ams, rel, "\u22E0", "\\npreceq", true); +defineSymbol(symbols_math, ams, rel, "\u22E8", "\\precnsim", true); +defineSymbol(symbols_math, ams, rel, "\u2AB9", "\\precnapprox", true); +defineSymbol(symbols_math, ams, rel, "\u2241", "\\nsim", true); +defineSymbol(symbols_math, ams, rel, "\uE006", "\\nshortmid"); +defineSymbol(symbols_math, ams, rel, "\u2224", "\\nmid", true); +defineSymbol(symbols_math, ams, rel, "\u22AC", "\\nvdash", true); +defineSymbol(symbols_math, ams, rel, "\u22AD", "\\nvDash", true); +defineSymbol(symbols_math, ams, rel, "\u22EA", "\\ntriangleleft"); +defineSymbol(symbols_math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); +defineSymbol(symbols_math, ams, rel, "\u228A", "\\subsetneq", true); +defineSymbol(symbols_math, ams, rel, "\uE01A", "\\varsubsetneq"); +defineSymbol(symbols_math, ams, rel, "\u2ACB", "\\subsetneqq", true); +defineSymbol(symbols_math, ams, rel, "\uE017", "\\varsubsetneqq"); +defineSymbol(symbols_math, ams, rel, "\u226F", "\\ngtr", true); +defineSymbol(symbols_math, ams, rel, "\uE00F", "\\ngeqslant"); +defineSymbol(symbols_math, ams, rel, "\uE00E", "\\ngeqq"); +defineSymbol(symbols_math, ams, rel, "\u2A88", "\\gneq", true); +defineSymbol(symbols_math, ams, rel, "\u2269", "\\gneqq", true); +defineSymbol(symbols_math, ams, rel, "\uE00D", "\\gvertneqq"); +defineSymbol(symbols_math, ams, rel, "\u22E7", "\\gnsim", true); +defineSymbol(symbols_math, ams, rel, "\u2A8A", "\\gnapprox", true); +defineSymbol(symbols_math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. + +defineSymbol(symbols_math, ams, rel, "\u22E1", "\\nsucceq", true); +defineSymbol(symbols_math, ams, rel, "\u22E9", "\\succnsim", true); +defineSymbol(symbols_math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. + +defineSymbol(symbols_math, ams, rel, "\u2246", "\\ncong", true); +defineSymbol(symbols_math, ams, rel, "\uE007", "\\nshortparallel"); +defineSymbol(symbols_math, ams, rel, "\u2226", "\\nparallel", true); +defineSymbol(symbols_math, ams, rel, "\u22AF", "\\nVDash", true); +defineSymbol(symbols_math, ams, rel, "\u22EB", "\\ntriangleright"); +defineSymbol(symbols_math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); +defineSymbol(symbols_math, ams, rel, "\uE018", "\\nsupseteqq"); +defineSymbol(symbols_math, ams, rel, "\u228B", "\\supsetneq", true); +defineSymbol(symbols_math, ams, rel, "\uE01B", "\\varsupsetneq"); +defineSymbol(symbols_math, ams, rel, "\u2ACC", "\\supsetneqq", true); +defineSymbol(symbols_math, ams, rel, "\uE019", "\\varsupsetneqq"); +defineSymbol(symbols_math, ams, rel, "\u22AE", "\\nVdash", true); +defineSymbol(symbols_math, ams, rel, "\u2AB5", "\\precneqq", true); +defineSymbol(symbols_math, ams, rel, "\u2AB6", "\\succneqq", true); +defineSymbol(symbols_math, ams, rel, "\uE016", "\\nsubseteqq"); +defineSymbol(symbols_math, ams, bin, "\u22B4", "\\unlhd"); +defineSymbol(symbols_math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows + +defineSymbol(symbols_math, ams, rel, "\u219A", "\\nleftarrow", true); +defineSymbol(symbols_math, ams, rel, "\u219B", "\\nrightarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21CD", "\\nLeftarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21CF", "\\nRightarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21AE", "\\nleftrightarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc + +defineSymbol(symbols_math, ams, rel, "\u25B3", "\\vartriangle"); +defineSymbol(symbols_math, ams, symbols_textord, "\u210F", "\\hslash"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25BD", "\\triangledown"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\lozenge"); +defineSymbol(symbols_math, ams, symbols_textord, "\u24C8", "\\circledS"); +defineSymbol(symbols_math, ams, symbols_textord, "\xAE", "\\circledR"); +defineSymbol(symbols_text, ams, symbols_textord, "\xAE", "\\circledR"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2221", "\\measuredangle", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2204", "\\nexists"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2127", "\\mho"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2132", "\\Finv", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2141", "\\Game", true); +defineSymbol(symbols_math, ams, symbols_textord, "k", "\\Bbbk"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2035", "\\backprime"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25B2", "\\blacktriangle"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25BC", "\\blacktriangledown"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25A0", "\\blacksquare"); +defineSymbol(symbols_math, ams, symbols_textord, "\u29EB", "\\blacklozenge"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2605", "\\bigstar"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2222", "\\sphericalangle", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 (ð) to \matheth. We map to AMS function \eth + +defineSymbol(symbols_math, ams, symbols_textord, "\xF0", "\\eth", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2571", "\\diagup"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2572", "\\diagdown"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\square"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\Box"); +defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen + +defineSymbol(symbols_math, ams, symbols_textord, "\xA5", "\\yen", true); +defineSymbol(symbols_text, ams, symbols_textord, "\xA5", "\\yen", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2713", "\\checkmark", true); +defineSymbol(symbols_text, ams, symbols_textord, "\u2713", "\\checkmark"); // AMS Hebrew + +defineSymbol(symbols_math, ams, symbols_textord, "\u2136", "\\beth", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2138", "\\daleth", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2137", "\\gimel", true); // AMS Greek + +defineSymbol(symbols_math, ams, symbols_textord, "\u03DD", "\\digamma"); +defineSymbol(symbols_math, ams, symbols_textord, "\u03F0", "\\varkappa"); // AMS Delimiters + +defineSymbol(symbols_math, ams, symbols_open, "\u250C", "\\ulcorner", true); +defineSymbol(symbols_math, ams, symbols_close, "\u2510", "\\urcorner", true); +defineSymbol(symbols_math, ams, symbols_open, "\u2514", "\\llcorner", true); +defineSymbol(symbols_math, ams, symbols_close, "\u2518", "\\lrcorner", true); // AMS Binary Relations + +defineSymbol(symbols_math, ams, rel, "\u2266", "\\leqq", true); +defineSymbol(symbols_math, ams, rel, "\u2A7D", "\\leqslant", true); +defineSymbol(symbols_math, ams, rel, "\u2A95", "\\eqslantless", true); +defineSymbol(symbols_math, ams, rel, "\u2272", "\\lesssim", true); +defineSymbol(symbols_math, ams, rel, "\u2A85", "\\lessapprox", true); +defineSymbol(symbols_math, ams, rel, "\u224A", "\\approxeq", true); +defineSymbol(symbols_math, ams, bin, "\u22D6", "\\lessdot"); +defineSymbol(symbols_math, ams, rel, "\u22D8", "\\lll", true); +defineSymbol(symbols_math, ams, rel, "\u2276", "\\lessgtr", true); +defineSymbol(symbols_math, ams, rel, "\u22DA", "\\lesseqgtr", true); +defineSymbol(symbols_math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); +defineSymbol(symbols_math, ams, rel, "\u2251", "\\doteqdot"); +defineSymbol(symbols_math, ams, rel, "\u2253", "\\risingdotseq", true); +defineSymbol(symbols_math, ams, rel, "\u2252", "\\fallingdotseq", true); +defineSymbol(symbols_math, ams, rel, "\u223D", "\\backsim", true); +defineSymbol(symbols_math, ams, rel, "\u22CD", "\\backsimeq", true); +defineSymbol(symbols_math, ams, rel, "\u2AC5", "\\subseteqq", true); +defineSymbol(symbols_math, ams, rel, "\u22D0", "\\Subset", true); +defineSymbol(symbols_math, ams, rel, "\u228F", "\\sqsubset", true); +defineSymbol(symbols_math, ams, rel, "\u227C", "\\preccurlyeq", true); +defineSymbol(symbols_math, ams, rel, "\u22DE", "\\curlyeqprec", true); +defineSymbol(symbols_math, ams, rel, "\u227E", "\\precsim", true); +defineSymbol(symbols_math, ams, rel, "\u2AB7", "\\precapprox", true); +defineSymbol(symbols_math, ams, rel, "\u22B2", "\\vartriangleleft"); +defineSymbol(symbols_math, ams, rel, "\u22B4", "\\trianglelefteq"); +defineSymbol(symbols_math, ams, rel, "\u22A8", "\\vDash", true); +defineSymbol(symbols_math, ams, rel, "\u22AA", "\\Vvdash", true); +defineSymbol(symbols_math, ams, rel, "\u2323", "\\smallsmile"); +defineSymbol(symbols_math, ams, rel, "\u2322", "\\smallfrown"); +defineSymbol(symbols_math, ams, rel, "\u224F", "\\bumpeq", true); +defineSymbol(symbols_math, ams, rel, "\u224E", "\\Bumpeq", true); +defineSymbol(symbols_math, ams, rel, "\u2267", "\\geqq", true); +defineSymbol(symbols_math, ams, rel, "\u2A7E", "\\geqslant", true); +defineSymbol(symbols_math, ams, rel, "\u2A96", "\\eqslantgtr", true); +defineSymbol(symbols_math, ams, rel, "\u2273", "\\gtrsim", true); +defineSymbol(symbols_math, ams, rel, "\u2A86", "\\gtrapprox", true); +defineSymbol(symbols_math, ams, bin, "\u22D7", "\\gtrdot"); +defineSymbol(symbols_math, ams, rel, "\u22D9", "\\ggg", true); +defineSymbol(symbols_math, ams, rel, "\u2277", "\\gtrless", true); +defineSymbol(symbols_math, ams, rel, "\u22DB", "\\gtreqless", true); +defineSymbol(symbols_math, ams, rel, "\u2A8C", "\\gtreqqless", true); +defineSymbol(symbols_math, ams, rel, "\u2256", "\\eqcirc", true); +defineSymbol(symbols_math, ams, rel, "\u2257", "\\circeq", true); +defineSymbol(symbols_math, ams, rel, "\u225C", "\\triangleq", true); +defineSymbol(symbols_math, ams, rel, "\u223C", "\\thicksim"); +defineSymbol(symbols_math, ams, rel, "\u2248", "\\thickapprox"); +defineSymbol(symbols_math, ams, rel, "\u2AC6", "\\supseteqq", true); +defineSymbol(symbols_math, ams, rel, "\u22D1", "\\Supset", true); +defineSymbol(symbols_math, ams, rel, "\u2290", "\\sqsupset", true); +defineSymbol(symbols_math, ams, rel, "\u227D", "\\succcurlyeq", true); +defineSymbol(symbols_math, ams, rel, "\u22DF", "\\curlyeqsucc", true); +defineSymbol(symbols_math, ams, rel, "\u227F", "\\succsim", true); +defineSymbol(symbols_math, ams, rel, "\u2AB8", "\\succapprox", true); +defineSymbol(symbols_math, ams, rel, "\u22B3", "\\vartriangleright"); +defineSymbol(symbols_math, ams, rel, "\u22B5", "\\trianglerighteq"); +defineSymbol(symbols_math, ams, rel, "\u22A9", "\\Vdash", true); +defineSymbol(symbols_math, ams, rel, "\u2223", "\\shortmid"); +defineSymbol(symbols_math, ams, rel, "\u2225", "\\shortparallel"); +defineSymbol(symbols_math, ams, rel, "\u226C", "\\between", true); +defineSymbol(symbols_math, ams, rel, "\u22D4", "\\pitchfork", true); +defineSymbol(symbols_math, ams, rel, "\u221D", "\\varpropto"); +defineSymbol(symbols_math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. +// We kept the amssymb atom type, which is rel. + +defineSymbol(symbols_math, ams, rel, "\u2234", "\\therefore", true); +defineSymbol(symbols_math, ams, rel, "\u220D", "\\backepsilon"); +defineSymbol(symbols_math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. +// We kept the amssymb atom type, which is rel. + +defineSymbol(symbols_math, ams, rel, "\u2235", "\\because", true); +defineSymbol(symbols_math, ams, rel, "\u22D8", "\\llless"); +defineSymbol(symbols_math, ams, rel, "\u22D9", "\\gggtr"); +defineSymbol(symbols_math, ams, bin, "\u22B2", "\\lhd"); +defineSymbol(symbols_math, ams, bin, "\u22B3", "\\rhd"); +defineSymbol(symbols_math, ams, rel, "\u2242", "\\eqsim", true); +defineSymbol(symbols_math, main, rel, "\u22C8", "\\Join"); +defineSymbol(symbols_math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators + +defineSymbol(symbols_math, ams, bin, "\u2214", "\\dotplus", true); +defineSymbol(symbols_math, ams, bin, "\u2216", "\\smallsetminus"); +defineSymbol(symbols_math, ams, bin, "\u22D2", "\\Cap", true); +defineSymbol(symbols_math, ams, bin, "\u22D3", "\\Cup", true); +defineSymbol(symbols_math, ams, bin, "\u2A5E", "\\doublebarwedge", true); +defineSymbol(symbols_math, ams, bin, "\u229F", "\\boxminus", true); +defineSymbol(symbols_math, ams, bin, "\u229E", "\\boxplus", true); +defineSymbol(symbols_math, ams, bin, "\u22C7", "\\divideontimes", true); +defineSymbol(symbols_math, ams, bin, "\u22C9", "\\ltimes", true); +defineSymbol(symbols_math, ams, bin, "\u22CA", "\\rtimes", true); +defineSymbol(symbols_math, ams, bin, "\u22CB", "\\leftthreetimes", true); +defineSymbol(symbols_math, ams, bin, "\u22CC", "\\rightthreetimes", true); +defineSymbol(symbols_math, ams, bin, "\u22CF", "\\curlywedge", true); +defineSymbol(symbols_math, ams, bin, "\u22CE", "\\curlyvee", true); +defineSymbol(symbols_math, ams, bin, "\u229D", "\\circleddash", true); +defineSymbol(symbols_math, ams, bin, "\u229B", "\\circledast", true); +defineSymbol(symbols_math, ams, bin, "\u22C5", "\\centerdot"); +defineSymbol(symbols_math, ams, bin, "\u22BA", "\\intercal", true); +defineSymbol(symbols_math, ams, bin, "\u22D2", "\\doublecap"); +defineSymbol(symbols_math, ams, bin, "\u22D3", "\\doublecup"); +defineSymbol(symbols_math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows +// Note: unicode-math maps \u21e2 to their own function \rightdasharrow. +// We'll map it to AMS function \dashrightarrow. It produces the same atom. + +defineSymbol(symbols_math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. + +defineSymbol(symbols_math, ams, rel, "\u21E0", "\\dashleftarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21C7", "\\leftleftarrows", true); +defineSymbol(symbols_math, ams, rel, "\u21C6", "\\leftrightarrows", true); +defineSymbol(symbols_math, ams, rel, "\u21DA", "\\Lleftarrow", true); +defineSymbol(symbols_math, ams, rel, "\u219E", "\\twoheadleftarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21A2", "\\leftarrowtail", true); +defineSymbol(symbols_math, ams, rel, "\u21AB", "\\looparrowleft", true); +defineSymbol(symbols_math, ams, rel, "\u21CB", "\\leftrightharpoons", true); +defineSymbol(symbols_math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. + +defineSymbol(symbols_math, ams, rel, "\u21BA", "\\circlearrowleft", true); +defineSymbol(symbols_math, ams, rel, "\u21B0", "\\Lsh", true); +defineSymbol(symbols_math, ams, rel, "\u21C8", "\\upuparrows", true); +defineSymbol(symbols_math, ams, rel, "\u21BF", "\\upharpoonleft", true); +defineSymbol(symbols_math, ams, rel, "\u21C3", "\\downharpoonleft", true); +defineSymbol(symbols_math, ams, rel, "\u22B8", "\\multimap", true); +defineSymbol(symbols_math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21C9", "\\rightrightarrows", true); +defineSymbol(symbols_math, ams, rel, "\u21C4", "\\rightleftarrows", true); +defineSymbol(symbols_math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21A3", "\\rightarrowtail", true); +defineSymbol(symbols_math, ams, rel, "\u21AC", "\\looparrowright", true); +defineSymbol(symbols_math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. + +defineSymbol(symbols_math, ams, rel, "\u21BB", "\\circlearrowright", true); +defineSymbol(symbols_math, ams, rel, "\u21B1", "\\Rsh", true); +defineSymbol(symbols_math, ams, rel, "\u21CA", "\\downdownarrows", true); +defineSymbol(symbols_math, ams, rel, "\u21BE", "\\upharpoonright", true); +defineSymbol(symbols_math, ams, rel, "\u21C2", "\\downharpoonright", true); +defineSymbol(symbols_math, ams, rel, "\u21DD", "\\rightsquigarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21DD", "\\leadsto"); +defineSymbol(symbols_math, ams, rel, "\u21DB", "\\Rrightarrow", true); +defineSymbol(symbols_math, ams, rel, "\u21BE", "\\restriction"); +defineSymbol(symbols_math, main, symbols_textord, "\u2018", "`"); +defineSymbol(symbols_math, main, symbols_textord, "$", "\\$"); +defineSymbol(symbols_text, main, symbols_textord, "$", "\\$"); +defineSymbol(symbols_text, main, symbols_textord, "$", "\\textdollar"); +defineSymbol(symbols_math, main, symbols_textord, "%", "\\%"); +defineSymbol(symbols_text, main, symbols_textord, "%", "\\%"); +defineSymbol(symbols_math, main, symbols_textord, "_", "\\_"); +defineSymbol(symbols_text, main, symbols_textord, "_", "\\_"); +defineSymbol(symbols_text, main, symbols_textord, "_", "\\textunderscore"); +defineSymbol(symbols_math, main, symbols_textord, "\u2220", "\\angle", true); +defineSymbol(symbols_math, main, symbols_textord, "\u221E", "\\infty", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2032", "\\prime"); +defineSymbol(symbols_math, main, symbols_textord, "\u25B3", "\\triangle"); +defineSymbol(symbols_math, main, symbols_textord, "\u0393", "\\Gamma", true); +defineSymbol(symbols_math, main, symbols_textord, "\u0394", "\\Delta", true); +defineSymbol(symbols_math, main, symbols_textord, "\u0398", "\\Theta", true); +defineSymbol(symbols_math, main, symbols_textord, "\u039B", "\\Lambda", true); +defineSymbol(symbols_math, main, symbols_textord, "\u039E", "\\Xi", true); +defineSymbol(symbols_math, main, symbols_textord, "\u03A0", "\\Pi", true); +defineSymbol(symbols_math, main, symbols_textord, "\u03A3", "\\Sigma", true); +defineSymbol(symbols_math, main, symbols_textord, "\u03A5", "\\Upsilon", true); +defineSymbol(symbols_math, main, symbols_textord, "\u03A6", "\\Phi", true); +defineSymbol(symbols_math, main, symbols_textord, "\u03A8", "\\Psi", true); +defineSymbol(symbols_math, main, symbols_textord, "\u03A9", "\\Omega", true); +defineSymbol(symbols_math, main, symbols_textord, "A", "\u0391"); +defineSymbol(symbols_math, main, symbols_textord, "B", "\u0392"); +defineSymbol(symbols_math, main, symbols_textord, "E", "\u0395"); +defineSymbol(symbols_math, main, symbols_textord, "Z", "\u0396"); +defineSymbol(symbols_math, main, symbols_textord, "H", "\u0397"); +defineSymbol(symbols_math, main, symbols_textord, "I", "\u0399"); +defineSymbol(symbols_math, main, symbols_textord, "K", "\u039A"); +defineSymbol(symbols_math, main, symbols_textord, "M", "\u039C"); +defineSymbol(symbols_math, main, symbols_textord, "N", "\u039D"); +defineSymbol(symbols_math, main, symbols_textord, "O", "\u039F"); +defineSymbol(symbols_math, main, symbols_textord, "P", "\u03A1"); +defineSymbol(symbols_math, main, symbols_textord, "T", "\u03A4"); +defineSymbol(symbols_math, main, symbols_textord, "X", "\u03A7"); +defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\neg", true); +defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\lnot"); +defineSymbol(symbols_math, main, symbols_textord, "\u22A4", "\\top"); +defineSymbol(symbols_math, main, symbols_textord, "\u22A5", "\\bot"); +defineSymbol(symbols_math, main, symbols_textord, "\u2205", "\\emptyset"); +defineSymbol(symbols_math, ams, symbols_textord, "\u2205", "\\varnothing"); +defineSymbol(symbols_math, main, mathord, "\u03B1", "\\alpha", true); +defineSymbol(symbols_math, main, mathord, "\u03B2", "\\beta", true); +defineSymbol(symbols_math, main, mathord, "\u03B3", "\\gamma", true); +defineSymbol(symbols_math, main, mathord, "\u03B4", "\\delta", true); +defineSymbol(symbols_math, main, mathord, "\u03F5", "\\epsilon", true); +defineSymbol(symbols_math, main, mathord, "\u03B6", "\\zeta", true); +defineSymbol(symbols_math, main, mathord, "\u03B7", "\\eta", true); +defineSymbol(symbols_math, main, mathord, "\u03B8", "\\theta", true); +defineSymbol(symbols_math, main, mathord, "\u03B9", "\\iota", true); +defineSymbol(symbols_math, main, mathord, "\u03BA", "\\kappa", true); +defineSymbol(symbols_math, main, mathord, "\u03BB", "\\lambda", true); +defineSymbol(symbols_math, main, mathord, "\u03BC", "\\mu", true); +defineSymbol(symbols_math, main, mathord, "\u03BD", "\\nu", true); +defineSymbol(symbols_math, main, mathord, "\u03BE", "\\xi", true); +defineSymbol(symbols_math, main, mathord, "\u03BF", "\\omicron", true); +defineSymbol(symbols_math, main, mathord, "\u03C0", "\\pi", true); +defineSymbol(symbols_math, main, mathord, "\u03C1", "\\rho", true); +defineSymbol(symbols_math, main, mathord, "\u03C3", "\\sigma", true); +defineSymbol(symbols_math, main, mathord, "\u03C4", "\\tau", true); +defineSymbol(symbols_math, main, mathord, "\u03C5", "\\upsilon", true); +defineSymbol(symbols_math, main, mathord, "\u03D5", "\\phi", true); +defineSymbol(symbols_math, main, mathord, "\u03C7", "\\chi", true); +defineSymbol(symbols_math, main, mathord, "\u03C8", "\\psi", true); +defineSymbol(symbols_math, main, mathord, "\u03C9", "\\omega", true); +defineSymbol(symbols_math, main, mathord, "\u03B5", "\\varepsilon", true); +defineSymbol(symbols_math, main, mathord, "\u03D1", "\\vartheta", true); +defineSymbol(symbols_math, main, mathord, "\u03D6", "\\varpi", true); +defineSymbol(symbols_math, main, mathord, "\u03F1", "\\varrho", true); +defineSymbol(symbols_math, main, mathord, "\u03C2", "\\varsigma", true); +defineSymbol(symbols_math, main, mathord, "\u03C6", "\\varphi", true); +defineSymbol(symbols_math, main, bin, "\u2217", "*"); +defineSymbol(symbols_math, main, bin, "+", "+"); +defineSymbol(symbols_math, main, bin, "\u2212", "-"); +defineSymbol(symbols_math, main, bin, "\u22C5", "\\cdot", true); +defineSymbol(symbols_math, main, bin, "\u2218", "\\circ"); +defineSymbol(symbols_math, main, bin, "\xF7", "\\div", true); +defineSymbol(symbols_math, main, bin, "\xB1", "\\pm", true); +defineSymbol(symbols_math, main, bin, "\xD7", "\\times", true); +defineSymbol(symbols_math, main, bin, "\u2229", "\\cap", true); +defineSymbol(symbols_math, main, bin, "\u222A", "\\cup", true); +defineSymbol(symbols_math, main, bin, "\u2216", "\\setminus"); +defineSymbol(symbols_math, main, bin, "\u2227", "\\land"); +defineSymbol(symbols_math, main, bin, "\u2228", "\\lor"); +defineSymbol(symbols_math, main, bin, "\u2227", "\\wedge", true); +defineSymbol(symbols_math, main, bin, "\u2228", "\\vee", true); +defineSymbol(symbols_math, main, symbols_textord, "\u221A", "\\surd"); +defineSymbol(symbols_math, main, symbols_open, "(", "("); +defineSymbol(symbols_math, main, symbols_open, "[", "["); +defineSymbol(symbols_math, main, symbols_open, "\u27E8", "\\langle", true); +defineSymbol(symbols_math, main, symbols_open, "\u2223", "\\lvert"); +defineSymbol(symbols_math, main, symbols_open, "\u2225", "\\lVert"); +defineSymbol(symbols_math, main, symbols_close, ")", ")"); +defineSymbol(symbols_math, main, symbols_close, "]", "]"); +defineSymbol(symbols_math, main, symbols_close, "?", "?"); +defineSymbol(symbols_math, main, symbols_close, "!", "!"); +defineSymbol(symbols_math, main, symbols_close, "\u27E9", "\\rangle", true); +defineSymbol(symbols_math, main, symbols_close, "\u2223", "\\rvert"); +defineSymbol(symbols_math, main, symbols_close, "\u2225", "\\rVert"); +defineSymbol(symbols_math, main, rel, "=", "="); +defineSymbol(symbols_math, main, rel, "<", "<"); +defineSymbol(symbols_math, main, rel, ">", ">"); +defineSymbol(symbols_math, main, rel, ":", ":"); +defineSymbol(symbols_math, main, rel, "\u2248", "\\approx", true); +defineSymbol(symbols_math, main, rel, "\u2245", "\\cong", true); +defineSymbol(symbols_math, main, rel, "\u2265", "\\ge"); +defineSymbol(symbols_math, main, rel, "\u2265", "\\geq", true); +defineSymbol(symbols_math, main, rel, "\u2190", "\\gets"); +defineSymbol(symbols_math, main, rel, ">", "\\gt"); +defineSymbol(symbols_math, main, rel, "\u2208", "\\in", true); +defineSymbol(symbols_math, main, rel, "\u0338", "\\@not"); +defineSymbol(symbols_math, main, rel, "\u2282", "\\subset", true); +defineSymbol(symbols_math, main, rel, "\u2283", "\\supset", true); +defineSymbol(symbols_math, main, rel, "\u2286", "\\subseteq", true); +defineSymbol(symbols_math, main, rel, "\u2287", "\\supseteq", true); +defineSymbol(symbols_math, ams, rel, "\u2288", "\\nsubseteq", true); +defineSymbol(symbols_math, ams, rel, "\u2289", "\\nsupseteq", true); +defineSymbol(symbols_math, main, rel, "\u22A8", "\\models"); +defineSymbol(symbols_math, main, rel, "\u2190", "\\leftarrow", true); +defineSymbol(symbols_math, main, rel, "\u2264", "\\le"); +defineSymbol(symbols_math, main, rel, "\u2264", "\\leq", true); +defineSymbol(symbols_math, main, rel, "<", "\\lt"); +defineSymbol(symbols_math, main, rel, "\u2192", "\\rightarrow", true); +defineSymbol(symbols_math, main, rel, "\u2192", "\\to"); +defineSymbol(symbols_math, ams, rel, "\u2271", "\\ngeq", true); +defineSymbol(symbols_math, ams, rel, "\u2270", "\\nleq", true); +defineSymbol(symbols_math, main, spacing, "\xA0", "\\ "); +defineSymbol(symbols_math, main, spacing, "\xA0", "~"); +defineSymbol(symbols_math, main, spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% + +defineSymbol(symbols_math, main, spacing, "\xA0", "\\nobreakspace"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\ "); +defineSymbol(symbols_text, main, spacing, "\xA0", "~"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\space"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\nobreakspace"); +defineSymbol(symbols_math, main, spacing, null, "\\nobreak"); +defineSymbol(symbols_math, main, spacing, null, "\\allowbreak"); +defineSymbol(symbols_math, main, punct, ",", ","); +defineSymbol(symbols_math, main, punct, ";", ";"); +defineSymbol(symbols_math, ams, bin, "\u22BC", "\\barwedge", true); +defineSymbol(symbols_math, ams, bin, "\u22BB", "\\veebar", true); +defineSymbol(symbols_math, main, bin, "\u2299", "\\odot", true); +defineSymbol(symbols_math, main, bin, "\u2295", "\\oplus", true); +defineSymbol(symbols_math, main, bin, "\u2297", "\\otimes", true); +defineSymbol(symbols_math, main, symbols_textord, "\u2202", "\\partial", true); +defineSymbol(symbols_math, main, bin, "\u2298", "\\oslash", true); +defineSymbol(symbols_math, ams, bin, "\u229A", "\\circledcirc", true); +defineSymbol(symbols_math, ams, bin, "\u22A1", "\\boxdot", true); +defineSymbol(symbols_math, main, bin, "\u25B3", "\\bigtriangleup"); +defineSymbol(symbols_math, main, bin, "\u25BD", "\\bigtriangledown"); +defineSymbol(symbols_math, main, bin, "\u2020", "\\dagger"); +defineSymbol(symbols_math, main, bin, "\u22C4", "\\diamond"); +defineSymbol(symbols_math, main, bin, "\u22C6", "\\star"); +defineSymbol(symbols_math, main, bin, "\u25C3", "\\triangleleft"); +defineSymbol(symbols_math, main, bin, "\u25B9", "\\triangleright"); +defineSymbol(symbols_math, main, symbols_open, "{", "\\{"); +defineSymbol(symbols_text, main, symbols_textord, "{", "\\{"); +defineSymbol(symbols_text, main, symbols_textord, "{", "\\textbraceleft"); +defineSymbol(symbols_math, main, symbols_close, "}", "\\}"); +defineSymbol(symbols_text, main, symbols_textord, "}", "\\}"); +defineSymbol(symbols_text, main, symbols_textord, "}", "\\textbraceright"); +defineSymbol(symbols_math, main, symbols_open, "{", "\\lbrace"); +defineSymbol(symbols_math, main, symbols_close, "}", "\\rbrace"); +defineSymbol(symbols_math, main, symbols_open, "[", "\\lbrack"); +defineSymbol(symbols_text, main, symbols_textord, "[", "\\lbrack"); +defineSymbol(symbols_math, main, symbols_close, "]", "\\rbrack"); +defineSymbol(symbols_text, main, symbols_textord, "]", "\\rbrack"); +defineSymbol(symbols_math, main, symbols_open, "(", "\\lparen"); +defineSymbol(symbols_math, main, symbols_close, ")", "\\rparen"); +defineSymbol(symbols_text, main, symbols_textord, "<", "\\textless"); // in T1 fontenc + +defineSymbol(symbols_text, main, symbols_textord, ">", "\\textgreater"); // in T1 fontenc + +defineSymbol(symbols_math, main, symbols_open, "\u230A", "\\lfloor", true); +defineSymbol(symbols_math, main, symbols_close, "\u230B", "\\rfloor", true); +defineSymbol(symbols_math, main, symbols_open, "\u2308", "\\lceil", true); +defineSymbol(symbols_math, main, symbols_close, "\u2309", "\\rceil", true); +defineSymbol(symbols_math, main, symbols_textord, "\\", "\\backslash"); +defineSymbol(symbols_math, main, symbols_textord, "\u2223", "|"); +defineSymbol(symbols_math, main, symbols_textord, "\u2223", "\\vert"); +defineSymbol(symbols_text, main, symbols_textord, "|", "\\textbar"); // in T1 fontenc + +defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\|"); +defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\Vert"); +defineSymbol(symbols_text, main, symbols_textord, "\u2225", "\\textbardbl"); +defineSymbol(symbols_text, main, symbols_textord, "~", "\\textasciitilde"); +defineSymbol(symbols_math, main, rel, "\u2191", "\\uparrow", true); +defineSymbol(symbols_math, main, rel, "\u21D1", "\\Uparrow", true); +defineSymbol(symbols_math, main, rel, "\u2193", "\\downarrow", true); +defineSymbol(symbols_math, main, rel, "\u21D3", "\\Downarrow", true); +defineSymbol(symbols_math, main, rel, "\u2195", "\\updownarrow", true); +defineSymbol(symbols_math, main, rel, "\u21D5", "\\Updownarrow", true); +defineSymbol(symbols_math, main, op, "\u2210", "\\coprod"); +defineSymbol(symbols_math, main, op, "\u22C1", "\\bigvee"); +defineSymbol(symbols_math, main, op, "\u22C0", "\\bigwedge"); +defineSymbol(symbols_math, main, op, "\u2A04", "\\biguplus"); +defineSymbol(symbols_math, main, op, "\u22C2", "\\bigcap"); +defineSymbol(symbols_math, main, op, "\u22C3", "\\bigcup"); +defineSymbol(symbols_math, main, op, "\u222B", "\\int"); +defineSymbol(symbols_math, main, op, "\u222B", "\\intop"); +defineSymbol(symbols_math, main, op, "\u222C", "\\iint"); +defineSymbol(symbols_math, main, op, "\u222D", "\\iiint"); +defineSymbol(symbols_math, main, op, "\u220F", "\\prod"); +defineSymbol(symbols_math, main, op, "\u2211", "\\sum"); +defineSymbol(symbols_math, main, op, "\u2A02", "\\bigotimes"); +defineSymbol(symbols_math, main, op, "\u2A01", "\\bigoplus"); +defineSymbol(symbols_math, main, op, "\u2A00", "\\bigodot"); +defineSymbol(symbols_math, main, op, "\u222E", "\\oint"); +defineSymbol(symbols_math, main, op, "\u222F", "\\oiint"); +defineSymbol(symbols_math, main, op, "\u2230", "\\oiiint"); +defineSymbol(symbols_math, main, op, "\u2A06", "\\bigsqcup"); +defineSymbol(symbols_math, main, op, "\u222B", "\\smallint"); +defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\textellipsis"); +defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\mathellipsis"); +defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\ldots", true); +defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\ldots", true); +defineSymbol(symbols_math, main, symbols_inner, "\u22EF", "\\@cdots", true); +defineSymbol(symbols_math, main, symbols_inner, "\u22F1", "\\ddots", true); +defineSymbol(symbols_math, main, symbols_textord, "\u22EE", "\\varvdots"); // \vdots is a macro + +defineSymbol(symbols_math, main, symbols_accent, "\u02CA", "\\acute"); +defineSymbol(symbols_math, main, symbols_accent, "\u02CB", "\\grave"); +defineSymbol(symbols_math, main, symbols_accent, "\xA8", "\\ddot"); +defineSymbol(symbols_math, main, symbols_accent, "~", "\\tilde"); +defineSymbol(symbols_math, main, symbols_accent, "\u02C9", "\\bar"); +defineSymbol(symbols_math, main, symbols_accent, "\u02D8", "\\breve"); +defineSymbol(symbols_math, main, symbols_accent, "\u02C7", "\\check"); +defineSymbol(symbols_math, main, symbols_accent, "^", "\\hat"); +defineSymbol(symbols_math, main, symbols_accent, "\u20D7", "\\vec"); +defineSymbol(symbols_math, main, symbols_accent, "\u02D9", "\\dot"); +defineSymbol(symbols_math, main, symbols_accent, "\u02DA", "\\mathring"); +defineSymbol(symbols_math, main, mathord, "\u0131", "\\imath", true); +defineSymbol(symbols_math, main, mathord, "\u0237", "\\jmath", true); +defineSymbol(symbols_text, main, symbols_textord, "\u0131", "\\i", true); +defineSymbol(symbols_text, main, symbols_textord, "\u0237", "\\j", true); +defineSymbol(symbols_text, main, symbols_textord, "\xDF", "\\ss", true); +defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true); +defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true); +defineSymbol(symbols_text, main, symbols_textord, "\u0153", "\\oe", true); +defineSymbol(symbols_text, main, symbols_textord, "\xF8", "\\o", true); +defineSymbol(symbols_text, main, symbols_textord, "\xC6", "\\AE", true); +defineSymbol(symbols_text, main, symbols_textord, "\u0152", "\\OE", true); +defineSymbol(symbols_text, main, symbols_textord, "\xD8", "\\O", true); +defineSymbol(symbols_text, main, symbols_accent, "\u02CA", "\\'"); // acute + +defineSymbol(symbols_text, main, symbols_accent, "\u02CB", "\\`"); // grave + +defineSymbol(symbols_text, main, symbols_accent, "\u02C6", "\\^"); // circumflex + +defineSymbol(symbols_text, main, symbols_accent, "\u02DC", "\\~"); // tilde + +defineSymbol(symbols_text, main, symbols_accent, "\u02C9", "\\="); // macron + +defineSymbol(symbols_text, main, symbols_accent, "\u02D8", "\\u"); // breve + +defineSymbol(symbols_text, main, symbols_accent, "\u02D9", "\\."); // dot above + +defineSymbol(symbols_text, main, symbols_accent, "\u02DA", "\\r"); // ring above + +defineSymbol(symbols_text, main, symbols_accent, "\u02C7", "\\v"); // caron + +defineSymbol(symbols_text, main, symbols_accent, "\xA8", '\\"'); // diaresis + +defineSymbol(symbols_text, main, symbols_accent, "\u02DD", "\\H"); // double acute + +defineSymbol(symbols_text, main, symbols_accent, "\u25EF", "\\textcircled"); // \bigcirc glyph +// These ligatures are detected and created in Parser.js's `formLigatures`. + +var ligatures = { + "--": true, + "---": true, + "``": true, + "''": true +}; +defineSymbol(symbols_text, main, symbols_textord, "\u2013", "--"); +defineSymbol(symbols_text, main, symbols_textord, "\u2013", "\\textendash"); +defineSymbol(symbols_text, main, symbols_textord, "\u2014", "---"); +defineSymbol(symbols_text, main, symbols_textord, "\u2014", "\\textemdash"); +defineSymbol(symbols_text, main, symbols_textord, "\u2018", "`"); +defineSymbol(symbols_text, main, symbols_textord, "\u2018", "\\textquoteleft"); +defineSymbol(symbols_text, main, symbols_textord, "\u2019", "'"); +defineSymbol(symbols_text, main, symbols_textord, "\u2019", "\\textquoteright"); +defineSymbol(symbols_text, main, symbols_textord, "\u201C", "``"); +defineSymbol(symbols_text, main, symbols_textord, "\u201C", "\\textquotedblleft"); +defineSymbol(symbols_text, main, symbols_textord, "\u201D", "''"); +defineSymbol(symbols_text, main, symbols_textord, "\u201D", "\\textquotedblright"); // \degree from gensymb package + +defineSymbol(symbols_math, main, symbols_textord, "\xB0", "\\degree", true); +defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\degree"); // \textdegree from inputenc package + +defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math +// mode, but among our fonts, only Main-Italic defines this character "163". + +defineSymbol(symbols_math, main, mathord, "\xA3", "\\pounds"); +defineSymbol(symbols_math, main, mathord, "\xA3", "\\mathsterling", true); +defineSymbol(symbols_text, main, mathord, "\xA3", "\\pounds"); +defineSymbol(symbols_text, main, mathord, "\xA3", "\\textsterling", true); +defineSymbol(symbols_math, ams, symbols_textord, "\u2720", "\\maltese"); +defineSymbol(symbols_text, ams, symbols_textord, "\u2720", "\\maltese"); +defineSymbol(symbols_text, main, spacing, "\xA0", "\\ "); +defineSymbol(symbols_text, main, spacing, "\xA0", " "); +defineSymbol(symbols_text, main, spacing, "\xA0", "~"); // There are lots of symbols which are the same, so we add them in afterwards. +// All of these are textords in math mode + +var mathTextSymbols = "0123456789/@.\""; + +for (var symbols_i = 0; symbols_i < mathTextSymbols.length; symbols_i++) { + var symbols_ch = mathTextSymbols.charAt(symbols_i); + defineSymbol(symbols_math, main, symbols_textord, symbols_ch, symbols_ch); +} // All of these are textords in text mode + + +var textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,"; + +for (var src_symbols_i = 0; src_symbols_i < textSymbols.length; src_symbols_i++) { + var _ch = textSymbols.charAt(src_symbols_i); + + defineSymbol(symbols_text, main, symbols_textord, _ch, _ch); +} // All of these are textords in text mode, and mathords in math mode + + +var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +for (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) { + var _ch2 = letters.charAt(symbols_i2); + + defineSymbol(symbols_math, main, mathord, _ch2, _ch2); + defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2); +} // The next loop loads wide (surrogate pair) characters. +// We support some letters in the Unicode range U+1D400 to U+1D7FF, +// Mathematical Alphanumeric Symbols. +// Some editors do not deal well with wide characters. So don't write the +// string into this file. Instead, create the string from the surrogate pair. + + +var symbols_wideChar = ""; + +for (var _i3 = 0; _i3 < letters.length; _i3++) { + var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair. + // 0xD835 is the high surrogate for all letters in the range we support. + // 0xDC00 is the low surrogate for bold A. + + + symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + + if (_i3 < 26) { + // KaTeX fonts have only capital letters for blackboard bold and script. + // See exception for k below. + symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script + + defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar); + } // TODO: Add bold script when it is supported by a KaTeX font. + +} // "k" is the only double struck lower case letter in the KaTeX fonts. + + +symbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck + +defineSymbol(symbols_math, main, mathord, "k", symbols_wideChar); +defineSymbol(symbols_text, main, symbols_textord, "k", symbols_wideChar); // Next, some wide character numerals + +for (var _i4 = 0; _i4 < 10; _i4++) { + var _ch4 = _i4.toString(); + + symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold + + defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif + + defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans + + defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); + symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace + + defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar); + defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar); +} // We add these Latin-1 letters as symbols for backwards-compatibility, +// but they are not actually in the font, nor are they supported by the +// Unicode accent mechanism, so they fall back to Times font and look ugly. +// TODO(edemaine): Fix this. + + +var extraLatin = "ÇÐÞçþ"; + +for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { + var _ch5 = extraLatin.charAt(_i5); + + defineSymbol(symbols_math, main, mathord, _ch5, _ch5); + defineSymbol(symbols_text, main, symbols_textord, _ch5, _ch5); +} + +defineSymbol(symbols_text, main, symbols_textord, "ð", "ð"); // Unicode versions of existing characters + +defineSymbol(symbols_text, main, symbols_textord, "\u2013", "–"); +defineSymbol(symbols_text, main, symbols_textord, "\u2014", "—"); +defineSymbol(symbols_text, main, symbols_textord, "\u2018", "‘"); +defineSymbol(symbols_text, main, symbols_textord, "\u2019", "’"); +defineSymbol(symbols_text, main, symbols_textord, "\u201C", "“"); +defineSymbol(symbols_text, main, symbols_textord, "\u201D", "”"); +// CONCATENATED MODULE: ./src/wide-character.js +/** + * This file provides support for Unicode range U+1D400 to U+1D7FF, + * Mathematical Alphanumeric Symbols. + * + * Function wideCharacterFont takes a wide character as input and returns + * the font information necessary to render it properly. + */ + +/** + * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf + * That document sorts characters into groups by font type, say bold or italic. + * + * In the arrays below, each subarray consists three elements: + * * The CSS class of that group when in math mode. + * * The CSS class of that group when in text mode. + * * The font name, so that KaTeX can get font metrics. + */ + +var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright +["mathbf", "textbf", "Main-Bold"], // a-z bold upright +["mathdefault", "textit", "Math-Italic"], // A-Z italic +["mathdefault", "textit", "Math-Italic"], // a-z italic +["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic +["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic +// Map fancy A-Z letters to script, not calligraphic. +// This aligns with unicode-math and math fonts (except Cambria Math). +["mathscr", "textscr", "Script-Regular"], // A-Z script +["", "", ""], // a-z script. No font +["", "", ""], // A-Z bold script. No font +["", "", ""], // a-z bold script. No font +["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur +["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur +["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck +["mathbb", "textbb", "AMS-Regular"], // k double-struck +["", "", ""], // A-Z bold Fraktur No font metrics +["", "", ""], // a-z bold Fraktur. No font. +["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif +["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif +["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif +["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif +["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif +["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif +["", "", ""], // A-Z bold italic sans. No font +["", "", ""], // a-z bold italic sans. No font +["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace +["mathtt", "texttt", "Typewriter-Regular"]]; +var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold +["", "", ""], // 0-9 double-struck. No KaTeX font. +["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif +["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif +["mathtt", "texttt", "Typewriter-Regular"]]; +var wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode) { + // IE doesn't support codePointAt(). So work with the surrogate pair. + var H = wideChar.charCodeAt(0); // high surrogate + + var L = wideChar.charCodeAt(1); // low surrogate + + var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; + var j = mode === "math" ? 0 : 1; // column index for CSS class. + + if (0x1D400 <= codePoint && codePoint < 0x1D6A4) { + // wideLatinLetterData contains exactly 26 chars on each row. + // So we can calculate the relevant row. No traverse necessary. + var i = Math.floor((codePoint - 0x1D400) / 26); + return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; + } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) { + // Numerals, ten per row. + var _i = Math.floor((codePoint - 0x1D7CE) / 10); + + return [wideNumeralData[_i][2], wideNumeralData[_i][j]]; + } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) { + // dotless i or j + return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; + } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) { + // Greek letters. Not supported, yet. + return ["", ""]; + } else { + // We don't support any wide characters outside 1D400–1D7FF. + throw new src_ParseError("Unsupported character: " + wideChar); + } +}; +// CONCATENATED MODULE: ./src/Options.js +/** + * This file contains information about the options that the Parser carries + * around with it while parsing. Data is held in an `Options` object, and when + * recursing, a new `Options` object can be created with the `.with*` and + * `.reset` functions. + */ + +var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. +// The size mappings are taken from TeX with \normalsize=10pt. +[1, 1, 1], // size1: [5, 5, 5] \tiny +[2, 1, 1], // size2: [6, 5, 5] +[3, 1, 1], // size3: [7, 5, 5] \scriptsize +[4, 2, 1], // size4: [8, 6, 5] \footnotesize +[5, 2, 1], // size5: [9, 6, 5] \small +[6, 3, 1], // size6: [10, 7, 5] \normalsize +[7, 4, 2], // size7: [12, 8, 6] \large +[8, 6, 3], // size8: [14.4, 10, 7] \Large +[9, 7, 6], // size9: [17.28, 12, 10] \LARGE +[10, 8, 7], // size10: [20.74, 14.4, 12] \huge +[11, 10, 9]]; +var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if +// you change size indexes, change that function. +0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; + +var sizeAtStyle = function sizeAtStyle(size, style) { + return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; +}; + +/** + * This is the main options class. It contains the current style, size, color, + * and font. + * + * Options objects should not be modified. To create a new Options with + * different properties, call a `.having*` method. + */ +var Options_Options = +/*#__PURE__*/ +function () { + // A font family applies to a group of fonts (i.e. SansSerif), while a font + // represents a specific font (i.e. SansSerif Bold). + // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm + + /** + * The base size index. + */ + function Options(data) { + this.style = void 0; + this.color = void 0; + this.size = void 0; + this.textSize = void 0; + this.phantom = void 0; + this.font = void 0; + this.fontFamily = void 0; + this.fontWeight = void 0; + this.fontShape = void 0; + this.sizeMultiplier = void 0; + this.maxSize = void 0; + this._fontMetrics = void 0; + this.style = data.style; + this.color = data.color; + this.size = data.size || Options.BASESIZE; + this.textSize = data.textSize || this.size; + this.phantom = !!data.phantom; + this.font = data.font || ""; + this.fontFamily = data.fontFamily || ""; + this.fontWeight = data.fontWeight || ''; + this.fontShape = data.fontShape || ''; + this.sizeMultiplier = sizeMultipliers[this.size - 1]; + this.maxSize = data.maxSize; + this._fontMetrics = undefined; + } + /** + * Returns a new options object with the same properties as "this". Properties + * from "extension" will be copied to the new options object. + */ + + + var _proto = Options.prototype; + + _proto.extend = function extend(extension) { + var data = { + style: this.style, + size: this.size, + textSize: this.textSize, + color: this.color, + phantom: this.phantom, + font: this.font, + fontFamily: this.fontFamily, + fontWeight: this.fontWeight, + fontShape: this.fontShape, + maxSize: this.maxSize + }; + + for (var key in extension) { + if (extension.hasOwnProperty(key)) { + data[key] = extension[key]; + } + } + + return new Options(data); + }; + /** + * Return an options object with the given style. If `this.style === style`, + * returns `this`. + */ + + + _proto.havingStyle = function havingStyle(style) { + if (this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: sizeAtStyle(this.textSize, style) + }); + } + }; + /** + * Return an options object with a cramped version of the current style. If + * the current style is cramped, returns `this`. + */ + + + _proto.havingCrampedStyle = function havingCrampedStyle() { + return this.havingStyle(this.style.cramp()); + }; + /** + * Return an options object with the given size and in at least `\textstyle`. + * Returns `this` if appropriate. + */ + + + _proto.havingSize = function havingSize(size) { + if (this.size === size && this.textSize === size) { + return this; + } else { + return this.extend({ + style: this.style.text(), + size: size, + textSize: size, + sizeMultiplier: sizeMultipliers[size - 1] + }); + } + }; + /** + * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, + * changes to at least `\textstyle`. + */ + + + _proto.havingBaseStyle = function havingBaseStyle(style) { + style = style || this.style.text(); + var wantSize = sizeAtStyle(Options.BASESIZE, style); + + if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: wantSize + }); + } + }; + /** + * Remove the effect of sizing changes such as \Huge. + * Keep the effect of the current style, such as \scriptstyle. + */ + + + _proto.havingBaseSizing = function havingBaseSizing() { + var size; + + switch (this.style.id) { + case 4: + case 5: + size = 3; // normalsize in scriptstyle + + break; + + case 6: + case 7: + size = 1; // normalsize in scriptscriptstyle + + break; + + default: + size = 6; + // normalsize in textstyle or displaystyle + } + + return this.extend({ + style: this.style.text(), + size: size + }); + }; + /** + * Create a new options object with the given color. + */ + + + _proto.withColor = function withColor(color) { + return this.extend({ + color: color + }); + }; + /** + * Create a new options object with "phantom" set to true. + */ + + + _proto.withPhantom = function withPhantom() { + return this.extend({ + phantom: true + }); + }; + /** + * Creates a new options object with the given math font or old text font. + * @type {[type]} + */ + + + _proto.withFont = function withFont(font) { + return this.extend({ + font: font + }); + }; + /** + * Create a new options objects with the given fontFamily. + */ + + + _proto.withTextFontFamily = function withTextFontFamily(fontFamily) { + return this.extend({ + fontFamily: fontFamily, + font: "" + }); + }; + /** + * Creates a new options object with the given font weight + */ + + + _proto.withTextFontWeight = function withTextFontWeight(fontWeight) { + return this.extend({ + fontWeight: fontWeight, + font: "" + }); + }; + /** + * Creates a new options object with the given font weight + */ + + + _proto.withTextFontShape = function withTextFontShape(fontShape) { + return this.extend({ + fontShape: fontShape, + font: "" + }); + }; + /** + * Return the CSS sizing classes required to switch from enclosing options + * `oldOptions` to `this`. Returns an array of classes. + */ + + + _proto.sizingClasses = function sizingClasses(oldOptions) { + if (oldOptions.size !== this.size) { + return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; + } else { + return []; + } + }; + /** + * Return the CSS sizing classes required to switch to the base size. Like + * `this.havingSize(BASESIZE).sizingClasses(this)`. + */ + + + _proto.baseSizingClasses = function baseSizingClasses() { + if (this.size !== Options.BASESIZE) { + return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; + } else { + return []; + } + }; + /** + * Return the font metrics for this size. + */ + + + _proto.fontMetrics = function fontMetrics() { + if (!this._fontMetrics) { + this._fontMetrics = getGlobalMetrics(this.size); + } + + return this._fontMetrics; + }; + /** + * A map of color names to CSS colors. + * TODO(emily): Remove this when we have real macros + */ + + + /** + * Gets the CSS color of the current options object, accounting for the + * `colorMap`. + */ + _proto.getColor = function getColor() { + if (this.phantom) { + return "transparent"; + } else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) { + return Options.colorMap[this.color]; + } else { + return this.color; + } + }; + + return Options; +}(); + +Options_Options.BASESIZE = 6; +Options_Options.colorMap = { + "katex-blue": "#6495ed", + "katex-orange": "#ffa500", + "katex-pink": "#ff00af", + "katex-red": "#df0030", + "katex-green": "#28ae7b", + "katex-gray": "gray", + "katex-purple": "#9d38bd", + "katex-blueA": "#ccfaff", + "katex-blueB": "#80f6ff", + "katex-blueC": "#63d9ea", + "katex-blueD": "#11accd", + "katex-blueE": "#0c7f99", + "katex-tealA": "#94fff5", + "katex-tealB": "#26edd5", + "katex-tealC": "#01d1c1", + "katex-tealD": "#01a995", + "katex-tealE": "#208170", + "katex-greenA": "#b6ffb0", + "katex-greenB": "#8af281", + "katex-greenC": "#74cf70", + "katex-greenD": "#1fab54", + "katex-greenE": "#0d923f", + "katex-goldA": "#ffd0a9", + "katex-goldB": "#ffbb71", + "katex-goldC": "#ff9c39", + "katex-goldD": "#e07d10", + "katex-goldE": "#a75a05", + "katex-redA": "#fca9a9", + "katex-redB": "#ff8482", + "katex-redC": "#f9685d", + "katex-redD": "#e84d39", + "katex-redE": "#bc2612", + "katex-maroonA": "#ffbde0", + "katex-maroonB": "#ff92c6", + "katex-maroonC": "#ed5fa6", + "katex-maroonD": "#ca337c", + "katex-maroonE": "#9e034e", + "katex-purpleA": "#ddd7ff", + "katex-purpleB": "#c6b9fc", + "katex-purpleC": "#aa87ff", + "katex-purpleD": "#7854ab", + "katex-purpleE": "#543b78", + "katex-mintA": "#f5f9e8", + "katex-mintB": "#edf2df", + "katex-mintC": "#e0e5cc", + "katex-grayA": "#f6f7f7", + "katex-grayB": "#f0f1f2", + "katex-grayC": "#e3e5e6", + "katex-grayD": "#d6d8da", + "katex-grayE": "#babec2", + "katex-grayF": "#888d93", + "katex-grayG": "#626569", + "katex-grayH": "#3b3e40", + "katex-grayI": "#21242c", + "katex-kaBlue": "#314453", + "katex-kaGreen": "#71B307" +}; +/* harmony default export */ var src_Options = (Options_Options); +// CONCATENATED MODULE: ./src/units.js +/** + * This file does conversion between units. In particular, it provides + * calculateSize to convert other units into ems. + */ + + // This table gives the number of TeX pts in one of each *absolute* TeX unit. +// Thus, multiplying a length by this number converts the length from units +// into pts. Dividing the result by ptPerEm gives the number of ems +// *assuming* a font size of ptPerEm (normal size, normal style). + +var ptPerUnit = { + // https://en.wikibooks.org/wiki/LaTeX/Lengths and + // https://tex.stackexchange.com/a/8263 + "pt": 1, + // TeX point + "mm": 7227 / 2540, + // millimeter + "cm": 7227 / 254, + // centimeter + "in": 72.27, + // inch + "bp": 803 / 800, + // big (PostScript) points + "pc": 12, + // pica + "dd": 1238 / 1157, + // didot + "cc": 14856 / 1157, + // cicero (12 didot) + "nd": 685 / 642, + // new didot + "nc": 1370 / 107, + // new cicero (12 new didot) + "sp": 1 / 65536, + // scaled point (TeX's internal smallest unit) + // https://tex.stackexchange.com/a/41371 + "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX + +}; // Dictionary of relative units, for fast validity testing. + +var relativeUnit = { + "ex": true, + "em": true, + "mu": true +}; + +/** + * Determine whether the specified unit (either a string defining the unit + * or a "size" parse node containing a unit field) is valid. + */ +var validUnit = function validUnit(unit) { + if (typeof unit !== "string") { + unit = unit.unit; + } + + return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; +}; +/* + * Convert a "size" parse node (with numeric "number" and string "unit" fields, + * as parsed by functions.js argType "size") into a CSS em value for the + * current style/scale. `options` gives the current options. + */ + +var units_calculateSize = function calculateSize(sizeValue, options) { + var scale; + + if (sizeValue.unit in ptPerUnit) { + // Absolute units + scale = ptPerUnit[sizeValue.unit] // Convert unit to pt + / options.fontMetrics().ptPerEm // Convert pt to CSS em + / options.sizeMultiplier; // Unscale to make absolute units + } else if (sizeValue.unit === "mu") { + // `mu` units scale with scriptstyle/scriptscriptstyle. + scale = options.fontMetrics().cssEmPerMu; + } else { + // Other relative units always refer to the *textstyle* font + // in the current size. + var unitOptions; + + if (options.style.isTight()) { + // isTight() means current style is script/scriptscript. + unitOptions = options.havingStyle(options.style.text()); + } else { + unitOptions = options; + } // TODO: In TeX these units are relative to the quad of the current + // *text* font, e.g. cmr10. KaTeX instead uses values from the + // comparably-sized *Computer Modern symbol* font. At 10pt, these + // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; + // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. + // TeX \showlists shows a kern of 1.13889 * fontsize; + // KaTeX shows a kern of 1.171 * fontsize. + + + if (sizeValue.unit === "ex") { + scale = unitOptions.fontMetrics().xHeight; + } else if (sizeValue.unit === "em") { + scale = unitOptions.fontMetrics().quad; + } else { + throw new src_ParseError("Invalid unit: '" + sizeValue.unit + "'"); + } + + if (unitOptions !== options) { + scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; + } + } + + return Math.min(sizeValue.number * scale, options.maxSize); +}; +// CONCATENATED MODULE: ./src/buildCommon.js /* eslint no-console:0 */ + /** * This module contains general functions that can be used for building * different kinds of domTree nodes in a consistent manner. */ -var domTree = require("./domTree"); -var fontMetrics = require("./fontMetrics"); -var symbols = require("./symbols"); -var utils = require("./utils"); -var greekCapitals = [ - "\\Gamma", - "\\Delta", - "\\Theta", - "\\Lambda", - "\\Xi", - "\\Pi", - "\\Sigma", - "\\Upsilon", - "\\Phi", - "\\Psi", - "\\Omega" -]; -// The following have to be loaded from Main-Italic font, using class mainit -var mainitLetters = [ - "\u0131", // dotless i, \imath - "\u0237", // dotless j, \jmath - "\u00a3" // \pounds -]; + + + +// The following have to be loaded from Main-Italic font, using class mathit +var mathitLetters = ["\\imath", "ı", // dotless i +"\\jmath", "ȷ", // dotless j +"\\pounds", "\\mathsterling", "\\textsterling", "£"]; +/** + * Looks up the given symbol in fontMetrics, after applying any symbol + * replacements defined in symbol.js + */ + +var buildCommon_lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. +fontName, mode) { + // Replace the value with its replaced value from symbol.js + if (src_symbols[mode][value] && src_symbols[mode][value].replace) { + value = src_symbols[mode][value].replace; + } + + return { + value: value, + metrics: getCharacterMetrics(value, fontName, mode) + }; +}; /** * Makes a symbolNode after translation via the list of symbols in symbols.js. * Correctly pulls out metrics for the character, and optionally takes a list of @@ -1631,497 +5290,1020 @@ var mainitLetters = [ * TODO: make argument order closer to makeSpan * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. + * TODO(#953): Make `options` mandatory and always pass it in. */ -var makeSymbol = function(value, fontFamily, mode, options, classes) { - // Replace the value with its replaced value from symbol.js - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; + + +var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { + var lookup = buildCommon_lookupSymbol(value, fontName, mode); + var metrics = lookup.metrics; + value = lookup.value; + var symbolNode; + + if (metrics) { + var italic = metrics.italic; + + if (mode === "text" || options && options.font === "mathit") { + italic = 0; } - var metrics = fontMetrics.getCharacterMetrics(value, fontFamily); + symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); + } else { + // TODO(emily): Figure out a good way to only print this in development + typeof console !== "undefined" && console.warn("No character metrics for '" + value + "' in style '" + fontName + "'"); + symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes); + } - var symbolNode; - if (metrics) { - var italic = metrics.italic; - if (mode === "text") { - italic = 0; - } - symbolNode = new domTree.symbolNode( - value, metrics.height, metrics.depth, italic, metrics.skew, - classes); - } else { - // TODO(emily): Figure out a good way to only print this in development - typeof console !== "undefined" && console.warn( - "No character metrics for '" + value + "' in style '" + - fontFamily + "'"); - symbolNode = new domTree.symbolNode(value, 0, 0, 0, 0, classes); + if (options) { + symbolNode.maxFontSize = options.sizeMultiplier; + + if (options.style.isTight()) { + symbolNode.classes.push("mtight"); } - if (options) { - if (options.style.isTight()) { - symbolNode.classes.push("mtight"); - } - if (options.getColor()) { - symbolNode.style.color = options.getColor(); - } - } + var color = options.getColor(); - return symbolNode; + if (color) { + symbolNode.style.color = color; + } + } + + return symbolNode; }; - /** * Makes a symbol in Main-Regular or AMS-Regular. * Used for rel, bin, open, close, inner, and punct. + * + * TODO(#953): Make `options` mandatory and always pass it in. */ -var mathsym = function(value, mode, options, classes) { - // Decide what font to render the symbol in by its entry in the symbols - // table. - // Have a special case for when the value = \ because the \ is used as a - // textord in unsupported command errors but cannot be parsed as a regular - // text ordinal and is therefore not present as a symbol in the symbols - // table for text - if (value === "\\" || symbols[mode][value].font === "main") { - return makeSymbol(value, "Main-Regular", mode, options, classes); - } else { - return makeSymbol( - value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); - } -}; + +var buildCommon_mathsym = function mathsym(value, mode, options, classes) { + if (classes === void 0) { + classes = []; + } + + // Decide what font to render the symbol in by its entry in the symbols + // table. + // Have a special case for when the value = \ because the \ is used as a + // textord in unsupported command errors but cannot be parsed as a regular + // text ordinal and is therefore not present as a symbol in the symbols + // table for text, as well as a special case for boldsymbol because it + // can be used for bold + and - + if (options && options.font && options.font === "boldsymbol" && buildCommon_lookupSymbol(value, "Main-Bold", mode).metrics) { + return buildCommon_makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); + } else if (value === "\\" || src_symbols[mode][value].font === "main") { + return buildCommon_makeSymbol(value, "Main-Regular", mode, options, classes); + } else { + return buildCommon_makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); + } +}; /** - * Makes a symbol in the default font for mathords and textords. + * Determines which of the two font names (Main-Italic and Math-Italic) and + * corresponding style tags (maindefault or mathit) to use for default math font, + * depending on the symbol. */ -var mathDefault = function(value, mode, options, classes, type) { - if (type === "mathord") { - return mathit(value, mode, options, classes); - } else if (type === "textord") { - return makeSymbol( - value, "Main-Regular", mode, options, classes.concat(["mathrm"])); - } else { - throw new Error("unexpected type: " + type + " in mathDefault"); - } -}; + +var buildCommon_mathdefault = function mathdefault(value, mode, options, classes) { + if (/[0-9]/.test(value.charAt(0)) || // glyphs for \imath and \jmath do not exist in Math-Italic so we + // need to use Main-Italic instead + utils.contains(mathitLetters, value)) { + return { + fontName: "Main-Italic", + fontClass: "mathit" + }; + } else { + return { + fontName: "Math-Italic", + fontClass: "mathdefault" + }; + } +}; /** - * Makes a symbol in the italic math font. + * Determines which of the font names (Main-Italic, Math-Italic, and Caligraphic) + * and corresponding style tags (mathit, mathdefault, or mathcal) to use for font + * "mathnormal", depending on the symbol. Use this function instead of fontMap for + * font "mathnormal". */ -var mathit = function(value, mode, options, classes) { - if (/[0-9]/.test(value.charAt(0)) || - // glyphs for \imath and \jmath do not exist in Math-Italic so we - // need to use Main-Italic instead - utils.contains(mainitLetters, value) || - utils.contains(greekCapitals, value)) { - return makeSymbol( - value, "Main-Italic", mode, options, classes.concat(["mainit"])); - } else { - return makeSymbol( - value, "Math-Italic", mode, options, classes.concat(["mathit"])); - } -}; + +var buildCommon_mathnormal = function mathnormal(value, mode, options, classes) { + if (utils.contains(mathitLetters, value)) { + return { + fontName: "Main-Italic", + fontClass: "mathit" + }; + } else if (/[0-9]/.test(value.charAt(0))) { + return { + fontName: "Caligraphic-Regular", + fontClass: "mathcal" + }; + } else { + return { + fontName: "Math-Italic", + fontClass: "mathdefault" + }; + } +}; +/** + * Determines which of the two font names (Main-Bold and Math-BoldItalic) and + * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol", + * depending on the symbol. Use this function instead of fontMap for font + * "boldsymbol". + */ + + +var boldsymbol = function boldsymbol(value, mode, options, classes) { + if (buildCommon_lookupSymbol(value, "Math-BoldItalic", mode).metrics) { + return { + fontName: "Math-BoldItalic", + fontClass: "boldsymbol" + }; + } else { + // Some glyphs do not exist in Math-BoldItalic so we need to use + // Main-Bold instead. + return { + fontName: "Main-Bold", + fontClass: "mathbf" + }; + } +}; /** * Makes either a mathord or textord in the correct font and color. */ -var makeOrd = function(group, options, type) { - var mode = group.mode; - var value = group.value; - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; - } - var classes = ["mord"]; - var font = options.font; - if (font) { - if (font === "mathit" || utils.contains(mainitLetters, value)) { - return mathit(value, mode, options, classes); - } else { - var fontName = fontMap[font].fontName; - if (fontMetrics.getCharacterMetrics(value, fontName)) { - return makeSymbol( - value, fontName, mode, options, classes.concat([font])); - } else { - return mathDefault(value, mode, options, classes, type); - } - } +var buildCommon_makeOrd = function makeOrd(group, options, type) { + var mode = group.mode; + var text = group.text; + var classes = ["mord"]; // Math mode or Old font (i.e. \rm) + + var isFont = mode === "math" || mode === "text" && options.font; + var fontOrFamily = isFont ? options.font : options.fontFamily; + + if (text.charCodeAt(0) === 0xD835) { + // surrogate pairs get special treatment + var _wideCharacterFont = wide_character_wideCharacterFont(text, mode), + wideFontName = _wideCharacterFont[0], + wideFontClass = _wideCharacterFont[1]; + + return buildCommon_makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); + } else if (fontOrFamily) { + var fontName; + var fontClasses; + + if (fontOrFamily === "boldsymbol" || fontOrFamily === "mathnormal") { + var fontData = fontOrFamily === "boldsymbol" ? boldsymbol(text, mode, options, classes) : buildCommon_mathnormal(text, mode, options, classes); + fontName = fontData.fontName; + fontClasses = [fontData.fontClass]; + } else if (utils.contains(mathitLetters, text)) { + fontName = "Main-Italic"; + fontClasses = ["mathit"]; + } else if (isFont) { + fontName = fontMap[fontOrFamily].fontName; + fontClasses = [fontOrFamily]; } else { - return mathDefault(value, mode, options, classes, type); + fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape); + fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; } -}; + if (buildCommon_lookupSymbol(text, fontName, mode).metrics) { + return buildCommon_makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); + } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { + // Deconstruct ligatures in monospace fonts (\texttt, \tt). + var parts = []; + + for (var i = 0; i < text.length; i++) { + parts.push(buildCommon_makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); + } + + return buildCommon_makeFragment(parts); + } + } // Makes a symbol in the default font for mathords and textords. + + + if (type === "mathord") { + var fontLookup = buildCommon_mathdefault(text, mode, options, classes); + return buildCommon_makeSymbol(text, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass])); + } else if (type === "textord") { + var font = src_symbols[mode][text] && src_symbols[mode][text].font; + + if (font === "ams") { + var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); + + return buildCommon_makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); + } else if (font === "main" || !font) { + var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); + + return buildCommon_makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape)); + } else { + // fonts added by plugins + var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class + + + return buildCommon_makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape)); + } + } else { + throw new Error("unexpected type: " + type + " in makeOrd"); + } +}; +/** + * Returns true if subsequent symbolNodes have the same classes, skew, maxFont, + * and styles. + */ + + +var buildCommon_canCombine = function canCombine(prev, next) { + if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { + return false; + } + + for (var style in prev.style) { + if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { + return false; + } + } + + for (var _style in next.style) { + if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) { + return false; + } + } + + return true; +}; +/** + * Combine consequetive domTree.symbolNodes into a single symbolNode. + * Note: this function mutates the argument. + */ + + +var buildCommon_tryCombineChars = function tryCombineChars(chars) { + for (var i = 0; i < chars.length - 1; i++) { + var prev = chars[i]; + var next = chars[i + 1]; + + if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) { + prev.text += next.text; + prev.height = Math.max(prev.height, next.height); + prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use + // it to add padding to the right of the span created from + // the combined characters. + + prev.italic = next.italic; + chars.splice(i + 1, 1); + i--; + } + } + + return chars; +}; /** * Calculate the height, depth, and maxFontSize of an element based on its * children. */ -var sizeElementFromChildren = function(elem) { - var height = 0; - var depth = 0; - var maxFontSize = 0; - if (elem.children) { - for (var i = 0; i < elem.children.length; i++) { - if (elem.children[i].height > height) { - height = elem.children[i].height; - } - if (elem.children[i].depth > depth) { - depth = elem.children[i].depth; - } - if (elem.children[i].maxFontSize > maxFontSize) { - maxFontSize = elem.children[i].maxFontSize; - } - } + +var sizeElementFromChildren = function sizeElementFromChildren(elem) { + var height = 0; + var depth = 0; + var maxFontSize = 0; + + for (var i = 0; i < elem.children.length; i++) { + var child = elem.children[i]; + + if (child.height > height) { + height = child.height; } - elem.height = height; - elem.depth = depth; - elem.maxFontSize = maxFontSize; -}; + if (child.depth > depth) { + depth = child.depth; + } + if (child.maxFontSize > maxFontSize) { + maxFontSize = child.maxFontSize; + } + } + + elem.height = height; + elem.depth = depth; + elem.maxFontSize = maxFontSize; +}; /** * Makes a span with the given list of classes, list of children, and options. * - * TODO: Ensure that `options` is always provided (currently some call sites - * don't pass it). + * TODO(#953): Ensure that `options` is always provided (currently some call + * sites don't pass it) and make the type below mandatory. * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which * should if present come first in `classes`. */ -var makeSpan = function(classes, children, options) { - var span = new domTree.span(classes, children, options); - sizeElementFromChildren(span); - return span; +var buildCommon_makeSpan = function makeSpan(classes, children, options, style) { + var span = new domTree_Span(classes, children, options, style); + sizeElementFromChildren(span); + return span; +}; // SVG one is simpler -- doesn't require height, depth, max-font setting. +// This is also a separate method for typesafety. + + +var buildCommon_makeSvgSpan = function makeSvgSpan(classes, children, options, style) { + return new domTree_Span(classes, children, options, style); }; +var makeLineSpan = function makeLineSpan(className, options, thickness) { + var line = buildCommon_makeSpan([className], [], options); + line.height = thickness || options.fontMetrics().defaultRuleThickness; + line.style.borderBottomWidth = line.height + "em"; + line.maxFontSize = 1.0; + return line; +}; /** - * Prepends the given children to the given span, updating height, depth, and - * maxFontSize. + * Makes an anchor with the given href, list of classes, list of children, + * and options. */ -var prependChildren = function(span, children) { - span.children = children.concat(span.children); - sizeElementFromChildren(span); + +var buildCommon_makeAnchor = function makeAnchor(href, classes, children, options) { + var anchor = new domTree_Anchor(href, classes, children, options); + sizeElementFromChildren(anchor); + return anchor; }; - /** * Makes a document fragment with the given list of children. */ -var makeFragment = function(children) { - var fragment = new domTree.documentFragment(children); - sizeElementFromChildren(fragment); - return fragment; +var buildCommon_makeFragment = function makeFragment(children) { + var fragment = new tree_DocumentFragment(children); + sizeElementFromChildren(fragment); + return fragment; }; - /** - * Makes an element placed in each of the vlist elements to ensure that each - * element has the same max font size. To do this, we create a zero-width space - * with the correct font size. + * Wraps group in a span if it's a document fragment, allowing to apply classes + * and styles */ -var makeFontSizer = function(options, fontSize) { - var fontSizeInner = makeSpan([], [new domTree.symbolNode("\u200b")]); - fontSizeInner.style.fontSize = - (fontSize / options.style.sizeMultiplier) + "em"; - var fontSizer = makeSpan( - ["fontsize-ensurer", "reset-" + options.size, "size5"], - [fontSizeInner]); - return fontSizer; +var buildCommon_wrapFragment = function wrapFragment(group, options) { + if (group instanceof tree_DocumentFragment) { + return buildCommon_makeSpan([], [group], options); + } + + return group; +}; // These are exact object types to catch typos in the names of the optional fields. + + +// Computes the updated `children` list and the overall depth. +// +// This helper function for makeVList makes it easier to enforce type safety by +// allowing early exits (returns) in the logic. +var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { + if (params.positionType === "individualShift") { + var oldChildren = params.children; + var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be + // shifted to the correct specified shift + + var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; + + var currPos = _depth; + + for (var i = 1; i < oldChildren.length; i++) { + var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; + var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); + currPos = currPos + diff; + children.push({ + type: "kern", + size: size + }); + children.push(oldChildren[i]); + } + + return { + children: children, + depth: _depth + }; + } + + var depth; + + if (params.positionType === "top") { + // We always start at the bottom, so calculate the bottom by adding up + // all the sizes + var bottom = params.positionData; + + for (var _i = 0; _i < params.children.length; _i++) { + var child = params.children[_i]; + bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; + } + + depth = bottom; + } else if (params.positionType === "bottom") { + depth = -params.positionData; + } else { + var firstChild = params.children[0]; + + if (firstChild.type !== "elem") { + throw new Error('First child must have type "elem".'); + } + + if (params.positionType === "shift") { + depth = -firstChild.elem.depth - params.positionData; + } else if (params.positionType === "firstBaseline") { + depth = -firstChild.elem.depth; + } else { + throw new Error("Invalid positionType " + params.positionType + "."); + } + } + + return { + children: params.children, + depth: depth + }; }; - /** * Makes a vertical list by stacking elements and kerns on top of each other. * Allows for many different ways of specifying the positioning method. * - * Arguments: - * - children: A list of child or kern nodes to be stacked on top of each other - * (i.e. the first element will be at the bottom, and the last at - * the top). Element nodes are specified as - * {type: "elem", elem: node} - * while kern nodes are specified as - * {type: "kern", size: size} - * - positionType: The method by which the vlist should be positioned. Valid - * values are: - * - "individualShift": The children list only contains elem - * nodes, and each node contains an extra - * "shift" value of how much it should be - * shifted (note that shifting is always - * moving downwards). positionData is - * ignored. - * - "top": The positionData specifies the topmost point of - * the vlist (note this is expected to be a height, - * so positive values move up) - * - "bottom": The positionData specifies the bottommost point - * of the vlist (note this is expected to be a - * depth, so positive values move down - * - "shift": The vlist will be positioned such that its - * baseline is positionData away from the baseline - * of the first child. Positive values move - * downwards. - * - "firstBaseline": The vlist will be positioned such that - * its baseline is aligned with the - * baseline of the first child. - * positionData is ignored. (this is - * equivalent to "shift" with - * positionData=0) - * - positionData: Data used in different ways depending on positionType - * - options: An Options object - * + * See VListParam documentation above. */ -var makeVList = function(children, positionType, positionData, options) { - var depth; - var currPos; - var i; - if (positionType === "individualShift") { - var oldChildren = children; - children = [oldChildren[0]]; - // Add in kerns to the list of children to get each element to be - // shifted to the correct specified shift - depth = -oldChildren[0].shift - oldChildren[0].elem.depth; - currPos = depth; - for (i = 1; i < oldChildren.length; i++) { - var diff = -oldChildren[i].shift - currPos - - oldChildren[i].elem.depth; - var size = diff - - (oldChildren[i - 1].elem.height + - oldChildren[i - 1].elem.depth); - currPos = currPos + diff; +var buildCommon_makeVList = function makeVList(params, options) { + var _getVListChildrenAndD = getVListChildrenAndDepth(params), + children = _getVListChildrenAndD.children, + depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to + // each item, where it will determine the item's baseline. Since it has + // `overflow:hidden`, the strut's top edge will sit on the item's line box's + // top edge and the strut's bottom edge will sit on the item's baseline, + // with no additional line-height spacing. This allows the item baseline to + // be positioned precisely without worrying about font ascent and + // line-height. - children.push({type: "kern", size: size}); - children.push(oldChildren[i]); - } - } else if (positionType === "top") { - // We always start at the bottom, so calculate the bottom by adding up - // all the sizes - var bottom = positionData; - for (i = 0; i < children.length; i++) { - if (children[i].type === "kern") { - bottom -= children[i].size; - } else { - bottom -= children[i].elem.height + children[i].elem.depth; - } - } - depth = bottom; - } else if (positionType === "bottom") { - depth = -positionData; - } else if (positionType === "shift") { - depth = -children[0].elem.depth - positionData; - } else if (positionType === "firstBaseline") { - depth = -children[0].elem.depth; + + var pstrutSize = 0; + + for (var i = 0; i < children.length; i++) { + var child = children[i]; + + if (child.type === "elem") { + var elem = child.elem; + pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); + } + } + + pstrutSize += 2; + var pstrut = buildCommon_makeSpan(["pstrut"], []); + pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets + + var realChildren = []; + var minPos = depth; + var maxPos = depth; + var currPos = depth; + + for (var _i2 = 0; _i2 < children.length; _i2++) { + var _child = children[_i2]; + + if (_child.type === "kern") { + currPos += _child.size; } else { - depth = 0; + var _elem = _child.elem; + var classes = _child.wrapperClasses || []; + var style = _child.wrapperStyle || {}; + var childWrap = buildCommon_makeSpan(classes, [pstrut, _elem], undefined, style); + childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em"; + + if (_child.marginLeft) { + childWrap.style.marginLeft = _child.marginLeft; + } + + if (_child.marginRight) { + childWrap.style.marginRight = _child.marginRight; + } + + realChildren.push(childWrap); + currPos += _elem.height + _elem.depth; } - // Make the fontSizer - var maxFontSize = 0; - for (i = 0; i < children.length; i++) { - if (children[i].type === "elem") { - maxFontSize = Math.max(maxFontSize, children[i].elem.maxFontSize); - } - } - var fontSizer = makeFontSizer(options, maxFontSize); + minPos = Math.min(minPos, currPos); + maxPos = Math.max(maxPos, currPos); + } // The vlist contents go in a table-cell with `vertical-align:bottom`. + // This cell's bottom edge will determine the containing table's baseline + // without overly expanding the containing line-box. - // Create a new list of actual children at the correct offsets - var realChildren = []; - currPos = depth; - for (i = 0; i < children.length; i++) { - if (children[i].type === "kern") { - currPos += children[i].size; - } else { - var child = children[i].elem; - var shift = -child.depth - currPos; - currPos += child.height + child.depth; + var vlist = buildCommon_makeSpan(["vlist"], realChildren); + vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. - var childWrap = makeSpan([], [fontSizer, child]); - childWrap.height -= shift; - childWrap.depth += shift; - childWrap.style.top = shift + "em"; + var rows; - realChildren.push(childWrap); - } - } + if (minPos < 0) { + // We will define depth in an empty span with display: table-cell. + // It should render with the height that we define. But Chrome, in + // contenteditable mode only, treats that span as if it contains some + // text content. And that min-height over-rides our desired height. + // So we put another empty span inside the depth strut span. + var emptySpan = buildCommon_makeSpan([], []); + var depthStrut = buildCommon_makeSpan(["vlist"], [emptySpan]); + depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it + // puts the bottom of the *second* row on the baseline. - // Add in an element at the end with no offset to fix the calculation of - // baselines in some browsers (namely IE, sometimes safari) - var baselineFix = makeSpan( - ["baseline-fix"], [fontSizer, new domTree.symbolNode("\u200b")]); - realChildren.push(baselineFix); + var topStrut = buildCommon_makeSpan(["vlist-s"], [new domTree_SymbolNode("\u200B")]); + rows = [buildCommon_makeSpan(["vlist-r"], [vlist, topStrut]), buildCommon_makeSpan(["vlist-r"], [depthStrut])]; + } else { + rows = [buildCommon_makeSpan(["vlist-r"], [vlist])]; + } - var vlist = makeSpan(["vlist"], realChildren); - // Fix the final height and depth, in case there were kerns at the ends - // since the makeSpan calculation won't take that in to account. - vlist.height = Math.max(currPos, vlist.height); - vlist.depth = Math.max(-depth, vlist.depth); - return vlist; + var vtable = buildCommon_makeSpan(["vlist-t"], rows); + + if (rows.length === 2) { + vtable.classes.push("vlist-t2"); + } + + vtable.height = maxPos; + vtable.depth = -minPos; + return vtable; +}; // Glue is a concept from TeX which is a flexible space between elements in +// either a vertical or horizontal list. In KaTeX, at least for now, it's +// static space between elements in a horizontal layout. + + +var buildCommon_makeGlue = function makeGlue(measurement, options) { + // Make an empty span for the space + var rule = buildCommon_makeSpan(["mspace"], [], options); + var size = units_calculateSize(measurement, options); + rule.style.marginRight = size + "em"; + return rule; +}; // Takes font options, and returns the appropriate fontLookup name + + +var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { + var baseFontName = ""; + + switch (fontFamily) { + case "amsrm": + baseFontName = "AMS"; + break; + + case "textrm": + baseFontName = "Main"; + break; + + case "textsf": + baseFontName = "SansSerif"; + break; + + case "texttt": + baseFontName = "Typewriter"; + break; + + default: + baseFontName = fontFamily; + // use fonts added by a plugin + } + + var fontStylesName; + + if (fontWeight === "textbf" && fontShape === "textit") { + fontStylesName = "BoldItalic"; + } else if (fontWeight === "textbf") { + fontStylesName = "Bold"; + } else if (fontWeight === "textit") { + fontStylesName = "Italic"; + } else { + fontStylesName = "Regular"; + } + + return baseFontName + "-" + fontStylesName; }; - -// A table of size -> font size for the different sizing functions -var sizingMultiplier = { - size1: 0.5, - size2: 0.7, - size3: 0.8, - size4: 0.9, - size5: 1.0, - size6: 1.2, - size7: 1.44, - size8: 1.73, - size9: 2.07, - size10: 2.49 -}; - -// A map of spacing functions to their attributes, like size and corresponding -// CSS class -var spacingFunctions = { - "\\qquad": { - size: "2em", - className: "qquad" - }, - "\\quad": { - size: "1em", - className: "quad" - }, - "\\enspace": { - size: "0.5em", - className: "enspace" - }, - "\\;": { - size: "0.277778em", - className: "thickspace" - }, - "\\:": { - size: "0.22222em", - className: "mediumspace" - }, - "\\,": { - size: "0.16667em", - className: "thinspace" - }, - "\\!": { - size: "-0.16667em", - className: "negativethinspace" - } -}; - /** * Maps TeX font commands to objects containing: * - variant: string used for "mathvariant" attribute in buildMathML.js * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics */ // A map between tex font commands an MathML mathvariant attribute values + + var fontMap = { - // styles - "mathbf": { - variant: "bold", - fontName: "Main-Bold" - }, - "mathrm": { - variant: "normal", - fontName: "Main-Regular" - }, - "textit": { - variant: "italic", - fontName: "Main-Italic" - }, + // styles + "mathbf": { + variant: "bold", + fontName: "Main-Bold" + }, + "mathrm": { + variant: "normal", + fontName: "Main-Regular" + }, + "textit": { + variant: "italic", + fontName: "Main-Italic" + }, + "mathit": { + variant: "italic", + fontName: "Main-Italic" + }, + // Default math font, "mathnormal" and "boldsymbol" are missing because they + // require the use of several fonts: Main-Italic and Math-Italic for default + // math font, Main-Italic, Math-Italic, Caligraphic for "mathnormal", and + // Math-BoldItalic and Main-Bold for "boldsymbol". This is handled by a + // special case in makeOrd which ends up calling mathdefault, mathnormal, + // and boldsymbol. + // families + "mathbb": { + variant: "double-struck", + fontName: "AMS-Regular" + }, + "mathcal": { + variant: "script", + fontName: "Caligraphic-Regular" + }, + "mathfrak": { + variant: "fraktur", + fontName: "Fraktur-Regular" + }, + "mathscr": { + variant: "script", + fontName: "Script-Regular" + }, + "mathsf": { + variant: "sans-serif", + fontName: "SansSerif-Regular" + }, + "mathtt": { + variant: "monospace", + fontName: "Typewriter-Regular" + } +}; +var svgData = { + // path, width, height + vec: ["vec", 0.471, 0.714], + // values from the font glyph + oiintSize1: ["oiintSize1", 0.957, 0.499], + // oval to overlay the integrand + oiintSize2: ["oiintSize2", 1.472, 0.659], + oiiintSize1: ["oiiintSize1", 1.304, 0.499], + oiiintSize2: ["oiiintSize2", 1.98, 0.659] +}; - // "mathit" is missing because it requires the use of two fonts: Main-Italic - // and Math-Italic. This is handled by a special case in makeOrd which ends - // up calling mathit. +var buildCommon_staticSvg = function staticSvg(value, options) { + // Create a span with inline SVG for the element. + var _svgData$value = svgData[value], + pathName = _svgData$value[0], + width = _svgData$value[1], + height = _svgData$value[2]; + var path = new domTree_PathNode(pathName); + var svgNode = new SvgNode([path], { + "width": width + "em", + "height": height + "em", + // Override CSS rule `.katex svg { width: 100% }` + "style": "width:" + width + "em", + "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, + "preserveAspectRatio": "xMinYMin" + }); + var span = buildCommon_makeSvgSpan(["overlay"], [svgNode], options); + span.height = height; + span.style.height = height + "em"; + span.style.width = width + "em"; + return span; +}; - // families - "mathbb": { - variant: "double-struck", - fontName: "AMS-Regular" - }, - "mathcal": { - variant: "script", - fontName: "Caligraphic-Regular" - }, - "mathfrak": { - variant: "fraktur", - fontName: "Fraktur-Regular" - }, - "mathscr": { - variant: "script", - fontName: "Script-Regular" - }, - "mathsf": { - variant: "sans-serif", - fontName: "SansSerif-Regular" - }, - "mathtt": { - variant: "monospace", - fontName: "Typewriter-Regular" +/* harmony default export */ var buildCommon = ({ + fontMap: fontMap, + makeSymbol: buildCommon_makeSymbol, + mathsym: buildCommon_mathsym, + makeSpan: buildCommon_makeSpan, + makeSvgSpan: buildCommon_makeSvgSpan, + makeLineSpan: makeLineSpan, + makeAnchor: buildCommon_makeAnchor, + makeFragment: buildCommon_makeFragment, + wrapFragment: buildCommon_wrapFragment, + makeVList: buildCommon_makeVList, + makeOrd: buildCommon_makeOrd, + makeGlue: buildCommon_makeGlue, + staticSvg: buildCommon_staticSvg, + svgData: svgData, + tryCombineChars: buildCommon_tryCombineChars +}); +// CONCATENATED MODULE: ./src/parseNode.js + + +/** + * Asserts that the node is of the given type and returns it with stricter + * typing. Throws if the node's type does not match. + */ +function assertNodeType(node, type) { + var typedNode = checkNodeType(node, type); + + if (!typedNode) { + throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node))); + } // $FlowFixMe: Unsure why. + + + return typedNode; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function checkNodeType(node, type) { + if (node && node.type === type) { + // The definition of ParseNode doesn't communicate to flow that + // `type: TYPE` (as that's not explicitly mentioned anywhere), though that + // happens to be true for all our value types. + // $FlowFixMe + return node; + } + + return null; +} +/** + * Asserts that the node is of the given type and returns it with stricter + * typing. Throws if the node's type does not match. + */ + +function assertAtomFamily(node, family) { + var typedNode = checkAtomFamily(node, family); + + if (!typedNode) { + throw new Error("Expected node of type \"atom\" and family \"" + family + "\", but got " + (node ? node.type === "atom" ? "atom of family " + node.family : "node of type " + node.type : String(node))); + } + + return typedNode; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function checkAtomFamily(node, family) { + return node && node.type === "atom" && node.family === family ? node : null; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function assertSymbolNodeType(node) { + var typedNode = checkSymbolNodeType(node); + + if (!typedNode) { + throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node))); + } + + return typedNode; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function checkSymbolNodeType(node) { + if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { + // $FlowFixMe + return node; + } + + return null; +} +// CONCATENATED MODULE: ./src/spacingData.js +/** + * Describes spaces between different classes of atoms. + */ +var thinspace = { + number: 3, + unit: "mu" +}; +var mediumspace = { + number: 4, + unit: "mu" +}; +var thickspace = { + number: 5, + unit: "mu" +}; // Making the type below exact with all optional fields doesn't work due to +// - https://github.com/facebook/flow/issues/4582 +// - https://github.com/facebook/flow/issues/5688 +// However, since *all* fields are optional, $Shape<> works as suggested in 5688 +// above. + +// Spacing relationships for display and text styles +var spacings = { + mord: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + minner: thinspace + }, + mbin: { + mord: mediumspace, + mop: mediumspace, + mopen: mediumspace, + minner: mediumspace + }, + mrel: { + mord: thickspace, + mop: thickspace, + mopen: thickspace, + minner: thickspace + }, + mopen: {}, + mclose: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mpunct: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + mopen: thinspace, + mclose: thinspace, + mpunct: thinspace, + minner: thinspace + }, + minner: { + mord: thinspace, + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + mopen: thinspace, + mpunct: thinspace, + minner: thinspace + } +}; // Spacing relationships for script and scriptscript styles + +var tightSpacings = { + mord: { + mop: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace + }, + mbin: {}, + mrel: {}, + mopen: {}, + mclose: { + mop: thinspace + }, + mpunct: {}, + minner: { + mop: thinspace + } +}; +// CONCATENATED MODULE: ./src/defineFunction.js + + +/** + * All registered functions. + * `functions.js` just exports this same dictionary again and makes it public. + * `Parser.js` requires this dictionary. + */ +var _functions = {}; +/** + * All HTML builders. Should be only used in the `define*` and the `build*ML` + * functions. + */ + +var _htmlGroupBuilders = {}; +/** + * All MathML builders. Should be only used in the `define*` and the `build*ML` + * functions. + */ + +var _mathmlGroupBuilders = {}; +function defineFunction(_ref) { + var type = _ref.type, + nodeType = _ref.nodeType, + names = _ref.names, + props = _ref.props, + handler = _ref.handler, + htmlBuilder = _ref.htmlBuilder, + mathmlBuilder = _ref.mathmlBuilder; + // Set default values of functions + var data = { + type: type, + numArgs: props.numArgs, + argTypes: props.argTypes, + greediness: props.greediness === undefined ? 1 : props.greediness, + allowedInText: !!props.allowedInText, + allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, + numOptionalArgs: props.numOptionalArgs || 0, + infix: !!props.infix, + consumeMode: props.consumeMode, + handler: handler + }; + + for (var i = 0; i < names.length; ++i) { + // TODO: The value type of _functions should be a type union of all + // possible `FunctionSpec<>` possibilities instead of `FunctionSpec<*>`, + // which is an existential type. + // $FlowFixMe + _functions[names[i]] = data; + } + + if (type) { + if (htmlBuilder) { + _htmlGroupBuilders[type] = htmlBuilder; } -}; -module.exports = { - fontMap: fontMap, - makeSymbol: makeSymbol, - mathsym: mathsym, - makeSpan: makeSpan, - makeFragment: makeFragment, - makeVList: makeVList, - makeOrd: makeOrd, - prependChildren: prependChildren, - sizingMultiplier: sizingMultiplier, - spacingFunctions: spacingFunctions -}; + if (mathmlBuilder) { + _mathmlGroupBuilders[type] = mathmlBuilder; + } + } +} +/** + * Use this to register only the HTML and MathML builders for a function (e.g. + * if the function's ParseNode is generated in Parser.js rather than via a + * stand-alone handler provided to `defineFunction`). + */ -},{"./domTree":15,"./fontMetrics":17,"./symbols":23,"./utils":25}],11:[function(require,module,exports){ -/* eslint no-console:0 */ +function defineFunctionBuilders(_ref2) { + var type = _ref2.type, + htmlBuilder = _ref2.htmlBuilder, + mathmlBuilder = _ref2.mathmlBuilder; + defineFunction({ + type: type, + names: [], + props: { + numArgs: 0 + }, + handler: function handler() { + throw new Error('Should never be called.'); + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder + }); +} // Since the corresponding buildHTML/buildMathML function expects a +// list of elements, we normalize for different kinds of arguments + +var defineFunction_ordargument = function ordargument(arg) { + var node = checkNodeType(arg, "ordgroup"); + return node ? node.body : [arg]; +}; +// CONCATENATED MODULE: ./src/buildHTML.js /** * This file does the main work of building a domTree structure from a parse * tree. The entry point is the `buildHTML` function, which takes a parse tree. - * Then, the buildExpression, buildGroup, and various groupTypes functions are - * called, to produce a final HTML tree. + * Then, the buildExpression, buildGroup, and various groupBuilders functions + * are called, to produce a final HTML tree. */ -var ParseError = require("./ParseError"); -var Style = require("./Style"); -var buildCommon = require("./buildCommon"); -var delimiter = require("./delimiter"); -var domTree = require("./domTree"); -var fontMetrics = require("./fontMetrics"); -var utils = require("./utils"); -var makeSpan = buildCommon.makeSpan; -var isSpace = function(node) { - return node instanceof domTree.span && node.classes[0] === "mspace"; -}; -// Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) + + + + +var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) // depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, // and the text before Rule 19. -var isBin = function(node) { - return node && node.classes[0] === "mbin"; +var buildHTML_isBinLeftCanceller = function isBinLeftCanceller(node, isRealGroup) { + // TODO: This code assumes that a node's math class is the first element + // of its `classes` array. A later cleanup should ensure this, for + // instance by changing the signature of `makeSpan`. + if (node) { + return utils.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], getTypeOfDomTree(node, "right")); + } else { + return isRealGroup; + } }; -var isBinLeftCanceller = function(node, isRealGroup) { - // TODO: This code assumes that a node's math class is the first element - // of its `classes` array. A later cleanup should ensure this, for - // instance by changing the signature of `makeSpan`. - if (node) { - return utils.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], - node.classes[0]); - } else { - return isRealGroup; - } +var buildHTML_isBinRightCanceller = function isBinRightCanceller(node, isRealGroup) { + if (node) { + return utils.contains(["mrel", "mclose", "mpunct"], getTypeOfDomTree(node, "left")); + } else { + return isRealGroup; + } }; -var isBinRightCanceller = function(node, isRealGroup) { - if (node) { - return utils.contains(["mrel", "mclose", "mpunct"], node.classes[0]); - } else { - return isRealGroup; - } +var buildHTML_styleMap = { + "display": src_Style.DISPLAY, + "text": src_Style.TEXT, + "script": src_Style.SCRIPT, + "scriptscript": src_Style.SCRIPTSCRIPT +}; +var DomEnum = { + mord: "mord", + mop: "mop", + mbin: "mbin", + mrel: "mrel", + mopen: "mopen", + mclose: "mclose", + mpunct: "mpunct", + minner: "minner" }; /** @@ -2129,2071 +6311,702 @@ var isBinRightCanceller = function(node, isRealGroup) { * nodes. documentFragments are flattened into their contents, so the * returned list contains no fragments. `isRealGroup` is true if `expression` * is a real group (no atoms will be added on either side), as opposed to - * a partial group (e.g. one created by \color). + * a partial group (e.g. one created by \color). `surrounding` is an array + * consisting type of nodes that will be added to the left and right. */ -var buildExpression = function(expression, options, isRealGroup) { - // Parse expressions into `groups`. - var groups = []; - for (var i = 0; i < expression.length; i++) { - var group = expression[i]; - var output = buildGroup(group, options); - if (output instanceof domTree.documentFragment) { - Array.prototype.push.apply(groups, output.children); - } else { - groups.push(output); - } - } - // At this point `groups` consists entirely of `symbolNode`s and `span`s. +var buildHTML_buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) { + if (surrounding === void 0) { + surrounding = [null, null]; + } - // Explicit spaces (e.g., \;, \,) should be ignored with respect to atom - // spacing (e.g., "add thick space between mord and mrel"). Since CSS - // adjacency rules implement atom spacing, spaces should be invisible to - // CSS. So we splice them out of `groups` and into the atoms themselves. - var spaces = null; - for (i = 0; i < groups.length; i++) { - if (isSpace(groups[i])) { - spaces = spaces || []; - spaces.push(groups[i]); - groups.splice(i, 1); - i--; - } else if (spaces) { - if (groups[i] instanceof domTree.symbolNode) { - groups[i] = makeSpan([].concat(groups[i].classes), [groups[i]]); - } - buildCommon.prependChildren(groups[i], spaces); - spaces = null; - } - } - if (spaces) { - Array.prototype.push.apply(groups, spaces); - } + // Parse expressions into `groups`. + var rawGroups = []; - // Binary operators change to ordinary symbols in some contexts. - for (i = 0; i < groups.length; i++) { - if (isBin(groups[i]) - && (isBinLeftCanceller(groups[i - 1], isRealGroup) - || isBinRightCanceller(groups[i + 1], isRealGroup))) { - groups[i].classes[0] = "mord"; - } - } + for (var i = 0; i < expression.length; i++) { + var output = buildHTML_buildGroup(expression[i], options); - return groups; -}; - -// Return math atom class (mclass) of a domTree. -var getTypeOfDomTree = function(node) { - if (node instanceof domTree.documentFragment) { - if (node.children.length) { - return getTypeOfDomTree( - node.children[node.children.length - 1]); - } + if (output instanceof tree_DocumentFragment) { + var children = output.children; + rawGroups.push.apply(rawGroups, children); } else { - if (utils.contains(["mord", "mop", "mbin", "mrel", "mopen", "mclose", - "mpunct", "minner"], node.classes[0])) { - return node.classes[0]; - } + rawGroups.push(output); } + } // At this point `rawGroups` consists entirely of `symbolNode`s and `span`s. + // Ignore explicit spaces (e.g., \;, \,) when determining what implicit + // spacing should go between atoms of different classes, and add dummy + // spans for determining spacings between surrounding atoms. + + + var nonSpaces = [surrounding[0] ? buildHTML_makeSpan([surrounding[0]], [], options) : null].concat(rawGroups.filter(function (group) { + return group && group.classes[0] !== "mspace"; + }), [surrounding[1] ? buildHTML_makeSpan([surrounding[1]], [], options) : null]); // Before determining what spaces to insert, perform bin cancellation. + // Binary operators change to ordinary symbols in some contexts. + + for (var _i = 1; _i < nonSpaces.length - 1; _i++) { + var nonSpacesI = assert(nonSpaces[_i]); + var left = buildHTML_getOutermostNode(nonSpacesI, "left"); + + if (left.classes[0] === "mbin" && buildHTML_isBinLeftCanceller(nonSpaces[_i - 1], isRealGroup)) { + left.classes[0] = "mord"; + } + + var right = buildHTML_getOutermostNode(nonSpacesI, "right"); + + if (right.classes[0] === "mbin" && buildHTML_isBinRightCanceller(nonSpaces[_i + 1], isRealGroup)) { + right.classes[0] = "mord"; + } + } + + var groups = []; + var j = 0; + + for (var _i2 = 0; _i2 < rawGroups.length; _i2++) { + groups.push(rawGroups[_i2]); // For any group that is not a space, get the next non-space. Then + // lookup what implicit space should be placed between those atoms and + // add it to groups. + + if (rawGroups[_i2].classes[0] !== "mspace" && j < nonSpaces.length - 1) { + // if current non-space node is left dummy span, add a glue before + // first real non-space node + if (j === 0) { + groups.pop(); + _i2--; + } // Get the type of the current non-space node. If it's a document + // fragment, get the type of the rightmost node in the fragment. + + + var _left = getTypeOfDomTree(nonSpaces[j], "right"); // Get the type of the next non-space node. If it's a document + // fragment, get the type of the leftmost node in the fragment. + + + var _right = getTypeOfDomTree(nonSpaces[j + 1], "left"); // We use buildExpression inside of sizingGroup, but it returns a + // document fragment of elements. sizingGroup sets `isRealGroup` + // to false to avoid processing spans multiple times. + + + if (_left && _right && isRealGroup) { + var nonSpacesJp1 = assert(nonSpaces[j + 1]); + var space = isLeftTight(nonSpacesJp1) ? tightSpacings[_left][_right] : spacings[_left][_right]; + + if (space) { + var glueOptions = options; + + if (expression.length === 1) { + var node = checkNodeType(expression[0], "sizing") || checkNodeType(expression[0], "styling"); + + if (!node) {// No match. + } else if (node.type === "sizing") { + glueOptions = options.havingSize(node.size); + } else if (node.type === "styling") { + glueOptions = options.havingStyle(buildHTML_styleMap[node.style]); + } + } + + groups.push(buildCommon.makeGlue(space, glueOptions)); + } + } + + j++; + } + } + + return groups; +}; // Return the outermost node of a domTree. + +var buildHTML_getOutermostNode = function getOutermostNode(node, side) { + if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor) { + var children = node.children; + + if (children.length) { + if (side === "right") { + return getOutermostNode(children[children.length - 1], "right"); + } else if (side === "left") { + return getOutermostNode(children[0], "right"); + } + } + } + + return node; +}; // Return math atom class (mclass) of a domTree. + + +var getTypeOfDomTree = function getTypeOfDomTree(node, side) { + if (!node) { return null; + } + + node = buildHTML_getOutermostNode(node, side); // This makes a lot of assumptions as to where the type of atom + // appears. We should do a better job of enforcing this. + + return DomEnum[node.classes[0]] || null; +}; // If `node` is an atom return whether it's been assigned the mtight class. +// If `node` is a document fragment, return the value of isLeftTight() for the +// leftmost node in the fragment. +// 'mtight' indicates that the node is script or scriptscript style. + +var isLeftTight = function isLeftTight(node) { + node = buildHTML_getOutermostNode(node, "left"); + return node.hasClass("mtight"); }; - -/** - * Sometimes, groups perform special rules when they have superscripts or - * subscripts attached to them. This function lets the `supsub` group know that - * its inner element should handle the superscripts and subscripts instead of - * handling them itself. - */ -var shouldHandleSupSub = function(group, options) { - if (!group) { - return false; - } else if (group.type === "op") { - // Operators handle supsubs differently when they have limits - // (e.g. `\displaystyle\sum_2^3`) - return group.value.limits && - (options.style.size === Style.DISPLAY.size || - group.value.alwaysHandleSupSub); - } else if (group.type === "accent") { - return isCharacterBox(group.value.base); - } else { - return null; - } +var makeNullDelimiter = function makeNullDelimiter(options, classes) { + var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); + return buildHTML_makeSpan(classes.concat(moreClasses)); }; - -/** - * Sometimes we want to pull out the innermost element of a group. In most - * cases, this will just be the group itself, but when ordgroups and colors have - * a single element, we want to pull that out. - */ -var getBaseElem = function(group) { - if (!group) { - return false; - } else if (group.type === "ordgroup") { - if (group.value.length === 1) { - return getBaseElem(group.value[0]); - } else { - return group; - } - } else if (group.type === "color") { - if (group.value.value.length === 1) { - return getBaseElem(group.value.value[0]); - } else { - return group; - } - } else if (group.type === "font") { - return getBaseElem(group.value.body); - } else { - return group; - } -}; - -/** - * TeXbook algorithms often reference "character boxes", which are simply groups - * with a single character in them. To decide if something is a character box, - * we find its innermost group, and see if it is a single character. - */ -var isCharacterBox = function(group) { - var baseElem = getBaseElem(group); - - // These are all they types of groups which hold single characters - return baseElem.type === "mathord" || - baseElem.type === "textord" || - baseElem.type === "bin" || - baseElem.type === "rel" || - baseElem.type === "inner" || - baseElem.type === "open" || - baseElem.type === "close" || - baseElem.type === "punct"; -}; - -var makeNullDelimiter = function(options, classes) { - return makeSpan(classes.concat([ - "sizing", "reset-" + options.size, "size5", - options.style.reset(), Style.TEXT.cls(), - "nulldelimiter"])); -}; - -/** - * This is a map of group types to the function used to handle that type. - * Simpler types come at the beginning, while complicated types come afterwards. - */ -var groupTypes = {}; - -groupTypes.mathord = function(group, options) { - return buildCommon.makeOrd(group, options, "mathord"); -}; - -groupTypes.textord = function(group, options) { - return buildCommon.makeOrd(group, options, "textord"); -}; - -groupTypes.bin = function(group, options) { - return buildCommon.mathsym( - group.value, group.mode, options, ["mbin"]); -}; - -groupTypes.rel = function(group, options) { - return buildCommon.mathsym( - group.value, group.mode, options, ["mrel"]); -}; - -groupTypes.open = function(group, options) { - return buildCommon.mathsym( - group.value, group.mode, options, ["mopen"]); -}; - -groupTypes.close = function(group, options) { - return buildCommon.mathsym( - group.value, group.mode, options, ["mclose"]); -}; - -groupTypes.inner = function(group, options) { - return buildCommon.mathsym( - group.value, group.mode, options, ["minner"]); -}; - -groupTypes.punct = function(group, options) { - return buildCommon.mathsym( - group.value, group.mode, options, ["mpunct"]); -}; - -groupTypes.ordgroup = function(group, options) { - return makeSpan( - ["mord", options.style.cls()], - buildExpression(group.value, options.reset(), true), - options - ); -}; - -groupTypes.text = function(group, options) { - var newOptions = options.withFont(group.value.style); - var inner = buildExpression(group.value.body, newOptions, true); - for (var i = 0; i < inner.length - 1; i++) { - if (inner[i].tryCombine(inner[i + 1])) { - inner.splice(i + 1, 1); - i--; - } - } - return makeSpan(["mord", "text", newOptions.style.cls()], - inner, newOptions); -}; - -groupTypes.color = function(group, options) { - var elements = buildExpression( - group.value.value, - options.withColor(group.value.color), - false - ); - - // \color isn't supposed to affect the type of the elements it contains. - // To accomplish this, we wrap the results in a fragment, so the inner - // elements will be able to directly interact with their neighbors. For - // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` - return new buildCommon.makeFragment(elements); -}; - -groupTypes.supsub = function(group, options) { - // Superscript and subscripts are handled in the TeXbook on page - // 445-446, rules 18(a-f). - - // Here is where we defer to the inner group if it should handle - // superscripts and subscripts itself. - if (shouldHandleSupSub(group.value.base, options)) { - return groupTypes[group.value.base.type](group, options); - } - - var base = buildGroup(group.value.base, options.reset()); - var supmid; - var submid; - var sup; - var sub; - - var style = options.style; - var newOptions; - - if (group.value.sup) { - newOptions = options.withStyle(style.sup()); - sup = buildGroup(group.value.sup, newOptions); - supmid = makeSpan([style.reset(), style.sup().cls()], - [sup], newOptions); - } - - if (group.value.sub) { - newOptions = options.withStyle(style.sub()); - sub = buildGroup(group.value.sub, newOptions); - submid = makeSpan([style.reset(), style.sub().cls()], - [sub], newOptions); - } - - // Rule 18a - var supShift; - var subShift; - if (isCharacterBox(group.value.base)) { - supShift = 0; - subShift = 0; - } else { - supShift = base.height - style.metrics.supDrop; - subShift = base.depth + style.metrics.subDrop; - } - - // Rule 18c - var minSupShift; - if (style === Style.DISPLAY) { - minSupShift = style.metrics.sup1; - } else if (style.cramped) { - minSupShift = style.metrics.sup3; - } else { - minSupShift = style.metrics.sup2; - } - - // scriptspace is a font-size-independent size, so scale it - // appropriately - var multiplier = Style.TEXT.sizeMultiplier * - style.sizeMultiplier; - var scriptspace = - (0.5 / fontMetrics.metrics.ptPerEm) / multiplier + "em"; - - var supsub; - if (!group.value.sup) { - // Rule 18b - subShift = Math.max( - subShift, style.metrics.sub1, - sub.height - 0.8 * style.metrics.xHeight); - - supsub = buildCommon.makeVList([ - {type: "elem", elem: submid} - ], "shift", subShift, options); - - supsub.children[0].style.marginRight = scriptspace; - - // Subscripts shouldn't be shifted by the base's italic correction. - // Account for that by shifting the subscript back the appropriate - // amount. Note we only do this when the base is a single symbol. - if (base instanceof domTree.symbolNode) { - supsub.children[0].style.marginLeft = -base.italic + "em"; - } - } else if (!group.value.sub) { - // Rule 18c, d - supShift = Math.max(supShift, minSupShift, - sup.depth + 0.25 * style.metrics.xHeight); - - supsub = buildCommon.makeVList([ - {type: "elem", elem: supmid} - ], "shift", -supShift, options); - - supsub.children[0].style.marginRight = scriptspace; - } else { - supShift = Math.max( - supShift, minSupShift, sup.depth + 0.25 * style.metrics.xHeight); - subShift = Math.max(subShift, style.metrics.sub2); - - var ruleWidth = fontMetrics.metrics.defaultRuleThickness; - - // Rule 18e - if ((supShift - sup.depth) - (sub.height - subShift) < - 4 * ruleWidth) { - subShift = 4 * ruleWidth - (supShift - sup.depth) + sub.height; - var psi = 0.8 * style.metrics.xHeight - (supShift - sup.depth); - if (psi > 0) { - supShift += psi; - subShift -= psi; - } - } - - supsub = buildCommon.makeVList([ - {type: "elem", elem: submid, shift: subShift}, - {type: "elem", elem: supmid, shift: -supShift} - ], "individualShift", null, options); - - // See comment above about subscripts not being shifted - if (base instanceof domTree.symbolNode) { - supsub.children[0].style.marginLeft = -base.italic + "em"; - } - - supsub.children[0].style.marginRight = scriptspace; - supsub.children[1].style.marginRight = scriptspace; - } - - // We ensure to wrap the supsub vlist in a span.msupsub to reset text-align - var mclass = getTypeOfDomTree(base) || "mord"; - return makeSpan([mclass], - [base, makeSpan(["msupsub"], [supsub])], - options); -}; - -groupTypes.genfrac = function(group, options) { - // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). - // Figure out what style this fraction should be in based on the - // function used - var style = options.style; - if (group.value.size === "display") { - style = Style.DISPLAY; - } else if (group.value.size === "text") { - style = Style.TEXT; - } - - var nstyle = style.fracNum(); - var dstyle = style.fracDen(); - var newOptions; - - newOptions = options.withStyle(nstyle); - var numer = buildGroup(group.value.numer, newOptions); - var numerreset = makeSpan([style.reset(), nstyle.cls()], - [numer], newOptions); - - newOptions = options.withStyle(dstyle); - var denom = buildGroup(group.value.denom, newOptions); - var denomreset = makeSpan([style.reset(), dstyle.cls()], - [denom], newOptions); - - var ruleWidth; - if (group.value.hasBarLine) { - ruleWidth = fontMetrics.metrics.defaultRuleThickness / - options.style.sizeMultiplier; - } else { - ruleWidth = 0; - } - - // Rule 15b - var numShift; - var clearance; - var denomShift; - if (style.size === Style.DISPLAY.size) { - numShift = style.metrics.num1; - if (ruleWidth > 0) { - clearance = 3 * ruleWidth; - } else { - clearance = 7 * fontMetrics.metrics.defaultRuleThickness; - } - denomShift = style.metrics.denom1; - } else { - if (ruleWidth > 0) { - numShift = style.metrics.num2; - clearance = ruleWidth; - } else { - numShift = style.metrics.num3; - clearance = 3 * fontMetrics.metrics.defaultRuleThickness; - } - denomShift = style.metrics.denom2; - } - - var frac; - if (ruleWidth === 0) { - // Rule 15c - var candidateClearance = - (numShift - numer.depth) - (denom.height - denomShift); - if (candidateClearance < clearance) { - numShift += 0.5 * (clearance - candidateClearance); - denomShift += 0.5 * (clearance - candidateClearance); - } - - frac = buildCommon.makeVList([ - {type: "elem", elem: denomreset, shift: denomShift}, - {type: "elem", elem: numerreset, shift: -numShift} - ], "individualShift", null, options); - } else { - // Rule 15d - var axisHeight = style.metrics.axisHeight; - - if ((numShift - numer.depth) - (axisHeight + 0.5 * ruleWidth) < - clearance) { - numShift += - clearance - ((numShift - numer.depth) - - (axisHeight + 0.5 * ruleWidth)); - } - - if ((axisHeight - 0.5 * ruleWidth) - (denom.height - denomShift) < - clearance) { - denomShift += - clearance - ((axisHeight - 0.5 * ruleWidth) - - (denom.height - denomShift)); - } - - var mid = makeSpan( - [options.style.reset(), Style.TEXT.cls(), "frac-line"]); - // Manually set the height of the line because its height is - // created in CSS - mid.height = ruleWidth; - - var midShift = -(axisHeight - 0.5 * ruleWidth); - - frac = buildCommon.makeVList([ - {type: "elem", elem: denomreset, shift: denomShift}, - {type: "elem", elem: mid, shift: midShift}, - {type: "elem", elem: numerreset, shift: -numShift} - ], "individualShift", null, options); - } - - // Since we manually change the style sometimes (with \dfrac or \tfrac), - // account for the possible size change here. - frac.height *= style.sizeMultiplier / options.style.sizeMultiplier; - frac.depth *= style.sizeMultiplier / options.style.sizeMultiplier; - - // Rule 15e - var delimSize; - if (style.size === Style.DISPLAY.size) { - delimSize = style.metrics.delim1; - } else { - delimSize = style.metrics.delim2; - } - - var leftDelim; - var rightDelim; - if (group.value.leftDelim == null) { - leftDelim = makeNullDelimiter(options, ["mopen"]); - } else { - leftDelim = delimiter.customSizedDelim( - group.value.leftDelim, delimSize, true, - options.withStyle(style), group.mode, ["mopen"]); - } - if (group.value.rightDelim == null) { - rightDelim = makeNullDelimiter(options, ["mclose"]); - } else { - rightDelim = delimiter.customSizedDelim( - group.value.rightDelim, delimSize, true, - options.withStyle(style), group.mode, ["mclose"]); - } - - return makeSpan( - ["mord", options.style.reset(), style.cls()], - [leftDelim, makeSpan(["mfrac"], [frac]), rightDelim], - options); -}; - -var calculateSize = function(sizeValue, style) { - var x = sizeValue.number; - if (sizeValue.unit === "ex") { - x *= style.metrics.emPerEx; - } else if (sizeValue.unit === "mu") { - x /= 18; - } - return x; -}; - -groupTypes.array = function(group, options) { - var r; - var c; - var nr = group.value.body.length; - var nc = 0; - var body = new Array(nr); - - var style = options.style; - - // Horizontal spacing - var pt = 1 / fontMetrics.metrics.ptPerEm; - var arraycolsep = 5 * pt; // \arraycolsep in article.cls - - // Vertical spacing - var baselineskip = 12 * pt; // see size10.clo - // Default \arraystretch from lttab.dtx - // TODO(gagern): may get redefined once we have user-defined macros - var arraystretch = utils.deflt(group.value.arraystretch, 1); - var arrayskip = arraystretch * baselineskip; - var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and - var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx - - var totalHeight = 0; - for (r = 0; r < group.value.body.length; ++r) { - var inrow = group.value.body[r]; - var height = arstrutHeight; // \@array adds an \@arstrut - var depth = arstrutDepth; // to each tow (via the template) - - if (nc < inrow.length) { - nc = inrow.length; - } - - var outrow = new Array(inrow.length); - for (c = 0; c < inrow.length; ++c) { - var elt = buildGroup(inrow[c], options); - if (depth < elt.depth) { - depth = elt.depth; - } - if (height < elt.height) { - height = elt.height; - } - outrow[c] = elt; - } - - var gap = 0; - if (group.value.rowGaps[r]) { - gap = calculateSize(group.value.rowGaps[r].value, style); - if (gap > 0) { // \@argarraycr - gap += arstrutDepth; - if (depth < gap) { - depth = gap; // \@xargarraycr - } - gap = 0; - } - } - - outrow.height = height; - outrow.depth = depth; - totalHeight += height; - outrow.pos = totalHeight; - totalHeight += depth + gap; // \@yargarraycr - body[r] = outrow; - } - - var offset = totalHeight / 2 + style.metrics.axisHeight; - var colDescriptions = group.value.cols || []; - var cols = []; - var colSep; - var colDescrNum; - for (c = 0, colDescrNum = 0; - // Continue while either there are more columns or more column - // descriptions, so trailing separators don't get lost. - c < nc || colDescrNum < colDescriptions.length; - ++c, ++colDescrNum) { - - var colDescr = colDescriptions[colDescrNum] || {}; - - var firstSeparator = true; - while (colDescr.type === "separator") { - // If there is more than one separator in a row, add a space - // between them. - if (!firstSeparator) { - colSep = makeSpan(["arraycolsep"], []); - colSep.style.width = - fontMetrics.metrics.doubleRuleSep + "em"; - cols.push(colSep); - } - - if (colDescr.separator === "|") { - var separator = makeSpan( - ["vertical-separator"], - []); - separator.style.height = totalHeight + "em"; - separator.style.verticalAlign = - -(totalHeight - offset) + "em"; - - cols.push(separator); - } else { - throw new ParseError( - "Invalid separator type: " + colDescr.separator); - } - - colDescrNum++; - colDescr = colDescriptions[colDescrNum] || {}; - firstSeparator = false; - } - - if (c >= nc) { - continue; - } - - var sepwidth; - if (c > 0 || group.value.hskipBeforeAndAfter) { - sepwidth = utils.deflt(colDescr.pregap, arraycolsep); - if (sepwidth !== 0) { - colSep = makeSpan(["arraycolsep"], []); - colSep.style.width = sepwidth + "em"; - cols.push(colSep); - } - } - - var col = []; - for (r = 0; r < nr; ++r) { - var row = body[r]; - var elem = row[c]; - if (!elem) { - continue; - } - var shift = row.pos - offset; - elem.depth = row.depth; - elem.height = row.height; - col.push({type: "elem", elem: elem, shift: shift}); - } - - col = buildCommon.makeVList(col, "individualShift", null, options); - col = makeSpan( - ["col-align-" + (colDescr.align || "c")], - [col]); - cols.push(col); - - if (c < nc - 1 || group.value.hskipBeforeAndAfter) { - sepwidth = utils.deflt(colDescr.postgap, arraycolsep); - if (sepwidth !== 0) { - colSep = makeSpan(["arraycolsep"], []); - colSep.style.width = sepwidth + "em"; - cols.push(colSep); - } - } - } - body = makeSpan(["mtable"], cols); - return makeSpan(["mord"], [body], options); -}; - -groupTypes.spacing = function(group, options) { - if (group.value === "\\ " || group.value === "\\space" || - group.value === " " || group.value === "~") { - // Spaces are generated by adding an actual space. Each of these - // things has an entry in the symbols table, so these will be turned - // into appropriate outputs. - if (group.mode === "text") { - return buildCommon.makeOrd(group, options, "textord"); - } else { - return makeSpan(["mspace"], - [buildCommon.mathsym(group.value, group.mode, options)], - options); - } - } else { - // Other kinds of spaces are of arbitrary width. We use CSS to - // generate these. - return makeSpan( - ["mspace", - buildCommon.spacingFunctions[group.value].className], - [], options); - } -}; - -groupTypes.llap = function(group, options) { - var inner = makeSpan( - ["inner"], [buildGroup(group.value.body, options.reset())]); - var fix = makeSpan(["fix"], []); - return makeSpan( - ["mord", "llap", options.style.cls()], [inner, fix], options); -}; - -groupTypes.rlap = function(group, options) { - var inner = makeSpan( - ["inner"], [buildGroup(group.value.body, options.reset())]); - var fix = makeSpan(["fix"], []); - return makeSpan( - ["mord", "rlap", options.style.cls()], [inner, fix], options); -}; - -groupTypes.op = function(group, options) { - // Operators are handled in the TeXbook pg. 443-444, rule 13(a). - var supGroup; - var subGroup; - var hasLimits = false; - if (group.type === "supsub") { - // If we have limits, supsub will pass us its group to handle. Pull - // out the superscript and subscript and set the group to the op in - // its base. - supGroup = group.value.sup; - subGroup = group.value.sub; - group = group.value.base; - hasLimits = true; - } - - var style = options.style; - - // Most operators have a large successor symbol, but these don't. - var noSuccessor = [ - "\\smallint" - ]; - - var large = false; - if (style.size === Style.DISPLAY.size && - group.value.symbol && - !utils.contains(noSuccessor, group.value.body)) { - - // Most symbol operators get larger in displaystyle (rule 13) - large = true; - } - - var base; - var baseShift = 0; - var slant = 0; - if (group.value.symbol) { - // If this is a symbol, create the symbol. - var fontName = large ? "Size2-Regular" : "Size1-Regular"; - base = buildCommon.makeSymbol( - group.value.body, fontName, "math", options, - ["mop", "op-symbol", large ? "large-op" : "small-op"]); - - // Shift the symbol so its center lies on the axis (rule 13). It - // appears that our fonts have the centers of the symbols already - // almost on the axis, so these numbers are very small. Note we - // don't actually apply this here, but instead it is used either in - // the vlist creation or separately when there are no limits. - baseShift = (base.height - base.depth) / 2 - - style.metrics.axisHeight * style.sizeMultiplier; - - // The slant of the symbol is just its italic correction. - slant = base.italic; - } else if (group.value.value) { - // If this is a list, compose that list. - var inner = buildExpression(group.value.value, options, true); - - base = makeSpan(["mop"], inner, options); - } else { - // Otherwise, this is a text operator. Build the text from the - // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup - var output = []; - for (var i = 1; i < group.value.body.length; i++) { - output.push(buildCommon.mathsym(group.value.body[i], group.mode)); - } - base = makeSpan(["mop"], output, options); - } - - if (hasLimits) { - // IE 8 clips \int if it is in a display: inline-block. We wrap it - // in a new span so it is an inline, and works. - base = makeSpan([], [base]); - - var supmid; - var supKern; - var submid; - var subKern; - var newOptions; - // We manually have to handle the superscripts and subscripts. This, - // aside from the kern calculations, is copied from supsub. - if (supGroup) { - newOptions = options.withStyle(style.sup()); - var sup = buildGroup(supGroup, newOptions); - supmid = makeSpan([style.reset(), style.sup().cls()], - [sup], newOptions); - - supKern = Math.max( - fontMetrics.metrics.bigOpSpacing1, - fontMetrics.metrics.bigOpSpacing3 - sup.depth); - } - - if (subGroup) { - newOptions = options.withStyle(style.sub()); - var sub = buildGroup(subGroup, newOptions); - submid = makeSpan([style.reset(), style.sub().cls()], - [sub], newOptions); - - subKern = Math.max( - fontMetrics.metrics.bigOpSpacing2, - fontMetrics.metrics.bigOpSpacing4 - sub.height); - } - - // Build the final group as a vlist of the possible subscript, base, - // and possible superscript. - var finalGroup; - var top; - var bottom; - if (!supGroup) { - top = base.height - baseShift; - - finalGroup = buildCommon.makeVList([ - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}, - {type: "elem", elem: submid}, - {type: "kern", size: subKern}, - {type: "elem", elem: base} - ], "top", top, options); - - // Here, we shift the limits by the slant of the symbol. Note - // that we are supposed to shift the limits by 1/2 of the slant, - // but since we are centering the limits adding a full slant of - // margin will shift by 1/2 that. - finalGroup.children[0].style.marginLeft = -slant + "em"; - } else if (!subGroup) { - bottom = base.depth + baseShift; - - finalGroup = buildCommon.makeVList([ - {type: "elem", elem: base}, - {type: "kern", size: supKern}, - {type: "elem", elem: supmid}, - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5} - ], "bottom", bottom, options); - - // See comment above about slants - finalGroup.children[1].style.marginLeft = slant + "em"; - } else if (!supGroup && !subGroup) { - // This case probably shouldn't occur (this would mean the - // supsub was sending us a group with no superscript or - // subscript) but be safe. - return base; - } else { - bottom = fontMetrics.metrics.bigOpSpacing5 + - submid.height + submid.depth + - subKern + - base.depth + baseShift; - - finalGroup = buildCommon.makeVList([ - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5}, - {type: "elem", elem: submid}, - {type: "kern", size: subKern}, - {type: "elem", elem: base}, - {type: "kern", size: supKern}, - {type: "elem", elem: supmid}, - {type: "kern", size: fontMetrics.metrics.bigOpSpacing5} - ], "bottom", bottom, options); - - // See comment above about slants - finalGroup.children[0].style.marginLeft = -slant + "em"; - finalGroup.children[2].style.marginLeft = slant + "em"; - } - - return makeSpan(["mop", "op-limits"], [finalGroup], options); - } else { - if (group.value.symbol) { - base.style.top = baseShift + "em"; - } - - return base; - } -}; - -groupTypes.mod = function(group, options) { - var inner = []; - - if (group.value.modType === "bmod") { - // “\nonscript\mskip-\medmuskip\mkern5mu” - if (!options.style.isTight()) { - inner.push(makeSpan( - ["mspace", "negativemediumspace"], [], options)); - } - inner.push(makeSpan(["mspace", "thickspace"], [], options)); - } else if (options.style.size === Style.DISPLAY.size) { - inner.push(makeSpan(["mspace", "quad"], [], options)); - } else if (group.value.modType === "mod") { - inner.push(makeSpan(["mspace", "twelvemuspace"], [], options)); - } else { - inner.push(makeSpan(["mspace", "eightmuspace"], [], options)); - } - - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(buildCommon.mathsym("(", group.mode)); - } - - if (group.value.modType !== "pod") { - var modInner = [ - buildCommon.mathsym("m", group.mode), - buildCommon.mathsym("o", group.mode), - buildCommon.mathsym("d", group.mode)]; - if (group.value.modType === "bmod") { - inner.push(makeSpan(["mbin"], modInner, options)); - // “\mkern5mu\nonscript\mskip-\medmuskip” - inner.push(makeSpan(["mspace", "thickspace"], [], options)); - if (!options.style.isTight()) { - inner.push(makeSpan( - ["mspace", "negativemediumspace"], [], options)); - } - } else { - Array.prototype.push.apply(inner, modInner); - inner.push(makeSpan(["mspace", "sixmuspace"], [], options)); - } - } - - if (group.value.value) { - Array.prototype.push.apply(inner, - buildExpression(group.value.value, options, false)); - } - - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(buildCommon.mathsym(")", group.mode)); - } - - return buildCommon.makeFragment(inner); -}; - -groupTypes.katex = function(group, options) { - // The KaTeX logo. The offsets for the K and a were chosen to look - // good, but the offsets for the T, E, and X were taken from the - // definition of \TeX in TeX (see TeXbook pg. 356) - var k = makeSpan( - ["k"], [buildCommon.mathsym("K", group.mode)], options); - var a = makeSpan( - ["a"], [buildCommon.mathsym("A", group.mode)], options); - - a.height = (a.height + 0.2) * 0.75; - a.depth = (a.height - 0.2) * 0.75; - - var t = makeSpan( - ["t"], [buildCommon.mathsym("T", group.mode)], options); - var e = makeSpan( - ["e"], [buildCommon.mathsym("E", group.mode)], options); - - e.height = (e.height - 0.2155); - e.depth = (e.depth + 0.2155); - - var x = makeSpan( - ["x"], [buildCommon.mathsym("X", group.mode)], options); - - return makeSpan( - ["mord", "katex-logo"], [k, a, t, e, x], options); -}; - -groupTypes.overline = function(group, options) { - // Overlines are handled in the TeXbook pg 443, Rule 9. - var style = options.style; - - // Build the inner group in the cramped style. - var innerGroup = buildGroup(group.value.body, - options.withStyle(style.cramp())); - - var ruleWidth = fontMetrics.metrics.defaultRuleThickness / - style.sizeMultiplier; - - // Create the line above the body - var line = makeSpan( - [style.reset(), Style.TEXT.cls(), "overline-line"]); - line.height = ruleWidth; - line.maxFontSize = 1.0; - - // Generate the vlist, with the appropriate kerns - var vlist = buildCommon.makeVList([ - {type: "elem", elem: innerGroup}, - {type: "kern", size: 3 * ruleWidth}, - {type: "elem", elem: line}, - {type: "kern", size: ruleWidth} - ], "firstBaseline", null, options); - - return makeSpan(["mord", "overline"], [vlist], options); -}; - -groupTypes.underline = function(group, options) { - // Underlines are handled in the TeXbook pg 443, Rule 10. - var style = options.style; - - // Build the inner group. - var innerGroup = buildGroup(group.value.body, options); - - var ruleWidth = fontMetrics.metrics.defaultRuleThickness / - style.sizeMultiplier; - - // Create the line above the body - var line = makeSpan([style.reset(), Style.TEXT.cls(), "underline-line"]); - line.height = ruleWidth; - line.maxFontSize = 1.0; - - // Generate the vlist, with the appropriate kerns - var vlist = buildCommon.makeVList([ - {type: "kern", size: ruleWidth}, - {type: "elem", elem: line}, - {type: "kern", size: 3 * ruleWidth}, - {type: "elem", elem: innerGroup} - ], "top", innerGroup.height, options); - - return makeSpan(["mord", "underline"], [vlist], options); -}; - -groupTypes.sqrt = function(group, options) { - // Square roots are handled in the TeXbook pg. 443, Rule 11. - var style = options.style; - - // First, we do the same steps as in overline to build the inner group - // and line - var inner = buildGroup(group.value.body, options.withStyle(style.cramp())); - - var ruleWidth = fontMetrics.metrics.defaultRuleThickness / - style.sizeMultiplier; - - var line = makeSpan( - [style.reset(), Style.TEXT.cls(), "sqrt-line"], [], - options); - line.height = ruleWidth; - line.maxFontSize = 1.0; - - var phi = ruleWidth; - if (style.id < Style.TEXT.id) { - phi = style.metrics.xHeight; - } - - // Calculate the clearance between the body and line - var lineClearance = ruleWidth + phi / 4; - - var innerHeight = (inner.height + inner.depth) * style.sizeMultiplier; - var minDelimiterHeight = innerHeight + lineClearance + ruleWidth; - - // Create a \surd delimiter of the required minimum size - var delim = makeSpan(["sqrt-sign"], [ - delimiter.customSizedDelim("\\surd", minDelimiterHeight, - false, options, group.mode)], - options); - - var delimDepth = (delim.height + delim.depth) - ruleWidth; - - // Adjust the clearance based on the delimiter size - if (delimDepth > inner.height + inner.depth + lineClearance) { - lineClearance = - (lineClearance + delimDepth - inner.height - inner.depth) / 2; - } - - // Shift the delimiter so that its top lines up with the top of the line - var delimShift = -(inner.height + lineClearance + ruleWidth) + delim.height; - delim.style.top = delimShift + "em"; - delim.height -= delimShift; - delim.depth += delimShift; - - // We add a special case here, because even when `inner` is empty, we - // still get a line. So, we use a simple heuristic to decide if we - // should omit the body entirely. (note this doesn't work for something - // like `\sqrt{\rlap{x}}`, but if someone is doing that they deserve for - // it not to work. - var body; - if (inner.height === 0 && inner.depth === 0) { - body = makeSpan(); - } else { - body = buildCommon.makeVList([ - {type: "elem", elem: inner}, - {type: "kern", size: lineClearance}, - {type: "elem", elem: line}, - {type: "kern", size: ruleWidth} - ], "firstBaseline", null, options); - } - - if (!group.value.index) { - return makeSpan(["mord", "sqrt"], [delim, body], options); - } else { - // Handle the optional root index - - // The index is always in scriptscript style - var newOptions = options.withStyle(Style.SCRIPTSCRIPT); - var root = buildGroup(group.value.index, newOptions); - var rootWrap = makeSpan( - [style.reset(), Style.SCRIPTSCRIPT.cls()], - [root], - newOptions); - - // Figure out the height and depth of the inner part - var innerRootHeight = Math.max(delim.height, body.height); - var innerRootDepth = Math.max(delim.depth, body.depth); - - // The amount the index is shifted by. This is taken from the TeX - // source, in the definition of `\r@@t`. - var toShift = 0.6 * (innerRootHeight - innerRootDepth); - - // Build a VList with the superscript shifted up correctly - var rootVList = buildCommon.makeVList( - [{type: "elem", elem: rootWrap}], - "shift", -toShift, options); - // Add a class surrounding it so we can add on the appropriate - // kerning - var rootVListWrap = makeSpan(["root"], [rootVList]); - - return makeSpan(["mord", "sqrt"], - [rootVListWrap, delim, body], options); - } -}; - -groupTypes.sizing = function(group, options) { - // Handle sizing operators like \Huge. Real TeX doesn't actually allow - // these functions inside of math expressions, so we do some special - // handling. - var inner = buildExpression(group.value.value, - options.withSize(group.value.size), false); - - // Compute the correct maxFontSize. - var style = options.style; - var fontSize = buildCommon.sizingMultiplier[group.value.size]; - fontSize = fontSize * style.sizeMultiplier; - - // Add size-resetting classes to the inner list and set maxFontSize - // manually. Handle nested size changes. - for (var i = 0; i < inner.length; i++) { - var pos = utils.indexOf(inner[i].classes, "sizing"); - if (pos < 0) { - inner[i].classes.push("sizing", "reset-" + options.size, - group.value.size, style.cls()); - inner[i].maxFontSize = fontSize; - } else if (inner[i].classes[pos + 1] === "reset-" + group.value.size) { - // This is a nested size change: e.g., inner[i] is the "b" in - // `\Huge a \small b`. Override the old size (the `reset-` class) - // but not the new size. - inner[i].classes[pos + 1] = "reset-" + options.size; - } - } - - return buildCommon.makeFragment(inner); -}; - -groupTypes.styling = function(group, options) { - // Style changes are handled in the TeXbook on pg. 442, Rule 3. - - // Figure out what style we're changing to. - var styleMap = { - "display": Style.DISPLAY, - "text": Style.TEXT, - "script": Style.SCRIPT, - "scriptscript": Style.SCRIPTSCRIPT - }; - - var newStyle = styleMap[group.value.style]; - var newOptions = options.withStyle(newStyle); - - // Build the inner expression in the new style. - var inner = buildExpression( - group.value.value, newOptions, false); - - // Add style-resetting classes to the inner list. Handle nested changes. - for (var i = 0; i < inner.length; i++) { - var pos = utils.indexOf(inner[i].classes, newStyle.reset()); - if (pos < 0) { - inner[i].classes.push(options.style.reset(), newStyle.cls()); - } else { - // This is a nested style change, as `\textstyle a\scriptstyle b`. - // Only override the old style (the reset class). - inner[i].classes[pos] = options.style.reset(); - } - } - - return new buildCommon.makeFragment(inner); -}; - -groupTypes.font = function(group, options) { - var font = group.value.font; - return buildGroup(group.value.body, options.withFont(font)); -}; - -groupTypes.delimsizing = function(group, options) { - var delim = group.value.value; - - if (delim === ".") { - // Empty delimiters still count as elements, even though they don't - // show anything. - return makeSpan([group.value.mclass]); - } - - // Use delimiter.sizedDelim to generate the delimiter. - return delimiter.sizedDelim( - delim, group.value.size, options, group.mode, - [group.value.mclass]); -}; - -groupTypes.leftright = function(group, options) { - // Build the inner expression - var inner = buildExpression(group.value.body, options.reset(), true); - - var innerHeight = 0; - var innerDepth = 0; - var hadMiddle = false; - - // Calculate its height and depth - for (var i = 0; i < inner.length; i++) { - if (inner[i].isMiddle) { - hadMiddle = true; - } else { - innerHeight = Math.max(inner[i].height, innerHeight); - innerDepth = Math.max(inner[i].depth, innerDepth); - } - } - - var style = options.style; - - // The size of delimiters is the same, regardless of what style we are - // in. Thus, to correctly calculate the size of delimiter we need around - // a group, we scale down the inner size based on the size. - innerHeight *= style.sizeMultiplier; - innerDepth *= style.sizeMultiplier; - - var leftDelim; - if (group.value.left === ".") { - // Empty delimiters in \left and \right make null delimiter spaces. - leftDelim = makeNullDelimiter(options, ["mopen"]); - } else { - // Otherwise, use leftRightDelim to generate the correct sized - // delimiter. - leftDelim = delimiter.leftRightDelim( - group.value.left, innerHeight, innerDepth, options, - group.mode, ["mopen"]); - } - // Add it to the beginning of the expression - inner.unshift(leftDelim); - - // Handle middle delimiters - if (hadMiddle) { - for (i = 1; i < inner.length; i++) { - if (inner[i].isMiddle) { - // Apply the options that were active when \middle was called - inner[i] = delimiter.leftRightDelim( - inner[i].isMiddle.value, innerHeight, innerDepth, - inner[i].isMiddle.options, group.mode, []); - } - } - } - - var rightDelim; - // Same for the right delimiter - if (group.value.right === ".") { - rightDelim = makeNullDelimiter(options, ["mclose"]); - } else { - rightDelim = delimiter.leftRightDelim( - group.value.right, innerHeight, innerDepth, options, - group.mode, ["mclose"]); - } - // Add it to the end of the expression. - inner.push(rightDelim); - - return makeSpan( - ["minner", style.cls()], inner, options); -}; - -groupTypes.middle = function(group, options) { - var middleDelim; - if (group.value.value === ".") { - middleDelim = makeNullDelimiter(options, []); - } else { - middleDelim = delimiter.sizedDelim( - group.value.value, 1, options, - group.mode, []); - middleDelim.isMiddle = {value: group.value.value, options: options}; - } - return middleDelim; -}; - -groupTypes.rule = function(group, options) { - // Make an empty span for the rule - var rule = makeSpan(["mord", "rule"], [], options); - var style = options.style; - - // Calculate the shift, width, and height of the rule, and account for units - var shift = 0; - if (group.value.shift) { - shift = calculateSize(group.value.shift, style); - } - - var width = calculateSize(group.value.width, style); - var height = calculateSize(group.value.height, style); - - // The sizes of rules are absolute, so make it larger if we are in a - // smaller style. - shift /= style.sizeMultiplier; - width /= style.sizeMultiplier; - height /= style.sizeMultiplier; - - // Style the rule to the right size - rule.style.borderRightWidth = width + "em"; - rule.style.borderTopWidth = height + "em"; - rule.style.bottom = shift + "em"; - - // Record the height and width - rule.width = width; - rule.height = height + shift; - rule.depth = -shift; - - return rule; -}; - -groupTypes.kern = function(group, options) { - // Make an empty span for the rule - var rule = makeSpan(["mord", "rule"], [], options); - var style = options.style; - - var dimension = 0; - if (group.value.dimension) { - dimension = calculateSize(group.value.dimension, style); - } - - dimension /= style.sizeMultiplier; - - rule.style.marginLeft = dimension + "em"; - - return rule; -}; - -groupTypes.accent = function(group, options) { - // Accents are handled in the TeXbook pg. 443, rule 12. - var base = group.value.base; - var style = options.style; - - var supsubGroup; - if (group.type === "supsub") { - // If our base is a character box, and we have superscripts and - // subscripts, the supsub will defer to us. In particular, we want - // to attach the superscripts and subscripts to the inner body (so - // that the position of the superscripts and subscripts won't be - // affected by the height of the accent). We accomplish this by - // sticking the base of the accent into the base of the supsub, and - // rendering that, while keeping track of where the accent is. - - // The supsub group is the group that was passed in - var supsub = group; - // The real accent group is the base of the supsub group - group = supsub.value.base; - // The character box is the base of the accent group - base = group.value.base; - // Stick the character box into the base of the supsub group - supsub.value.base = base; - - // Rerender the supsub group with its new base, and store that - // result. - supsubGroup = buildGroup( - supsub, options.reset()); - } - - // Build the base group - var body = buildGroup( - base, options.withStyle(style.cramp())); - - // Calculate the skew of the accent. This is based on the line "If the - // nucleus is not a single character, let s = 0; otherwise set s to the - // kern amount for the nucleus followed by the \skewchar of its font." - // Note that our skew metrics are just the kern between each character - // and the skewchar. - var skew; - if (isCharacterBox(base)) { - // If the base is a character box, then we want the skew of the - // innermost character. To do that, we find the innermost character: - var baseChar = getBaseElem(base); - // Then, we render its group to get the symbol inside it - var baseGroup = buildGroup( - baseChar, options.withStyle(style.cramp())); - // Finally, we pull the skew off of the symbol. - skew = baseGroup.skew; - // Note that we now throw away baseGroup, because the layers we - // removed with getBaseElem might contain things like \color which - // we can't get rid of. - // TODO(emily): Find a better way to get the skew - } else { - skew = 0; - } - - // calculate the amount of space between the body and the accent - var clearance = Math.min( - body.height, - style.metrics.xHeight); - - // Build the accent - var accent = buildCommon.makeSymbol( - group.value.accent, "Main-Regular", "math", options); - // Remove the italic correction of the accent, because it only serves to - // shift the accent over to a place we don't want. - accent.italic = 0; - - // The \vec character that the fonts use is a combining character, and - // thus shows up much too far to the left. To account for this, we add a - // specific class which shifts the accent over to where we want it. - // TODO(emily): Fix this in a better way, like by changing the font - var vecClass = group.value.accent === "\\vec" ? "accent-vec" : null; - - var accentBody = makeSpan(["accent-body", vecClass], [ - makeSpan([], [accent])]); - - accentBody = buildCommon.makeVList([ - {type: "elem", elem: body}, - {type: "kern", size: -clearance}, - {type: "elem", elem: accentBody} - ], "firstBaseline", null, options); - - // Shift the accent over by the skew. Note we shift by twice the skew - // because we are centering the accent, so by adding 2*skew to the left, - // we shift it to the right by 1*skew. - accentBody.children[1].style.marginLeft = 2 * skew + "em"; - - var accentWrap = makeSpan(["mord", "accent"], [accentBody], options); - - if (supsubGroup) { - // Here, we replace the "base" child of the supsub with our newly - // generated accent. - supsubGroup.children[0] = accentWrap; - - // Since we don't rerun the height calculation after replacing the - // accent, we manually recalculate height. - supsubGroup.height = Math.max(accentWrap.height, supsubGroup.height); - - // Accents should always be ords, even when their innards are not. - supsubGroup.classes[0] = "mord"; - - return supsubGroup; - } else { - return accentWrap; - } -}; - -groupTypes.phantom = function(group, options) { - var elements = buildExpression( - group.value.value, - options.withPhantom(), - false - ); - - // \phantom isn't supposed to affect the elements it contains. - // See "color" for more details. - return new buildCommon.makeFragment(elements); -}; - -groupTypes.mclass = function(group, options) { - var elements = buildExpression(group.value.value, options, true); - - return makeSpan([group.value.mclass], elements, options); -}; - /** * buildGroup is the function that takes a group and calls the correct groupType * function for it. It also handles the interaction of size and style changes * between parents and children. */ -var buildGroup = function(group, options) { - if (!group) { - return makeSpan(); + +var buildHTML_buildGroup = function buildGroup(group, options, baseOptions) { + if (!group) { + return buildHTML_makeSpan(); + } + + if (_htmlGroupBuilders[group.type]) { + // Call the groupBuilders function + var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account + // for that size difference. + + if (baseOptions && options.size !== baseOptions.size) { + groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options); + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; + groupNode.height *= multiplier; + groupNode.depth *= multiplier; } - if (groupTypes[group.type]) { - // Call the groupTypes function - var groupNode = groupTypes[group.type](group, options); - var multiplier; - - // If the style changed between the parent and the current group, - // account for the size difference - if (options.style !== options.parentStyle) { - multiplier = options.style.sizeMultiplier / - options.parentStyle.sizeMultiplier; - - groupNode.height *= multiplier; - groupNode.depth *= multiplier; - } - - // If the size changed between the parent and the current group, account - // for that size difference. - if (options.size !== options.parentSize) { - multiplier = buildCommon.sizingMultiplier[options.size] / - buildCommon.sizingMultiplier[options.parentSize]; - - groupNode.height *= multiplier; - groupNode.depth *= multiplier; - } - - return groupNode; - } else { - throw new ParseError( - "Got group of unknown type: '" + group.type + "'"); - } + return groupNode; + } else { + throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); + } }; +/** + * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`) + * into an unbreakable HTML node of class .base, with proper struts to + * guarantee correct vertical extent. `buildHTML` calls this repeatedly to + * make up the entire expression as a sequence of unbreakable units. + */ +function buildHTMLUnbreakable(children, options) { + // Compute height and depth of this chunk. + var body = buildHTML_makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at + // the height of the expression, and the bottom of the HTML element + // falls at the depth of the expression. + // We used to have separate top and bottom struts, where the bottom strut + // would like to use `vertical-align: top`, but in IE 9 this lowers the + // baseline of the box to the bottom of this strut (instead of staying in + // the normal place) so we use an absolute value for vertical-align instead. + + var strut = buildHTML_makeSpan(["strut"]); + strut.style.height = body.height + body.depth + "em"; + strut.style.verticalAlign = -body.depth + "em"; + body.children.unshift(strut); + return body; +} /** * Take an entire parse tree, and build it into an appropriate set of HTML * nodes. */ -var buildHTML = function(tree, options) { - // buildExpression is destructive, so we need to make a clone - // of the incoming tree so that it isn't accidentally changed - tree = JSON.parse(JSON.stringify(tree)); - // Build the expression contained in the tree - var expression = buildExpression(tree, options, true); - var body = makeSpan(["base", options.style.cls()], expression, options); - // Add struts, which ensure that the top of the HTML element falls at the - // height of the expression, and the bottom of the HTML element falls at the - // depth of the expression. - var topStrut = makeSpan(["strut"]); - var bottomStrut = makeSpan(["strut", "bottom"]); +function buildHTML(tree, options) { + // Strip off outer tag wrapper for processing below. + var tag = null; - topStrut.style.height = body.height + "em"; - bottomStrut.style.height = (body.height + body.depth) + "em"; - // We'd like to use `vertical-align: top` but in IE 9 this lowers the - // baseline of the box to the bottom of this strut (instead staying in the - // normal place) so we use an absolute value for vertical-align instead - bottomStrut.style.verticalAlign = -body.depth + "em"; + if (tree.length === 1 && tree[0].type === "tag") { + tag = tree[0].tag; + tree = tree[0].body; + } // Build the expression contained in the tree - // Wrap the struts and body together - var htmlNode = makeSpan(["katex-html"], [topStrut, bottomStrut, body]); - htmlNode.setAttribute("aria-hidden", "true"); + var expression = buildHTML_buildExpression(tree, options, true); + var children = []; // Create one base node for each chunk between potential line breaks. + // The TeXBook [p.173] says "A formula will be broken only after a + // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary + // operation symbol like $+$ or $-$ or $\times$, where the relation or + // binary operation is on the ``outer level'' of the formula (i.e., not + // enclosed in {...} and not part of an \over construction)." - return htmlNode; -}; + var parts = []; -module.exports = buildHTML; + for (var i = 0; i < expression.length; i++) { + parts.push(expression[i]); -},{"./ParseError":6,"./Style":9,"./buildCommon":10,"./delimiter":14,"./domTree":15,"./fontMetrics":17,"./utils":25}],12:[function(require,module,exports){ + if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) { + // Put any post-operator glue on same line as operator. + // Watch for \nobreak along the way. + var nobreak = false; + + while (i < expression.length - 1 && expression[i + 1].hasClass("mspace")) { + i++; + parts.push(expression[i]); + + if (expression[i].hasClass("nobreak")) { + nobreak = true; + } + } // Don't allow break if \nobreak among the post-operator glue. + + + if (!nobreak) { + children.push(buildHTMLUnbreakable(parts, options)); + parts = []; + } + } else if (expression[i].hasClass("newline")) { + // Write the line except the newline + parts.pop(); + + if (parts.length > 0) { + children.push(buildHTMLUnbreakable(parts, options)); + parts = []; + } // Put the newline at the top level + + + children.push(expression[i]); + } + } + + if (parts.length > 0) { + children.push(buildHTMLUnbreakable(parts, options)); + } // Now, if there was a tag, build it too and append it as a final child. + + + var tagChild; + + if (tag) { + tagChild = buildHTMLUnbreakable(buildHTML_buildExpression(tag, options, true)); + tagChild.classes = ["tag"]; + children.push(tagChild); + } + + var htmlNode = buildHTML_makeSpan(["katex-html"], children); + htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children + // (the height of the enclosing htmlNode) for proper vertical alignment. + + if (tagChild) { + var strut = tagChild.children[0]; + strut.style.height = htmlNode.height + htmlNode.depth + "em"; + strut.style.verticalAlign = -htmlNode.depth + "em"; + } + + return htmlNode; +} +// CONCATENATED MODULE: ./src/mathMLTree.js +/** + * These objects store data about MathML nodes. This is the MathML equivalent + * of the types in domTree.js. Since MathML handles its own rendering, and + * since we're mainly using MathML to improve accessibility, we don't manage + * any of the styling state that the plain DOM nodes do. + * + * The `toNode` and `toMarkup` functions work simlarly to how they do in + * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. + */ + + +function newDocumentFragment(children) { + return new tree_DocumentFragment(children); +} +/** + * This node represents a general purpose MathML node of any type. The + * constructor requires the type of node to create (for example, `"mo"` or + * `"mspace"`, corresponding to `` and `` tags). + */ + +var mathMLTree_MathNode = +/*#__PURE__*/ +function () { + function MathNode(type, children) { + this.type = void 0; + this.attributes = void 0; + this.children = void 0; + this.type = type; + this.attributes = {}; + this.children = children || []; + } + /** + * Sets an attribute on a MathML node. MathML depends on attributes to convey a + * semantic content, so this is used heavily. + */ + + + var _proto = MathNode.prototype; + + _proto.setAttribute = function setAttribute(name, value) { + this.attributes[name] = value; + }; + /** + * Gets an attribute on a MathML node. + */ + + + _proto.getAttribute = function getAttribute(name) { + return this.attributes[name]; + }; + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + + + _proto.toNode = function toNode() { + var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + for (var i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + + return node; + }; + /** + * Converts the math node into an HTML markup string. + */ + + + _proto.toMarkup = function toMarkup() { + var markup = "<" + this.type; // Add the attributes + + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + markup += " " + attr + "=\""; + markup += utils.escape(this.attributes[attr]); + markup += "\""; + } + } + + markup += ">"; + + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + markup += ""; + return markup; + }; + /** + * Converts the math node into a string, similar to innerText, but escaped. + */ + + + _proto.toText = function toText() { + return this.children.map(function (child) { + return child.toText(); + }).join(""); + }; + + return MathNode; +}(); +/** + * This node represents a piece of text. + */ + +var mathMLTree_TextNode = +/*#__PURE__*/ +function () { + function TextNode(text, needsEscape) { + if (needsEscape === void 0) { + needsEscape = true; + } + + this.text = void 0; + this.needsEscape = void 0; + this.text = text; + this.needsEscape = needsEscape; + } + /** + * Converts the text node into a DOM text node. + */ + + + var _proto2 = TextNode.prototype; + + _proto2.toNode = function toNode() { + return document.createTextNode(this.toText()); + }; + /** + * Converts the text node into escaped HTML markup + * (representing the text itself). + */ + + + _proto2.toMarkup = function toMarkup() { + return this.toText(); + }; + /** + * Converts the text node into an escaped string + * (representing the text iteself). + */ + + + _proto2.toText = function toText() { + return this.needsEscape ? utils.escape(this.text) : this.text; + }; + + return TextNode; +}(); +/** + * This node represents a space, but may render as or as text, + * depending on the width. + */ + +var SpaceNode = +/*#__PURE__*/ +function () { + /** + * Create a Space node with width given in CSS ems. + */ + function SpaceNode(width) { + this.width = void 0; + this.character = void 0; + this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html + // for a table of space-like characters. We consistently use the + // &LongNames; because Unicode does not have single characters for + //    (\u2005\u200a) and all negative spaces. + + if (width >= 0.05555 && width <= 0.05556) { + this.character = " "; // \u200a + } else if (width >= 0.1666 && width <= 0.1667) { + this.character = " "; // \u2009 + } else if (width >= 0.2222 && width <= 0.2223) { + this.character = " "; // \u2005 + } else if (width >= 0.2777 && width <= 0.2778) { + this.character = "  "; // \u2005\u200a + } else if (width >= -0.05556 && width <= -0.05555) { + this.character = "​"; + } else if (width >= -0.1667 && width <= -0.1666) { + this.character = "​"; + } else if (width >= -0.2223 && width <= -0.2222) { + this.character = "​"; + } else if (width >= -0.2778 && width <= -0.2777) { + this.character = "​"; + } else { + this.character = null; + } + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + + + var _proto3 = SpaceNode.prototype; + + _proto3.toNode = function toNode() { + if (this.character) { + return document.createTextNode(this.character); + } else { + var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); + node.setAttribute("width", this.width + "em"); + return node; + } + }; + /** + * Converts the math node into an HTML markup string. + */ + + + _proto3.toMarkup = function toMarkup() { + if (this.character) { + return "" + this.character + ""; + } else { + return ""; + } + }; + /** + * Converts the math node into a string, similar to innerText. + */ + + + _proto3.toText = function toText() { + if (this.character) { + return this.character; + } else { + return " "; + } + }; + + return SpaceNode; +}(); + +/* harmony default export */ var mathMLTree = ({ + MathNode: mathMLTree_MathNode, + TextNode: mathMLTree_TextNode, + SpaceNode: SpaceNode, + newDocumentFragment: newDocumentFragment +}); +// CONCATENATED MODULE: ./src/buildMathML.js /** * This file converts a parse tree into a cooresponding MathML tree. The main * entry point is the `buildMathML` function, which takes a parse tree from the * parser. */ -var buildCommon = require("./buildCommon"); -var fontMetrics = require("./fontMetrics"); -var mathMLTree = require("./mathMLTree"); -var ParseError = require("./ParseError"); -var symbols = require("./symbols"); -var utils = require("./utils"); -var makeSpan = buildCommon.makeSpan; -var fontMap = buildCommon.fontMap; + + + + + + /** * Takes a symbol and converts it into a MathML text node after performing * optional replacement from symbols.js. */ -var makeText = function(text, mode) { - if (symbols[mode][text] && symbols[mode][text].replace) { - text = symbols[mode][text].replace; - } +var buildMathML_makeText = function makeText(text, mode, options) { + if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { + text = src_symbols[mode][text].replace; + } - return new mathMLTree.TextNode(text); + return new mathMLTree.TextNode(text); }; +/** + * Wrap the given array of nodes in an node if needed, i.e., + * unless the array has length 1. Always returns a single node. + */ +var buildMathML_makeRow = function makeRow(body) { + if (body.length === 1) { + return body[0]; + } else { + return new mathMLTree.MathNode("mrow", body); + } +}; /** * Returns the math variant as a string or null if none is required. */ -var getVariant = function(group, options) { - var font = options.font; - if (!font) { - return null; - } - var mode = group.mode; - if (font === "mathit") { - return "italic"; +var buildMathML_getVariant = function getVariant(group, options) { + // Handle \text... font specifiers as best we can. + // MathML has a limited list of allowable mathvariant specifiers; see + // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt + if (options.fontFamily === "texttt") { + return "monospace"; + } else if (options.fontFamily === "textsf") { + if (options.fontShape === "textit" && options.fontWeight === "textbf") { + return "sans-serif-bold-italic"; + } else if (options.fontShape === "textit") { + return "sans-serif-italic"; + } else if (options.fontWeight === "textbf") { + return "bold-sans-serif"; + } else { + return "sans-serif"; } + } else if (options.fontShape === "textit" && options.fontWeight === "textbf") { + return "bold-italic"; + } else if (options.fontShape === "textit") { + return "italic"; + } else if (options.fontWeight === "textbf") { + return "bold"; + } - var value = group.value; - if (utils.contains(["\\imath", "\\jmath"], value)) { - return null; - } - - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; - } - - var fontName = fontMap[font].fontName; - if (fontMetrics.getCharacterMetrics(value, fontName)) { - return fontMap[options.font].variant; - } + var font = options.font; + if (!font || font === "mathnormal") { return null; + } + + var mode = group.mode; + + if (font === "mathit") { + return "italic"; + } else if (font === "boldsymbol") { + return "bold-italic"; + } + + var text = group.text; + + if (utils.contains(["\\imath", "\\jmath"], text)) { + return null; + } + + if (src_symbols[mode][text] && src_symbols[mode][text].replace) { + text = src_symbols[mode][text].replace; + } + + var fontName = buildCommon.fontMap[font].fontName; + + if (getCharacterMetrics(text, fontName, mode)) { + return buildCommon.fontMap[font].variant; + } + + return null; }; - -/** - * Functions for handling the different types of groups found in the parse - * tree. Each function should take a parse group and return a MathML node. - */ -var groupTypes = {}; - -groupTypes.mathord = function(group, options) { - var node = new mathMLTree.MathNode( - "mi", - [makeText(group.value, group.mode)]); - - var variant = getVariant(group, options); - if (variant) { - node.setAttribute("mathvariant", variant); - } - return node; -}; - -groupTypes.textord = function(group, options) { - var text = makeText(group.value, group.mode); - - var variant = getVariant(group, options) || "normal"; - - var node; - if (/[0-9]/.test(group.value)) { - // TODO(kevinb) merge adjacent nodes - // do it as a post processing step - node = new mathMLTree.MathNode("mn", [text]); - if (options.font) { - node.setAttribute("mathvariant", variant); - } - } else { - node = new mathMLTree.MathNode("mi", [text]); - node.setAttribute("mathvariant", variant); - } - - return node; -}; - -groupTypes.bin = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.rel = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.open = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.close = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.inner = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); - - return node; -}; - -groupTypes.punct = function(group) { - var node = new mathMLTree.MathNode( - "mo", [makeText(group.value, group.mode)]); - - node.setAttribute("separator", "true"); - - return node; -}; - -groupTypes.ordgroup = function(group, options) { - var inner = buildExpression(group.value, options); - - var node = new mathMLTree.MathNode("mrow", inner); - - return node; -}; - -groupTypes.text = function(group, options) { - var inner = buildExpression(group.value.body, options); - - var node = new mathMLTree.MathNode("mtext", inner); - - return node; -}; - -groupTypes.color = function(group, options) { - var inner = buildExpression(group.value.value, options); - - var node = new mathMLTree.MathNode("mstyle", inner); - - node.setAttribute("mathcolor", group.value.color); - - return node; -}; - -groupTypes.supsub = function(group, options) { - var children = [buildGroup(group.value.base, options)]; - - if (group.value.sub) { - children.push(buildGroup(group.value.sub, options)); - } - - if (group.value.sup) { - children.push(buildGroup(group.value.sup, options)); - } - - var nodeType; - if (!group.value.sub) { - nodeType = "msup"; - } else if (!group.value.sup) { - nodeType = "msub"; - } else { - nodeType = "msubsup"; - } - - var node = new mathMLTree.MathNode(nodeType, children); - - return node; -}; - -groupTypes.genfrac = function(group, options) { - var node = new mathMLTree.MathNode( - "mfrac", - [buildGroup(group.value.numer, options), - buildGroup(group.value.denom, options)]); - - if (!group.value.hasBarLine) { - node.setAttribute("linethickness", "0px"); - } - - if (group.value.leftDelim != null || group.value.rightDelim != null) { - var withDelims = []; - - if (group.value.leftDelim != null) { - var leftOp = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode(group.value.leftDelim)]); - - leftOp.setAttribute("fence", "true"); - - withDelims.push(leftOp); - } - - withDelims.push(node); - - if (group.value.rightDelim != null) { - var rightOp = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode(group.value.rightDelim)]); - - rightOp.setAttribute("fence", "true"); - - withDelims.push(rightOp); - } - - var outerNode = new mathMLTree.MathNode("mrow", withDelims); - - return outerNode; - } - - return node; -}; - -groupTypes.array = function(group, options) { - return new mathMLTree.MathNode( - "mtable", group.value.body.map(function(row) { - return new mathMLTree.MathNode( - "mtr", row.map(function(cell) { - return new mathMLTree.MathNode( - "mtd", [buildGroup(cell, options)]); - })); - })); -}; - -groupTypes.sqrt = function(group, options) { - var node; - if (group.value.index) { - node = new mathMLTree.MathNode( - "mroot", [ - buildGroup(group.value.body, options), - buildGroup(group.value.index, options) - ]); - } else { - node = new mathMLTree.MathNode( - "msqrt", [buildGroup(group.value.body, options)]); - } - - return node; -}; - -groupTypes.leftright = function(group, options) { - var inner = buildExpression(group.value.body, options); - - if (group.value.left !== ".") { - var leftNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.left, group.mode)]); - - leftNode.setAttribute("fence", "true"); - - inner.unshift(leftNode); - } - - if (group.value.right !== ".") { - var rightNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.right, group.mode)]); - - rightNode.setAttribute("fence", "true"); - - inner.push(rightNode); - } - - var outerNode = new mathMLTree.MathNode("mrow", inner); - - return outerNode; -}; - -groupTypes.middle = function(group, options) { - var middleNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.middle, group.mode)]); - middleNode.setAttribute("fence", "true"); - return middleNode; -}; - -groupTypes.accent = function(group, options) { - var accentNode = new mathMLTree.MathNode( - "mo", [makeText(group.value.accent, group.mode)]); - - var node = new mathMLTree.MathNode( - "mover", - [buildGroup(group.value.base, options), - accentNode]); - - node.setAttribute("accent", "true"); - - return node; -}; - -groupTypes.spacing = function(group) { - var node; - - if (group.value === "\\ " || group.value === "\\space" || - group.value === " " || group.value === "~") { - node = new mathMLTree.MathNode( - "mtext", [new mathMLTree.TextNode("\u00a0")]); - } else { - node = new mathMLTree.MathNode("mspace"); - - node.setAttribute( - "width", buildCommon.spacingFunctions[group.value].size); - } - - return node; -}; - -groupTypes.op = function(group, options) { - var node; - - // TODO(emily): handle big operators using the `largeop` attribute - - if (group.value.symbol) { - // This is a symbol. Just add the symbol. - node = new mathMLTree.MathNode( - "mo", [makeText(group.value.body, group.mode)]); - } else if (group.value.value) { - // This is an operator with children. Add them. - node = new mathMLTree.MathNode( - "mo", buildExpression(group.value.value, options)); - } else { - // This is a text operator. Add all of the characters from the - // operator's name. - // TODO(emily): Add a space in the middle of some of these - // operators, like \limsup. - node = new mathMLTree.MathNode( - "mi", [new mathMLTree.TextNode(group.value.body.slice(1))]); - } - - return node; -}; - -groupTypes.mod = function(group, options) { - var inner = []; - - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(new mathMLTree.MathNode( - "mo", [makeText("(", group.mode)])); - } - if (group.value.modType !== "pod") { - inner.push(new mathMLTree.MathNode( - "mo", [makeText("mod", group.mode)])); - } - if (group.value.value) { - var space = new mathMLTree.MathNode("mspace"); - space.setAttribute("width", "0.333333em"); - inner.push(space); - inner = inner.concat(buildExpression(group.value.value, options)); - } - if (group.value.modType === "pod" || group.value.modType === "pmod") { - inner.push(new mathMLTree.MathNode( - "mo", [makeText(")", group.mode)])); - } - - return new mathMLTree.MathNode("mo", inner); -}; - -groupTypes.katex = function(group) { - var node = new mathMLTree.MathNode( - "mtext", [new mathMLTree.TextNode("KaTeX")]); - - return node; -}; - -groupTypes.font = function(group, options) { - var font = group.value.font; - return buildGroup(group.value.body, options.withFont(font)); -}; - -groupTypes.delimsizing = function(group) { - var children = []; - - if (group.value.value !== ".") { - children.push(makeText(group.value.value, group.mode)); - } - - var node = new mathMLTree.MathNode("mo", children); - - if (group.value.mclass === "mopen" || - group.value.mclass === "mclose") { - // Only some of the delimsizing functions act as fences, and they - // return "mopen" or "mclose" mclass. - node.setAttribute("fence", "true"); - } else { - // Explicitly disable fencing if it's not a fence, to override the - // defaults. - node.setAttribute("fence", "false"); - } - - return node; -}; - -groupTypes.styling = function(group, options) { - var inner = buildExpression(group.value.value, options); - - var node = new mathMLTree.MathNode("mstyle", inner); - - var styleAttributes = { - "display": ["0", "true"], - "text": ["0", "false"], - "script": ["1", "false"], - "scriptscript": ["2", "false"] - }; - - var attr = styleAttributes[group.value.style]; - - node.setAttribute("scriptlevel", attr[0]); - node.setAttribute("displaystyle", attr[1]); - - return node; -}; - -groupTypes.sizing = function(group, options) { - var inner = buildExpression(group.value.value, options); - - var node = new mathMLTree.MathNode("mstyle", inner); - - // TODO(emily): This doesn't produce the correct size for nested size - // changes, because we don't keep state of what style we're currently - // in, so we can't reset the size to normal before changing it. Now - // that we're passing an options parameter we should be able to fix - // this. - node.setAttribute( - "mathsize", buildCommon.sizingMultiplier[group.value.size] + "em"); - - return node; -}; - -groupTypes.overline = function(group, options) { - var operator = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode("\u203e")]); - operator.setAttribute("stretchy", "true"); - - var node = new mathMLTree.MathNode( - "mover", - [buildGroup(group.value.body, options), - operator]); - node.setAttribute("accent", "true"); - - return node; -}; - -groupTypes.underline = function(group, options) { - var operator = new mathMLTree.MathNode( - "mo", [new mathMLTree.TextNode("\u203e")]); - operator.setAttribute("stretchy", "true"); - - var node = new mathMLTree.MathNode( - "munder", - [buildGroup(group.value.body, options), - operator]); - node.setAttribute("accentunder", "true"); - - return node; -}; - -groupTypes.rule = function(group) { - // TODO(emily): Figure out if there's an actual way to draw black boxes - // in MathML. - var node = new mathMLTree.MathNode("mrow"); - - return node; -}; - -groupTypes.kern = function(group) { - // TODO(kevin): Figure out if there's a way to add space in MathML - var node = new mathMLTree.MathNode("mrow"); - - return node; -}; - -groupTypes.llap = function(group, options) { - var node = new mathMLTree.MathNode( - "mpadded", [buildGroup(group.value.body, options)]); - - node.setAttribute("lspace", "-1width"); - node.setAttribute("width", "0px"); - - return node; -}; - -groupTypes.rlap = function(group, options) { - var node = new mathMLTree.MathNode( - "mpadded", [buildGroup(group.value.body, options)]); - - node.setAttribute("width", "0px"); - - return node; -}; - -groupTypes.phantom = function(group, options) { - var inner = buildExpression(group.value.value, options); - return new mathMLTree.MathNode("mphantom", inner); -}; - -groupTypes.mclass = function(group, options) { - var inner = buildExpression(group.value.value, options); - return new mathMLTree.MathNode("mstyle", inner); -}; - /** * Takes a list of nodes, builds them, and returns a list of the generated - * MathML nodes. A little simpler than the HTML version because we don't do any - * previous-node handling. + * MathML nodes. Also combine consecutive outputs into a single + * tag. */ -var buildExpression = function(expression, options) { - var groups = []; - for (var i = 0; i < expression.length; i++) { - var group = expression[i]; - groups.push(buildGroup(group, options)); - } - return groups; -}; +var buildMathML_buildExpression = function buildExpression(expression, options) { + var groups = []; + var lastGroup; + + for (var i = 0; i < expression.length; i++) { + var group = buildMathML_buildGroup(expression[i], options); + + if (group instanceof mathMLTree_MathNode && lastGroup instanceof mathMLTree_MathNode) { + // Concatenate adjacent s + if (group.type === 'mtext' && lastGroup.type === 'mtext' && group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { + var _lastGroup$children; + + (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, group.children); + + continue; // Concatenate adjacent s + } else if (group.type === 'mn' && lastGroup.type === 'mn') { + var _lastGroup$children2; + + (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, group.children); + + continue; // Concatenate ... followed by . + } else if (group.type === 'mi' && group.children.length === 1 && lastGroup.type === 'mn') { + var child = group.children[0]; + + if (child instanceof mathMLTree_TextNode && child.text === '.') { + var _lastGroup$children3; + + (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, group.children); + + continue; + } + } + } + + groups.push(group); + lastGroup = group; + } // TODO(kevinb): combine \\not with mrels and mords + + + return groups; +}; /** - * Takes a group from the parser and calls the appropriate groupTypes function + * Equivalent to buildExpression, but wraps the elements in an + * if there's more than one. Returns a single node instead of an array. + */ + +var buildExpressionRow = function buildExpressionRow(expression, options) { + return buildMathML_makeRow(buildMathML_buildExpression(expression, options)); +}; +/** + * Takes a group from the parser and calls the appropriate groupBuilders function * on it to produce a MathML node. */ -var buildGroup = function(group, options) { - if (!group) { - return new mathMLTree.MathNode("mrow"); - } - if (groupTypes[group.type]) { - // Call the groupTypes function - return groupTypes[group.type](group, options); - } else { - throw new ParseError( - "Got group of unknown type: '" + group.type + "'"); - } +var buildMathML_buildGroup = function buildGroup(group, options) { + if (!group) { + return new mathMLTree.MathNode("mrow"); + } + + if (_mathmlGroupBuilders[group.type]) { + // Call the groupBuilders function + var result = _mathmlGroupBuilders[group.type](group, options); + return result; + } else { + throw new src_ParseError("Got group of unknown type: '" + group.type + "'"); + } }; - /** * Takes a full parse tree and settings and builds a MathML representation of * it. In particular, we put the elements from building the parse tree into a @@ -4202,73 +7015,1025 @@ var buildGroup = function(group, options) { * Note that we actually return a domTree element with a `` inside it so * we can do appropriate styling. */ -var buildMathML = function(tree, texExpression, options) { - var expression = buildExpression(tree, options); - // Wrap up the expression in an mrow so it is presented in the semantics - // tag correctly. - var wrapper = new mathMLTree.MathNode("mrow", expression); +function buildMathML(tree, texExpression, options) { + var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics + // tag correctly, unless it's a single or . - // Build a TeX annotation of the source - var annotation = new mathMLTree.MathNode( - "annotation", [new mathMLTree.TextNode(texExpression)]); + var wrapper; - annotation.setAttribute("encoding", "application/x-tex"); + if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { + wrapper = expression[0]; + } else { + wrapper = new mathMLTree.MathNode("mrow", expression); + } // Build a TeX annotation of the source - var semantics = new mathMLTree.MathNode( - "semantics", [wrapper, annotation]); - var math = new mathMLTree.MathNode("math", [semantics]); + var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); + annotation.setAttribute("encoding", "application/x-tex"); + var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); + var math = new mathMLTree.MathNode("math", [semantics]); // You can't style nodes, so we wrap the node in a span. + // NOTE: The span class is not typed to have nodes as children, and + // we don't want to make the children type more generic since the children + // of span are expected to have more fields in `buildHtml` contexts. + // $FlowFixMe - // You can't style nodes, so we wrap the node in a span. - return makeSpan(["katex-mathml"], [math]); + return buildCommon.makeSpan(["katex-mathml"], [math]); +} +// CONCATENATED MODULE: ./src/buildTree.js + + + + + + + +var buildTree_optionsFromSettings = function optionsFromSettings(settings) { + return new src_Options({ + style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT, + maxSize: settings.maxSize + }); }; -module.exports = buildMathML; +var buildTree_buildTree = function buildTree(tree, expression, settings) { + var options = buildTree_optionsFromSettings(settings); + var mathMLNode = buildMathML(tree, expression, options); + var htmlNode = buildHTML(tree, options); + var katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, htmlNode]); -},{"./ParseError":6,"./buildCommon":10,"./fontMetrics":17,"./mathMLTree":20,"./symbols":23,"./utils":25}],13:[function(require,module,exports){ -var buildHTML = require("./buildHTML"); -var buildMathML = require("./buildMathML"); -var buildCommon = require("./buildCommon"); -var Options = require("./Options"); -var Settings = require("./Settings"); -var Style = require("./Style"); + if (settings.displayMode) { + return buildCommon.makeSpan(["katex-display"], [katexNode]); + } else { + return katexNode; + } +}; +var buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) { + var options = buildTree_optionsFromSettings(settings); + var htmlNode = buildHTML(tree, options); + var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); -var makeSpan = buildCommon.makeSpan; + if (settings.displayMode) { + return buildCommon.makeSpan(["katex-display"], [katexNode]); + } else { + return katexNode; + } +}; +/* harmony default export */ var src_buildTree = (buildTree_buildTree); +// CONCATENATED MODULE: ./src/stretchy.js +/** + * This file provides support to buildMathML.js and buildHTML.js + * for stretchy wide elements rendered from SVG files + * and other CSS trickery. + */ -var buildTree = function(tree, expression, settings) { - settings = settings || new Settings({}); - var startStyle = Style.TEXT; - if (settings.displayMode) { - startStyle = Style.DISPLAY; - } - // Setup the default options - var options = new Options({ - style: startStyle, - size: "size5" - }); - // `buildHTML` sometimes messes with the parse tree (like turning bins -> - // ords), so we build the MathML version first. - var mathMLNode = buildMathML(tree, expression, options); - var htmlNode = buildHTML(tree, options); +var stretchyCodePoint = { + widehat: "^", + widecheck: "ˇ", + widetilde: "~", + utilde: "~", + overleftarrow: "\u2190", + underleftarrow: "\u2190", + xleftarrow: "\u2190", + overrightarrow: "\u2192", + underrightarrow: "\u2192", + xrightarrow: "\u2192", + underbrace: "\u23B5", + overbrace: "\u23DE", + overleftrightarrow: "\u2194", + underleftrightarrow: "\u2194", + xleftrightarrow: "\u2194", + Overrightarrow: "\u21D2", + xRightarrow: "\u21D2", + overleftharpoon: "\u21BC", + xleftharpoonup: "\u21BC", + overrightharpoon: "\u21C0", + xrightharpoonup: "\u21C0", + xLeftarrow: "\u21D0", + xLeftrightarrow: "\u21D4", + xhookleftarrow: "\u21A9", + xhookrightarrow: "\u21AA", + xmapsto: "\u21A6", + xrightharpoondown: "\u21C1", + xleftharpoondown: "\u21BD", + xrightleftharpoons: "\u21CC", + xleftrightharpoons: "\u21CB", + xtwoheadleftarrow: "\u219E", + xtwoheadrightarrow: "\u21A0", + xlongequal: "=", + xtofrom: "\u21C4", + xrightleftarrows: "\u21C4", + xrightequilibrium: "\u21CC", + // Not a perfect match. + xleftequilibrium: "\u21CB" // None better available. - var katexNode = makeSpan(["katex"], [ - mathMLNode, htmlNode - ]); +}; - if (settings.displayMode) { - return makeSpan(["katex-display"], [katexNode]); +var stretchy_mathMLnode = function mathMLnode(label) { + var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); + node.setAttribute("stretchy", "true"); + return node; +}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. +// Copyright (c) 2009-2010, Design Science, Inc. () +// Copyright (c) 2014-2017 Khan Academy () +// Licensed under the SIL Open Font License, Version 1.1. +// See \nhttp://scripts.sil.org/OFL +// Very Long SVGs +// Many of the KaTeX stretchy wide elements use a long SVG image and an +// overflow: hidden tactic to achieve a stretchy image while avoiding +// distortion of arrowheads or brace corners. +// The SVG typically contains a very long (400 em) arrow. +// The SVG is in a container span that has overflow: hidden, so the span +// acts like a window that exposes only part of the SVG. +// The SVG always has a longer, thinner aspect ratio than the container span. +// After the SVG fills 100% of the height of the container span, +// there is a long arrow shaft left over. That left-over shaft is not shown. +// Instead, it is sliced off because the span's CSS has overflow: hidden. +// Thus, the reader sees an arrow that matches the subject matter width +// without distortion. +// Some functions, such as \cancel, need to vary their aspect ratio. These +// functions do not get the overflow SVG treatment. +// Second Brush Stroke +// Low resolution monitors struggle to display images in fine detail. +// So browsers apply anti-aliasing. A long straight arrow shaft therefore +// will sometimes appear as if it has a blurred edge. +// To mitigate this, these SVG files contain a second "brush-stroke" on the +// arrow shafts. That is, a second long thin rectangular SVG path has been +// written directly on top of each arrow shaft. This reinforcement causes +// some of the screen pixels to display as black instead of the anti-aliased +// gray pixel that a single path would generate. So we get arrow shafts +// whose edges appear to be sharper. +// In the katexImagesData object just below, the dimensions all +// correspond to path geometry inside the relevant SVG. +// For example, \overrightarrow uses the same arrowhead as glyph U+2192 +// from the KaTeX Main font. The scaling factor is 1000. +// That is, inside the font, that arrowhead is 522 units tall, which +// corresponds to 0.522 em inside the document. + + +var katexImagesData = { + // path(s), minWidth, height, align + overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], + xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], + xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], + overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], + overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], + xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], + xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], + overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], + underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], + underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], + xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], + xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], + xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], + overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + overgroup: [["leftgroup", "rightgroup"], 0.888, 342], + undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], + xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], + xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], + // The next three arrows are from the mhchem package. + // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the + // document as \xrightarrow or \xrightleftharpoons. Those have + // min-length = 1.75em, so we set min-length on these next three to match. + xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], + xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], + xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] +}; + +var groupLength = function groupLength(arg) { + if (arg.type === "ordgroup") { + return arg.body.length; + } else { + return 1; + } +}; + +var stretchy_svgSpan = function svgSpan(group, options) { + // Create a span with inline SVG for the element. + function buildSvgSpan_() { + var viewBoxWidth = 400000; // default + + var label = group.label.substr(1); + + if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { + // Each type in the `if` statement corresponds to one of the ParseNode + // types below. This narrowing is required to access `grp.base`. + var grp = group; // There are four SVG images available for each function. + // Choose a taller image when there are more characters. + + var numChars = groupLength(grp.base); + var viewBoxHeight; + var pathName; + + var _height; + + if (numChars > 5) { + if (label === "widehat" || label === "widecheck") { + viewBoxHeight = 420; + viewBoxWidth = 2364; + _height = 0.42; + pathName = label + "4"; + } else { + viewBoxHeight = 312; + viewBoxWidth = 2340; + _height = 0.34; + pathName = "tilde4"; + } + } else { + var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; + + if (label === "widehat" || label === "widecheck") { + viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; + viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; + _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; + pathName = label + imgIndex; + } else { + viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; + viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; + _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; + pathName = "tilde" + imgIndex; + } + } + + var path = new domTree_PathNode(pathName); + var svgNode = new SvgNode([path], { + "width": "100%", + "height": _height + "em", + "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, + "preserveAspectRatio": "none" + }); + return { + span: buildCommon.makeSvgSpan([], [svgNode], options), + minWidth: 0, + height: _height + }; } else { - return katexNode; + var spans = []; + var data = katexImagesData[label]; + var paths = data[0], + _minWidth = data[1], + _viewBoxHeight = data[2]; + + var _height2 = _viewBoxHeight / 1000; + + var numSvgChildren = paths.length; + var widthClasses; + var aligns; + + if (numSvgChildren === 1) { + // $FlowFixMe: All these cases must be of the 4-tuple type. + var align1 = data[3]; + widthClasses = ["hide-tail"]; + aligns = [align1]; + } else if (numSvgChildren === 2) { + widthClasses = ["halfarrow-left", "halfarrow-right"]; + aligns = ["xMinYMin", "xMaxYMin"]; + } else if (numSvgChildren === 3) { + widthClasses = ["brace-left", "brace-center", "brace-right"]; + aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + } else { + throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); + } + + for (var i = 0; i < numSvgChildren; i++) { + var _path = new domTree_PathNode(paths[i]); + + var _svgNode = new SvgNode([_path], { + "width": "400em", + "height": _height2 + "em", + "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, + "preserveAspectRatio": aligns[i] + " slice" + }); + + var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options); + + if (numSvgChildren === 1) { + return { + span: _span, + minWidth: _minWidth, + height: _height2 + }; + } else { + _span.style.height = _height2 + "em"; + spans.push(_span); + } + } + + return { + span: buildCommon.makeSpan(["stretchy"], spans, options), + minWidth: _minWidth, + height: _height2 + }; } + } // buildSvgSpan_() + + + var _buildSvgSpan_ = buildSvgSpan_(), + span = _buildSvgSpan_.span, + minWidth = _buildSvgSpan_.minWidth, + height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0. + // Any adjustments relative to the baseline must be done in buildHTML. + + + span.height = height; + span.style.height = height + "em"; + + if (minWidth > 0) { + span.style.minWidth = minWidth + "em"; + } + + return span; }; -module.exports = buildTree; +var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) { + // Return an image span for \cancel, \bcancel, \xcancel, or \fbox + var img; + var totalHeight = inner.height + inner.depth + 2 * pad; -},{"./Options":5,"./Settings":8,"./Style":9,"./buildCommon":10,"./buildHTML":11,"./buildMathML":12}],14:[function(require,module,exports){ + if (/fbox|color/.test(label)) { + img = buildCommon.makeSpan(["stretchy", label], [], options); + + if (label === "fbox") { + var color = options.color && options.getColor(); + + if (color) { + img.style.borderColor = color; + } + } + } else { + // \cancel, \bcancel, or \xcancel + // Since \cancel's SVG is inline and it omits the viewBox attribute, + // its stroke-width will not vary with span area. + var lines = []; + + if (/^[bx]cancel$/.test(label)) { + lines.push(new LineNode({ + "x1": "0", + "y1": "0", + "x2": "100%", + "y2": "100%", + "stroke-width": "0.046em" + })); + } + + if (/^x?cancel$/.test(label)) { + lines.push(new LineNode({ + "x1": "0", + "y1": "100%", + "x2": "100%", + "y2": "0", + "stroke-width": "0.046em" + })); + } + + var svgNode = new SvgNode(lines, { + "width": "100%", + "height": totalHeight + "em" + }); + img = buildCommon.makeSvgSpan([], [svgNode], options); + } + + img.height = totalHeight; + img.style.height = totalHeight + "em"; + return img; +}; + +/* harmony default export */ var stretchy = ({ + encloseSpan: stretchy_encloseSpan, + mathMLnode: stretchy_mathMLnode, + svgSpan: stretchy_svgSpan +}); +// CONCATENATED MODULE: ./src/functions/accent.js + + + + + + + + + +// NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but +var accent_htmlBuilder = function htmlBuilder(grp, options) { + // Accents are handled in the TeXbook pg. 443, rule 12. + var base; + var group; + var supSub = checkNodeType(grp, "supsub"); + var supSubGroup; + + if (supSub) { + // If our base is a character box, and we have superscripts and + // subscripts, the supsub will defer to us. In particular, we want + // to attach the superscripts and subscripts to the inner body (so + // that the position of the superscripts and subscripts won't be + // affected by the height of the accent). We accomplish this by + // sticking the base of the accent into the base of the supsub, and + // rendering that, while keeping track of where the accent is. + // The real accent group is the base of the supsub group + group = assertNodeType(supSub.base, "accent"); // The character box is the base of the accent group + + base = group.base; // Stick the character box into the base of the supsub group + + supSub.base = base; // Rerender the supsub group with its new base, and store that + // result. + + supSubGroup = assertSpan(buildHTML_buildGroup(supSub, options)); // reset original base + + supSub.base = group; + } else { + group = assertNodeType(grp, "accent"); + base = group.base; + } // Build the base group + + + var body = buildHTML_buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? + + var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the + // nucleus is not a single character, let s = 0; otherwise set s to the + // kern amount for the nucleus followed by the \skewchar of its font." + // Note that our skew metrics are just the kern between each character + // and the skewchar. + + var skew = 0; + + if (mustShift) { + // If the base is a character box, then we want the skew of the + // innermost character. To do that, we find the innermost character: + var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it + + var baseGroup = buildHTML_buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. + + skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we + // removed with getBaseElem might contain things like \color which + // we can't get rid of. + // TODO(emily): Find a better way to get the skew + } // calculate the amount of space between the body and the accent + + + var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent + + var accentBody; + + if (!group.isStretchy) { + var accent; + var width; + + if (group.label === "\\vec") { + // Before version 0.9, \vec used the combining font glyph U+20D7. + // But browsers, especially Safari, are not consistent in how they + // render combining characters when not preceded by a character. + // So now we use an SVG. + // If Safari reforms, we should consider reverting to the glyph. + accent = buildCommon.staticSvg("vec", options); + width = buildCommon.svgData.vec[1]; + } else { + accent = buildCommon.makeSymbol(group.label, "Main-Regular", group.mode, options); // Remove the italic correction of the accent, because it only serves to + // shift the accent over to a place we don't want. + + accent.italic = 0; + width = accent.width; + } + + accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be + // at least the width of the accent, and overlap directly onto the + // character without any vertical offset. + + var accentFull = group.label === "\\textcircled"; + + if (accentFull) { + accentBody.classes.push('accent-full'); + clearance = body.height; + } // Shift the accent over by the skew. + + + var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` + // so that the accent doesn't contribute to the bounding box. + // We need to shift the character by its width (effectively half + // its width) to compensate. + + if (!accentFull) { + left -= width / 2; + } + + accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some + // vertical adjustment to match LaTeX. + + if (group.label === "\\textcircled") { + accentBody.style.top = ".2em"; + } + + accentBody = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "kern", + size: -clearance + }, { + type: "elem", + elem: accentBody + }] + }, options); + } else { + accentBody = stretchy.svgSpan(group, options); + accentBody = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"], + wrapperStyle: skew > 0 ? { + width: "calc(100% - " + 2 * skew + "em)", + marginLeft: 2 * skew + "em" + } : undefined + }] + }, options); + } + + var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); + + if (supSubGroup) { + // Here, we replace the "base" child of the supsub with our newly + // generated accent. + supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the + // accent, we manually recalculate height. + + supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not. + + supSubGroup.classes[0] = "mord"; + return supSubGroup; + } else { + return accentWrap; + } +}; + +var accent_mathmlBuilder = function mathmlBuilder(group, options) { + var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [buildMathML_makeText(group.label, group.mode)]); + var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]); + node.setAttribute("accent", "true"); + return node; +}; + +var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(function (accent) { + return "\\" + accent; +}).join("|")); // Accents + +defineFunction({ + type: "accent", + names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var base = args[0]; + var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); + var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; + return { + type: "accent", + mode: context.parser.mode, + label: context.funcName, + isStretchy: isStretchy, + isShifty: isShifty, + base: base + }; + }, + htmlBuilder: accent_htmlBuilder, + mathmlBuilder: accent_mathmlBuilder +}); // Text-mode accents + +defineFunction({ + type: "accent", + names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"], + props: { + numArgs: 1, + allowedInText: true, + allowedInMath: false + }, + handler: function handler(context, args) { + var base = args[0]; + return { + type: "accent", + mode: context.parser.mode, + label: context.funcName, + isStretchy: false, + isShifty: true, + base: base + }; + }, + htmlBuilder: accent_htmlBuilder, + mathmlBuilder: accent_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/accentunder.js +// Horizontal overlap functions + + + + + + +defineFunction({ + type: "accentUnder", + names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], + props: { + numArgs: 1 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var base = args[0]; + return { + type: "accentUnder", + mode: parser.mode, + label: funcName, + base: base + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Treat under accents much like underlines. + var innerGroup = buildHTML_buildGroup(group.base, options); + var accentBody = stretchy.svgSpan(group, options); + var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns + + var vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: accentBody.height + kern, + children: [{ + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: kern + }, { + type: "elem", + elem: innerGroup + }] + }, options); + return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var accentNode = stretchy.mathMLnode(group.label); + var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]); + node.setAttribute("accentunder", "true"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/arrow.js + + + + + + +// Stretchy arrows with an optional argument +defineFunction({ + type: "xArrow", + names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. + // Direct use of these functions is discouraged and may break someday. + "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser, + funcName = _ref.funcName; + return { + type: "xArrow", + mode: parser.mode, + label: funcName, + body: args[0], + below: optArgs[0] + }; + }, + // Flow is unable to correctly infer the type of `group`, even though it's + // unamibiguously determined from the passed-in `type` above. + htmlBuilder: function htmlBuilder(group, options) { + var style = options.style; // Build the argument groups in the appropriate style. + // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% + // Some groups can return document fragments. Handle those by wrapping + // them in a span. + + var newOptions = options.havingStyle(style.sup()); + var upperGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, newOptions, options), options); + upperGroup.classes.push("x-arrow-pad"); + var lowerGroup; + + if (group.below) { + // Build the lower group + newOptions = options.havingStyle(style.sub()); + lowerGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.below, newOptions, options), options); + lowerGroup.classes.push("x-arrow-pad"); + } + + var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. + // The point we want on the math axis is at 0.5 * arrowBody.height. + + var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi + + var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu + + if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { + upperShift -= upperGroup.depth; // shift up if depth encroaches + } // Generate the vlist + + + var vlist; + + if (lowerGroup) { + var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: upperGroup, + shift: upperShift + }, { + type: "elem", + elem: arrowBody, + shift: arrowShift + }, { + type: "elem", + elem: lowerGroup, + shift: lowerShift + }] + }, options); + } else { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: upperGroup, + shift: upperShift + }, { + type: "elem", + elem: arrowBody, + shift: arrowShift + }] + }, options); + } // $FlowFixMe: Replace this with passing "svg-align" into makeVList. + + + vlist.children[0].children[0].children[1].classes.push("svg-align"); + return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var arrowNode = stretchy.mathMLnode(group.label); + var node; + var lowerNode; + + if (group.body) { + var upperNode = buildMathML_buildGroup(group.body, options); + + if (group.below) { + lowerNode = buildMathML_buildGroup(group.below, options); + node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); + } else { + node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); + } + } else if (group.below) { + lowerNode = buildMathML_buildGroup(group.below, options); + node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]); + } else { + node = new mathMLTree.MathNode("mover", [arrowNode]); + } + + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/char.js + + + // \@char is an internal function that takes a grouped decimal argument like +// {123} and converts into symbol with code 123. It is used by the *macro* +// \char defined in macros.js. + +defineFunction({ + type: "textord", + names: ["\\@char"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var arg = assertNodeType(args[0], "ordgroup"); + var group = arg.body; + var number = ""; + + for (var i = 0; i < group.length; i++) { + var node = assertNodeType(group[i], "textord"); + number += node.text; + } + + var code = parseInt(number); + + if (isNaN(code)) { + throw new src_ParseError("\\@char has non-numeric argument " + number); + } + + return { + type: "textord", + mode: parser.mode, + text: String.fromCharCode(code) + }; + } +}); +// CONCATENATED MODULE: ./src/functions/color.js + + + + + + + +var color_htmlBuilder = function htmlBuilder(group, options) { + var elements = buildHTML_buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. + // To accomplish this, we wrap the results in a fragment, so the inner + // elements will be able to directly interact with their neighbors. For + // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` + + return buildCommon.makeFragment(elements); +}; + +var color_mathmlBuilder = function mathmlBuilder(group, options) { + var inner = buildMathML_buildExpression(group.body, options); + var node = new mathMLTree.MathNode("mstyle", inner); + node.setAttribute("mathcolor", group.color); + return node; +}; + +defineFunction({ + type: "color", + names: ["\\textcolor"], + props: { + numArgs: 2, + allowedInText: true, + greediness: 3, + argTypes: ["color", "original"] + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var color = assertNodeType(args[0], "color-token").color; + var body = args[1]; + return { + type: "color", + mode: parser.mode, + color: color, + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: color_htmlBuilder, + mathmlBuilder: color_mathmlBuilder +}); // TODO(kevinb): define these using macros + +defineFunction({ + type: "color", + names: ["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"], + props: { + numArgs: 1, + allowedInText: true, + greediness: 3 + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser, + funcName = _ref2.funcName; + var body = args[0]; + return { + type: "color", + mode: parser.mode, + color: "katex-" + funcName.slice(1), + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: color_htmlBuilder, + mathmlBuilder: color_mathmlBuilder +}); +defineFunction({ + type: "color", + names: ["\\color"], + props: { + numArgs: 1, + allowedInText: true, + greediness: 3, + argTypes: ["color"] + }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser, + breakOnTokenText = _ref3.breakOnTokenText; + var color = assertNodeType(args[0], "color-token").color; // If we see a styling function, parse out the implicit body + + var body = parser.parseExpression(true, breakOnTokenText); + return { + type: "color", + mode: parser.mode, + color: color, + body: body + }; + }, + htmlBuilder: color_htmlBuilder, + mathmlBuilder: color_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/cr.js +// Row breaks within tabular environments, and line breaks at top level + + + + + + // \\ is a macro mapping to either \cr or \newline. Because they have the +// same signature, we implement them as one megafunction, with newRow +// indicating whether we're in the \cr case, and newLine indicating whether +// to break the line in the \newline case. + +defineFunction({ + type: "cr", + names: ["\\cr", "\\newline"], + props: { + numArgs: 0, + numOptionalArgs: 1, + argTypes: ["size"], + allowedInText: true + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser, + funcName = _ref.funcName; + var size = optArgs[0]; + var newRow = funcName === "\\cr"; + var newLine = false; + + if (!newRow) { + if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { + newLine = false; + } else { + newLine = true; + } + } + + return { + type: "cr", + mode: parser.mode, + newLine: newLine, + newRow: newRow, + size: size && assertNodeType(size, "size").value + }; + }, + // The following builders are called only at the top level, + // not within tabular/array environments. + htmlBuilder: function htmlBuilder(group, options) { + if (group.newRow) { + throw new src_ParseError("\\cr valid only within a tabular/array environment"); + } + + var span = buildCommon.makeSpan(["mspace"], [], options); + + if (group.newLine) { + span.classes.push("newline"); + + if (group.size) { + span.style.marginTop = units_calculateSize(group.size, options) + "em"; + } + } + + return span; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mspace"); + + if (group.newLine) { + node.setAttribute("linebreak", "newline"); + + if (group.size) { + node.setAttribute("height", units_calculateSize(group.size, options) + "em"); + } + } + + return node; + } +}); +// CONCATENATED MODULE: ./src/delimiter.js /** * This file deals with creating delimiters of various sizes. The TeXbook * discusses these routines on page 441-442, in the "Another subroutine sets box @@ -4291,362 +8056,426 @@ module.exports = buildTree; * used in `\left` and `\right`. */ -var ParseError = require("./ParseError"); -var Style = require("./Style"); -var buildCommon = require("./buildCommon"); -var fontMetrics = require("./fontMetrics"); -var symbols = require("./symbols"); -var utils = require("./utils"); -var makeSpan = buildCommon.makeSpan; + + + + /** * Get the metrics for a given symbol and font, after transformation (i.e. * after following replacement from symbols.js) */ -var getMetrics = function(symbol, font) { - if (symbols.math[symbol] && symbols.math[symbol].replace) { - return fontMetrics.getCharacterMetrics( - symbols.math[symbol].replace, font); - } else { - return fontMetrics.getCharacterMetrics( - symbol, font); - } -}; +var delimiter_getMetrics = function getMetrics(symbol, font, mode) { + var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace; + var metrics = getCharacterMetrics(replace || symbol, font, mode); -/** - * Builds a symbol in the given font size (note size is an integer) - */ -var mathrmSize = function(value, size, mode, options) { - return buildCommon.makeSymbol(value, "Size" + size + "-Regular", - mode, options); -}; + if (!metrics) { + throw new Error("Unsupported symbol " + symbol + " and font size " + font + "."); + } + return metrics; +}; /** * Puts a delimiter span in a given style, and adds appropriate height, depth, * and maxFontSizes. */ -var styleWrap = function(delim, toStyle, options, classes) { - classes = classes || []; - var span = makeSpan( - classes.concat(["style-wrap", options.style.reset(), toStyle.cls()]), - [delim], options); - var multiplier = toStyle.sizeMultiplier / options.style.sizeMultiplier; - span.height *= multiplier; - span.depth *= multiplier; - span.maxFontSize = toStyle.sizeMultiplier; - - return span; +var delimiter_styleWrap = function styleWrap(delim, toStyle, options, classes) { + var newOptions = options.havingBaseStyle(toStyle); + var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); + var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; + span.height *= delimSizeMultiplier; + span.depth *= delimSizeMultiplier; + span.maxFontSize = newOptions.sizeMultiplier; + return span; }; +var centerSpan = function centerSpan(span, options, style) { + var newOptions = options.havingBaseStyle(style); + var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; + span.classes.push("delimcenter"); + span.style.top = shift + "em"; + span.height -= shift; + span.depth += shift; +}; /** * Makes a small delimiter. This is a delimiter that comes in the Main-Regular * font, but is restyled to either be in textstyle, scriptstyle, or * scriptscriptstyle. */ -var makeSmallDelim = function(delim, style, center, options, mode, classes) { - var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); - var span = styleWrap(text, style, options, classes); - if (center) { - var shift = - (1 - options.style.sizeMultiplier / style.sizeMultiplier) * - options.style.metrics.axisHeight; +var delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { + var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); + var span = delimiter_styleWrap(text, style, options, classes); - span.style.top = shift + "em"; - span.height -= shift; - span.depth += shift; - } + if (center) { + centerSpan(span, options, style); + } - return span; + return span; }; +/** + * Builds a symbol in the given font size (note size is an integer) + */ + +var delimiter_mathrmSize = function mathrmSize(value, size, mode, options) { + return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); +}; /** * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, * Size3, or Size4 fonts. It is always rendered in textstyle. */ -var makeLargeDelim = function(delim, size, center, options, mode, classes) { - var inner = mathrmSize(delim, size, mode, options); - var span = styleWrap( - makeSpan(["delimsizing", "size" + size], [inner], options), - Style.TEXT, options, classes); - if (center) { - var shift = (1 - options.style.sizeMultiplier) * - options.style.metrics.axisHeight; +var delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { + var inner = delimiter_mathrmSize(delim, size, mode, options); + var span = delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes); - span.style.top = shift + "em"; - span.height -= shift; - span.depth += shift; - } + if (center) { + centerSpan(span, options, src_Style.TEXT); + } - return span; + return span; }; - /** * Make an inner span with the given offset and in the given font. This is used * in `makeStackedDelim` to make the stacking pieces for the delimiter. */ -var makeInner = function(symbol, font, mode) { - var sizeClass; - // Apply the correct CSS class to choose the right font. - if (font === "Size1-Regular") { - sizeClass = "delim-size1"; - } else if (font === "Size4-Regular") { - sizeClass = "delim-size4"; + + +var delimiter_makeInner = function makeInner(symbol, font, mode) { + var sizeClass; // Apply the correct CSS class to choose the right font. + + if (font === "Size1-Regular") { + sizeClass = "delim-size1"; + } else + /* if (font === "Size4-Regular") */ + { + sizeClass = "delim-size4"; } - var inner = makeSpan( - ["delimsizinginner", sizeClass], - [makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); + var inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element + // in the appropriate tag that VList uses. - // Since this will be passed into `makeVList` in the end, wrap the element - // in the appropriate tag that VList uses. - return {type: "elem", elem: inner}; + return { + type: "elem", + elem: inner + }; }; - /** * Make a stacked delimiter out of a given delimiter, with the total height at * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. */ -var makeStackedDelim = function(delim, heightTotal, center, options, mode, - classes) { - // There are four parts, the top, an optional middle, a repeated part, and a - // bottom. - var top; - var middle; - var repeat; - var bottom; - top = repeat = bottom = delim; - middle = null; - // Also keep track of what font the delimiters are in - var font = "Size1-Regular"; - // We set the parts and font based on the symbol. Note that we use - // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the - // repeats of the arrows - if (delim === "\\uparrow") { - repeat = bottom = "\u23d0"; - } else if (delim === "\\Uparrow") { - repeat = bottom = "\u2016"; - } else if (delim === "\\downarrow") { - top = repeat = "\u23d0"; - } else if (delim === "\\Downarrow") { - top = repeat = "\u2016"; - } else if (delim === "\\updownarrow") { - top = "\\uparrow"; - repeat = "\u23d0"; - bottom = "\\downarrow"; - } else if (delim === "\\Updownarrow") { - top = "\\Uparrow"; - repeat = "\u2016"; - bottom = "\\Downarrow"; - } else if (delim === "[" || delim === "\\lbrack") { - top = "\u23a1"; - repeat = "\u23a2"; - bottom = "\u23a3"; - font = "Size4-Regular"; - } else if (delim === "]" || delim === "\\rbrack") { - top = "\u23a4"; - repeat = "\u23a5"; - bottom = "\u23a6"; - font = "Size4-Regular"; - } else if (delim === "\\lfloor") { - repeat = top = "\u23a2"; - bottom = "\u23a3"; - font = "Size4-Regular"; - } else if (delim === "\\lceil") { - top = "\u23a1"; - repeat = bottom = "\u23a2"; - font = "Size4-Regular"; - } else if (delim === "\\rfloor") { - repeat = top = "\u23a5"; - bottom = "\u23a6"; - font = "Size4-Regular"; - } else if (delim === "\\rceil") { - top = "\u23a4"; - repeat = bottom = "\u23a5"; - font = "Size4-Regular"; - } else if (delim === "(") { - top = "\u239b"; - repeat = "\u239c"; - bottom = "\u239d"; - font = "Size4-Regular"; - } else if (delim === ")") { - top = "\u239e"; - repeat = "\u239f"; - bottom = "\u23a0"; - font = "Size4-Regular"; - } else if (delim === "\\{" || delim === "\\lbrace") { - top = "\u23a7"; - middle = "\u23a8"; - bottom = "\u23a9"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\}" || delim === "\\rbrace") { - top = "\u23ab"; - middle = "\u23ac"; - bottom = "\u23ad"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\lgroup") { - top = "\u23a7"; - bottom = "\u23a9"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\rgroup") { - top = "\u23ab"; - bottom = "\u23ad"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\lmoustache") { - top = "\u23a7"; - bottom = "\u23ad"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\rmoustache") { - top = "\u23ab"; - bottom = "\u23a9"; - repeat = "\u23aa"; - font = "Size4-Regular"; - } else if (delim === "\\surd") { - top = "\ue001"; - bottom = "\u23b7"; - repeat = "\ue000"; - font = "Size4-Regular"; + +var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { + // There are four parts, the top, an optional middle, a repeated part, and a + // bottom. + var top; + var middle; + var repeat; + var bottom; + top = repeat = bottom = delim; + middle = null; // Also keep track of what font the delimiters are in + + var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use + // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the + // repeats of the arrows + + if (delim === "\\uparrow") { + repeat = bottom = "\u23D0"; + } else if (delim === "\\Uparrow") { + repeat = bottom = "\u2016"; + } else if (delim === "\\downarrow") { + top = repeat = "\u23D0"; + } else if (delim === "\\Downarrow") { + top = repeat = "\u2016"; + } else if (delim === "\\updownarrow") { + top = "\\uparrow"; + repeat = "\u23D0"; + bottom = "\\downarrow"; + } else if (delim === "\\Updownarrow") { + top = "\\Uparrow"; + repeat = "\u2016"; + bottom = "\\Downarrow"; + } else if (delim === "[" || delim === "\\lbrack") { + top = "\u23A1"; + repeat = "\u23A2"; + bottom = "\u23A3"; + font = "Size4-Regular"; + } else if (delim === "]" || delim === "\\rbrack") { + top = "\u23A4"; + repeat = "\u23A5"; + bottom = "\u23A6"; + font = "Size4-Regular"; + } else if (delim === "\\lfloor" || delim === "\u230A") { + repeat = top = "\u23A2"; + bottom = "\u23A3"; + font = "Size4-Regular"; + } else if (delim === "\\lceil" || delim === "\u2308") { + top = "\u23A1"; + repeat = bottom = "\u23A2"; + font = "Size4-Regular"; + } else if (delim === "\\rfloor" || delim === "\u230B") { + repeat = top = "\u23A5"; + bottom = "\u23A6"; + font = "Size4-Regular"; + } else if (delim === "\\rceil" || delim === "\u2309") { + top = "\u23A4"; + repeat = bottom = "\u23A5"; + font = "Size4-Regular"; + } else if (delim === "(" || delim === "\\lparen") { + top = "\u239B"; + repeat = "\u239C"; + bottom = "\u239D"; + font = "Size4-Regular"; + } else if (delim === ")" || delim === "\\rparen") { + top = "\u239E"; + repeat = "\u239F"; + bottom = "\u23A0"; + font = "Size4-Regular"; + } else if (delim === "\\{" || delim === "\\lbrace") { + top = "\u23A7"; + middle = "\u23A8"; + bottom = "\u23A9"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\}" || delim === "\\rbrace") { + top = "\u23AB"; + middle = "\u23AC"; + bottom = "\u23AD"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\lgroup" || delim === "\u27EE") { + top = "\u23A7"; + bottom = "\u23A9"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\rgroup" || delim === "\u27EF") { + top = "\u23AB"; + bottom = "\u23AD"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\lmoustache" || delim === "\u23B0") { + top = "\u23A7"; + bottom = "\u23AD"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\rmoustache" || delim === "\u23B1") { + top = "\u23AB"; + bottom = "\u23A9"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } // Get the metrics of the four sections + + + var topMetrics = delimiter_getMetrics(top, font, mode); + var topHeightTotal = topMetrics.height + topMetrics.depth; + var repeatMetrics = delimiter_getMetrics(repeat, font, mode); + var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; + var bottomMetrics = delimiter_getMetrics(bottom, font, mode); + var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; + var middleHeightTotal = 0; + var middleFactor = 1; + + if (middle !== null) { + var middleMetrics = delimiter_getMetrics(middle, font, mode); + middleHeightTotal = middleMetrics.height + middleMetrics.depth; + middleFactor = 2; // repeat symmetrically above and below middle + } // Calcuate the minimal height that the delimiter can have. + // It is at least the size of the top, bottom, and optional middle combined. + + + var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need + + var repeatCount = Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)); // Compute the total height of the delimiter including all the symbols + + var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note + // that in this context, "center" means that the delimiter should be + // centered around the axis in the current style, while normally it is + // centered around the axis in textstyle. + + var axisHeight = options.fontMetrics().axisHeight; + + if (center) { + axisHeight *= options.sizeMultiplier; + } // Calculate the depth + + + var depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist + // Keep a list of the inner pieces + + var inners = []; // Add the bottom symbol + + inners.push(delimiter_makeInner(bottom, font, mode)); + + if (middle === null) { + // Add that many symbols + for (var i = 0; i < repeatCount; i++) { + inners.push(delimiter_makeInner(repeat, font, mode)); + } + } else { + // When there is a middle bit, we need the middle part and two repeated + // sections + for (var _i = 0; _i < repeatCount; _i++) { + inners.push(delimiter_makeInner(repeat, font, mode)); } - // Get the metrics of the four sections - var topMetrics = getMetrics(top, font); - var topHeightTotal = topMetrics.height + topMetrics.depth; - var repeatMetrics = getMetrics(repeat, font); - var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; - var bottomMetrics = getMetrics(bottom, font); - var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; - var middleHeightTotal = 0; - var middleFactor = 1; - if (middle !== null) { - var middleMetrics = getMetrics(middle, font); - middleHeightTotal = middleMetrics.height + middleMetrics.depth; - middleFactor = 2; // repeat symmetrically above and below middle + inners.push(delimiter_makeInner(middle, font, mode)); + + for (var _i2 = 0; _i2 < repeatCount; _i2++) { + inners.push(delimiter_makeInner(repeat, font, mode)); } + } // Add the top symbol - // Calcuate the minimal height that the delimiter can have. - // It is at least the size of the top, bottom, and optional middle combined. - var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; - // Compute the number of copies of the repeat symbol we will need - var repeatCount = Math.ceil( - (heightTotal - minHeight) / (middleFactor * repeatHeightTotal)); + inners.push(delimiter_makeInner(top, font, mode)); // Finally, build the vlist - // Compute the total height of the delimiter including all the symbols - var realHeightTotal = - minHeight + repeatCount * middleFactor * repeatHeightTotal; + var newOptions = options.havingBaseStyle(src_Style.TEXT); + var inner = buildCommon.makeVList({ + positionType: "bottom", + positionData: depth, + children: inners + }, newOptions); + return delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes); +}; // All surds have 0.08em padding above the viniculum inside the SVG. +// That keeps browser span height rounding error from pinching the line. - // The center of the delimiter is placed at the center of the axis. Note - // that in this context, "center" means that the delimiter should be - // centered around the axis in the current style, while normally it is - // centered around the axis in textstyle. - var axisHeight = options.style.metrics.axisHeight; - if (center) { - axisHeight *= options.style.sizeMultiplier; - } - // Calculate the depth - var depth = realHeightTotal / 2 - axisHeight; - // Now, we start building the pieces that will go into the vlist +var vbPad = 80; // padding above the surd, measured inside the viewBox. - // Keep a list of the inner pieces - var inners = []; +var emPad = 0.08; // padding, in ems, measured in the document. - // Add the bottom symbol - inners.push(makeInner(bottom, font, mode)); +var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, options) { + var alternate; - var i; - if (middle === null) { - // Add that many symbols - for (i = 0; i < repeatCount; i++) { - inners.push(makeInner(repeat, font, mode)); - } - } else { - // When there is a middle bit, we need the middle part and two repeated - // sections - for (i = 0; i < repeatCount; i++) { - inners.push(makeInner(repeat, font, mode)); - } - inners.push(makeInner(middle, font, mode)); - for (i = 0; i < repeatCount; i++) { - inners.push(makeInner(repeat, font, mode)); - } - } + if (sqrtName === "sqrtTall") { + // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular + // One path edge has a variable length. It runs from the viniculumn + // to a point near (14 units) the bottom of the surd. The viniculum + // is 40 units thick. So the length of the line in question is: + var vertSegment = viewBoxHeight - 54 - vbPad; + alternate = "M702 " + vbPad + "H400000v40H742v" + vertSegment + "l-4 4-4 4c-.667.7\n-2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667\n-294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155\n 77-156c66 199.333 139 419.667 219 661 l218 661zM702 " + vbPad + "H400000v40H742z"; + } - // Add the top symbol - inners.push(makeInner(top, font, mode)); - - // Finally, build the vlist - var inner = buildCommon.makeVList(inners, "bottom", depth, options); - - return styleWrap( - makeSpan(["delimsizing", "mult"], [inner], options), - Style.TEXT, options, classes); + var pathNode = new domTree_PathNode(sqrtName, alternate); + var svg = new SvgNode([pathNode], { + // Note: 1000:1 ratio of viewBox to document em width. + "width": "400em", + "height": height + "em", + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); + return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); }; +/** + * Make a sqrt image of the given height, + */ -// There are three kinds of delimiters, delimiters that stack when they become + +var makeSqrtImage = function makeSqrtImage(height, options) { + // Define a newOptions that removes the effect of size changes such as \Huge. + // We don't pick different a height surd for \Huge. For it, we scale up. + var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. + + var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); + var sizeMultiplier = newOptions.sizeMultiplier; // default + // Create a span containing an SVG image of a sqrt symbol. + + var span; + var spanHeight = 0; + var texHeight = 0; + var viewBoxHeight = 0; + var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. + // Then browser rounding error on the parent span height will not + // encroach on the ink of the viniculum. But that padding is not + // included in the TeX-like `height` used for calculation of + // vertical alignment. So texHeight = span.height < span.style.height. + + if (delim.type === "small") { + // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. + viewBoxHeight = 1000 + vbPad; // 1000 unit glyph height. + + if (height < 1.0) { + sizeMultiplier = 1.0; // mimic a \textfont radical + } else if (height < 1.4) { + sizeMultiplier = 0.7; // mimic a \scriptfont radical + } + + spanHeight = (1.0 + emPad) / sizeMultiplier; + texHeight = 1.00 / sizeMultiplier; + span = delimiter_sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, options); + span.style.minWidth = "0.853em"; + advanceWidth = 0.833 / sizeMultiplier; // from the font. + } else if (delim.type === "large") { + // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. + viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; + texHeight = sizeToMaxHeight[delim.size] / sizeMultiplier; + spanHeight = (sizeToMaxHeight[delim.size] + emPad) / sizeMultiplier; + span = delimiter_sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, options); + span.style.minWidth = "1.02em"; + advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. + } else { + // Tall sqrt. In TeX, this would be stacked using multiple glyphs. + // We'll use a single SVG to accomplish the same thing. + spanHeight = height + emPad; + texHeight = height; + viewBoxHeight = Math.floor(1000 * height) + vbPad; + span = delimiter_sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, options); + span.style.minWidth = "0.742em"; + advanceWidth = 1.056; + } + + span.height = texHeight; + span.style.height = spanHeight + "em"; + return { + span: span, + advanceWidth: advanceWidth, + // Calculate the actual line width. + // This actually should depend on the chosen font -- e.g. \boldmath + // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and + // have thicker rules. + ruleWidth: options.fontMetrics().sqrtRuleThickness * sizeMultiplier + }; +}; // There are three kinds of delimiters, delimiters that stack when they become // too large -var stackLargeDelimiters = [ - "(", ")", "[", "\\lbrack", "]", "\\rbrack", - "\\{", "\\lbrace", "\\}", "\\rbrace", - "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", - "\\surd" -]; -// delimiters that always stack -var stackAlwaysDelimiters = [ - "\\uparrow", "\\downarrow", "\\updownarrow", - "\\Uparrow", "\\Downarrow", "\\Updownarrow", - "|", "\\|", "\\vert", "\\Vert", - "\\lvert", "\\rvert", "\\lVert", "\\rVert", - "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache" -]; -// and delimiters that never stack -var stackNeverDelimiters = [ - "<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt" -]; +var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack -// Metrics of the different sizes. Found by looking at TeX's output of +var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"]; // and delimiters that never stack + +var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of // $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ // Used to create stacked delimiters of appropriate sizes in makeSizedDelim. -var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; +var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; /** * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. */ -var makeSizedDelim = function(delim, size, options, mode, classes) { - // < and > turn into \langle and \rangle in delimiters - if (delim === "<" || delim === "\\lt") { - delim = "\\langle"; - } else if (delim === ">" || delim === "\\gt") { - delim = "\\rangle"; - } - // Sized delimiters are never centered. - if (utils.contains(stackLargeDelimiters, delim) || - utils.contains(stackNeverDelimiters, delim)) { - return makeLargeDelim(delim, size, false, options, mode, classes); - } else if (utils.contains(stackAlwaysDelimiters, delim)) { - return makeStackedDelim( - delim, sizeToMaxHeight[size], false, options, mode, classes); - } else { - throw new ParseError("Illegal delimiter: '" + delim + "'"); - } +var delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { + // < and > turn into \langle and \rangle in delimiters + if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { + delim = "\\rangle"; + } // Sized delimiters are never centered. + + + if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) { + return delimiter_makeLargeDelim(delim, size, false, options, mode, classes); + } else if (utils.contains(stackAlwaysDelimiters, delim)) { + return delimiter_makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); + } else { + throw new src_ParseError("Illegal delimiter: '" + delim + "'"); + } }; - /** * There are three different sequences of delimiter sizes that the delimiters * follow depending on the kind of delimiter. This is used when creating custom @@ -4659,3225 +8488,1981 @@ var makeSizedDelim = function(delim, size, options, mode, classes) { * them explicitly here. */ + // Delimiters that never stack try small delimiters and large delimiters only -var stackNeverDelimiterSequence = [ - {type: "small", style: Style.SCRIPTSCRIPT}, - {type: "small", style: Style.SCRIPT}, - {type: "small", style: Style.TEXT}, - {type: "large", size: 1}, - {type: "large", size: 2}, - {type: "large", size: 3}, - {type: "large", size: 4} -]; +var stackNeverDelimiterSequence = [{ + type: "small", + style: src_Style.SCRIPTSCRIPT +}, { + type: "small", + style: src_Style.SCRIPT +}, { + type: "small", + style: src_Style.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}]; // Delimiters that always stack try the small delimiters first, then stack -// Delimiters that always stack try the small delimiters first, then stack -var stackAlwaysDelimiterSequence = [ - {type: "small", style: Style.SCRIPTSCRIPT}, - {type: "small", style: Style.SCRIPT}, - {type: "small", style: Style.TEXT}, - {type: "stack"} -]; - -// Delimiters that stack when large try the small and then large delimiters, and +var stackAlwaysDelimiterSequence = [{ + type: "small", + style: src_Style.SCRIPTSCRIPT +}, { + type: "small", + style: src_Style.SCRIPT +}, { + type: "small", + style: src_Style.TEXT +}, { + type: "stack" +}]; // Delimiters that stack when large try the small and then large delimiters, and // stack afterwards -var stackLargeDelimiterSequence = [ - {type: "small", style: Style.SCRIPTSCRIPT}, - {type: "small", style: Style.SCRIPT}, - {type: "small", style: Style.TEXT}, - {type: "large", size: 1}, - {type: "large", size: 2}, - {type: "large", size: 3}, - {type: "large", size: 4}, - {type: "stack"} -]; +var stackLargeDelimiterSequence = [{ + type: "small", + style: src_Style.SCRIPTSCRIPT +}, { + type: "small", + style: src_Style.SCRIPT +}, { + type: "small", + style: src_Style.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}, { + type: "stack" +}]; /** * Get the font used in a delimiter based on what kind of delimiter it is. + * TODO(#963) Use more specific font family return type once that is introduced. */ -var delimTypeToFont = function(type) { - if (type.type === "small") { - return "Main-Regular"; - } else if (type.type === "large") { - return "Size" + type.size + "-Regular"; - } else if (type.type === "stack") { - return "Size4-Regular"; - } -}; +var delimTypeToFont = function delimTypeToFont(type) { + if (type.type === "small") { + return "Main-Regular"; + } else if (type.type === "large") { + return "Size" + type.size + "-Regular"; + } else if (type.type === "stack") { + return "Size4-Regular"; + } else { + throw new Error("Add support for delim type '" + type.type + "' here."); + } +}; /** * Traverse a sequence of types of delimiters to decide what kind of delimiter * should be used to create a delimiter of the given height+depth. */ -var traverseSequence = function(delim, height, sequence, options) { - // Here, we choose the index we should start at in the sequences. In smaller - // sizes (which correspond to larger numbers in style.size) we start earlier - // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts - // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 - var start = Math.min(2, 3 - options.style.size); - for (var i = start; i < sequence.length; i++) { - if (sequence[i].type === "stack") { - // This is always the last delimiter, so we just break the loop now. - break; - } - var metrics = getMetrics(delim, delimTypeToFont(sequence[i])); - var heightDepth = metrics.height + metrics.depth; - // Small delimiters are scaled down versions of the same font, so we - // account for the style change size. +var traverseSequence = function traverseSequence(delim, height, sequence, options) { + // Here, we choose the index we should start at in the sequences. In smaller + // sizes (which correspond to larger numbers in style.size) we start earlier + // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts + // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 + var start = Math.min(2, 3 - options.style.size); - if (sequence[i].type === "small") { - heightDepth *= sequence[i].style.sizeMultiplier; - } - - // Check if the delimiter at this size works for the given height. - if (heightDepth > height) { - return sequence[i]; - } + for (var i = start; i < sequence.length; i++) { + if (sequence[i].type === "stack") { + // This is always the last delimiter, so we just break the loop now. + break; } - // If we reached the end of the sequence, return the last sequence element. - return sequence[sequence.length - 1]; -}; + var metrics = delimiter_getMetrics(delim, delimTypeToFont(sequence[i]), "math"); + var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we + // account for the style change size. + if (sequence[i].type === "small") { + var newOptions = options.havingBaseStyle(sequence[i].style); + heightDepth *= newOptions.sizeMultiplier; + } // Check if the delimiter at this size works for the given height. + + + if (heightDepth > height) { + return sequence[i]; + } + } // If we reached the end of the sequence, return the last sequence element. + + + return sequence[sequence.length - 1]; +}; /** * Make a delimiter of a given height+depth, with optional centering. Here, we * traverse the sequences, and create a delimiter that the sequence tells us to. */ -var makeCustomSizedDelim = function(delim, height, center, options, mode, - classes) { - if (delim === "<" || delim === "\\lt") { - delim = "\\langle"; - } else if (delim === ">" || delim === "\\gt") { - delim = "\\rangle"; - } - // Decide what sequence to use - var sequence; - if (utils.contains(stackNeverDelimiters, delim)) { - sequence = stackNeverDelimiterSequence; - } else if (utils.contains(stackLargeDelimiters, delim)) { - sequence = stackLargeDelimiterSequence; - } else { - sequence = stackAlwaysDelimiterSequence; - } - // Look through the sequence - var delimType = traverseSequence(delim, height, sequence, options); +var delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { + if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { + delim = "\\rangle"; + } // Decide what sequence to use - // Depending on the sequence element we decided on, call the appropriate - // function. - if (delimType.type === "small") { - return makeSmallDelim(delim, delimType.style, center, options, mode, - classes); - } else if (delimType.type === "large") { - return makeLargeDelim(delim, delimType.size, center, options, mode, - classes); - } else if (delimType.type === "stack") { - return makeStackedDelim(delim, height, center, options, mode, classes); + + var sequence; + + if (utils.contains(stackNeverDelimiters, delim)) { + sequence = stackNeverDelimiterSequence; + } else if (utils.contains(stackLargeDelimiters, delim)) { + sequence = stackLargeDelimiterSequence; + } else { + sequence = stackAlwaysDelimiterSequence; + } // Look through the sequence + + + var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. + // Depending on the sequence element we decided on, call the + // appropriate function. + + if (delimType.type === "small") { + return delimiter_makeSmallDelim(delim, delimType.style, center, options, mode, classes); + } else if (delimType.type === "large") { + return delimiter_makeLargeDelim(delim, delimType.size, center, options, mode, classes); + } else + /* if (delimType.type === "stack") */ + { + return delimiter_makeStackedDelim(delim, height, center, options, mode, classes); } }; - /** * Make a delimiter for use with `\left` and `\right`, given a height and depth * of an expression that the delimiters surround. */ -var makeLeftRightDelim = function(delim, height, depth, options, mode, - classes) { - // We always center \left/\right delimiters, so the axis is always shifted - var axisHeight = - options.style.metrics.axisHeight * options.style.sizeMultiplier; - // Taken from TeX source, tex.web, function make_left_right - var delimiterFactor = 901; - var delimiterExtend = 5.0 / fontMetrics.metrics.ptPerEm; - var maxDistFromAxis = Math.max( - height - axisHeight, depth + axisHeight); +var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { + // We always center \left/\right delimiters, so the axis is always shifted + var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right - var totalHeight = Math.max( - // In real TeX, calculations are done using integral values which are - // 65536 per pt, or 655360 per em. So, the division here truncates in - // TeX but doesn't here, producing different results. If we wanted to - // exactly match TeX's calculation, we could do - // Math.floor(655360 * maxDistFromAxis / 500) * - // delimiterFactor / 655360 - // (To see the difference, compare - // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} - // in TeX and KaTeX) - maxDistFromAxis / 500 * delimiterFactor, - 2 * maxDistFromAxis - delimiterExtend); + var delimiterFactor = 901; + var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; + var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); + var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are + // 65536 per pt, or 655360 per em. So, the division here truncates in + // TeX but doesn't here, producing different results. If we wanted to + // exactly match TeX's calculation, we could do + // Math.floor(655360 * maxDistFromAxis / 500) * + // delimiterFactor / 655360 + // (To see the difference, compare + // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} + // in TeX and KaTeX) + maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total + // height - // Finally, we defer to `makeCustomSizedDelim` with our calculated total - // height - return makeCustomSizedDelim(delim, totalHeight, true, options, mode, - classes); + return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); }; -module.exports = { - sizedDelim: makeSizedDelim, - customSizedDelim: makeCustomSizedDelim, - leftRightDelim: makeLeftRightDelim -}; - -},{"./ParseError":6,"./Style":9,"./buildCommon":10,"./fontMetrics":17,"./symbols":23,"./utils":25}],15:[function(require,module,exports){ -/** - * These objects store the data about the DOM nodes we create, as well as some - * extra data. They can then be transformed into real DOM nodes with the - * `toNode` function or HTML markup using `toMarkup`. They are useful for both - * storing extra properties on the nodes, as well as providing a way to easily - * work with the DOM. - * - * Similar functions for working with MathML nodes exist in mathMLTree.js. - */ -var unicodeRegexes = require("./unicodeRegexes"); -var utils = require("./utils"); - -/** - * Create an HTML className based on a list of classes. In addition to joining - * with spaces, we also remove null or empty classes. - */ -var createClass = function(classes) { - classes = classes.slice(); - for (var i = classes.length - 1; i >= 0; i--) { - if (!classes[i]) { - classes.splice(i, 1); - } - } - - return classes.join(" "); -}; - -/** - * This node represents a span node, with a className, a list of children, and - * an inline style. It also contains information about its height, depth, and - * maxFontSize. - */ -function span(classes, children, options) { - this.classes = classes || []; - this.children = children || []; - this.height = 0; - this.depth = 0; - this.maxFontSize = 0; - this.style = {}; - this.attributes = {}; - if (options) { - if (options.style.isTight()) { - this.classes.push("mtight"); - } - if (options.getColor()) { - this.style.color = options.getColor(); - } - } -} - -/** - * Sets an arbitrary attribute on the span. Warning: use this wisely. Not all - * browsers support attributes the same, and having too many custom attributes - * is probably bad. - */ -span.prototype.setAttribute = function(attribute, value) { - this.attributes[attribute] = value; -}; - -span.prototype.tryCombine = function(sibling) { - return false; -}; - -/** - * Convert the span into an HTML node - */ -span.prototype.toNode = function() { - var span = document.createElement("span"); - - // Apply the class - span.className = createClass(this.classes); - - // Apply inline styles - for (var style in this.style) { - if (Object.prototype.hasOwnProperty.call(this.style, style)) { - span.style[style] = this.style[style]; - } - } - - // Apply attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - span.setAttribute(attr, this.attributes[attr]); - } - } - - // Append the children, also as HTML nodes - for (var i = 0; i < this.children.length; i++) { - span.appendChild(this.children[i].toNode()); - } - - return span; -}; - -/** - * Convert the span into an HTML markup string - */ -span.prototype.toMarkup = function() { - var markup = " 0 - || createClass(this.classes) !== createClass(sibling.classes) - || this.skew !== sibling.skew - || this.maxFontSize !== sibling.maxFontSize) { - return false; - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style) - && this.style[style] !== sibling.style[style]) { - return false; - } - } - for (style in sibling.style) { - if (sibling.style.hasOwnProperty(style) - && this.style[style] !== sibling.style[style]) { - return false; - } - } - this.value += sibling.value; - this.height = Math.max(this.height, sibling.height); - this.depth = Math.max(this.depth, sibling.depth); - this.italic = sibling.italic; - return true; -}; - -/** - * Creates a text node or span from a symbol node. Note that a span is only - * created if it is needed. - */ -symbolNode.prototype.toNode = function() { - var node = document.createTextNode(this.value); - var span = null; - - if (this.italic > 0) { - span = document.createElement("span"); - span.style.marginRight = this.italic + "em"; - } - - if (this.classes.length > 0) { - span = span || document.createElement("span"); - span.className = createClass(this.classes); - } - - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - span = span || document.createElement("span"); - span.style[style] = this.style[style]; - } - } - - if (span) { - span.appendChild(node); - return span; - } else { - return node; - } -}; - -/** - * Creates markup for a symbol node. - */ -symbolNode.prototype.toMarkup = function() { - // TODO(alpert): More duplication than I'd like from - // span.prototype.toMarkup and symbolNode.prototype.toNode... - var needsSpan = false; - - var markup = " 0) { - styles += "margin-right:" + this.italic + "em;"; - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; - } - } - - if (styles) { - needsSpan = true; - markup += " style=\"" + utils.escape(styles) + "\""; - } - - var escaped = utils.escape(this.value); - if (needsSpan) { - markup += ">"; - markup += escaped; - markup += ""; - return markup; - } else { - return escaped; - } -}; - -module.exports = { - span: span, - documentFragment: documentFragment, - symbolNode: symbolNode -}; - -},{"./unicodeRegexes":24,"./utils":25}],16:[function(require,module,exports){ -/* eslint no-constant-condition:0 */ -var parseData = require("./parseData"); -var ParseError = require("./ParseError"); -var Style = require("./Style"); - -var ParseNode = parseData.ParseNode; - -/** - * Parse the body of the environment, with rows delimited by \\ and - * columns delimited by &, and create a nested list in row-major order - * with one group per cell. - */ -function parseArray(parser, result) { - var row = []; - var body = [row]; - var rowGaps = []; - while (true) { - var cell = parser.parseExpression(false, null); - row.push(new ParseNode("ordgroup", cell, parser.mode)); - var next = parser.nextToken.text; - if (next === "&") { - parser.consume(); - } else if (next === "\\end") { - break; - } else if (next === "\\\\" || next === "\\cr") { - var cr = parser.parseFunction(); - rowGaps.push(cr.value.size); - row = []; - body.push(row); - } else { - throw new ParseError("Expected & or \\\\ or \\end", - parser.nextToken); - } - } - result.body = body; - result.rowGaps = rowGaps; - return new ParseNode(result.type, result, parser.mode); -} - -/* - * An environment definition is very similar to a function definition: - * it is declared with a name or a list of names, a set of properties - * and a handler containing the actual implementation. - * - * The properties include: - * - numArgs: The number of arguments after the \begin{name} function. - * - argTypes: (optional) Just like for a function - * - allowedInText: (optional) Whether or not the environment is allowed inside - * text mode (default false) (not enforced yet) - * - numOptionalArgs: (optional) Just like for a function - * A bare number instead of that object indicates the numArgs value. - * - * The handler function will receive two arguments - * - context: information and references provided by the parser - * - args: an array of arguments passed to \begin{name} - * The context contains the following properties: - * - envName: the name of the environment, one of the listed names. - * - parser: the parser object - * - lexer: the lexer object - * - positions: the positions associated with these arguments from args. - * The handler must return a ParseResult. - */ - -function defineEnvironment(names, props, handler) { - if (typeof names === "string") { - names = [names]; - } - if (typeof props === "number") { - props = { numArgs: props }; - } - // Set default values of environments - var data = { - numArgs: props.numArgs || 0, - argTypes: props.argTypes, - greediness: 1, - allowedInText: !!props.allowedInText, - numOptionalArgs: props.numOptionalArgs || 0, - handler: handler - }; - for (var i = 0; i < names.length; ++i) { - module.exports[names[i]] = data; - } -} - -// Arrays are part of LaTeX, defined in lttab.dtx so its documentation -// is part of the source2e.pdf file of LaTeX2e source documentation. -defineEnvironment("array", { - numArgs: 1 -}, function(context, args) { - var colalign = args[0]; - colalign = colalign.value.map ? colalign.value : [colalign]; - var cols = colalign.map(function(node) { - var ca = node.value; - if ("lcr".indexOf(ca) !== -1) { - return { - type: "align", - align: ca - }; - } else if (ca === "|") { - return { - type: "separator", - separator: "|" - }; - } - throw new ParseError( - "Unknown column alignment: " + node.value, - node); - }); - var res = { - type: "array", - cols: cols, - hskipBeforeAndAfter: true // \@preamble in lttab.dtx - }; - res = parseArray(context.parser, res); - return res; +/* harmony default export */ var delimiter = ({ + sqrtImage: makeSqrtImage, + sizedDelim: delimiter_makeSizedDelim, + customSizedDelim: delimiter_makeCustomSizedDelim, + leftRightDelim: makeLeftRightDelim }); +// CONCATENATED MODULE: ./src/functions/delimsizing.js -// The matrix environments of amsmath builds on the array environment -// of LaTeX, which is discussed above. -defineEnvironment([ - "matrix", - "pmatrix", - "bmatrix", - "Bmatrix", - "vmatrix", - "Vmatrix" -], { -}, function(context) { - var delimiters = { - "matrix": null, - "pmatrix": ["(", ")"], - "bmatrix": ["[", "]"], - "Bmatrix": ["\\{", "\\}"], - "vmatrix": ["|", "|"], - "Vmatrix": ["\\Vert", "\\Vert"] - }[context.envName]; - var res = { - type: "array", - hskipBeforeAndAfter: false // \hskip -\arraycolsep in amsmath - }; - res = parseArray(context.parser, res); - if (delimiters) { - res = new ParseNode("leftright", { - body: [res], - left: delimiters[0], - right: delimiters[1] - }, context.mode); - } - return res; -}); -// A cases environment (in amsmath.sty) is almost equivalent to -// \def\arraystretch{1.2}% -// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. -defineEnvironment("cases", { -}, function(context) { - var res = { - type: "array", - arraystretch: 1.2, - cols: [{ - type: "align", - align: "l", - pregap: 0, - // TODO(kevinb) get the current style. - // For now we use the metrics for TEXT style which is what we were - // doing before. Before attempting to get the current style we - // should look at TeX's behavior especially for \over and matrices. - postgap: Style.TEXT.metrics.quad - }, { - type: "align", - align: "l", - pregap: 0, - postgap: 0 - }] - }; - res = parseArray(context.parser, res); - res = new ParseNode("leftright", { - body: [res], - left: "\\{", - right: "." - }, context.mode); - return res; -}); -// An aligned environment is like the align* environment -// except it operates within math mode. -// Note that we assume \nomallineskiplimit to be zero, -// so that \strut@ is the same as \strut. -defineEnvironment("aligned", { -}, function(context) { - var res = { - type: "array", - cols: [] - }; - res = parseArray(context.parser, res); - var emptyGroup = new ParseNode("ordgroup", [], context.mode); - var numCols = 0; - res.value.body.forEach(function(row) { - var i; - for (i = 1; i < row.length; i += 2) { - row[i].value.unshift(emptyGroup); - } - if (numCols < row.length) { - numCols = row.length; - } - }); - for (var i = 0; i < numCols; ++i) { - var align = "r"; - var pregap = 0; - if (i % 2 === 1) { - align = "l"; - } else if (i > 0) { - pregap = 2; // one \qquad between columns - } - res.value.cols[i] = { - type: "align", - align: align, - pregap: pregap, - postgap: 0 - }; - } - return res; -}); -},{"./ParseError":6,"./Style":9,"./parseData":21}],17:[function(require,module,exports){ -/* eslint no-unused-vars:0 */ -var Style = require("./Style"); -var cjkRegex = require("./unicodeRegexes").cjkRegex; -/** - * This file contains metrics regarding fonts and individual symbols. The sigma - * and xi variables, as well as the metricMap map contain data extracted from - * TeX, TeX font metrics, and the TTF files. These data are then exposed via the - * `metrics` variable and the getCharacterMetrics function. - */ -// In TeX, there are actually three sets of dimensions, one for each of -// textstyle, scriptstyle, and scriptscriptstyle. These are provided in the -// the arrays below, in that order. -// -// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. -// This was determined by running the folllowing script: -// -// latex -interaction=nonstopmode \ -// '\documentclass{article}\usepackage{amsmath}\begin{document}' \ -// '$a$ \expandafter\show\the\textfont2' \ -// '\expandafter\show\the\scriptfont2' \ -// '\expandafter\show\the\scriptscriptfont2' \ -// '\stop' -// -// The metrics themselves were retreived using the following commands: -// -// tftopl cmsy10 -// tftopl cmsy7 -// tftopl cmsy5 -// -// The output of each of these commands is quite lengthy. The only part we -// care about is the FONTDIMEN section. Each value is measured in EMs. -var sigmas = { - slant: [0.250, 0.250, 0.250], // sigma1 - space: [0.000, 0.000, 0.000], // sigma2 - stretch: [0.000, 0.000, 0.000], // sigma3 - shrink: [0.000, 0.000, 0.000], // sigma4 - xHeight: [0.431, 0.431, 0.431], // sigma5 - quad: [1.000, 1.171, 1.472], // sigma6 - extraSpace: [0.000, 0.000, 0.000], // sigma7 - num1: [0.677, 0.732, 0.925], // sigma8 - num2: [0.394, 0.384, 0.387], // sigma9 - num3: [0.444, 0.471, 0.504], // sigma10 - denom1: [0.686, 0.752, 1.025], // sigma11 - denom2: [0.345, 0.344, 0.532], // sigma12 - sup1: [0.413, 0.503, 0.504], // sigma13 - sup2: [0.363, 0.431, 0.404], // sigma14 - sup3: [0.289, 0.286, 0.294], // sigma15 - sub1: [0.150, 0.143, 0.200], // sigma16 - sub2: [0.247, 0.286, 0.400], // sigma17 - supDrop: [0.386, 0.353, 0.494], // sigma18 - subDrop: [0.050, 0.071, 0.100], // sigma19 - delim1: [2.390, 1.700, 1.980], // sigma20 - delim2: [1.010, 1.157, 1.420], // sigma21 - axisHeight: [0.250, 0.250, 0.250] // sigma22 -}; -// These font metrics are extracted from TeX by using -// \font\a=cmex10 -// \showthe\fontdimenX\a -// where X is the corresponding variable number. These correspond to the font -// parameters of the extension fonts (family 3). See the TeXbook, page 441. -var xi1 = 0; -var xi2 = 0; -var xi3 = 0; -var xi4 = 0; -var xi5 = 0.431; -var xi6 = 1; -var xi7 = 0; -var xi8 = 0.04; -var xi9 = 0.111; -var xi10 = 0.166; -var xi11 = 0.2; -var xi12 = 0.6; -var xi13 = 0.1; - -// This value determines how large a pt is, for metrics which are defined in -// terms of pts. -// This value is also used in katex.less; if you change it make sure the values -// match. -var ptPerEm = 10.0; - -// The space between adjacent `|` columns in an array definition. From -// `\showthe\doublerulesep` in LaTeX. -var doubleRuleSep = 2.0 / ptPerEm; - -/** - * This is just a mapping from common names to real metrics - */ -var metrics = { - defaultRuleThickness: xi8, - bigOpSpacing1: xi9, - bigOpSpacing2: xi10, - bigOpSpacing3: xi11, - bigOpSpacing4: xi12, - bigOpSpacing5: xi13, - ptPerEm: ptPerEm, - doubleRuleSep: doubleRuleSep -}; - -// This map contains a mapping from font name and character code to character -// metrics, including height, depth, italic correction, and skew (kern from the -// character to the corresponding \skewchar) -// This map is generated via `make metrics`. It should not be changed manually. -var metricMap = require("./fontMetricsData"); - -// These are very rough approximations. We default to Times New Roman which -// should have Latin-1 and Cyrillic characters, but may not depending on the -// operating system. The metrics do not account for extra height from the -// accents. In the case of Cyrillic characters which have both ascenders and -// descenders we prefer approximations with ascenders, primarily to prevent -// the fraction bar or root line from intersecting the glyph. -// TODO(kevinb) allow union of multiple glyph metrics for better accuracy. -var extraCharacterMap = { - // Latin-1 - 'À': 'A', - 'Á': 'A', - 'Â': 'A', - 'Ã': 'A', - 'Ä': 'A', - 'Å': 'A', - 'Æ': 'A', - 'Ç': 'C', - 'È': 'E', - 'É': 'E', - 'Ê': 'E', - 'Ë': 'E', - 'Ì': 'I', - 'Í': 'I', - 'Î': 'I', - 'Ï': 'I', - 'Ð': 'D', - 'Ñ': 'N', - 'Ò': 'O', - 'Ó': 'O', - 'Ô': 'O', - 'Õ': 'O', - 'Ö': 'O', - 'Ø': 'O', - 'Ù': 'U', - 'Ú': 'U', - 'Û': 'U', - 'Ü': 'U', - 'Ý': 'Y', - 'Þ': 'o', - 'ß': 'B', - 'à': 'a', - 'á': 'a', - 'â': 'a', - 'ã': 'a', - 'ä': 'a', - 'å': 'a', - 'æ': 'a', - 'ç': 'c', - 'è': 'e', - 'é': 'e', - 'ê': 'e', - 'ë': 'e', - 'ì': 'i', - 'í': 'i', - 'î': 'i', - 'ï': 'i', - 'ð': 'd', - 'ñ': 'n', - 'ò': 'o', - 'ó': 'o', - 'ô': 'o', - 'õ': 'o', - 'ö': 'o', - 'ø': 'o', - 'ù': 'u', - 'ú': 'u', - 'û': 'u', - 'ü': 'u', - 'ý': 'y', - 'þ': 'o', - 'ÿ': 'y', - - // Cyrillic - 'А': 'A', - 'Б': 'B', - 'В': 'B', - 'Г': 'F', - 'Д': 'A', - 'Е': 'E', - 'Ж': 'K', - 'З': '3', - 'И': 'N', - 'Й': 'N', - 'К': 'K', - 'Л': 'N', - 'М': 'M', - 'Н': 'H', - 'О': 'O', - 'П': 'N', - 'Р': 'P', - 'С': 'C', - 'Т': 'T', - 'У': 'y', - 'Ф': 'O', - 'Х': 'X', - 'Ц': 'U', - 'Ч': 'h', - 'Ш': 'W', - 'Щ': 'W', - 'Ъ': 'B', - 'Ы': 'X', - 'Ь': 'B', - 'Э': '3', - 'Ю': 'X', - 'Я': 'R', - 'а': 'a', - 'б': 'b', - 'в': 'a', - 'г': 'r', - 'д': 'y', - 'е': 'e', - 'ж': 'm', - 'з': 'e', - 'и': 'n', - 'й': 'n', - 'к': 'n', - 'л': 'n', - 'м': 'm', - 'н': 'n', - 'о': 'o', - 'п': 'n', - 'р': 'p', - 'с': 'c', - 'т': 'o', - 'у': 'y', - 'ф': 'b', - 'х': 'x', - 'ц': 'n', - 'ч': 'n', - 'ш': 'w', - 'щ': 'w', - 'ъ': 'a', - 'ы': 'm', - 'ь': 'a', - 'э': 'e', - 'ю': 'm', - 'я': 'r' -}; - -/** - * This function is a convenience function for looking up information in the - * metricMap table. It takes a character as a string, and a style. - * - * Note: the `width` property may be undefined if fontMetricsData.js wasn't - * built using `Make extended_metrics`. - */ -var getCharacterMetrics = function(character, style) { - var ch = character.charCodeAt(0); - if (character[0] in extraCharacterMap) { - ch = extraCharacterMap[character[0]].charCodeAt(0); - } else if (cjkRegex.test(character[0])) { - ch = 'M'.charCodeAt(0); - } - var metrics = metricMap[style][ch]; - if (metrics) { - return { - depth: metrics[0], - height: metrics[1], - italic: metrics[2], - skew: metrics[3], - width: metrics[4] - }; - } -}; - -module.exports = { - metrics: metrics, - sigmas: sigmas, - getCharacterMetrics: getCharacterMetrics -}; - -},{"./Style":9,"./fontMetricsData":18,"./unicodeRegexes":24}],18:[function(require,module,exports){ -module.exports = { - "AMS-Regular": { - "65": [0, 0.68889, 0, 0], - "66": [0, 0.68889, 0, 0], - "67": [0, 0.68889, 0, 0], - "68": [0, 0.68889, 0, 0], - "69": [0, 0.68889, 0, 0], - "70": [0, 0.68889, 0, 0], - "71": [0, 0.68889, 0, 0], - "72": [0, 0.68889, 0, 0], - "73": [0, 0.68889, 0, 0], - "74": [0.16667, 0.68889, 0, 0], - "75": [0, 0.68889, 0, 0], - "76": [0, 0.68889, 0, 0], - "77": [0, 0.68889, 0, 0], - "78": [0, 0.68889, 0, 0], - "79": [0.16667, 0.68889, 0, 0], - "80": [0, 0.68889, 0, 0], - "81": [0.16667, 0.68889, 0, 0], - "82": [0, 0.68889, 0, 0], - "83": [0, 0.68889, 0, 0], - "84": [0, 0.68889, 0, 0], - "85": [0, 0.68889, 0, 0], - "86": [0, 0.68889, 0, 0], - "87": [0, 0.68889, 0, 0], - "88": [0, 0.68889, 0, 0], - "89": [0, 0.68889, 0, 0], - "90": [0, 0.68889, 0, 0], - "107": [0, 0.68889, 0, 0], - "165": [0, 0.675, 0.025, 0], - "174": [0.15559, 0.69224, 0, 0], - "240": [0, 0.68889, 0, 0], - "295": [0, 0.68889, 0, 0], - "710": [0, 0.825, 0, 0], - "732": [0, 0.9, 0, 0], - "770": [0, 0.825, 0, 0], - "771": [0, 0.9, 0, 0], - "989": [0.08167, 0.58167, 0, 0], - "1008": [0, 0.43056, 0.04028, 0], - "8245": [0, 0.54986, 0, 0], - "8463": [0, 0.68889, 0, 0], - "8487": [0, 0.68889, 0, 0], - "8498": [0, 0.68889, 0, 0], - "8502": [0, 0.68889, 0, 0], - "8503": [0, 0.68889, 0, 0], - "8504": [0, 0.68889, 0, 0], - "8513": [0, 0.68889, 0, 0], - "8592": [-0.03598, 0.46402, 0, 0], - "8594": [-0.03598, 0.46402, 0, 0], - "8602": [-0.13313, 0.36687, 0, 0], - "8603": [-0.13313, 0.36687, 0, 0], - "8606": [0.01354, 0.52239, 0, 0], - "8608": [0.01354, 0.52239, 0, 0], - "8610": [0.01354, 0.52239, 0, 0], - "8611": [0.01354, 0.52239, 0, 0], - "8619": [0, 0.54986, 0, 0], - "8620": [0, 0.54986, 0, 0], - "8621": [-0.13313, 0.37788, 0, 0], - "8622": [-0.13313, 0.36687, 0, 0], - "8624": [0, 0.69224, 0, 0], - "8625": [0, 0.69224, 0, 0], - "8630": [0, 0.43056, 0, 0], - "8631": [0, 0.43056, 0, 0], - "8634": [0.08198, 0.58198, 0, 0], - "8635": [0.08198, 0.58198, 0, 0], - "8638": [0.19444, 0.69224, 0, 0], - "8639": [0.19444, 0.69224, 0, 0], - "8642": [0.19444, 0.69224, 0, 0], - "8643": [0.19444, 0.69224, 0, 0], - "8644": [0.1808, 0.675, 0, 0], - "8646": [0.1808, 0.675, 0, 0], - "8647": [0.1808, 0.675, 0, 0], - "8648": [0.19444, 0.69224, 0, 0], - "8649": [0.1808, 0.675, 0, 0], - "8650": [0.19444, 0.69224, 0, 0], - "8651": [0.01354, 0.52239, 0, 0], - "8652": [0.01354, 0.52239, 0, 0], - "8653": [-0.13313, 0.36687, 0, 0], - "8654": [-0.13313, 0.36687, 0, 0], - "8655": [-0.13313, 0.36687, 0, 0], - "8666": [0.13667, 0.63667, 0, 0], - "8667": [0.13667, 0.63667, 0, 0], - "8669": [-0.13313, 0.37788, 0, 0], - "8672": [-0.064, 0.437, 0, 0], - "8674": [-0.064, 0.437, 0, 0], - "8705": [0, 0.825, 0, 0], - "8708": [0, 0.68889, 0, 0], - "8709": [0.08167, 0.58167, 0, 0], - "8717": [0, 0.43056, 0, 0], - "8722": [-0.03598, 0.46402, 0, 0], - "8724": [0.08198, 0.69224, 0, 0], - "8726": [0.08167, 0.58167, 0, 0], - "8733": [0, 0.69224, 0, 0], - "8736": [0, 0.69224, 0, 0], - "8737": [0, 0.69224, 0, 0], - "8738": [0.03517, 0.52239, 0, 0], - "8739": [0.08167, 0.58167, 0, 0], - "8740": [0.25142, 0.74111, 0, 0], - "8741": [0.08167, 0.58167, 0, 0], - "8742": [0.25142, 0.74111, 0, 0], - "8756": [0, 0.69224, 0, 0], - "8757": [0, 0.69224, 0, 0], - "8764": [-0.13313, 0.36687, 0, 0], - "8765": [-0.13313, 0.37788, 0, 0], - "8769": [-0.13313, 0.36687, 0, 0], - "8770": [-0.03625, 0.46375, 0, 0], - "8774": [0.30274, 0.79383, 0, 0], - "8776": [-0.01688, 0.48312, 0, 0], - "8778": [0.08167, 0.58167, 0, 0], - "8782": [0.06062, 0.54986, 0, 0], - "8783": [0.06062, 0.54986, 0, 0], - "8785": [0.08198, 0.58198, 0, 0], - "8786": [0.08198, 0.58198, 0, 0], - "8787": [0.08198, 0.58198, 0, 0], - "8790": [0, 0.69224, 0, 0], - "8791": [0.22958, 0.72958, 0, 0], - "8796": [0.08198, 0.91667, 0, 0], - "8806": [0.25583, 0.75583, 0, 0], - "8807": [0.25583, 0.75583, 0, 0], - "8808": [0.25142, 0.75726, 0, 0], - "8809": [0.25142, 0.75726, 0, 0], - "8812": [0.25583, 0.75583, 0, 0], - "8814": [0.20576, 0.70576, 0, 0], - "8815": [0.20576, 0.70576, 0, 0], - "8816": [0.30274, 0.79383, 0, 0], - "8817": [0.30274, 0.79383, 0, 0], - "8818": [0.22958, 0.72958, 0, 0], - "8819": [0.22958, 0.72958, 0, 0], - "8822": [0.1808, 0.675, 0, 0], - "8823": [0.1808, 0.675, 0, 0], - "8828": [0.13667, 0.63667, 0, 0], - "8829": [0.13667, 0.63667, 0, 0], - "8830": [0.22958, 0.72958, 0, 0], - "8831": [0.22958, 0.72958, 0, 0], - "8832": [0.20576, 0.70576, 0, 0], - "8833": [0.20576, 0.70576, 0, 0], - "8840": [0.30274, 0.79383, 0, 0], - "8841": [0.30274, 0.79383, 0, 0], - "8842": [0.13597, 0.63597, 0, 0], - "8843": [0.13597, 0.63597, 0, 0], - "8847": [0.03517, 0.54986, 0, 0], - "8848": [0.03517, 0.54986, 0, 0], - "8858": [0.08198, 0.58198, 0, 0], - "8859": [0.08198, 0.58198, 0, 0], - "8861": [0.08198, 0.58198, 0, 0], - "8862": [0, 0.675, 0, 0], - "8863": [0, 0.675, 0, 0], - "8864": [0, 0.675, 0, 0], - "8865": [0, 0.675, 0, 0], - "8872": [0, 0.69224, 0, 0], - "8873": [0, 0.69224, 0, 0], - "8874": [0, 0.69224, 0, 0], - "8876": [0, 0.68889, 0, 0], - "8877": [0, 0.68889, 0, 0], - "8878": [0, 0.68889, 0, 0], - "8879": [0, 0.68889, 0, 0], - "8882": [0.03517, 0.54986, 0, 0], - "8883": [0.03517, 0.54986, 0, 0], - "8884": [0.13667, 0.63667, 0, 0], - "8885": [0.13667, 0.63667, 0, 0], - "8888": [0, 0.54986, 0, 0], - "8890": [0.19444, 0.43056, 0, 0], - "8891": [0.19444, 0.69224, 0, 0], - "8892": [0.19444, 0.69224, 0, 0], - "8901": [0, 0.54986, 0, 0], - "8903": [0.08167, 0.58167, 0, 0], - "8905": [0.08167, 0.58167, 0, 0], - "8906": [0.08167, 0.58167, 0, 0], - "8907": [0, 0.69224, 0, 0], - "8908": [0, 0.69224, 0, 0], - "8909": [-0.03598, 0.46402, 0, 0], - "8910": [0, 0.54986, 0, 0], - "8911": [0, 0.54986, 0, 0], - "8912": [0.03517, 0.54986, 0, 0], - "8913": [0.03517, 0.54986, 0, 0], - "8914": [0, 0.54986, 0, 0], - "8915": [0, 0.54986, 0, 0], - "8916": [0, 0.69224, 0, 0], - "8918": [0.0391, 0.5391, 0, 0], - "8919": [0.0391, 0.5391, 0, 0], - "8920": [0.03517, 0.54986, 0, 0], - "8921": [0.03517, 0.54986, 0, 0], - "8922": [0.38569, 0.88569, 0, 0], - "8923": [0.38569, 0.88569, 0, 0], - "8926": [0.13667, 0.63667, 0, 0], - "8927": [0.13667, 0.63667, 0, 0], - "8928": [0.30274, 0.79383, 0, 0], - "8929": [0.30274, 0.79383, 0, 0], - "8934": [0.23222, 0.74111, 0, 0], - "8935": [0.23222, 0.74111, 0, 0], - "8936": [0.23222, 0.74111, 0, 0], - "8937": [0.23222, 0.74111, 0, 0], - "8938": [0.20576, 0.70576, 0, 0], - "8939": [0.20576, 0.70576, 0, 0], - "8940": [0.30274, 0.79383, 0, 0], - "8941": [0.30274, 0.79383, 0, 0], - "8994": [0.19444, 0.69224, 0, 0], - "8995": [0.19444, 0.69224, 0, 0], - "9416": [0.15559, 0.69224, 0, 0], - "9484": [0, 0.69224, 0, 0], - "9488": [0, 0.69224, 0, 0], - "9492": [0, 0.37788, 0, 0], - "9496": [0, 0.37788, 0, 0], - "9585": [0.19444, 0.68889, 0, 0], - "9586": [0.19444, 0.74111, 0, 0], - "9632": [0, 0.675, 0, 0], - "9633": [0, 0.675, 0, 0], - "9650": [0, 0.54986, 0, 0], - "9651": [0, 0.54986, 0, 0], - "9654": [0.03517, 0.54986, 0, 0], - "9660": [0, 0.54986, 0, 0], - "9661": [0, 0.54986, 0, 0], - "9664": [0.03517, 0.54986, 0, 0], - "9674": [0.11111, 0.69224, 0, 0], - "9733": [0.19444, 0.69224, 0, 0], - "10003": [0, 0.69224, 0, 0], - "10016": [0, 0.69224, 0, 0], - "10731": [0.11111, 0.69224, 0, 0], - "10846": [0.19444, 0.75583, 0, 0], - "10877": [0.13667, 0.63667, 0, 0], - "10878": [0.13667, 0.63667, 0, 0], - "10885": [0.25583, 0.75583, 0, 0], - "10886": [0.25583, 0.75583, 0, 0], - "10887": [0.13597, 0.63597, 0, 0], - "10888": [0.13597, 0.63597, 0, 0], - "10889": [0.26167, 0.75726, 0, 0], - "10890": [0.26167, 0.75726, 0, 0], - "10891": [0.48256, 0.98256, 0, 0], - "10892": [0.48256, 0.98256, 0, 0], - "10901": [0.13667, 0.63667, 0, 0], - "10902": [0.13667, 0.63667, 0, 0], - "10933": [0.25142, 0.75726, 0, 0], - "10934": [0.25142, 0.75726, 0, 0], - "10935": [0.26167, 0.75726, 0, 0], - "10936": [0.26167, 0.75726, 0, 0], - "10937": [0.26167, 0.75726, 0, 0], - "10938": [0.26167, 0.75726, 0, 0], - "10949": [0.25583, 0.75583, 0, 0], - "10950": [0.25583, 0.75583, 0, 0], - "10955": [0.28481, 0.79383, 0, 0], - "10956": [0.28481, 0.79383, 0, 0], - "57350": [0.08167, 0.58167, 0, 0], - "57351": [0.08167, 0.58167, 0, 0], - "57352": [0.08167, 0.58167, 0, 0], - "57353": [0, 0.43056, 0.04028, 0], - "57356": [0.25142, 0.75726, 0, 0], - "57357": [0.25142, 0.75726, 0, 0], - "57358": [0.41951, 0.91951, 0, 0], - "57359": [0.30274, 0.79383, 0, 0], - "57360": [0.30274, 0.79383, 0, 0], - "57361": [0.41951, 0.91951, 0, 0], - "57366": [0.25142, 0.75726, 0, 0], - "57367": [0.25142, 0.75726, 0, 0], - "57368": [0.25142, 0.75726, 0, 0], - "57369": [0.25142, 0.75726, 0, 0], - "57370": [0.13597, 0.63597, 0, 0], - "57371": [0.13597, 0.63597, 0, 0] - }, - "Caligraphic-Regular": { - "48": [0, 0.43056, 0, 0], - "49": [0, 0.43056, 0, 0], - "50": [0, 0.43056, 0, 0], - "51": [0.19444, 0.43056, 0, 0], - "52": [0.19444, 0.43056, 0, 0], - "53": [0.19444, 0.43056, 0, 0], - "54": [0, 0.64444, 0, 0], - "55": [0.19444, 0.43056, 0, 0], - "56": [0, 0.64444, 0, 0], - "57": [0.19444, 0.43056, 0, 0], - "65": [0, 0.68333, 0, 0.19445], - "66": [0, 0.68333, 0.03041, 0.13889], - "67": [0, 0.68333, 0.05834, 0.13889], - "68": [0, 0.68333, 0.02778, 0.08334], - "69": [0, 0.68333, 0.08944, 0.11111], - "70": [0, 0.68333, 0.09931, 0.11111], - "71": [0.09722, 0.68333, 0.0593, 0.11111], - "72": [0, 0.68333, 0.00965, 0.11111], - "73": [0, 0.68333, 0.07382, 0], - "74": [0.09722, 0.68333, 0.18472, 0.16667], - "75": [0, 0.68333, 0.01445, 0.05556], - "76": [0, 0.68333, 0, 0.13889], - "77": [0, 0.68333, 0, 0.13889], - "78": [0, 0.68333, 0.14736, 0.08334], - "79": [0, 0.68333, 0.02778, 0.11111], - "80": [0, 0.68333, 0.08222, 0.08334], - "81": [0.09722, 0.68333, 0, 0.11111], - "82": [0, 0.68333, 0, 0.08334], - "83": [0, 0.68333, 0.075, 0.13889], - "84": [0, 0.68333, 0.25417, 0], - "85": [0, 0.68333, 0.09931, 0.08334], - "86": [0, 0.68333, 0.08222, 0], - "87": [0, 0.68333, 0.08222, 0.08334], - "88": [0, 0.68333, 0.14643, 0.13889], - "89": [0.09722, 0.68333, 0.08222, 0.08334], - "90": [0, 0.68333, 0.07944, 0.13889] - }, - "Fraktur-Regular": { - "33": [0, 0.69141, 0, 0], - "34": [0, 0.69141, 0, 0], - "38": [0, 0.69141, 0, 0], - "39": [0, 0.69141, 0, 0], - "40": [0.24982, 0.74947, 0, 0], - "41": [0.24982, 0.74947, 0, 0], - "42": [0, 0.62119, 0, 0], - "43": [0.08319, 0.58283, 0, 0], - "44": [0, 0.10803, 0, 0], - "45": [0.08319, 0.58283, 0, 0], - "46": [0, 0.10803, 0, 0], - "47": [0.24982, 0.74947, 0, 0], - "48": [0, 0.47534, 0, 0], - "49": [0, 0.47534, 0, 0], - "50": [0, 0.47534, 0, 0], - "51": [0.18906, 0.47534, 0, 0], - "52": [0.18906, 0.47534, 0, 0], - "53": [0.18906, 0.47534, 0, 0], - "54": [0, 0.69141, 0, 0], - "55": [0.18906, 0.47534, 0, 0], - "56": [0, 0.69141, 0, 0], - "57": [0.18906, 0.47534, 0, 0], - "58": [0, 0.47534, 0, 0], - "59": [0.12604, 0.47534, 0, 0], - "61": [-0.13099, 0.36866, 0, 0], - "63": [0, 0.69141, 0, 0], - "65": [0, 0.69141, 0, 0], - "66": [0, 0.69141, 0, 0], - "67": [0, 0.69141, 0, 0], - "68": [0, 0.69141, 0, 0], - "69": [0, 0.69141, 0, 0], - "70": [0.12604, 0.69141, 0, 0], - "71": [0, 0.69141, 0, 0], - "72": [0.06302, 0.69141, 0, 0], - "73": [0, 0.69141, 0, 0], - "74": [0.12604, 0.69141, 0, 0], - "75": [0, 0.69141, 0, 0], - "76": [0, 0.69141, 0, 0], - "77": [0, 0.69141, 0, 0], - "78": [0, 0.69141, 0, 0], - "79": [0, 0.69141, 0, 0], - "80": [0.18906, 0.69141, 0, 0], - "81": [0.03781, 0.69141, 0, 0], - "82": [0, 0.69141, 0, 0], - "83": [0, 0.69141, 0, 0], - "84": [0, 0.69141, 0, 0], - "85": [0, 0.69141, 0, 0], - "86": [0, 0.69141, 0, 0], - "87": [0, 0.69141, 0, 0], - "88": [0, 0.69141, 0, 0], - "89": [0.18906, 0.69141, 0, 0], - "90": [0.12604, 0.69141, 0, 0], - "91": [0.24982, 0.74947, 0, 0], - "93": [0.24982, 0.74947, 0, 0], - "94": [0, 0.69141, 0, 0], - "97": [0, 0.47534, 0, 0], - "98": [0, 0.69141, 0, 0], - "99": [0, 0.47534, 0, 0], - "100": [0, 0.62119, 0, 0], - "101": [0, 0.47534, 0, 0], - "102": [0.18906, 0.69141, 0, 0], - "103": [0.18906, 0.47534, 0, 0], - "104": [0.18906, 0.69141, 0, 0], - "105": [0, 0.69141, 0, 0], - "106": [0, 0.69141, 0, 0], - "107": [0, 0.69141, 0, 0], - "108": [0, 0.69141, 0, 0], - "109": [0, 0.47534, 0, 0], - "110": [0, 0.47534, 0, 0], - "111": [0, 0.47534, 0, 0], - "112": [0.18906, 0.52396, 0, 0], - "113": [0.18906, 0.47534, 0, 0], - "114": [0, 0.47534, 0, 0], - "115": [0, 0.47534, 0, 0], - "116": [0, 0.62119, 0, 0], - "117": [0, 0.47534, 0, 0], - "118": [0, 0.52396, 0, 0], - "119": [0, 0.52396, 0, 0], - "120": [0.18906, 0.47534, 0, 0], - "121": [0.18906, 0.47534, 0, 0], - "122": [0.18906, 0.47534, 0, 0], - "8216": [0, 0.69141, 0, 0], - "8217": [0, 0.69141, 0, 0], - "58112": [0, 0.62119, 0, 0], - "58113": [0, 0.62119, 0, 0], - "58114": [0.18906, 0.69141, 0, 0], - "58115": [0.18906, 0.69141, 0, 0], - "58116": [0.18906, 0.47534, 0, 0], - "58117": [0, 0.69141, 0, 0], - "58118": [0, 0.62119, 0, 0], - "58119": [0, 0.47534, 0, 0] - }, - "Main-Bold": { - "33": [0, 0.69444, 0, 0], - "34": [0, 0.69444, 0, 0], - "35": [0.19444, 0.69444, 0, 0], - "36": [0.05556, 0.75, 0, 0], - "37": [0.05556, 0.75, 0, 0], - "38": [0, 0.69444, 0, 0], - "39": [0, 0.69444, 0, 0], - "40": [0.25, 0.75, 0, 0], - "41": [0.25, 0.75, 0, 0], - "42": [0, 0.75, 0, 0], - "43": [0.13333, 0.63333, 0, 0], - "44": [0.19444, 0.15556, 0, 0], - "45": [0, 0.44444, 0, 0], - "46": [0, 0.15556, 0, 0], - "47": [0.25, 0.75, 0, 0], - "48": [0, 0.64444, 0, 0], - "49": [0, 0.64444, 0, 0], - "50": [0, 0.64444, 0, 0], - "51": [0, 0.64444, 0, 0], - "52": [0, 0.64444, 0, 0], - "53": [0, 0.64444, 0, 0], - "54": [0, 0.64444, 0, 0], - "55": [0, 0.64444, 0, 0], - "56": [0, 0.64444, 0, 0], - "57": [0, 0.64444, 0, 0], - "58": [0, 0.44444, 0, 0], - "59": [0.19444, 0.44444, 0, 0], - "60": [0.08556, 0.58556, 0, 0], - "61": [-0.10889, 0.39111, 0, 0], - "62": [0.08556, 0.58556, 0, 0], - "63": [0, 0.69444, 0, 0], - "64": [0, 0.69444, 0, 0], - "65": [0, 0.68611, 0, 0], - "66": [0, 0.68611, 0, 0], - "67": [0, 0.68611, 0, 0], - "68": [0, 0.68611, 0, 0], - "69": [0, 0.68611, 0, 0], - "70": [0, 0.68611, 0, 0], - "71": [0, 0.68611, 0, 0], - "72": [0, 0.68611, 0, 0], - "73": [0, 0.68611, 0, 0], - "74": [0, 0.68611, 0, 0], - "75": [0, 0.68611, 0, 0], - "76": [0, 0.68611, 0, 0], - "77": [0, 0.68611, 0, 0], - "78": [0, 0.68611, 0, 0], - "79": [0, 0.68611, 0, 0], - "80": [0, 0.68611, 0, 0], - "81": [0.19444, 0.68611, 0, 0], - "82": [0, 0.68611, 0, 0], - "83": [0, 0.68611, 0, 0], - "84": [0, 0.68611, 0, 0], - "85": [0, 0.68611, 0, 0], - "86": [0, 0.68611, 0.01597, 0], - "87": [0, 0.68611, 0.01597, 0], - "88": [0, 0.68611, 0, 0], - "89": [0, 0.68611, 0.02875, 0], - "90": [0, 0.68611, 0, 0], - "91": [0.25, 0.75, 0, 0], - "92": [0.25, 0.75, 0, 0], - "93": [0.25, 0.75, 0, 0], - "94": [0, 0.69444, 0, 0], - "95": [0.31, 0.13444, 0.03194, 0], - "96": [0, 0.69444, 0, 0], - "97": [0, 0.44444, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.44444, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.44444, 0, 0], - "102": [0, 0.69444, 0.10903, 0], - "103": [0.19444, 0.44444, 0.01597, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.69444, 0, 0], - "106": [0.19444, 0.69444, 0, 0], - "107": [0, 0.69444, 0, 0], - "108": [0, 0.69444, 0, 0], - "109": [0, 0.44444, 0, 0], - "110": [0, 0.44444, 0, 0], - "111": [0, 0.44444, 0, 0], - "112": [0.19444, 0.44444, 0, 0], - "113": [0.19444, 0.44444, 0, 0], - "114": [0, 0.44444, 0, 0], - "115": [0, 0.44444, 0, 0], - "116": [0, 0.63492, 0, 0], - "117": [0, 0.44444, 0, 0], - "118": [0, 0.44444, 0.01597, 0], - "119": [0, 0.44444, 0.01597, 0], - "120": [0, 0.44444, 0, 0], - "121": [0.19444, 0.44444, 0.01597, 0], - "122": [0, 0.44444, 0, 0], - "123": [0.25, 0.75, 0, 0], - "124": [0.25, 0.75, 0, 0], - "125": [0.25, 0.75, 0, 0], - "126": [0.35, 0.34444, 0, 0], - "168": [0, 0.69444, 0, 0], - "172": [0, 0.44444, 0, 0], - "175": [0, 0.59611, 0, 0], - "176": [0, 0.69444, 0, 0], - "177": [0.13333, 0.63333, 0, 0], - "180": [0, 0.69444, 0, 0], - "215": [0.13333, 0.63333, 0, 0], - "247": [0.13333, 0.63333, 0, 0], - "305": [0, 0.44444, 0, 0], - "567": [0.19444, 0.44444, 0, 0], - "710": [0, 0.69444, 0, 0], - "711": [0, 0.63194, 0, 0], - "713": [0, 0.59611, 0, 0], - "714": [0, 0.69444, 0, 0], - "715": [0, 0.69444, 0, 0], - "728": [0, 0.69444, 0, 0], - "729": [0, 0.69444, 0, 0], - "730": [0, 0.69444, 0, 0], - "732": [0, 0.69444, 0, 0], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0, 0], - "770": [0, 0.69444, 0, 0], - "771": [0, 0.69444, 0, 0], - "772": [0, 0.59611, 0, 0], - "774": [0, 0.69444, 0, 0], - "775": [0, 0.69444, 0, 0], - "776": [0, 0.69444, 0, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0, 0], - "780": [0, 0.63194, 0, 0], - "824": [0.19444, 0.69444, 0, 0], - "915": [0, 0.68611, 0, 0], - "916": [0, 0.68611, 0, 0], - "920": [0, 0.68611, 0, 0], - "923": [0, 0.68611, 0, 0], - "926": [0, 0.68611, 0, 0], - "928": [0, 0.68611, 0, 0], - "931": [0, 0.68611, 0, 0], - "933": [0, 0.68611, 0, 0], - "934": [0, 0.68611, 0, 0], - "936": [0, 0.68611, 0, 0], - "937": [0, 0.68611, 0, 0], - "8211": [0, 0.44444, 0.03194, 0], - "8212": [0, 0.44444, 0.03194, 0], - "8216": [0, 0.69444, 0, 0], - "8217": [0, 0.69444, 0, 0], - "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0], - "8224": [0.19444, 0.69444, 0, 0], - "8225": [0.19444, 0.69444, 0, 0], - "8242": [0, 0.55556, 0, 0], - "8407": [0, 0.72444, 0.15486, 0], - "8463": [0, 0.69444, 0, 0], - "8465": [0, 0.69444, 0, 0], - "8467": [0, 0.69444, 0, 0], - "8472": [0.19444, 0.44444, 0, 0], - "8476": [0, 0.69444, 0, 0], - "8501": [0, 0.69444, 0, 0], - "8592": [-0.10889, 0.39111, 0, 0], - "8593": [0.19444, 0.69444, 0, 0], - "8594": [-0.10889, 0.39111, 0, 0], - "8595": [0.19444, 0.69444, 0, 0], - "8596": [-0.10889, 0.39111, 0, 0], - "8597": [0.25, 0.75, 0, 0], - "8598": [0.19444, 0.69444, 0, 0], - "8599": [0.19444, 0.69444, 0, 0], - "8600": [0.19444, 0.69444, 0, 0], - "8601": [0.19444, 0.69444, 0, 0], - "8636": [-0.10889, 0.39111, 0, 0], - "8637": [-0.10889, 0.39111, 0, 0], - "8640": [-0.10889, 0.39111, 0, 0], - "8641": [-0.10889, 0.39111, 0, 0], - "8656": [-0.10889, 0.39111, 0, 0], - "8657": [0.19444, 0.69444, 0, 0], - "8658": [-0.10889, 0.39111, 0, 0], - "8659": [0.19444, 0.69444, 0, 0], - "8660": [-0.10889, 0.39111, 0, 0], - "8661": [0.25, 0.75, 0, 0], - "8704": [0, 0.69444, 0, 0], - "8706": [0, 0.69444, 0.06389, 0], - "8707": [0, 0.69444, 0, 0], - "8709": [0.05556, 0.75, 0, 0], - "8711": [0, 0.68611, 0, 0], - "8712": [0.08556, 0.58556, 0, 0], - "8715": [0.08556, 0.58556, 0, 0], - "8722": [0.13333, 0.63333, 0, 0], - "8723": [0.13333, 0.63333, 0, 0], - "8725": [0.25, 0.75, 0, 0], - "8726": [0.25, 0.75, 0, 0], - "8727": [-0.02778, 0.47222, 0, 0], - "8728": [-0.02639, 0.47361, 0, 0], - "8729": [-0.02639, 0.47361, 0, 0], - "8730": [0.18, 0.82, 0, 0], - "8733": [0, 0.44444, 0, 0], - "8734": [0, 0.44444, 0, 0], - "8736": [0, 0.69224, 0, 0], - "8739": [0.25, 0.75, 0, 0], - "8741": [0.25, 0.75, 0, 0], - "8743": [0, 0.55556, 0, 0], - "8744": [0, 0.55556, 0, 0], - "8745": [0, 0.55556, 0, 0], - "8746": [0, 0.55556, 0, 0], - "8747": [0.19444, 0.69444, 0.12778, 0], - "8764": [-0.10889, 0.39111, 0, 0], - "8768": [0.19444, 0.69444, 0, 0], - "8771": [0.00222, 0.50222, 0, 0], - "8776": [0.02444, 0.52444, 0, 0], - "8781": [0.00222, 0.50222, 0, 0], - "8801": [0.00222, 0.50222, 0, 0], - "8804": [0.19667, 0.69667, 0, 0], - "8805": [0.19667, 0.69667, 0, 0], - "8810": [0.08556, 0.58556, 0, 0], - "8811": [0.08556, 0.58556, 0, 0], - "8826": [0.08556, 0.58556, 0, 0], - "8827": [0.08556, 0.58556, 0, 0], - "8834": [0.08556, 0.58556, 0, 0], - "8835": [0.08556, 0.58556, 0, 0], - "8838": [0.19667, 0.69667, 0, 0], - "8839": [0.19667, 0.69667, 0, 0], - "8846": [0, 0.55556, 0, 0], - "8849": [0.19667, 0.69667, 0, 0], - "8850": [0.19667, 0.69667, 0, 0], - "8851": [0, 0.55556, 0, 0], - "8852": [0, 0.55556, 0, 0], - "8853": [0.13333, 0.63333, 0, 0], - "8854": [0.13333, 0.63333, 0, 0], - "8855": [0.13333, 0.63333, 0, 0], - "8856": [0.13333, 0.63333, 0, 0], - "8857": [0.13333, 0.63333, 0, 0], - "8866": [0, 0.69444, 0, 0], - "8867": [0, 0.69444, 0, 0], - "8868": [0, 0.69444, 0, 0], - "8869": [0, 0.69444, 0, 0], - "8900": [-0.02639, 0.47361, 0, 0], - "8901": [-0.02639, 0.47361, 0, 0], - "8902": [-0.02778, 0.47222, 0, 0], - "8968": [0.25, 0.75, 0, 0], - "8969": [0.25, 0.75, 0, 0], - "8970": [0.25, 0.75, 0, 0], - "8971": [0.25, 0.75, 0, 0], - "8994": [-0.13889, 0.36111, 0, 0], - "8995": [-0.13889, 0.36111, 0, 0], - "9651": [0.19444, 0.69444, 0, 0], - "9657": [-0.02778, 0.47222, 0, 0], - "9661": [0.19444, 0.69444, 0, 0], - "9667": [-0.02778, 0.47222, 0, 0], - "9711": [0.19444, 0.69444, 0, 0], - "9824": [0.12963, 0.69444, 0, 0], - "9825": [0.12963, 0.69444, 0, 0], - "9826": [0.12963, 0.69444, 0, 0], - "9827": [0.12963, 0.69444, 0, 0], - "9837": [0, 0.75, 0, 0], - "9838": [0.19444, 0.69444, 0, 0], - "9839": [0.19444, 0.69444, 0, 0], - "10216": [0.25, 0.75, 0, 0], - "10217": [0.25, 0.75, 0, 0], - "10815": [0, 0.68611, 0, 0], - "10927": [0.19667, 0.69667, 0, 0], - "10928": [0.19667, 0.69667, 0, 0] - }, - "Main-Italic": { - "33": [0, 0.69444, 0.12417, 0], - "34": [0, 0.69444, 0.06961, 0], - "35": [0.19444, 0.69444, 0.06616, 0], - "37": [0.05556, 0.75, 0.13639, 0], - "38": [0, 0.69444, 0.09694, 0], - "39": [0, 0.69444, 0.12417, 0], - "40": [0.25, 0.75, 0.16194, 0], - "41": [0.25, 0.75, 0.03694, 0], - "42": [0, 0.75, 0.14917, 0], - "43": [0.05667, 0.56167, 0.03694, 0], - "44": [0.19444, 0.10556, 0, 0], - "45": [0, 0.43056, 0.02826, 0], - "46": [0, 0.10556, 0, 0], - "47": [0.25, 0.75, 0.16194, 0], - "48": [0, 0.64444, 0.13556, 0], - "49": [0, 0.64444, 0.13556, 0], - "50": [0, 0.64444, 0.13556, 0], - "51": [0, 0.64444, 0.13556, 0], - "52": [0.19444, 0.64444, 0.13556, 0], - "53": [0, 0.64444, 0.13556, 0], - "54": [0, 0.64444, 0.13556, 0], - "55": [0.19444, 0.64444, 0.13556, 0], - "56": [0, 0.64444, 0.13556, 0], - "57": [0, 0.64444, 0.13556, 0], - "58": [0, 0.43056, 0.0582, 0], - "59": [0.19444, 0.43056, 0.0582, 0], - "61": [-0.13313, 0.36687, 0.06616, 0], - "63": [0, 0.69444, 0.1225, 0], - "64": [0, 0.69444, 0.09597, 0], - "65": [0, 0.68333, 0, 0], - "66": [0, 0.68333, 0.10257, 0], - "67": [0, 0.68333, 0.14528, 0], - "68": [0, 0.68333, 0.09403, 0], - "69": [0, 0.68333, 0.12028, 0], - "70": [0, 0.68333, 0.13305, 0], - "71": [0, 0.68333, 0.08722, 0], - "72": [0, 0.68333, 0.16389, 0], - "73": [0, 0.68333, 0.15806, 0], - "74": [0, 0.68333, 0.14028, 0], - "75": [0, 0.68333, 0.14528, 0], - "76": [0, 0.68333, 0, 0], - "77": [0, 0.68333, 0.16389, 0], - "78": [0, 0.68333, 0.16389, 0], - "79": [0, 0.68333, 0.09403, 0], - "80": [0, 0.68333, 0.10257, 0], - "81": [0.19444, 0.68333, 0.09403, 0], - "82": [0, 0.68333, 0.03868, 0], - "83": [0, 0.68333, 0.11972, 0], - "84": [0, 0.68333, 0.13305, 0], - "85": [0, 0.68333, 0.16389, 0], - "86": [0, 0.68333, 0.18361, 0], - "87": [0, 0.68333, 0.18361, 0], - "88": [0, 0.68333, 0.15806, 0], - "89": [0, 0.68333, 0.19383, 0], - "90": [0, 0.68333, 0.14528, 0], - "91": [0.25, 0.75, 0.1875, 0], - "93": [0.25, 0.75, 0.10528, 0], - "94": [0, 0.69444, 0.06646, 0], - "95": [0.31, 0.12056, 0.09208, 0], - "97": [0, 0.43056, 0.07671, 0], - "98": [0, 0.69444, 0.06312, 0], - "99": [0, 0.43056, 0.05653, 0], - "100": [0, 0.69444, 0.10333, 0], - "101": [0, 0.43056, 0.07514, 0], - "102": [0.19444, 0.69444, 0.21194, 0], - "103": [0.19444, 0.43056, 0.08847, 0], - "104": [0, 0.69444, 0.07671, 0], - "105": [0, 0.65536, 0.1019, 0], - "106": [0.19444, 0.65536, 0.14467, 0], - "107": [0, 0.69444, 0.10764, 0], - "108": [0, 0.69444, 0.10333, 0], - "109": [0, 0.43056, 0.07671, 0], - "110": [0, 0.43056, 0.07671, 0], - "111": [0, 0.43056, 0.06312, 0], - "112": [0.19444, 0.43056, 0.06312, 0], - "113": [0.19444, 0.43056, 0.08847, 0], - "114": [0, 0.43056, 0.10764, 0], - "115": [0, 0.43056, 0.08208, 0], - "116": [0, 0.61508, 0.09486, 0], - "117": [0, 0.43056, 0.07671, 0], - "118": [0, 0.43056, 0.10764, 0], - "119": [0, 0.43056, 0.10764, 0], - "120": [0, 0.43056, 0.12042, 0], - "121": [0.19444, 0.43056, 0.08847, 0], - "122": [0, 0.43056, 0.12292, 0], - "126": [0.35, 0.31786, 0.11585, 0], - "163": [0, 0.69444, 0, 0], - "305": [0, 0.43056, 0, 0.02778], - "567": [0.19444, 0.43056, 0, 0.08334], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0.09694, 0], - "770": [0, 0.69444, 0.06646, 0], - "771": [0, 0.66786, 0.11585, 0], - "772": [0, 0.56167, 0.10333, 0], - "774": [0, 0.69444, 0.10806, 0], - "775": [0, 0.66786, 0.11752, 0], - "776": [0, 0.66786, 0.10474, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0.1225, 0], - "780": [0, 0.62847, 0.08295, 0], - "915": [0, 0.68333, 0.13305, 0], - "916": [0, 0.68333, 0, 0], - "920": [0, 0.68333, 0.09403, 0], - "923": [0, 0.68333, 0, 0], - "926": [0, 0.68333, 0.15294, 0], - "928": [0, 0.68333, 0.16389, 0], - "931": [0, 0.68333, 0.12028, 0], - "933": [0, 0.68333, 0.11111, 0], - "934": [0, 0.68333, 0.05986, 0], - "936": [0, 0.68333, 0.11111, 0], - "937": [0, 0.68333, 0.10257, 0], - "8211": [0, 0.43056, 0.09208, 0], - "8212": [0, 0.43056, 0.09208, 0], - "8216": [0, 0.69444, 0.12417, 0], - "8217": [0, 0.69444, 0.12417, 0], - "8220": [0, 0.69444, 0.1685, 0], - "8221": [0, 0.69444, 0.06961, 0], - "8463": [0, 0.68889, 0, 0] - }, - "Main-Regular": { - "32": [0, 0, 0, 0], - "33": [0, 0.69444, 0, 0], - "34": [0, 0.69444, 0, 0], - "35": [0.19444, 0.69444, 0, 0], - "36": [0.05556, 0.75, 0, 0], - "37": [0.05556, 0.75, 0, 0], - "38": [0, 0.69444, 0, 0], - "39": [0, 0.69444, 0, 0], - "40": [0.25, 0.75, 0, 0], - "41": [0.25, 0.75, 0, 0], - "42": [0, 0.75, 0, 0], - "43": [0.08333, 0.58333, 0, 0], - "44": [0.19444, 0.10556, 0, 0], - "45": [0, 0.43056, 0, 0], - "46": [0, 0.10556, 0, 0], - "47": [0.25, 0.75, 0, 0], - "48": [0, 0.64444, 0, 0], - "49": [0, 0.64444, 0, 0], - "50": [0, 0.64444, 0, 0], - "51": [0, 0.64444, 0, 0], - "52": [0, 0.64444, 0, 0], - "53": [0, 0.64444, 0, 0], - "54": [0, 0.64444, 0, 0], - "55": [0, 0.64444, 0, 0], - "56": [0, 0.64444, 0, 0], - "57": [0, 0.64444, 0, 0], - "58": [0, 0.43056, 0, 0], - "59": [0.19444, 0.43056, 0, 0], - "60": [0.0391, 0.5391, 0, 0], - "61": [-0.13313, 0.36687, 0, 0], - "62": [0.0391, 0.5391, 0, 0], - "63": [0, 0.69444, 0, 0], - "64": [0, 0.69444, 0, 0], - "65": [0, 0.68333, 0, 0], - "66": [0, 0.68333, 0, 0], - "67": [0, 0.68333, 0, 0], - "68": [0, 0.68333, 0, 0], - "69": [0, 0.68333, 0, 0], - "70": [0, 0.68333, 0, 0], - "71": [0, 0.68333, 0, 0], - "72": [0, 0.68333, 0, 0], - "73": [0, 0.68333, 0, 0], - "74": [0, 0.68333, 0, 0], - "75": [0, 0.68333, 0, 0], - "76": [0, 0.68333, 0, 0], - "77": [0, 0.68333, 0, 0], - "78": [0, 0.68333, 0, 0], - "79": [0, 0.68333, 0, 0], - "80": [0, 0.68333, 0, 0], - "81": [0.19444, 0.68333, 0, 0], - "82": [0, 0.68333, 0, 0], - "83": [0, 0.68333, 0, 0], - "84": [0, 0.68333, 0, 0], - "85": [0, 0.68333, 0, 0], - "86": [0, 0.68333, 0.01389, 0], - "87": [0, 0.68333, 0.01389, 0], - "88": [0, 0.68333, 0, 0], - "89": [0, 0.68333, 0.025, 0], - "90": [0, 0.68333, 0, 0], - "91": [0.25, 0.75, 0, 0], - "92": [0.25, 0.75, 0, 0], - "93": [0.25, 0.75, 0, 0], - "94": [0, 0.69444, 0, 0], - "95": [0.31, 0.12056, 0.02778, 0], - "96": [0, 0.69444, 0, 0], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.43056, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.43056, 0, 0], - "102": [0, 0.69444, 0.07778, 0], - "103": [0.19444, 0.43056, 0.01389, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.66786, 0, 0], - "106": [0.19444, 0.66786, 0, 0], - "107": [0, 0.69444, 0, 0], - "108": [0, 0.69444, 0, 0], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0], - "112": [0.19444, 0.43056, 0, 0], - "113": [0.19444, 0.43056, 0, 0], - "114": [0, 0.43056, 0, 0], - "115": [0, 0.43056, 0, 0], - "116": [0, 0.61508, 0, 0], - "117": [0, 0.43056, 0, 0], - "118": [0, 0.43056, 0.01389, 0], - "119": [0, 0.43056, 0.01389, 0], - "120": [0, 0.43056, 0, 0], - "121": [0.19444, 0.43056, 0.01389, 0], - "122": [0, 0.43056, 0, 0], - "123": [0.25, 0.75, 0, 0], - "124": [0.25, 0.75, 0, 0], - "125": [0.25, 0.75, 0, 0], - "126": [0.35, 0.31786, 0, 0], - "160": [0, 0, 0, 0], - "168": [0, 0.66786, 0, 0], - "172": [0, 0.43056, 0, 0], - "175": [0, 0.56778, 0, 0], - "176": [0, 0.69444, 0, 0], - "177": [0.08333, 0.58333, 0, 0], - "180": [0, 0.69444, 0, 0], - "215": [0.08333, 0.58333, 0, 0], - "247": [0.08333, 0.58333, 0, 0], - "305": [0, 0.43056, 0, 0], - "567": [0.19444, 0.43056, 0, 0], - "710": [0, 0.69444, 0, 0], - "711": [0, 0.62847, 0, 0], - "713": [0, 0.56778, 0, 0], - "714": [0, 0.69444, 0, 0], - "715": [0, 0.69444, 0, 0], - "728": [0, 0.69444, 0, 0], - "729": [0, 0.66786, 0, 0], - "730": [0, 0.69444, 0, 0], - "732": [0, 0.66786, 0, 0], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0, 0], - "770": [0, 0.69444, 0, 0], - "771": [0, 0.66786, 0, 0], - "772": [0, 0.56778, 0, 0], - "774": [0, 0.69444, 0, 0], - "775": [0, 0.66786, 0, 0], - "776": [0, 0.66786, 0, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0, 0], - "780": [0, 0.62847, 0, 0], - "824": [0.19444, 0.69444, 0, 0], - "915": [0, 0.68333, 0, 0], - "916": [0, 0.68333, 0, 0], - "920": [0, 0.68333, 0, 0], - "923": [0, 0.68333, 0, 0], - "926": [0, 0.68333, 0, 0], - "928": [0, 0.68333, 0, 0], - "931": [0, 0.68333, 0, 0], - "933": [0, 0.68333, 0, 0], - "934": [0, 0.68333, 0, 0], - "936": [0, 0.68333, 0, 0], - "937": [0, 0.68333, 0, 0], - "8211": [0, 0.43056, 0.02778, 0], - "8212": [0, 0.43056, 0.02778, 0], - "8216": [0, 0.69444, 0, 0], - "8217": [0, 0.69444, 0, 0], - "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0], - "8224": [0.19444, 0.69444, 0, 0], - "8225": [0.19444, 0.69444, 0, 0], - "8230": [0, 0.12, 0, 0], - "8242": [0, 0.55556, 0, 0], - "8407": [0, 0.71444, 0.15382, 0], - "8463": [0, 0.68889, 0, 0], - "8465": [0, 0.69444, 0, 0], - "8467": [0, 0.69444, 0, 0.11111], - "8472": [0.19444, 0.43056, 0, 0.11111], - "8476": [0, 0.69444, 0, 0], - "8501": [0, 0.69444, 0, 0], - "8592": [-0.13313, 0.36687, 0, 0], - "8593": [0.19444, 0.69444, 0, 0], - "8594": [-0.13313, 0.36687, 0, 0], - "8595": [0.19444, 0.69444, 0, 0], - "8596": [-0.13313, 0.36687, 0, 0], - "8597": [0.25, 0.75, 0, 0], - "8598": [0.19444, 0.69444, 0, 0], - "8599": [0.19444, 0.69444, 0, 0], - "8600": [0.19444, 0.69444, 0, 0], - "8601": [0.19444, 0.69444, 0, 0], - "8614": [0.011, 0.511, 0, 0], - "8617": [0.011, 0.511, 0, 0], - "8618": [0.011, 0.511, 0, 0], - "8636": [-0.13313, 0.36687, 0, 0], - "8637": [-0.13313, 0.36687, 0, 0], - "8640": [-0.13313, 0.36687, 0, 0], - "8641": [-0.13313, 0.36687, 0, 0], - "8652": [0.011, 0.671, 0, 0], - "8656": [-0.13313, 0.36687, 0, 0], - "8657": [0.19444, 0.69444, 0, 0], - "8658": [-0.13313, 0.36687, 0, 0], - "8659": [0.19444, 0.69444, 0, 0], - "8660": [-0.13313, 0.36687, 0, 0], - "8661": [0.25, 0.75, 0, 0], - "8704": [0, 0.69444, 0, 0], - "8706": [0, 0.69444, 0.05556, 0.08334], - "8707": [0, 0.69444, 0, 0], - "8709": [0.05556, 0.75, 0, 0], - "8711": [0, 0.68333, 0, 0], - "8712": [0.0391, 0.5391, 0, 0], - "8715": [0.0391, 0.5391, 0, 0], - "8722": [0.08333, 0.58333, 0, 0], - "8723": [0.08333, 0.58333, 0, 0], - "8725": [0.25, 0.75, 0, 0], - "8726": [0.25, 0.75, 0, 0], - "8727": [-0.03472, 0.46528, 0, 0], - "8728": [-0.05555, 0.44445, 0, 0], - "8729": [-0.05555, 0.44445, 0, 0], - "8730": [0.2, 0.8, 0, 0], - "8733": [0, 0.43056, 0, 0], - "8734": [0, 0.43056, 0, 0], - "8736": [0, 0.69224, 0, 0], - "8739": [0.25, 0.75, 0, 0], - "8741": [0.25, 0.75, 0, 0], - "8743": [0, 0.55556, 0, 0], - "8744": [0, 0.55556, 0, 0], - "8745": [0, 0.55556, 0, 0], - "8746": [0, 0.55556, 0, 0], - "8747": [0.19444, 0.69444, 0.11111, 0], - "8764": [-0.13313, 0.36687, 0, 0], - "8768": [0.19444, 0.69444, 0, 0], - "8771": [-0.03625, 0.46375, 0, 0], - "8773": [-0.022, 0.589, 0, 0], - "8776": [-0.01688, 0.48312, 0, 0], - "8781": [-0.03625, 0.46375, 0, 0], - "8784": [-0.133, 0.67, 0, 0], - "8800": [0.215, 0.716, 0, 0], - "8801": [-0.03625, 0.46375, 0, 0], - "8804": [0.13597, 0.63597, 0, 0], - "8805": [0.13597, 0.63597, 0, 0], - "8810": [0.0391, 0.5391, 0, 0], - "8811": [0.0391, 0.5391, 0, 0], - "8826": [0.0391, 0.5391, 0, 0], - "8827": [0.0391, 0.5391, 0, 0], - "8834": [0.0391, 0.5391, 0, 0], - "8835": [0.0391, 0.5391, 0, 0], - "8838": [0.13597, 0.63597, 0, 0], - "8839": [0.13597, 0.63597, 0, 0], - "8846": [0, 0.55556, 0, 0], - "8849": [0.13597, 0.63597, 0, 0], - "8850": [0.13597, 0.63597, 0, 0], - "8851": [0, 0.55556, 0, 0], - "8852": [0, 0.55556, 0, 0], - "8853": [0.08333, 0.58333, 0, 0], - "8854": [0.08333, 0.58333, 0, 0], - "8855": [0.08333, 0.58333, 0, 0], - "8856": [0.08333, 0.58333, 0, 0], - "8857": [0.08333, 0.58333, 0, 0], - "8866": [0, 0.69444, 0, 0], - "8867": [0, 0.69444, 0, 0], - "8868": [0, 0.69444, 0, 0], - "8869": [0, 0.69444, 0, 0], - "8872": [0.249, 0.75, 0, 0], - "8900": [-0.05555, 0.44445, 0, 0], - "8901": [-0.05555, 0.44445, 0, 0], - "8902": [-0.03472, 0.46528, 0, 0], - "8904": [0.005, 0.505, 0, 0], - "8942": [0.03, 0.9, 0, 0], - "8943": [-0.19, 0.31, 0, 0], - "8945": [-0.1, 0.82, 0, 0], - "8968": [0.25, 0.75, 0, 0], - "8969": [0.25, 0.75, 0, 0], - "8970": [0.25, 0.75, 0, 0], - "8971": [0.25, 0.75, 0, 0], - "8994": [-0.14236, 0.35764, 0, 0], - "8995": [-0.14236, 0.35764, 0, 0], - "9136": [0.244, 0.744, 0, 0], - "9137": [0.244, 0.744, 0, 0], - "9651": [0.19444, 0.69444, 0, 0], - "9657": [-0.03472, 0.46528, 0, 0], - "9661": [0.19444, 0.69444, 0, 0], - "9667": [-0.03472, 0.46528, 0, 0], - "9711": [0.19444, 0.69444, 0, 0], - "9824": [0.12963, 0.69444, 0, 0], - "9825": [0.12963, 0.69444, 0, 0], - "9826": [0.12963, 0.69444, 0, 0], - "9827": [0.12963, 0.69444, 0, 0], - "9837": [0, 0.75, 0, 0], - "9838": [0.19444, 0.69444, 0, 0], - "9839": [0.19444, 0.69444, 0, 0], - "10216": [0.25, 0.75, 0, 0], - "10217": [0.25, 0.75, 0, 0], - "10222": [0.244, 0.744, 0, 0], - "10223": [0.244, 0.744, 0, 0], - "10229": [0.011, 0.511, 0, 0], - "10230": [0.011, 0.511, 0, 0], - "10231": [0.011, 0.511, 0, 0], - "10232": [0.024, 0.525, 0, 0], - "10233": [0.024, 0.525, 0, 0], - "10234": [0.024, 0.525, 0, 0], - "10236": [0.011, 0.511, 0, 0], - "10815": [0, 0.68333, 0, 0], - "10927": [0.13597, 0.63597, 0, 0], - "10928": [0.13597, 0.63597, 0, 0] - }, - "Math-BoldItalic": { - "47": [0.19444, 0.69444, 0, 0], - "65": [0, 0.68611, 0, 0], - "66": [0, 0.68611, 0.04835, 0], - "67": [0, 0.68611, 0.06979, 0], - "68": [0, 0.68611, 0.03194, 0], - "69": [0, 0.68611, 0.05451, 0], - "70": [0, 0.68611, 0.15972, 0], - "71": [0, 0.68611, 0, 0], - "72": [0, 0.68611, 0.08229, 0], - "73": [0, 0.68611, 0.07778, 0], - "74": [0, 0.68611, 0.10069, 0], - "75": [0, 0.68611, 0.06979, 0], - "76": [0, 0.68611, 0, 0], - "77": [0, 0.68611, 0.11424, 0], - "78": [0, 0.68611, 0.11424, 0], - "79": [0, 0.68611, 0.03194, 0], - "80": [0, 0.68611, 0.15972, 0], - "81": [0.19444, 0.68611, 0, 0], - "82": [0, 0.68611, 0.00421, 0], - "83": [0, 0.68611, 0.05382, 0], - "84": [0, 0.68611, 0.15972, 0], - "85": [0, 0.68611, 0.11424, 0], - "86": [0, 0.68611, 0.25555, 0], - "87": [0, 0.68611, 0.15972, 0], - "88": [0, 0.68611, 0.07778, 0], - "89": [0, 0.68611, 0.25555, 0], - "90": [0, 0.68611, 0.06979, 0], - "97": [0, 0.44444, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.44444, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.44444, 0, 0], - "102": [0.19444, 0.69444, 0.11042, 0], - "103": [0.19444, 0.44444, 0.03704, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.69326, 0, 0], - "106": [0.19444, 0.69326, 0.0622, 0], - "107": [0, 0.69444, 0.01852, 0], - "108": [0, 0.69444, 0.0088, 0], - "109": [0, 0.44444, 0, 0], - "110": [0, 0.44444, 0, 0], - "111": [0, 0.44444, 0, 0], - "112": [0.19444, 0.44444, 0, 0], - "113": [0.19444, 0.44444, 0.03704, 0], - "114": [0, 0.44444, 0.03194, 0], - "115": [0, 0.44444, 0, 0], - "116": [0, 0.63492, 0, 0], - "117": [0, 0.44444, 0, 0], - "118": [0, 0.44444, 0.03704, 0], - "119": [0, 0.44444, 0.02778, 0], - "120": [0, 0.44444, 0, 0], - "121": [0.19444, 0.44444, 0.03704, 0], - "122": [0, 0.44444, 0.04213, 0], - "915": [0, 0.68611, 0.15972, 0], - "916": [0, 0.68611, 0, 0], - "920": [0, 0.68611, 0.03194, 0], - "923": [0, 0.68611, 0, 0], - "926": [0, 0.68611, 0.07458, 0], - "928": [0, 0.68611, 0.08229, 0], - "931": [0, 0.68611, 0.05451, 0], - "933": [0, 0.68611, 0.15972, 0], - "934": [0, 0.68611, 0, 0], - "936": [0, 0.68611, 0.11653, 0], - "937": [0, 0.68611, 0.04835, 0], - "945": [0, 0.44444, 0, 0], - "946": [0.19444, 0.69444, 0.03403, 0], - "947": [0.19444, 0.44444, 0.06389, 0], - "948": [0, 0.69444, 0.03819, 0], - "949": [0, 0.44444, 0, 0], - "950": [0.19444, 0.69444, 0.06215, 0], - "951": [0.19444, 0.44444, 0.03704, 0], - "952": [0, 0.69444, 0.03194, 0], - "953": [0, 0.44444, 0, 0], - "954": [0, 0.44444, 0, 0], - "955": [0, 0.69444, 0, 0], - "956": [0.19444, 0.44444, 0, 0], - "957": [0, 0.44444, 0.06898, 0], - "958": [0.19444, 0.69444, 0.03021, 0], - "959": [0, 0.44444, 0, 0], - "960": [0, 0.44444, 0.03704, 0], - "961": [0.19444, 0.44444, 0, 0], - "962": [0.09722, 0.44444, 0.07917, 0], - "963": [0, 0.44444, 0.03704, 0], - "964": [0, 0.44444, 0.13472, 0], - "965": [0, 0.44444, 0.03704, 0], - "966": [0.19444, 0.44444, 0, 0], - "967": [0.19444, 0.44444, 0, 0], - "968": [0.19444, 0.69444, 0.03704, 0], - "969": [0, 0.44444, 0.03704, 0], - "977": [0, 0.69444, 0, 0], - "981": [0.19444, 0.69444, 0, 0], - "982": [0, 0.44444, 0.03194, 0], - "1009": [0.19444, 0.44444, 0, 0], - "1013": [0, 0.44444, 0, 0] - }, - "Math-Italic": { - "47": [0.19444, 0.69444, 0, 0], - "65": [0, 0.68333, 0, 0.13889], - "66": [0, 0.68333, 0.05017, 0.08334], - "67": [0, 0.68333, 0.07153, 0.08334], - "68": [0, 0.68333, 0.02778, 0.05556], - "69": [0, 0.68333, 0.05764, 0.08334], - "70": [0, 0.68333, 0.13889, 0.08334], - "71": [0, 0.68333, 0, 0.08334], - "72": [0, 0.68333, 0.08125, 0.05556], - "73": [0, 0.68333, 0.07847, 0.11111], - "74": [0, 0.68333, 0.09618, 0.16667], - "75": [0, 0.68333, 0.07153, 0.05556], - "76": [0, 0.68333, 0, 0.02778], - "77": [0, 0.68333, 0.10903, 0.08334], - "78": [0, 0.68333, 0.10903, 0.08334], - "79": [0, 0.68333, 0.02778, 0.08334], - "80": [0, 0.68333, 0.13889, 0.08334], - "81": [0.19444, 0.68333, 0, 0.08334], - "82": [0, 0.68333, 0.00773, 0.08334], - "83": [0, 0.68333, 0.05764, 0.08334], - "84": [0, 0.68333, 0.13889, 0.08334], - "85": [0, 0.68333, 0.10903, 0.02778], - "86": [0, 0.68333, 0.22222, 0], - "87": [0, 0.68333, 0.13889, 0], - "88": [0, 0.68333, 0.07847, 0.08334], - "89": [0, 0.68333, 0.22222, 0], - "90": [0, 0.68333, 0.07153, 0.08334], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.43056, 0, 0.05556], - "100": [0, 0.69444, 0, 0.16667], - "101": [0, 0.43056, 0, 0.05556], - "102": [0.19444, 0.69444, 0.10764, 0.16667], - "103": [0.19444, 0.43056, 0.03588, 0.02778], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.65952, 0, 0], - "106": [0.19444, 0.65952, 0.05724, 0], - "107": [0, 0.69444, 0.03148, 0], - "108": [0, 0.69444, 0.01968, 0.08334], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0.05556], - "112": [0.19444, 0.43056, 0, 0.08334], - "113": [0.19444, 0.43056, 0.03588, 0.08334], - "114": [0, 0.43056, 0.02778, 0.05556], - "115": [0, 0.43056, 0, 0.05556], - "116": [0, 0.61508, 0, 0.08334], - "117": [0, 0.43056, 0, 0.02778], - "118": [0, 0.43056, 0.03588, 0.02778], - "119": [0, 0.43056, 0.02691, 0.08334], - "120": [0, 0.43056, 0, 0.02778], - "121": [0.19444, 0.43056, 0.03588, 0.05556], - "122": [0, 0.43056, 0.04398, 0.05556], - "915": [0, 0.68333, 0.13889, 0.08334], - "916": [0, 0.68333, 0, 0.16667], - "920": [0, 0.68333, 0.02778, 0.08334], - "923": [0, 0.68333, 0, 0.16667], - "926": [0, 0.68333, 0.07569, 0.08334], - "928": [0, 0.68333, 0.08125, 0.05556], - "931": [0, 0.68333, 0.05764, 0.08334], - "933": [0, 0.68333, 0.13889, 0.05556], - "934": [0, 0.68333, 0, 0.08334], - "936": [0, 0.68333, 0.11, 0.05556], - "937": [0, 0.68333, 0.05017, 0.08334], - "945": [0, 0.43056, 0.0037, 0.02778], - "946": [0.19444, 0.69444, 0.05278, 0.08334], - "947": [0.19444, 0.43056, 0.05556, 0], - "948": [0, 0.69444, 0.03785, 0.05556], - "949": [0, 0.43056, 0, 0.08334], - "950": [0.19444, 0.69444, 0.07378, 0.08334], - "951": [0.19444, 0.43056, 0.03588, 0.05556], - "952": [0, 0.69444, 0.02778, 0.08334], - "953": [0, 0.43056, 0, 0.05556], - "954": [0, 0.43056, 0, 0], - "955": [0, 0.69444, 0, 0], - "956": [0.19444, 0.43056, 0, 0.02778], - "957": [0, 0.43056, 0.06366, 0.02778], - "958": [0.19444, 0.69444, 0.04601, 0.11111], - "959": [0, 0.43056, 0, 0.05556], - "960": [0, 0.43056, 0.03588, 0], - "961": [0.19444, 0.43056, 0, 0.08334], - "962": [0.09722, 0.43056, 0.07986, 0.08334], - "963": [0, 0.43056, 0.03588, 0], - "964": [0, 0.43056, 0.1132, 0.02778], - "965": [0, 0.43056, 0.03588, 0.02778], - "966": [0.19444, 0.43056, 0, 0.08334], - "967": [0.19444, 0.43056, 0, 0.05556], - "968": [0.19444, 0.69444, 0.03588, 0.11111], - "969": [0, 0.43056, 0.03588, 0], - "977": [0, 0.69444, 0, 0.08334], - "981": [0.19444, 0.69444, 0, 0.08334], - "982": [0, 0.43056, 0.02778, 0], - "1009": [0.19444, 0.43056, 0, 0.08334], - "1013": [0, 0.43056, 0, 0.05556] - }, - "Math-Regular": { - "65": [0, 0.68333, 0, 0.13889], - "66": [0, 0.68333, 0.05017, 0.08334], - "67": [0, 0.68333, 0.07153, 0.08334], - "68": [0, 0.68333, 0.02778, 0.05556], - "69": [0, 0.68333, 0.05764, 0.08334], - "70": [0, 0.68333, 0.13889, 0.08334], - "71": [0, 0.68333, 0, 0.08334], - "72": [0, 0.68333, 0.08125, 0.05556], - "73": [0, 0.68333, 0.07847, 0.11111], - "74": [0, 0.68333, 0.09618, 0.16667], - "75": [0, 0.68333, 0.07153, 0.05556], - "76": [0, 0.68333, 0, 0.02778], - "77": [0, 0.68333, 0.10903, 0.08334], - "78": [0, 0.68333, 0.10903, 0.08334], - "79": [0, 0.68333, 0.02778, 0.08334], - "80": [0, 0.68333, 0.13889, 0.08334], - "81": [0.19444, 0.68333, 0, 0.08334], - "82": [0, 0.68333, 0.00773, 0.08334], - "83": [0, 0.68333, 0.05764, 0.08334], - "84": [0, 0.68333, 0.13889, 0.08334], - "85": [0, 0.68333, 0.10903, 0.02778], - "86": [0, 0.68333, 0.22222, 0], - "87": [0, 0.68333, 0.13889, 0], - "88": [0, 0.68333, 0.07847, 0.08334], - "89": [0, 0.68333, 0.22222, 0], - "90": [0, 0.68333, 0.07153, 0.08334], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.43056, 0, 0.05556], - "100": [0, 0.69444, 0, 0.16667], - "101": [0, 0.43056, 0, 0.05556], - "102": [0.19444, 0.69444, 0.10764, 0.16667], - "103": [0.19444, 0.43056, 0.03588, 0.02778], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.65952, 0, 0], - "106": [0.19444, 0.65952, 0.05724, 0], - "107": [0, 0.69444, 0.03148, 0], - "108": [0, 0.69444, 0.01968, 0.08334], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0.05556], - "112": [0.19444, 0.43056, 0, 0.08334], - "113": [0.19444, 0.43056, 0.03588, 0.08334], - "114": [0, 0.43056, 0.02778, 0.05556], - "115": [0, 0.43056, 0, 0.05556], - "116": [0, 0.61508, 0, 0.08334], - "117": [0, 0.43056, 0, 0.02778], - "118": [0, 0.43056, 0.03588, 0.02778], - "119": [0, 0.43056, 0.02691, 0.08334], - "120": [0, 0.43056, 0, 0.02778], - "121": [0.19444, 0.43056, 0.03588, 0.05556], - "122": [0, 0.43056, 0.04398, 0.05556], - "915": [0, 0.68333, 0.13889, 0.08334], - "916": [0, 0.68333, 0, 0.16667], - "920": [0, 0.68333, 0.02778, 0.08334], - "923": [0, 0.68333, 0, 0.16667], - "926": [0, 0.68333, 0.07569, 0.08334], - "928": [0, 0.68333, 0.08125, 0.05556], - "931": [0, 0.68333, 0.05764, 0.08334], - "933": [0, 0.68333, 0.13889, 0.05556], - "934": [0, 0.68333, 0, 0.08334], - "936": [0, 0.68333, 0.11, 0.05556], - "937": [0, 0.68333, 0.05017, 0.08334], - "945": [0, 0.43056, 0.0037, 0.02778], - "946": [0.19444, 0.69444, 0.05278, 0.08334], - "947": [0.19444, 0.43056, 0.05556, 0], - "948": [0, 0.69444, 0.03785, 0.05556], - "949": [0, 0.43056, 0, 0.08334], - "950": [0.19444, 0.69444, 0.07378, 0.08334], - "951": [0.19444, 0.43056, 0.03588, 0.05556], - "952": [0, 0.69444, 0.02778, 0.08334], - "953": [0, 0.43056, 0, 0.05556], - "954": [0, 0.43056, 0, 0], - "955": [0, 0.69444, 0, 0], - "956": [0.19444, 0.43056, 0, 0.02778], - "957": [0, 0.43056, 0.06366, 0.02778], - "958": [0.19444, 0.69444, 0.04601, 0.11111], - "959": [0, 0.43056, 0, 0.05556], - "960": [0, 0.43056, 0.03588, 0], - "961": [0.19444, 0.43056, 0, 0.08334], - "962": [0.09722, 0.43056, 0.07986, 0.08334], - "963": [0, 0.43056, 0.03588, 0], - "964": [0, 0.43056, 0.1132, 0.02778], - "965": [0, 0.43056, 0.03588, 0.02778], - "966": [0.19444, 0.43056, 0, 0.08334], - "967": [0.19444, 0.43056, 0, 0.05556], - "968": [0.19444, 0.69444, 0.03588, 0.11111], - "969": [0, 0.43056, 0.03588, 0], - "977": [0, 0.69444, 0, 0.08334], - "981": [0.19444, 0.69444, 0, 0.08334], - "982": [0, 0.43056, 0.02778, 0], - "1009": [0.19444, 0.43056, 0, 0.08334], - "1013": [0, 0.43056, 0, 0.05556] - }, - "SansSerif-Regular": { - "33": [0, 0.69444, 0, 0], - "34": [0, 0.69444, 0, 0], - "35": [0.19444, 0.69444, 0, 0], - "36": [0.05556, 0.75, 0, 0], - "37": [0.05556, 0.75, 0, 0], - "38": [0, 0.69444, 0, 0], - "39": [0, 0.69444, 0, 0], - "40": [0.25, 0.75, 0, 0], - "41": [0.25, 0.75, 0, 0], - "42": [0, 0.75, 0, 0], - "43": [0.08333, 0.58333, 0, 0], - "44": [0.125, 0.08333, 0, 0], - "45": [0, 0.44444, 0, 0], - "46": [0, 0.08333, 0, 0], - "47": [0.25, 0.75, 0, 0], - "48": [0, 0.65556, 0, 0], - "49": [0, 0.65556, 0, 0], - "50": [0, 0.65556, 0, 0], - "51": [0, 0.65556, 0, 0], - "52": [0, 0.65556, 0, 0], - "53": [0, 0.65556, 0, 0], - "54": [0, 0.65556, 0, 0], - "55": [0, 0.65556, 0, 0], - "56": [0, 0.65556, 0, 0], - "57": [0, 0.65556, 0, 0], - "58": [0, 0.44444, 0, 0], - "59": [0.125, 0.44444, 0, 0], - "61": [-0.13, 0.37, 0, 0], - "63": [0, 0.69444, 0, 0], - "64": [0, 0.69444, 0, 0], - "65": [0, 0.69444, 0, 0], - "66": [0, 0.69444, 0, 0], - "67": [0, 0.69444, 0, 0], - "68": [0, 0.69444, 0, 0], - "69": [0, 0.69444, 0, 0], - "70": [0, 0.69444, 0, 0], - "71": [0, 0.69444, 0, 0], - "72": [0, 0.69444, 0, 0], - "73": [0, 0.69444, 0, 0], - "74": [0, 0.69444, 0, 0], - "75": [0, 0.69444, 0, 0], - "76": [0, 0.69444, 0, 0], - "77": [0, 0.69444, 0, 0], - "78": [0, 0.69444, 0, 0], - "79": [0, 0.69444, 0, 0], - "80": [0, 0.69444, 0, 0], - "81": [0.125, 0.69444, 0, 0], - "82": [0, 0.69444, 0, 0], - "83": [0, 0.69444, 0, 0], - "84": [0, 0.69444, 0, 0], - "85": [0, 0.69444, 0, 0], - "86": [0, 0.69444, 0.01389, 0], - "87": [0, 0.69444, 0.01389, 0], - "88": [0, 0.69444, 0, 0], - "89": [0, 0.69444, 0.025, 0], - "90": [0, 0.69444, 0, 0], - "91": [0.25, 0.75, 0, 0], - "93": [0.25, 0.75, 0, 0], - "94": [0, 0.69444, 0, 0], - "95": [0.35, 0.09444, 0.02778, 0], - "97": [0, 0.44444, 0, 0], - "98": [0, 0.69444, 0, 0], - "99": [0, 0.44444, 0, 0], - "100": [0, 0.69444, 0, 0], - "101": [0, 0.44444, 0, 0], - "102": [0, 0.69444, 0.06944, 0], - "103": [0.19444, 0.44444, 0.01389, 0], - "104": [0, 0.69444, 0, 0], - "105": [0, 0.67937, 0, 0], - "106": [0.19444, 0.67937, 0, 0], - "107": [0, 0.69444, 0, 0], - "108": [0, 0.69444, 0, 0], - "109": [0, 0.44444, 0, 0], - "110": [0, 0.44444, 0, 0], - "111": [0, 0.44444, 0, 0], - "112": [0.19444, 0.44444, 0, 0], - "113": [0.19444, 0.44444, 0, 0], - "114": [0, 0.44444, 0.01389, 0], - "115": [0, 0.44444, 0, 0], - "116": [0, 0.57143, 0, 0], - "117": [0, 0.44444, 0, 0], - "118": [0, 0.44444, 0.01389, 0], - "119": [0, 0.44444, 0.01389, 0], - "120": [0, 0.44444, 0, 0], - "121": [0.19444, 0.44444, 0.01389, 0], - "122": [0, 0.44444, 0, 0], - "126": [0.35, 0.32659, 0, 0], - "305": [0, 0.44444, 0, 0], - "567": [0.19444, 0.44444, 0, 0], - "768": [0, 0.69444, 0, 0], - "769": [0, 0.69444, 0, 0], - "770": [0, 0.69444, 0, 0], - "771": [0, 0.67659, 0, 0], - "772": [0, 0.60889, 0, 0], - "774": [0, 0.69444, 0, 0], - "775": [0, 0.67937, 0, 0], - "776": [0, 0.67937, 0, 0], - "778": [0, 0.69444, 0, 0], - "779": [0, 0.69444, 0, 0], - "780": [0, 0.63194, 0, 0], - "915": [0, 0.69444, 0, 0], - "916": [0, 0.69444, 0, 0], - "920": [0, 0.69444, 0, 0], - "923": [0, 0.69444, 0, 0], - "926": [0, 0.69444, 0, 0], - "928": [0, 0.69444, 0, 0], - "931": [0, 0.69444, 0, 0], - "933": [0, 0.69444, 0, 0], - "934": [0, 0.69444, 0, 0], - "936": [0, 0.69444, 0, 0], - "937": [0, 0.69444, 0, 0], - "8211": [0, 0.44444, 0.02778, 0], - "8212": [0, 0.44444, 0.02778, 0], - "8216": [0, 0.69444, 0, 0], - "8217": [0, 0.69444, 0, 0], - "8220": [0, 0.69444, 0, 0], - "8221": [0, 0.69444, 0, 0] - }, - "Script-Regular": { - "65": [0, 0.7, 0.22925, 0], - "66": [0, 0.7, 0.04087, 0], - "67": [0, 0.7, 0.1689, 0], - "68": [0, 0.7, 0.09371, 0], - "69": [0, 0.7, 0.18583, 0], - "70": [0, 0.7, 0.13634, 0], - "71": [0, 0.7, 0.17322, 0], - "72": [0, 0.7, 0.29694, 0], - "73": [0, 0.7, 0.19189, 0], - "74": [0.27778, 0.7, 0.19189, 0], - "75": [0, 0.7, 0.31259, 0], - "76": [0, 0.7, 0.19189, 0], - "77": [0, 0.7, 0.15981, 0], - "78": [0, 0.7, 0.3525, 0], - "79": [0, 0.7, 0.08078, 0], - "80": [0, 0.7, 0.08078, 0], - "81": [0, 0.7, 0.03305, 0], - "82": [0, 0.7, 0.06259, 0], - "83": [0, 0.7, 0.19189, 0], - "84": [0, 0.7, 0.29087, 0], - "85": [0, 0.7, 0.25815, 0], - "86": [0, 0.7, 0.27523, 0], - "87": [0, 0.7, 0.27523, 0], - "88": [0, 0.7, 0.26006, 0], - "89": [0, 0.7, 0.2939, 0], - "90": [0, 0.7, 0.24037, 0] - }, - "Size1-Regular": { - "40": [0.35001, 0.85, 0, 0], - "41": [0.35001, 0.85, 0, 0], - "47": [0.35001, 0.85, 0, 0], - "91": [0.35001, 0.85, 0, 0], - "92": [0.35001, 0.85, 0, 0], - "93": [0.35001, 0.85, 0, 0], - "123": [0.35001, 0.85, 0, 0], - "125": [0.35001, 0.85, 0, 0], - "710": [0, 0.72222, 0, 0], - "732": [0, 0.72222, 0, 0], - "770": [0, 0.72222, 0, 0], - "771": [0, 0.72222, 0, 0], - "8214": [-0.00099, 0.601, 0, 0], - "8593": [1e-05, 0.6, 0, 0], - "8595": [1e-05, 0.6, 0, 0], - "8657": [1e-05, 0.6, 0, 0], - "8659": [1e-05, 0.6, 0, 0], - "8719": [0.25001, 0.75, 0, 0], - "8720": [0.25001, 0.75, 0, 0], - "8721": [0.25001, 0.75, 0, 0], - "8730": [0.35001, 0.85, 0, 0], - "8739": [-0.00599, 0.606, 0, 0], - "8741": [-0.00599, 0.606, 0, 0], - "8747": [0.30612, 0.805, 0.19445, 0], - "8748": [0.306, 0.805, 0.19445, 0], - "8749": [0.306, 0.805, 0.19445, 0], - "8750": [0.30612, 0.805, 0.19445, 0], - "8896": [0.25001, 0.75, 0, 0], - "8897": [0.25001, 0.75, 0, 0], - "8898": [0.25001, 0.75, 0, 0], - "8899": [0.25001, 0.75, 0, 0], - "8968": [0.35001, 0.85, 0, 0], - "8969": [0.35001, 0.85, 0, 0], - "8970": [0.35001, 0.85, 0, 0], - "8971": [0.35001, 0.85, 0, 0], - "9168": [-0.00099, 0.601, 0, 0], - "10216": [0.35001, 0.85, 0, 0], - "10217": [0.35001, 0.85, 0, 0], - "10752": [0.25001, 0.75, 0, 0], - "10753": [0.25001, 0.75, 0, 0], - "10754": [0.25001, 0.75, 0, 0], - "10756": [0.25001, 0.75, 0, 0], - "10758": [0.25001, 0.75, 0, 0] - }, - "Size2-Regular": { - "40": [0.65002, 1.15, 0, 0], - "41": [0.65002, 1.15, 0, 0], - "47": [0.65002, 1.15, 0, 0], - "91": [0.65002, 1.15, 0, 0], - "92": [0.65002, 1.15, 0, 0], - "93": [0.65002, 1.15, 0, 0], - "123": [0.65002, 1.15, 0, 0], - "125": [0.65002, 1.15, 0, 0], - "710": [0, 0.75, 0, 0], - "732": [0, 0.75, 0, 0], - "770": [0, 0.75, 0, 0], - "771": [0, 0.75, 0, 0], - "8719": [0.55001, 1.05, 0, 0], - "8720": [0.55001, 1.05, 0, 0], - "8721": [0.55001, 1.05, 0, 0], - "8730": [0.65002, 1.15, 0, 0], - "8747": [0.86225, 1.36, 0.44445, 0], - "8748": [0.862, 1.36, 0.44445, 0], - "8749": [0.862, 1.36, 0.44445, 0], - "8750": [0.86225, 1.36, 0.44445, 0], - "8896": [0.55001, 1.05, 0, 0], - "8897": [0.55001, 1.05, 0, 0], - "8898": [0.55001, 1.05, 0, 0], - "8899": [0.55001, 1.05, 0, 0], - "8968": [0.65002, 1.15, 0, 0], - "8969": [0.65002, 1.15, 0, 0], - "8970": [0.65002, 1.15, 0, 0], - "8971": [0.65002, 1.15, 0, 0], - "10216": [0.65002, 1.15, 0, 0], - "10217": [0.65002, 1.15, 0, 0], - "10752": [0.55001, 1.05, 0, 0], - "10753": [0.55001, 1.05, 0, 0], - "10754": [0.55001, 1.05, 0, 0], - "10756": [0.55001, 1.05, 0, 0], - "10758": [0.55001, 1.05, 0, 0] - }, - "Size3-Regular": { - "40": [0.95003, 1.45, 0, 0], - "41": [0.95003, 1.45, 0, 0], - "47": [0.95003, 1.45, 0, 0], - "91": [0.95003, 1.45, 0, 0], - "92": [0.95003, 1.45, 0, 0], - "93": [0.95003, 1.45, 0, 0], - "123": [0.95003, 1.45, 0, 0], - "125": [0.95003, 1.45, 0, 0], - "710": [0, 0.75, 0, 0], - "732": [0, 0.75, 0, 0], - "770": [0, 0.75, 0, 0], - "771": [0, 0.75, 0, 0], - "8730": [0.95003, 1.45, 0, 0], - "8968": [0.95003, 1.45, 0, 0], - "8969": [0.95003, 1.45, 0, 0], - "8970": [0.95003, 1.45, 0, 0], - "8971": [0.95003, 1.45, 0, 0], - "10216": [0.95003, 1.45, 0, 0], - "10217": [0.95003, 1.45, 0, 0] - }, - "Size4-Regular": { - "40": [1.25003, 1.75, 0, 0], - "41": [1.25003, 1.75, 0, 0], - "47": [1.25003, 1.75, 0, 0], - "91": [1.25003, 1.75, 0, 0], - "92": [1.25003, 1.75, 0, 0], - "93": [1.25003, 1.75, 0, 0], - "123": [1.25003, 1.75, 0, 0], - "125": [1.25003, 1.75, 0, 0], - "710": [0, 0.825, 0, 0], - "732": [0, 0.825, 0, 0], - "770": [0, 0.825, 0, 0], - "771": [0, 0.825, 0, 0], - "8730": [1.25003, 1.75, 0, 0], - "8968": [1.25003, 1.75, 0, 0], - "8969": [1.25003, 1.75, 0, 0], - "8970": [1.25003, 1.75, 0, 0], - "8971": [1.25003, 1.75, 0, 0], - "9115": [0.64502, 1.155, 0, 0], - "9116": [1e-05, 0.6, 0, 0], - "9117": [0.64502, 1.155, 0, 0], - "9118": [0.64502, 1.155, 0, 0], - "9119": [1e-05, 0.6, 0, 0], - "9120": [0.64502, 1.155, 0, 0], - "9121": [0.64502, 1.155, 0, 0], - "9122": [-0.00099, 0.601, 0, 0], - "9123": [0.64502, 1.155, 0, 0], - "9124": [0.64502, 1.155, 0, 0], - "9125": [-0.00099, 0.601, 0, 0], - "9126": [0.64502, 1.155, 0, 0], - "9127": [1e-05, 0.9, 0, 0], - "9128": [0.65002, 1.15, 0, 0], - "9129": [0.90001, 0, 0, 0], - "9130": [0, 0.3, 0, 0], - "9131": [1e-05, 0.9, 0, 0], - "9132": [0.65002, 1.15, 0, 0], - "9133": [0.90001, 0, 0, 0], - "9143": [0.88502, 0.915, 0, 0], - "10216": [1.25003, 1.75, 0, 0], - "10217": [1.25003, 1.75, 0, 0], - "57344": [-0.00499, 0.605, 0, 0], - "57345": [-0.00499, 0.605, 0, 0], - "57680": [0, 0.12, 0, 0], - "57681": [0, 0.12, 0, 0], - "57682": [0, 0.12, 0, 0], - "57683": [0, 0.12, 0, 0] - }, - "Typewriter-Regular": { - "33": [0, 0.61111, 0, 0], - "34": [0, 0.61111, 0, 0], - "35": [0, 0.61111, 0, 0], - "36": [0.08333, 0.69444, 0, 0], - "37": [0.08333, 0.69444, 0, 0], - "38": [0, 0.61111, 0, 0], - "39": [0, 0.61111, 0, 0], - "40": [0.08333, 0.69444, 0, 0], - "41": [0.08333, 0.69444, 0, 0], - "42": [0, 0.52083, 0, 0], - "43": [-0.08056, 0.53055, 0, 0], - "44": [0.13889, 0.125, 0, 0], - "45": [-0.08056, 0.53055, 0, 0], - "46": [0, 0.125, 0, 0], - "47": [0.08333, 0.69444, 0, 0], - "48": [0, 0.61111, 0, 0], - "49": [0, 0.61111, 0, 0], - "50": [0, 0.61111, 0, 0], - "51": [0, 0.61111, 0, 0], - "52": [0, 0.61111, 0, 0], - "53": [0, 0.61111, 0, 0], - "54": [0, 0.61111, 0, 0], - "55": [0, 0.61111, 0, 0], - "56": [0, 0.61111, 0, 0], - "57": [0, 0.61111, 0, 0], - "58": [0, 0.43056, 0, 0], - "59": [0.13889, 0.43056, 0, 0], - "60": [-0.05556, 0.55556, 0, 0], - "61": [-0.19549, 0.41562, 0, 0], - "62": [-0.05556, 0.55556, 0, 0], - "63": [0, 0.61111, 0, 0], - "64": [0, 0.61111, 0, 0], - "65": [0, 0.61111, 0, 0], - "66": [0, 0.61111, 0, 0], - "67": [0, 0.61111, 0, 0], - "68": [0, 0.61111, 0, 0], - "69": [0, 0.61111, 0, 0], - "70": [0, 0.61111, 0, 0], - "71": [0, 0.61111, 0, 0], - "72": [0, 0.61111, 0, 0], - "73": [0, 0.61111, 0, 0], - "74": [0, 0.61111, 0, 0], - "75": [0, 0.61111, 0, 0], - "76": [0, 0.61111, 0, 0], - "77": [0, 0.61111, 0, 0], - "78": [0, 0.61111, 0, 0], - "79": [0, 0.61111, 0, 0], - "80": [0, 0.61111, 0, 0], - "81": [0.13889, 0.61111, 0, 0], - "82": [0, 0.61111, 0, 0], - "83": [0, 0.61111, 0, 0], - "84": [0, 0.61111, 0, 0], - "85": [0, 0.61111, 0, 0], - "86": [0, 0.61111, 0, 0], - "87": [0, 0.61111, 0, 0], - "88": [0, 0.61111, 0, 0], - "89": [0, 0.61111, 0, 0], - "90": [0, 0.61111, 0, 0], - "91": [0.08333, 0.69444, 0, 0], - "92": [0.08333, 0.69444, 0, 0], - "93": [0.08333, 0.69444, 0, 0], - "94": [0, 0.61111, 0, 0], - "95": [0.09514, 0, 0, 0], - "96": [0, 0.61111, 0, 0], - "97": [0, 0.43056, 0, 0], - "98": [0, 0.61111, 0, 0], - "99": [0, 0.43056, 0, 0], - "100": [0, 0.61111, 0, 0], - "101": [0, 0.43056, 0, 0], - "102": [0, 0.61111, 0, 0], - "103": [0.22222, 0.43056, 0, 0], - "104": [0, 0.61111, 0, 0], - "105": [0, 0.61111, 0, 0], - "106": [0.22222, 0.61111, 0, 0], - "107": [0, 0.61111, 0, 0], - "108": [0, 0.61111, 0, 0], - "109": [0, 0.43056, 0, 0], - "110": [0, 0.43056, 0, 0], - "111": [0, 0.43056, 0, 0], - "112": [0.22222, 0.43056, 0, 0], - "113": [0.22222, 0.43056, 0, 0], - "114": [0, 0.43056, 0, 0], - "115": [0, 0.43056, 0, 0], - "116": [0, 0.55358, 0, 0], - "117": [0, 0.43056, 0, 0], - "118": [0, 0.43056, 0, 0], - "119": [0, 0.43056, 0, 0], - "120": [0, 0.43056, 0, 0], - "121": [0.22222, 0.43056, 0, 0], - "122": [0, 0.43056, 0, 0], - "123": [0.08333, 0.69444, 0, 0], - "124": [0.08333, 0.69444, 0, 0], - "125": [0.08333, 0.69444, 0, 0], - "126": [0, 0.61111, 0, 0], - "127": [0, 0.61111, 0, 0], - "305": [0, 0.43056, 0, 0], - "567": [0.22222, 0.43056, 0, 0], - "768": [0, 0.61111, 0, 0], - "769": [0, 0.61111, 0, 0], - "770": [0, 0.61111, 0, 0], - "771": [0, 0.61111, 0, 0], - "772": [0, 0.56555, 0, 0], - "774": [0, 0.61111, 0, 0], - "776": [0, 0.61111, 0, 0], - "778": [0, 0.61111, 0, 0], - "780": [0, 0.56597, 0, 0], - "915": [0, 0.61111, 0, 0], - "916": [0, 0.61111, 0, 0], - "920": [0, 0.61111, 0, 0], - "923": [0, 0.61111, 0, 0], - "926": [0, 0.61111, 0, 0], - "928": [0, 0.61111, 0, 0], - "931": [0, 0.61111, 0, 0], - "933": [0, 0.61111, 0, 0], - "934": [0, 0.61111, 0, 0], - "936": [0, 0.61111, 0, 0], - "937": [0, 0.61111, 0, 0], - "2018": [0, 0.61111, 0, 0], - "2019": [0, 0.61111, 0, 0], - "8242": [0, 0.61111, 0, 0] - } -}; - -},{}],19:[function(require,module,exports){ -var utils = require("./utils"); -var ParseError = require("./ParseError"); -var parseData = require("./parseData"); -var ParseNode = parseData.ParseNode; - -/* This file contains a list of functions that we parse, identified by - * the calls to defineFunction. - * - * The first argument to defineFunction is a single name or a list of names. - * All functions named in such a list will share a single implementation. - * - * Each declared function can have associated properties, which - * include the following: - * - * - numArgs: The number of arguments the function takes. - * If this is the only property, it can be passed as a number - * instead of an element of a properties object. - * - argTypes: (optional) An array corresponding to each argument of the - * function, giving the type of argument that should be parsed. Its - * length should be equal to `numArgs + numOptionalArgs`. Valid - * types: - * - "size": A size-like thing, such as "1em" or "5ex" - * - "color": An html color, like "#abc" or "blue" - * - "original": The same type as the environment that the - * function being parsed is in (e.g. used for the - * bodies of functions like \color where the first - * argument is special and the second argument is - * parsed normally) - * Other possible types (probably shouldn't be used) - * - "text": Text-like (e.g. \text) - * - "math": Normal math - * If undefined, this will be treated as an appropriate length - * array of "original" strings - * - greediness: (optional) The greediness of the function to use ungrouped - * arguments. - * - * E.g. if you have an expression - * \sqrt \frac 1 2 - * since \frac has greediness=2 vs \sqrt's greediness=1, \frac - * will use the two arguments '1' and '2' as its two arguments, - * then that whole function will be used as the argument to - * \sqrt. On the other hand, the expressions - * \frac \frac 1 2 3 - * and - * \frac \sqrt 1 2 - * will fail because \frac and \frac have equal greediness - * and \sqrt has a lower greediness than \frac respectively. To - * make these parse, we would have to change them to: - * \frac {\frac 1 2} 3 - * and - * \frac {\sqrt 1} 2 - * - * The default value is `1` - * - allowedInText: (optional) Whether or not the function is allowed inside - * text mode (default false) - * - numOptionalArgs: (optional) The number of optional arguments the function - * should parse. If the optional arguments aren't found, - * `null` will be passed to the handler in their place. - * (default 0) - * - infix: (optional) Must be true if the function is an infix operator. - * - * The last argument is that implementation, the handler for the function(s). - * It is called to handle these functions and their arguments. - * It receives two arguments: - * - context contains information and references provided by the parser - * - args is an array of arguments obtained from TeX input - * The context contains the following properties: - * - funcName: the text (i.e. name) of the function, including \ - * - parser: the parser object - * - lexer: the lexer object - * - positions: the positions in the overall string of the function - * and the arguments. - * The latter three should only be used to produce error messages. - * - * The function should return an object with the following keys: - * - type: The type of element that this is. This is then used in - * buildHTML/buildMathML to determine which function - * should be called to build this node into a DOM node - * Any other data can be added to the object, which will be passed - * in to the function in buildHTML/buildMathML as `group.value`. - */ - -function defineFunction(names, props, handler) { - if (typeof names === "string") { - names = [names]; - } - if (typeof props === "number") { - props = { numArgs: props }; - } - // Set default values of functions - var data = { - numArgs: props.numArgs, - argTypes: props.argTypes, - greediness: (props.greediness === undefined) ? 1 : props.greediness, - allowedInText: !!props.allowedInText, - numOptionalArgs: props.numOptionalArgs || 0, - infix: !!props.infix, - handler: handler - }; - for (var i = 0; i < names.length; ++i) { - module.exports[names[i]] = data; - } -} - -// Since the corresponding buildHTML/buildMathML function expects a -// list of elements, we normalize for different kinds of arguments -var ordargument = function(arg) { - if (arg.type === "ordgroup") { - return arg.value; - } else { - return [arg]; - } -}; - -// A normal square root -defineFunction("\\sqrt", { - numArgs: 1, - numOptionalArgs: 1 -}, function(context, args) { - var index = args[0]; - var body = args[1]; - return { - type: "sqrt", - body: body, - index: index - }; -}); - -// Non-mathy text, possibly in a font -var textFunctionStyles = { - "\\text": undefined, "\\textrm": "mathrm", "\\textsf": "mathsf", - "\\texttt": "mathtt", "\\textnormal": "mathrm", "\\textbf": "mathbf", - "\\textit": "textit" -}; - -defineFunction([ - "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", - "\\textbf", "\\textit" -], { - numArgs: 1, - argTypes: ["text"], - greediness: 2, - allowedInText: true -}, function(context, args) { - var body = args[0]; - return { - type: "text", - body: ordargument(body), - style: textFunctionStyles[context.funcName] - }; -}); - -// A two-argument custom color -defineFunction("\\color", { - numArgs: 2, - allowedInText: true, - greediness: 3, - argTypes: ["color", "original"] -}, function(context, args) { - var color = args[0]; - var body = args[1]; - return { - type: "color", - color: color.value, - value: ordargument(body) - }; -}); - -// An overline -defineFunction("\\overline", { - numArgs: 1 -}, function(context, args) { - var body = args[0]; - return { - type: "overline", - body: body - }; -}); - -// An underline -defineFunction("\\underline", { - numArgs: 1 -}, function(context, args) { - var body = args[0]; - return { - type: "underline", - body: body - }; -}); - -// A box of the width and height -defineFunction("\\rule", { - numArgs: 2, - numOptionalArgs: 1, - argTypes: ["size", "size", "size"] -}, function(context, args) { - var shift = args[0]; - var width = args[1]; - var height = args[2]; - return { - type: "rule", - shift: shift && shift.value, - width: width.value, - height: height.value - }; -}); - -// TODO: In TeX, \mkern only accepts mu-units, and \kern does not accept -// mu-units. In current KaTeX we relax this; both commands accept any unit. -defineFunction(["\\kern", "\\mkern"], { - numArgs: 1, - argTypes: ["size"] -}, function(context, args) { - return { - type: "kern", - dimension: args[0].value - }; -}); - -// A KaTeX logo -defineFunction("\\KaTeX", { - numArgs: 0 -}, function(context) { - return { - type: "katex" - }; -}); - -defineFunction("\\phantom", { - numArgs: 1 -}, function(context, args) { - var body = args[0]; - return { - type: "phantom", - value: ordargument(body) - }; -}); - -// Math class commands except \mathop -defineFunction([ - "\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", - "\\mathclose", "\\mathpunct", "\\mathinner" -], { - numArgs: 1 -}, function(context, args) { - var body = args[0]; - return { - type: "mclass", - mclass: "m" + context.funcName.substr(5), - value: ordargument(body) - }; -}); - -// Build a relation by placing one symbol on top of another -defineFunction("\\stackrel", { - numArgs: 2 -}, function(context, args) { - var top = args[0]; - var bottom = args[1]; - - var bottomop = new ParseNode("op", { - type: "op", - limits: true, - alwaysHandleSupSub: true, - symbol: false, - value: ordargument(bottom) - }, bottom.mode); - - var supsub = new ParseNode("supsub", { - base: bottomop, - sup: top, - sub: null - }, top.mode); - - return { - type: "mclass", - mclass: "mrel", - value: [supsub] - }; -}); - -// \mod-type functions -defineFunction("\\bmod", { - numArgs: 0 -}, function(context, args) { - return { - type: "mod", - modType: "bmod", - value: null - }; -}); - -defineFunction(["\\pod", "\\pmod", "\\mod"], { - numArgs: 1 -}, function(context, args) { - var body = args[0]; - return { - type: "mod", - modType: context.funcName.substr(1), - value: ordargument(body) - }; -}); // Extra data needed for the delimiter handler down below var delimiterSizes = { - "\\bigl" : {mclass: "mopen", size: 1}, - "\\Bigl" : {mclass: "mopen", size: 2}, - "\\biggl": {mclass: "mopen", size: 3}, - "\\Biggl": {mclass: "mopen", size: 4}, - "\\bigr" : {mclass: "mclose", size: 1}, - "\\Bigr" : {mclass: "mclose", size: 2}, - "\\biggr": {mclass: "mclose", size: 3}, - "\\Biggr": {mclass: "mclose", size: 4}, - "\\bigm" : {mclass: "mrel", size: 1}, - "\\Bigm" : {mclass: "mrel", size: 2}, - "\\biggm": {mclass: "mrel", size: 3}, - "\\Biggm": {mclass: "mrel", size: 4}, - "\\big" : {mclass: "mord", size: 1}, - "\\Big" : {mclass: "mord", size: 2}, - "\\bigg" : {mclass: "mord", size: 3}, - "\\Bigg" : {mclass: "mord", size: 4} + "\\bigl": { + mclass: "mopen", + size: 1 + }, + "\\Bigl": { + mclass: "mopen", + size: 2 + }, + "\\biggl": { + mclass: "mopen", + size: 3 + }, + "\\Biggl": { + mclass: "mopen", + size: 4 + }, + "\\bigr": { + mclass: "mclose", + size: 1 + }, + "\\Bigr": { + mclass: "mclose", + size: 2 + }, + "\\biggr": { + mclass: "mclose", + size: 3 + }, + "\\Biggr": { + mclass: "mclose", + size: 4 + }, + "\\bigm": { + mclass: "mrel", + size: 1 + }, + "\\Bigm": { + mclass: "mrel", + size: 2 + }, + "\\biggm": { + mclass: "mrel", + size: 3 + }, + "\\Biggm": { + mclass: "mrel", + size: 4 + }, + "\\big": { + mclass: "mord", + size: 1 + }, + "\\Big": { + mclass: "mord", + size: 2 + }, + "\\bigg": { + mclass: "mord", + size: 3 + }, + "\\Bigg": { + mclass: "mord", + size: 4 + } +}; +var delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27E8", "\\rangle", "\u27E9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; + +// Delimiter functions +function checkDelimiter(delim, context) { + var symDelim = checkSymbolNodeType(delim); + + if (symDelim && utils.contains(delimiters, symDelim.text)) { + return symDelim; + } else { + throw new src_ParseError("Invalid delimiter: '" + (symDelim ? symDelim.text : JSON.stringify(delim)) + "' after '" + context.funcName + "'", delim); + } +} + +defineFunction({ + type: "delimsizing", + names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + return { + type: "delimsizing", + mode: context.parser.mode, + size: delimiterSizes[context.funcName].size, + mclass: delimiterSizes[context.funcName].mclass, + delim: delim.text + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + if (group.delim === ".") { + // Empty delimiters still count as elements, even though they don't + // show anything. + return buildCommon.makeSpan([group.mclass]); + } // Use delimiter.sizedDelim to generate the delimiter. + + + return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]); + }, + mathmlBuilder: function mathmlBuilder(group) { + var children = []; + + if (group.delim !== ".") { + children.push(buildMathML_makeText(group.delim, group.mode)); + } + + var node = new mathMLTree.MathNode("mo", children); + + if (group.mclass === "mopen" || group.mclass === "mclose") { + // Only some of the delimsizing functions act as fences, and they + // return "mopen" or "mclose" mclass. + node.setAttribute("fence", "true"); + } else { + // Explicitly disable fencing if it's not a fence, to override the + // defaults. + node.setAttribute("fence", "false"); + } + + return node; + } +}); + +function assertParsed(group) { + if (!group.body) { + throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); + } +} + +defineFunction({ + type: "leftright-right", + names: ["\\right"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + // \left case below triggers parsing of \right in + // `const right = parser.parseFunction();` + // uses this return value. + return { + type: "leftright-right", + mode: context.parser.mode, + delim: checkDelimiter(args[0], context).text + }; + } +}); +defineFunction({ + type: "leftright", + names: ["\\left"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + var parser = context.parser; // Parse out the implicit body + + ++parser.leftrightDepth; // parseExpression stops before '\\right' + + var body = parser.parseExpression(false); + --parser.leftrightDepth; // Check the next token + + parser.expect("\\right", false); + var right = assertNodeType(parser.parseFunction(), "leftright-right"); + return { + type: "leftright", + mode: parser.mode, + body: body, + left: delim.text, + right: right.delim + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + assertParsed(group); // Build the inner expression + + var inner = buildHTML_buildExpression(group.body, options, true, [null, "mclose"]); + var innerHeight = 0; + var innerDepth = 0; + var hadMiddle = false; // Calculate its height and depth + + for (var i = 0; i < inner.length; i++) { + // Property `isMiddle` not defined on `span`. See comment in + // "middle"'s htmlBuilder. + // $FlowFixMe + if (inner[i].isMiddle) { + hadMiddle = true; + } else { + innerHeight = Math.max(inner[i].height, innerHeight); + innerDepth = Math.max(inner[i].depth, innerDepth); + } + } // The size of delimiters is the same, regardless of what style we are + // in. Thus, to correctly calculate the size of delimiter we need around + // a group, we scale down the inner size based on the size. + + + innerHeight *= options.sizeMultiplier; + innerDepth *= options.sizeMultiplier; + var leftDelim; + + if (group.left === ".") { + // Empty delimiters in \left and \right make null delimiter spaces. + leftDelim = makeNullDelimiter(options, ["mopen"]); + } else { + // Otherwise, use leftRightDelim to generate the correct sized + // delimiter. + leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); + } // Add it to the beginning of the expression + + + inner.unshift(leftDelim); // Handle middle delimiters + + if (hadMiddle) { + for (var _i = 1; _i < inner.length; _i++) { + var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in + // "middle"'s htmlBuilder. + // $FlowFixMe + + var isMiddle = middleDelim.isMiddle; + + if (isMiddle) { + // Apply the options that were active when \middle was called + inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); + } + } + } + + var rightDelim; // Same for the right delimiter + + if (group.right === ".") { + rightDelim = makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, options, group.mode, ["mclose"]); + } // Add it to the end of the expression. + + + inner.push(rightDelim); + return buildCommon.makeSpan(["minner"], inner, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + assertParsed(group); + var inner = buildMathML_buildExpression(group.body, options); + + if (group.left !== ".") { + var leftNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.left, group.mode)]); + leftNode.setAttribute("fence", "true"); + inner.unshift(leftNode); + } + + if (group.right !== ".") { + var rightNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.right, group.mode)]); + rightNode.setAttribute("fence", "true"); + inner.push(rightNode); + } + + return buildMathML_makeRow(inner); + } +}); +defineFunction({ + type: "middle", + names: ["\\middle"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + + if (!context.parser.leftrightDepth) { + throw new src_ParseError("\\middle without preceding \\left", delim); + } + + return { + type: "middle", + mode: context.parser.mode, + delim: delim.text + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var middleDelim; + + if (group.delim === ".") { + middleDelim = makeNullDelimiter(options, []); + } else { + middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []); + var isMiddle = { + delim: group.delim, + options: options + }; // Property `isMiddle` not defined on `span`. It is only used in + // this file above. + // TODO: Fix this violation of the `span` type and possibly rename + // things since `isMiddle` sounds like a boolean, but is a struct. + // $FlowFixMe + + middleDelim.isMiddle = isMiddle; + } + + return middleDelim; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var middleNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.delim, group.mode)]); + middleNode.setAttribute("fence", "true"); + return middleNode; + } +}); +// CONCATENATED MODULE: ./src/functions/enclose.js + + + + + + + + + +var enclose_htmlBuilder = function htmlBuilder(group, options) { + // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox + // Some groups can return document fragments. Handle those by wrapping + // them in a span. + var inner = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, options), options); + var label = group.label.substr(1); + var scale = options.sizeMultiplier; + var img; + var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different + // depending on whether the subject is wider than it is tall, or vice versa. + // We don't know the width of a group, so as a proxy, we test if + // the subject is a single character. This captures most of the + // subjects that should get the "tall" treatment. + + var isSingleChar = utils.isCharacterBox(group.body); + + if (label === "sout") { + img = buildCommon.makeSpan(["stretchy", "sout"]); + img.height = options.fontMetrics().defaultRuleThickness / scale; + imgShift = -0.5 * options.fontMetrics().xHeight; + } else { + // Add horizontal padding + if (/cancel/.test(label)) { + if (!isSingleChar) { + inner.classes.push("cancel-pad"); + } + } else { + inner.classes.push("boxpad"); + } // Add vertical padding + + + var vertPad = 0; // ref: LaTeX source2e: \fboxsep = 3pt; \fboxrule = .4pt + // ref: cancel package: \advance\totalheight2\p@ % "+2" + + if (/box/.test(label)) { + vertPad = label === "colorbox" ? 0.3 : 0.34; + } else { + vertPad = isSingleChar ? 0.2 : 0; + } + + img = stretchy.encloseSpan(inner, label, vertPad, options); + imgShift = inner.depth + vertPad; + + if (group.backgroundColor) { + img.style.backgroundColor = group.backgroundColor; + + if (group.borderColor) { + img.style.borderColor = group.borderColor; + } + } + } + + var vlist; + + if (group.backgroundColor) { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [// Put the color background behind inner; + { + type: "elem", + elem: img, + shift: imgShift + }, { + type: "elem", + elem: inner, + shift: 0 + }] + }, options); + } else { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [// Write the \cancel stroke on top of inner. + { + type: "elem", + elem: inner, + shift: 0 + }, { + type: "elem", + elem: img, + shift: imgShift, + wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] + }] + }, options); + } + + if (/cancel/.test(label)) { + // The cancel package documentation says that cancel lines add their height + // to the expression, but tests show that isn't how it actually works. + vlist.height = inner.height; + vlist.depth = inner.depth; + } + + if (/cancel/.test(label) && !isSingleChar) { + // cancel does not create horiz space for its line extension. + return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); + } else { + return buildCommon.makeSpan(["mord"], [vlist], options); + } }; -var delimiters = [ - "(", ")", "[", "\\lbrack", "]", "\\rbrack", - "\\{", "\\lbrace", "\\}", "\\rbrace", - "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", - "<", ">", "\\langle", "\\rangle", "\\lt", "\\gt", - "\\lvert", "\\rvert", "\\lVert", "\\rVert", - "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache", - "/", "\\backslash", - "|", "\\vert", "\\|", "\\Vert", - "\\uparrow", "\\Uparrow", - "\\downarrow", "\\Downarrow", - "\\updownarrow", "\\Updownarrow", - "." -]; +var enclose_mathmlBuilder = function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("menclose", [buildMathML_buildGroup(group.body, options)]); + + switch (group.label) { + case "\\cancel": + node.setAttribute("notation", "updiagonalstrike"); + break; + + case "\\bcancel": + node.setAttribute("notation", "downdiagonalstrike"); + break; + + case "\\sout": + node.setAttribute("notation", "horizontalstrike"); + break; + + case "\\fbox": + node.setAttribute("notation", "box"); + break; + + case "\\fcolorbox": + // TODO(ron): I don't know any way to set the border color. + node.setAttribute("notation", "box"); + break; + + case "\\xcancel": + node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + break; + } + + if (group.backgroundColor) { + node.setAttribute("mathbackground", group.backgroundColor); + } + + return node; +}; + +defineFunction({ + type: "enclose", + names: ["\\colorbox"], + props: { + numArgs: 2, + allowedInText: true, + greediness: 3, + argTypes: ["color", "text"] + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser, + funcName = _ref.funcName; + var color = assertNodeType(args[0], "color-token").color; + var body = args[1]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + backgroundColor: color, + body: body + }; + }, + htmlBuilder: enclose_htmlBuilder, + mathmlBuilder: enclose_mathmlBuilder +}); +defineFunction({ + type: "enclose", + names: ["\\fcolorbox"], + props: { + numArgs: 3, + allowedInText: true, + greediness: 3, + argTypes: ["color", "color", "text"] + }, + handler: function handler(_ref2, args, optArgs) { + var parser = _ref2.parser, + funcName = _ref2.funcName; + var borderColor = assertNodeType(args[0], "color-token").color; + var backgroundColor = assertNodeType(args[1], "color-token").color; + var body = args[2]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + backgroundColor: backgroundColor, + borderColor: borderColor, + body: body + }; + }, + htmlBuilder: enclose_htmlBuilder, + mathmlBuilder: enclose_mathmlBuilder +}); +defineFunction({ + type: "enclose", + names: ["\\fbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: true + }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser; + return { + type: "enclose", + mode: parser.mode, + label: "\\fbox", + body: args[0] + }; + } +}); +defineFunction({ + type: "enclose", + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], + props: { + numArgs: 1 + }, + handler: function handler(_ref4, args, optArgs) { + var parser = _ref4.parser, + funcName = _ref4.funcName; + var body = args[0]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + body: body + }; + }, + htmlBuilder: enclose_htmlBuilder, + mathmlBuilder: enclose_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/defineEnvironment.js + + +/** + * All registered environments. + * `environments.js` exports this same dictionary again and makes it public. + * `Parser.js` requires this dictionary via `environments.js`. + */ +var _environments = {}; +function defineEnvironment(_ref) { + var type = _ref.type, + names = _ref.names, + props = _ref.props, + handler = _ref.handler, + htmlBuilder = _ref.htmlBuilder, + mathmlBuilder = _ref.mathmlBuilder; + // Set default values of environments. + var data = { + type: type, + numArgs: props.numArgs || 0, + greediness: 1, + allowedInText: false, + numOptionalArgs: 0, + handler: handler + }; + + for (var i = 0; i < names.length; ++i) { + // TODO: The value type of _environments should be a type union of all + // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is + // an existential type. + // $FlowFixMe + _environments[names[i]] = data; + } + + if (htmlBuilder) { + _htmlGroupBuilders[type] = htmlBuilder; + } + + if (mathmlBuilder) { + _mathmlGroupBuilders[type] = mathmlBuilder; + } +} +// CONCATENATED MODULE: ./src/environments/array.js + + + + + + + + + + + + +function getHLines(parser) { + // Return an array. The array length = number of hlines. + // Each element in the array tells if the line is dashed. + var hlineInfo = []; + parser.consumeSpaces(); + var nxt = parser.nextToken.text; + + while (nxt === "\\hline" || nxt === "\\hdashline") { + parser.consume(); + hlineInfo.push(nxt === "\\hdashline"); + parser.consumeSpaces(); + nxt = parser.nextToken.text; + } + + return hlineInfo; +} +/** + * Parse the body of the environment, with rows delimited by \\ and + * columns delimited by &, and create a nested list in row-major order + * with one group per cell. If given an optional argument style + * ("text", "display", etc.), then each cell is cast into that style. + */ + + +function parseArray(parser, _ref, style) { + var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, + addJot = _ref.addJot, + cols = _ref.cols, + arraystretch = _ref.arraystretch; + // Parse body of array with \\ temporarily mapped to \cr + parser.gullet.beginGroup(); + parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment + + if (!arraystretch) { + var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); + + if (stretch == null) { + // Default \arraystretch from lttab.dtx + arraystretch = 1; + } else { + arraystretch = parseFloat(stretch); + + if (!arraystretch || arraystretch < 0) { + throw new src_ParseError("Invalid \\arraystretch: " + stretch); + } + } + } + + var row = []; + var body = [row]; + var rowGaps = []; + var hLinesBeforeRow = []; // Test for \hline at the top of the array. + + hLinesBeforeRow.push(getHLines(parser)); + + while (true) { + // eslint-disable-line no-constant-condition + var cell = parser.parseExpression(false, "\\cr"); + cell = { + type: "ordgroup", + mode: parser.mode, + body: cell + }; + + if (style) { + cell = { + type: "styling", + mode: parser.mode, + style: style, + body: [cell] + }; + } + + row.push(cell); + var next = parser.nextToken.text; + + if (next === "&") { + parser.consume(); + } else if (next === "\\end") { + // Arrays terminate newlines with `\crcr` which consumes a `\cr` if + // the last line is empty. + // NOTE: Currently, `cell` is the last item added into `row`. + if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) { + body.pop(); + } + + if (hLinesBeforeRow.length < body.length + 1) { + hLinesBeforeRow.push([]); + } + + break; + } else if (next === "\\cr") { + var cr = assertNodeType(parser.parseFunction(), "cr"); + rowGaps.push(cr.size); // check for \hline(s) following the row separator + + hLinesBeforeRow.push(getHLines(parser)); + row = []; + body.push(row); + } else { + throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken); + } + } + + parser.gullet.endGroup(); + return { + type: "array", + mode: parser.mode, + addJot: addJot, + arraystretch: arraystretch, + body: body, + cols: cols, + rowGaps: rowGaps, + hskipBeforeAndAfter: hskipBeforeAndAfter, + hLinesBeforeRow: hLinesBeforeRow + }; +} // Decides on a style for cells in an array according to whether the given +// environment name starts with the letter 'd'. + + +function dCellStyle(envName) { + if (envName.substr(0, 1) === "d") { + return "display"; + } else { + return "text"; + } +} + +var array_htmlBuilder = function htmlBuilder(group, options) { + var r; + var c; + var nr = group.body.length; + var hLinesBeforeRow = group.hLinesBeforeRow; + var nc = 0; + var body = new Array(nr); + var hlines = []; // Horizontal spacing + + var pt = 1 / options.fontMetrics().ptPerEm; + var arraycolsep = 5 * pt; // \arraycolsep in article.cls + // Vertical spacing + + var baselineskip = 12 * pt; // see size10.clo + // Default \jot from ltmath.dtx + // TODO(edemaine): allow overriding \jot via \setlength (#687) + + var jot = 3 * pt; + var arrayskip = group.arraystretch * baselineskip; + var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and + + var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx + + var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. + + function setHLinePos(hlinesInGap) { + for (var i = 0; i < hlinesInGap.length; ++i) { + if (i > 0) { + totalHeight += 0.25; + } + + hlines.push({ + pos: totalHeight, + isDashed: hlinesInGap[i] + }); + } + } + + setHLinePos(hLinesBeforeRow[0]); + + for (r = 0; r < group.body.length; ++r) { + var inrow = group.body[r]; + var height = arstrutHeight; // \@array adds an \@arstrut + + var depth = arstrutDepth; // to each tow (via the template) + + if (nc < inrow.length) { + nc = inrow.length; + } + + var outrow = new Array(inrow.length); + + for (c = 0; c < inrow.length; ++c) { + var elt = buildHTML_buildGroup(inrow[c], options); + + if (depth < elt.depth) { + depth = elt.depth; + } + + if (height < elt.height) { + height = elt.height; + } + + outrow[c] = elt; + } + + var rowGap = group.rowGaps[r]; + var gap = 0; + + if (rowGap) { + gap = units_calculateSize(rowGap, options); + + if (gap > 0) { + // \@argarraycr + gap += arstrutDepth; + + if (depth < gap) { + depth = gap; // \@xargarraycr + } + + gap = 0; + } + } // In AMS multiline environments such as aligned and gathered, rows + // correspond to lines that have additional \jot added to the + // \baselineskip via \openup. + + + if (group.addJot) { + depth += jot; + } + + outrow.height = height; + outrow.depth = depth; + totalHeight += height; + outrow.pos = totalHeight; + totalHeight += depth + gap; // \@yargarraycr + + body[r] = outrow; // Set a position for \hline(s), if any. + + setHLinePos(hLinesBeforeRow[r + 1]); + } + + var offset = totalHeight / 2 + options.fontMetrics().axisHeight; + var colDescriptions = group.cols || []; + var cols = []; + var colSep; + var colDescrNum; + + for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column + // descriptions, so trailing separators don't get lost. + c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { + var colDescr = colDescriptions[colDescrNum] || {}; + var firstSeparator = true; + + while (colDescr.type === "separator") { + // If there is more than one separator in a row, add a space + // between them. + if (!firstSeparator) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; + cols.push(colSep); + } + + if (colDescr.separator === "|") { + var separator = buildCommon.makeSpan(["vertical-separator"], [], options); + separator.style.height = totalHeight + "em"; + separator.style.verticalAlign = -(totalHeight - offset) + "em"; + cols.push(separator); + } else if (colDescr.separator === ":") { + var _separator = buildCommon.makeSpan(["vertical-separator", "vs-dashed"], [], options); + + _separator.style.height = totalHeight + "em"; + _separator.style.verticalAlign = -(totalHeight - offset) + "em"; + cols.push(_separator); + } else { + throw new src_ParseError("Invalid separator type: " + colDescr.separator); + } + + colDescrNum++; + colDescr = colDescriptions[colDescrNum] || {}; + firstSeparator = false; + } + + if (c >= nc) { + continue; + } + + var sepwidth = void 0; + + if (c > 0 || group.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.pregap, arraycolsep); + + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = sepwidth + "em"; + cols.push(colSep); + } + } + + var col = []; + + for (r = 0; r < nr; ++r) { + var row = body[r]; + var elem = row[c]; + + if (!elem) { + continue; + } + + var shift = row.pos - offset; + elem.depth = row.depth; + elem.height = row.height; + col.push({ + type: "elem", + elem: elem, + shift: shift + }); + } + + col = buildCommon.makeVList({ + positionType: "individualShift", + children: col + }, options); + col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); + cols.push(col); + + if (c < nc - 1 || group.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.postgap, arraycolsep); + + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = sepwidth + "em"; + cols.push(colSep); + } + } + } + + body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any. + + if (hlines.length > 0) { + var line = buildCommon.makeLineSpan("hline", options, 0.05); + var dashes = buildCommon.makeLineSpan("hdashline", options, 0.05); + var vListElems = [{ + type: "elem", + elem: body, + shift: 0 + }]; + + while (hlines.length > 0) { + var hline = hlines.pop(); + var lineShift = hline.pos - offset; + + if (hline.isDashed) { + vListElems.push({ + type: "elem", + elem: dashes, + shift: lineShift + }); + } else { + vListElems.push({ + type: "elem", + elem: line, + shift: lineShift + }); + } + } + + body = buildCommon.makeVList({ + positionType: "individualShift", + children: vListElems + }, options); + } + + return buildCommon.makeSpan(["mord"], [body], options); +}; + +var array_mathmlBuilder = function mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mtable", group.body.map(function (row) { + return new mathMLTree.MathNode("mtr", row.map(function (cell) { + return new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(cell, options)]); + })); + })); +}; // Convenience function for aligned and alignedat environments. + + +var array_alignedHandler = function alignedHandler(context, args) { + var cols = []; + var res = parseArray(context.parser, { + cols: cols, + addJot: true + }, "display"); // Determining number of columns. + // 1. If the first argument is given, we use it as a number of columns, + // and makes sure that each row doesn't exceed that number. + // 2. Otherwise, just count number of columns = maximum number + // of cells in each row ("aligned" mode -- isAligned will be true). + // + // At the same time, prepend empty group {} at beginning of every second + // cell in each row (starting with second cell) so that operators become + // binary. This behavior is implemented in amsmath's \start@aligned. + + var numMaths; + var numCols = 0; + var emptyGroup = { + type: "ordgroup", + mode: context.mode, + body: [] + }; + var ordgroup = checkNodeType(args[0], "ordgroup"); + + if (ordgroup) { + var arg0 = ""; + + for (var i = 0; i < ordgroup.body.length; i++) { + var textord = assertNodeType(ordgroup.body[i], "textord"); + arg0 += textord.text; + } + + numMaths = Number(arg0); + numCols = numMaths * 2; + } + + var isAligned = !numCols; + res.body.forEach(function (row) { + for (var _i = 1; _i < row.length; _i += 2) { + // Modify ordgroup node within styling node + var styling = assertNodeType(row[_i], "styling"); + + var _ordgroup = assertNodeType(styling.body[0], "ordgroup"); + + _ordgroup.body.unshift(emptyGroup); + } + + if (!isAligned) { + // Case 1 + var curMaths = row.length / 2; + + if (numMaths < curMaths) { + throw new src_ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]); + } + } else if (numCols < row.length) { + // Case 2 + numCols = row.length; + } + }); // Adjusting alignment. + // In aligned mode, we add one \qquad between columns; + // otherwise we add nothing. + + for (var _i2 = 0; _i2 < numCols; ++_i2) { + var align = "r"; + var pregap = 0; + + if (_i2 % 2 === 1) { + align = "l"; + } else if (_i2 > 0 && isAligned) { + // "aligned" mode. + pregap = 1; // add one \quad + } + + cols[_i2] = { + type: "align", + align: align, + pregap: pregap, + postgap: 0 + }; + } + + return res; +}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation +// is part of the source2e.pdf file of LaTeX2e source documentation. +// {darray} is an {array} environment where cells are set in \displaystyle, +// as defined in nccmath.sty. + + +defineEnvironment({ + type: "array", + names: ["array", "darray"], + props: { + numArgs: 1 + }, + handler: function handler(context, args) { + // Since no types are specified above, the two possibilities are + // - The argument is wrapped in {} or [], in which case Parser's + // parseGroup() returns an "ordgroup" wrapping some symbol node. + // - The argument is a bare symbol node. + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function (nde) { + var node = assertSymbolNodeType(nde); + var ca = node.text; + + if ("lcr".indexOf(ca) !== -1) { + return { + type: "align", + align: ca + }; + } else if (ca === "|") { + return { + type: "separator", + separator: "|" + }; + } else if (ca === ":") { + return { + type: "separator", + separator: ":" + }; + } + + throw new src_ParseError("Unknown column alignment: " + ca, nde); + }); + var res = { + cols: cols, + hskipBeforeAndAfter: true // \@preamble in lttab.dtx + + }; + return parseArray(context.parser, res, dCellStyle(context.envName)); + }, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); // The matrix environments of amsmath builds on the array environment +// of LaTeX, which is discussed above. + +defineEnvironment({ + type: "array", + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + var delimiters = { + "matrix": null, + "pmatrix": ["(", ")"], + "bmatrix": ["[", "]"], + "Bmatrix": ["\\{", "\\}"], + "vmatrix": ["|", "|"], + "Vmatrix": ["\\Vert", "\\Vert"] + }[context.envName]; // \hskip -\arraycolsep in amsmath + + var payload = { + hskipBeforeAndAfter: false + }; + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); + return delimiters ? { + type: "leftright", + mode: context.mode, + body: [res], + left: delimiters[0], + right: delimiters[1] + } : res; + }, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); // A cases environment (in amsmath.sty) is almost equivalent to +// \def\arraystretch{1.2}% +// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. +// {dcases} is a {cases} environment where cells are set in \displaystyle, +// as defined in mathtools.sty. + +defineEnvironment({ + type: "array", + names: ["cases", "dcases"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + var payload = { + arraystretch: 1.2, + cols: [{ + type: "align", + align: "l", + pregap: 0, + // TODO(kevinb) get the current style. + // For now we use the metrics for TEXT style which is what we were + // doing before. Before attempting to get the current style we + // should look at TeX's behavior especially for \over and matrices. + postgap: 1.0 + /* 1em quad */ + + }, { + type: "align", + align: "l", + pregap: 0, + postgap: 0 + }] + }; + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); + return { + type: "leftright", + mode: context.mode, + body: [res], + left: "\\{", + right: "." + }; + }, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); // An aligned environment is like the align* environment +// except it operates within math mode. +// Note that we assume \nomallineskiplimit to be zero, +// so that \strut@ is the same as \strut. + +defineEnvironment({ + type: "array", + names: ["aligned"], + props: { + numArgs: 0 + }, + handler: array_alignedHandler, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); // A gathered environment is like an array environment with one centered +// column, but where rows are considered lines so get \jot line spacing +// and contents are set in \displaystyle. + +defineEnvironment({ + type: "array", + names: ["gathered"], + props: { + numArgs: 0 + }, + handler: function handler(context) { + var res = { + cols: [{ + type: "align", + align: "c" + }], + addJot: true + }; + return parseArray(context.parser, res, "display"); + }, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); // alignat environment is like an align environment, but one must explicitly +// specify maximum number of columns in each row, and can adjust spacing between +// each columns. + +defineEnvironment({ + type: "array", + names: ["alignedat"], + // One for numbered and for unnumbered; + // but, KaTeX doesn't supports math numbering yet, + // they make no difference for now. + props: { + numArgs: 1 + }, + handler: array_alignedHandler, + htmlBuilder: array_htmlBuilder, + mathmlBuilder: array_mathmlBuilder +}); // Catch \hline outside array environment + +defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\hline", "\\hdashline"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: true + }, + handler: function handler(context, args) { + throw new src_ParseError(context.funcName + " valid only within array environment"); + } +}); +// CONCATENATED MODULE: ./src/environments.js + +var environments = _environments; +/* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below + + +// CONCATENATED MODULE: ./src/functions/environment.js + + + + // Environment delimiters. HTML/MathML rendering is defined in the corresponding +// defineEnvironment definitions. +// $FlowFixMe, "environment" handler returns an environment ParseNode + +defineFunction({ + type: "environment", + names: ["\\begin", "\\end"], + props: { + numArgs: 1, + argTypes: ["text"] + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var nameGroup = args[0]; + + if (nameGroup.type !== "ordgroup") { + throw new src_ParseError("Invalid environment name", nameGroup); + } + + var envName = ""; + + for (var i = 0; i < nameGroup.body.length; ++i) { + envName += assertNodeType(nameGroup.body[i], "textord").text; + } + + if (funcName === "\\begin") { + // begin...end is similar to left...right + if (!src_environments.hasOwnProperty(envName)) { + throw new src_ParseError("No such environment: " + envName, nameGroup); + } // Build the environment object. Arguments and other information will + // be made available to the begin and end methods using properties. + + + var env = src_environments[envName]; + + var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env), + _args = _parser$parseArgument.args, + optArgs = _parser$parseArgument.optArgs; + + var context = { + mode: parser.mode, + envName: envName, + parser: parser + }; + var result = env.handler(context, _args, optArgs); + parser.expect("\\end", false); + var endNameToken = parser.nextToken; + var end = assertNodeType(parser.parseFunction(), "environment"); + + if (end.name !== envName) { + throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken); + } + + return result; + } + + return { + type: "environment", + mode: parser.mode, + name: envName, + nameGroup: nameGroup + }; + } +}); +// CONCATENATED MODULE: ./src/functions/mclass.js + + + + + +var mclass_makeSpan = buildCommon.makeSpan; + +function mclass_htmlBuilder(group, options) { + var elements = buildHTML_buildExpression(group.body, options, true); + return mclass_makeSpan([group.mclass], elements, options); +} + +function mclass_mathmlBuilder(group, options) { + var inner = buildMathML_buildExpression(group.body, options); + return mathMLTree.newDocumentFragment(inner); +} // Math class commands except \mathop + + +defineFunction({ + type: "mclass", + names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], + props: { + numArgs: 1 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "mclass", + mode: parser.mode, + mclass: "m" + funcName.substr(5), + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: mclass_htmlBuilder, + mathmlBuilder: mclass_mathmlBuilder +}); +var binrelClass = function binrelClass(arg) { + // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument. + // (by rendering separately and with {}s before and after, and measuring + // the change in spacing). We'll do roughly the same by detecting the + // atom type directly. + var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; + + if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) { + return "m" + atom.family; + } else { + return "mord"; + } +}; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord. +// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX. + +defineFunction({ + type: "mclass", + names: ["\\@binrel"], + props: { + numArgs: 2 + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + return { + type: "mclass", + mode: parser.mode, + mclass: binrelClass(args[0]), + body: [args[1]] + }; + } +}); // Build a relation or stacked op by placing one symbol on top of another + +defineFunction({ + type: "mclass", + names: ["\\stackrel", "\\overset", "\\underset"], + props: { + numArgs: 2 + }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser, + funcName = _ref3.funcName; + var baseArg = args[1]; + var shiftedArg = args[0]; + var mclass; + + if (funcName !== "\\stackrel") { + // LaTeX applies \binrel spacing to \overset and \underset. + mclass = binrelClass(baseArg); + } else { + mclass = "mrel"; // for \stackrel + } + + var baseOp = { + type: "op", + mode: baseArg.mode, + limits: true, + alwaysHandleSupSub: true, + symbol: false, + suppressBaseShift: funcName !== "\\stackrel", + body: defineFunction_ordargument(baseArg) + }; + var supsub = { + type: "supsub", + mode: shiftedArg.mode, + base: baseOp, + sup: funcName === "\\underset" ? null : shiftedArg, + sub: funcName === "\\underset" ? shiftedArg : null + }; + return { + type: "mclass", + mode: parser.mode, + mclass: mclass, + body: [supsub] + }; + }, + htmlBuilder: mclass_htmlBuilder, + mathmlBuilder: mclass_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/font.js +// TODO(kevinb): implement \\sl and \\sc + + + + + +var font_htmlBuilder = function htmlBuilder(group, options) { + var font = group.font; + var newOptions = options.withFont(font); + return buildHTML_buildGroup(group.body, newOptions); +}; + +var font_mathmlBuilder = function mathmlBuilder(group, options) { + var font = group.font; + var newOptions = options.withFont(font); + return buildMathML_buildGroup(group.body, newOptions); +}; var fontAliases = { - "\\Bbb": "\\mathbb", - "\\bold": "\\mathbf", - "\\frak": "\\mathfrak" + "\\Bbb": "\\mathbb", + "\\bold": "\\mathbf", + "\\frak": "\\mathfrak", + "\\bm": "\\boldsymbol" +}; +defineFunction({ + type: "font", + names: [// styles, except \boldsymbol defined below + "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families + "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below + "\\Bbb", "\\bold", "\\frak"], + props: { + numArgs: 1, + greediness: 2 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + var func = funcName; + + if (func in fontAliases) { + func = fontAliases[func]; + } + + return { + type: "font", + mode: parser.mode, + font: func.slice(1), + body: body + }; + }, + htmlBuilder: font_htmlBuilder, + mathmlBuilder: font_mathmlBuilder +}); +defineFunction({ + type: "mclass", + names: ["\\boldsymbol", "\\bm"], + props: { + numArgs: 1, + greediness: 2 + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var body = args[0]; // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the + // argument's bin|rel|ord status + + return { + type: "mclass", + mode: parser.mode, + mclass: binrelClass(body), + body: [{ + type: "font", + mode: parser.mode, + font: "boldsymbol", + body: body + }] + }; + } +}); // Old font changing functions + +defineFunction({ + type: "font", + names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it"], + props: { + numArgs: 0, + allowedInText: true + }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser, + funcName = _ref3.funcName, + breakOnTokenText = _ref3.breakOnTokenText; + var mode = parser.mode; + parser.consumeSpaces(); + var body = parser.parseExpression(true, breakOnTokenText); + var style = "math" + funcName.slice(1); + return { + type: "font", + mode: mode, + font: style, + body: { + type: "ordgroup", + mode: parser.mode, + body: body + } + }; + }, + htmlBuilder: font_htmlBuilder, + mathmlBuilder: font_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/genfrac.js + + + + + + + + + + + +var genfrac_htmlBuilder = function htmlBuilder(group, options) { + // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). + // Figure out what style this fraction should be in based on the + // function used + var style = options.style; + + if (group.size === "display") { + style = src_Style.DISPLAY; + } else if (group.size === "text" && style.size === src_Style.DISPLAY.size) { + // We're in a \tfrac but incoming style is displaystyle, so: + style = src_Style.TEXT; + } else if (group.size === "script") { + style = src_Style.SCRIPT; + } else if (group.size === "scriptscript") { + style = src_Style.SCRIPTSCRIPT; + } + + var nstyle = style.fracNum(); + var dstyle = style.fracDen(); + var newOptions; + newOptions = options.havingStyle(nstyle); + var numerm = buildHTML_buildGroup(group.numer, newOptions, options); + + if (group.continued) { + // \cfrac inserts a \strut into the numerator. + // Get \strut dimensions from TeXbook page 353. + var hStrut = 8.5 / options.fontMetrics().ptPerEm; + var dStrut = 3.5 / options.fontMetrics().ptPerEm; + numerm.height = numerm.height < hStrut ? hStrut : numerm.height; + numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; + } + + newOptions = options.havingStyle(dstyle); + var denomm = buildHTML_buildGroup(group.denom, newOptions, options); + var rule; + var ruleWidth; + var ruleSpacing; + + if (group.hasBarLine) { + if (group.barSize) { + ruleWidth = units_calculateSize(group.barSize, options); + rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); + } else { + rule = buildCommon.makeLineSpan("frac-line", options); + } + + ruleWidth = rule.height; + ruleSpacing = rule.height; + } else { + rule = null; + ruleWidth = 0; + ruleSpacing = options.fontMetrics().defaultRuleThickness; + } // Rule 15b + + + var numShift; + var clearance; + var denomShift; + + if (style.size === src_Style.DISPLAY.size) { + numShift = options.fontMetrics().num1; + + if (ruleWidth > 0) { + clearance = 3 * ruleSpacing; + } else { + clearance = 7 * ruleSpacing; + } + + denomShift = options.fontMetrics().denom1; + } else { + if (ruleWidth > 0) { + numShift = options.fontMetrics().num2; + clearance = ruleSpacing; + } else { + numShift = options.fontMetrics().num3; + clearance = 3 * ruleSpacing; + } + + denomShift = options.fontMetrics().denom2; + } + + var frac; + + if (!rule) { + // Rule 15c + var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); + + if (candidateClearance < clearance) { + numShift += 0.5 * (clearance - candidateClearance); + denomShift += 0.5 * (clearance - candidateClearance); + } + + frac = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: denomm, + shift: denomShift + }, { + type: "elem", + elem: numerm, + shift: -numShift + }] + }, options); + } else { + // Rule 15d + var axisHeight = options.fontMetrics().axisHeight; + + if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { + numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); + } + + if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { + denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); + } + + var midShift = -(axisHeight - 0.5 * ruleWidth); + frac = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: denomm, + shift: denomShift + }, { + type: "elem", + elem: rule, + shift: midShift + }, { + type: "elem", + elem: numerm, + shift: -numShift + }] + }, options); + } // Since we manually change the style sometimes (with \dfrac or \tfrac), + // account for the possible size change here. + + + newOptions = options.havingStyle(style); + frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; + frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e + + var delimSize; + + if (style.size === src_Style.DISPLAY.size) { + delimSize = options.fontMetrics().delim1; + } else { + delimSize = options.fontMetrics().delim2; + } + + var leftDelim; + var rightDelim; + + if (group.leftDelim == null) { + leftDelim = makeNullDelimiter(options, ["mopen"]); + } else { + leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); + } + + if (group.continued) { + rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac + } else if (group.rightDelim == null) { + rightDelim = makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); + } + + return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options); }; -// Single-argument color functions -defineFunction([ - "\\blue", "\\orange", "\\pink", "\\red", - "\\green", "\\gray", "\\purple", - "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", - "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", - "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", - "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", - "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", - "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", - "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", - "\\mintA", "\\mintB", "\\mintC", - "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", - "\\grayF", "\\grayG", "\\grayH", "\\grayI", - "\\kaBlue", "\\kaGreen" -], { - numArgs: 1, - allowedInText: true, - greediness: 3 -}, function(context, args) { - var body = args[0]; - return { - type: "color", - color: "katex-" + context.funcName.slice(1), - value: ordargument(body) - }; -}); +var genfrac_mathmlBuilder = function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]); -// There are 2 flags for operators; whether they produce limits in -// displaystyle, and whether they are symbols and should grow in -// displaystyle. These four groups cover the four possible choices. + if (!group.hasBarLine) { + node.setAttribute("linethickness", "0px"); + } else if (group.barSize) { + var ruleWidth = units_calculateSize(group.barSize, options); + node.setAttribute("linethickness", ruleWidth + "em"); + } -// No limits, not symbols -defineFunction([ - "\\arcsin", "\\arccos", "\\arctan", "\\arg", "\\cos", "\\cosh", - "\\cot", "\\coth", "\\csc", "\\deg", "\\dim", "\\exp", "\\hom", - "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", - "\\tan", "\\tanh" -], { - numArgs: 0 -}, function(context) { - return { - type: "op", - limits: false, - symbol: false, - body: context.funcName - }; -}); + if (group.leftDelim != null || group.rightDelim != null) { + var withDelims = []; -// Limits, not symbols -defineFunction([ - "\\det", "\\gcd", "\\inf", "\\lim", "\\liminf", "\\limsup", "\\max", - "\\min", "\\Pr", "\\sup" -], { - numArgs: 0 -}, function(context) { - return { - type: "op", - limits: true, - symbol: false, - body: context.funcName - }; -}); + if (group.leftDelim != null) { + var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim)]); + leftOp.setAttribute("fence", "true"); + withDelims.push(leftOp); + } -// No limits, symbols -defineFunction([ - "\\int", "\\iint", "\\iiint", "\\oint" -], { - numArgs: 0 -}, function(context) { - return { - type: "op", - limits: false, - symbol: true, - body: context.funcName - }; -}); + withDelims.push(node); -// Limits, symbols -defineFunction([ - "\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", - "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", - "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint" -], { - numArgs: 0 -}, function(context) { - return { - type: "op", - limits: true, - symbol: true, - body: context.funcName - }; -}); + if (group.rightDelim != null) { + var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim)]); + rightOp.setAttribute("fence", "true"); + withDelims.push(rightOp); + } -// \mathop class command -defineFunction("\\mathop", { - numArgs: 1 -}, function(context, args) { - var body = args[0]; - return { - type: "op", - limits: false, - symbol: false, - value: ordargument(body) - }; -}); + return buildMathML_makeRow(withDelims); + } -// Fractions -defineFunction([ - "\\dfrac", "\\frac", "\\tfrac", - "\\dbinom", "\\binom", "\\tbinom", - "\\\\atopfrac" // can’t be entered directly -], { + return node; +}; + +defineFunction({ + type: "genfrac", + names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly + "\\\\bracefrac", "\\\\brackfrac"], + props: { numArgs: 2, greediness: 2 -}, function(context, args) { + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; var numer = args[0]; var denom = args[1]; var hasBarLine; @@ -7885,1191 +10470,5992 @@ defineFunction([ var rightDelim = null; var size = "auto"; - switch (context.funcName) { - case "\\dfrac": - case "\\frac": - case "\\tfrac": - hasBarLine = true; - break; - case "\\\\atopfrac": - hasBarLine = false; - break; - case "\\dbinom": - case "\\binom": - case "\\tbinom": - hasBarLine = false; - leftDelim = "("; - rightDelim = ")"; - break; - default: - throw new Error("Unrecognized genfrac command"); + switch (funcName) { + case "\\cfrac": + case "\\dfrac": + case "\\frac": + case "\\tfrac": + hasBarLine = true; + break; + + case "\\\\atopfrac": + hasBarLine = false; + break; + + case "\\dbinom": + case "\\binom": + case "\\tbinom": + hasBarLine = false; + leftDelim = "("; + rightDelim = ")"; + break; + + case "\\\\bracefrac": + hasBarLine = false; + leftDelim = "\\{"; + rightDelim = "\\}"; + break; + + case "\\\\brackfrac": + hasBarLine = false; + leftDelim = "["; + rightDelim = "]"; + break; + + default: + throw new Error("Unrecognized genfrac command"); } - switch (context.funcName) { - case "\\dfrac": - case "\\dbinom": - size = "display"; - break; - case "\\tfrac": - case "\\tbinom": - size = "text"; - break; + switch (funcName) { + case "\\cfrac": + case "\\dfrac": + case "\\dbinom": + size = "display"; + break; + + case "\\tfrac": + case "\\tbinom": + size = "text"; + break; } return { - type: "genfrac", - numer: numer, - denom: denom, - hasBarLine: hasBarLine, - leftDelim: leftDelim, - rightDelim: rightDelim, - size: size + type: "genfrac", + mode: parser.mode, + continued: funcName === "\\cfrac", + numer: numer, + denom: denom, + hasBarLine: hasBarLine, + leftDelim: leftDelim, + rightDelim: rightDelim, + size: size, + barSize: null }; -}); + }, + htmlBuilder: genfrac_htmlBuilder, + mathmlBuilder: genfrac_mathmlBuilder +}); // Infix generalized fractions -- these are not rendered directly, but replaced +// immediately by one of the variants above. -// Left and right overlap functions -defineFunction(["\\llap", "\\rlap"], { - numArgs: 1, - allowedInText: true -}, function(context, args) { - var body = args[0]; - return { - type: context.funcName.slice(1), - body: body - }; -}); - -// Delimiter functions -var checkDelimiter = function(delim, context) { - if (utils.contains(delimiters, delim.value)) { - return delim; - } else { - throw new ParseError( - "Invalid delimiter: '" + delim.value + "' after '" + - context.funcName + "'", delim); - } -}; - -defineFunction([ - "\\bigl", "\\Bigl", "\\biggl", "\\Biggl", - "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", - "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", - "\\big", "\\Big", "\\bigg", "\\Bigg" -], { - numArgs: 1 -}, function(context, args) { - var delim = checkDelimiter(args[0], context); - - return { - type: "delimsizing", - size: delimiterSizes[context.funcName].size, - mclass: delimiterSizes[context.funcName].mclass, - value: delim.value - }; -}); - -defineFunction([ - "\\left", "\\right" -], { - numArgs: 1 -}, function(context, args) { - var delim = checkDelimiter(args[0], context); - - // \left and \right are caught somewhere in Parser.js, which is - // why this data doesn't match what is in buildHTML. - return { - type: "leftright", - value: delim.value - }; -}); - -defineFunction("\\middle", { - numArgs: 1 -}, function(context, args) { - var delim = checkDelimiter(args[0], context); - if (!context.parser.leftrightDepth) { - throw new ParseError("\\middle without preceding \\left", delim); - } - - return { - type: "middle", - value: delim.value - }; -}); - -// Sizing functions (handled in Parser.js explicitly, hence no handler) -defineFunction([ - "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", - "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge" -], 0, null); - -// Style changing functions (handled in Parser.js explicitly, hence no -// handler) -defineFunction([ - "\\displaystyle", "\\textstyle", "\\scriptstyle", - "\\scriptscriptstyle" -], 0, null); - -defineFunction([ - // styles - "\\mathrm", "\\mathit", "\\mathbf", - - // families - "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", - "\\mathtt", - - // aliases - "\\Bbb", "\\bold", "\\frak" -], { - numArgs: 1, - greediness: 2 -}, function(context, args) { - var body = args[0]; - var func = context.funcName; - if (func in fontAliases) { - func = fontAliases[func]; - } - return { - type: "font", - font: func.slice(1), - body: body - }; -}); - -// Accents -defineFunction([ - "\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", - "\\check", "\\hat", "\\vec", "\\dot" - // We don't support expanding accents yet - // "\\widetilde", "\\widehat" -], { - numArgs: 1 -}, function(context, args) { - var base = args[0]; - return { - type: "accent", - accent: context.funcName, - base: base - }; -}); - -// Infix generalized fractions -defineFunction(["\\over", "\\choose", "\\atop"], { +defineFunction({ + type: "infix", + names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], + props: { numArgs: 0, infix: true -}, function(context) { + }, + handler: function handler(_ref2) { + var parser = _ref2.parser, + funcName = _ref2.funcName, + token = _ref2.token; var replaceWith; - switch (context.funcName) { - case "\\over": - replaceWith = "\\frac"; - break; - case "\\choose": - replaceWith = "\\binom"; - break; - case "\\atop": - replaceWith = "\\\\atopfrac"; - break; - default: - throw new Error("Unrecognized infix genfrac command"); + + switch (funcName) { + case "\\over": + replaceWith = "\\frac"; + break; + + case "\\choose": + replaceWith = "\\binom"; + break; + + case "\\atop": + replaceWith = "\\\\atopfrac"; + break; + + case "\\brace": + replaceWith = "\\\\bracefrac"; + break; + + case "\\brack": + replaceWith = "\\\\brackfrac"; + break; + + default: + throw new Error("Unrecognized infix genfrac command"); } + return { - type: "infix", - replaceWith: replaceWith, - token: context.token + type: "infix", + mode: parser.mode, + replaceWith: replaceWith, + token: token }; + } }); +var stylArray = ["display", "text", "script", "scriptscript"]; -// Row breaks for aligned data -defineFunction(["\\\\", "\\cr"], { - numArgs: 0, - numOptionalArgs: 1, - argTypes: ["size"] -}, function(context, args) { - var size = args[0]; - return { - type: "cr", - size: size - }; -}); +var delimFromValue = function delimFromValue(delimString) { + var delim = null; -// Environment delimiters -defineFunction(["\\begin", "\\end"], { - numArgs: 1, - argTypes: ["text"] -}, function(context, args) { - var nameGroup = args[0]; - if (nameGroup.type !== "ordgroup") { - throw new ParseError("Invalid environment name", nameGroup); - } - var name = ""; - for (var i = 0; i < nameGroup.value.length; ++i) { - name += nameGroup.value[i].value; - } - return { - type: "environment", - name: name, - nameGroup: nameGroup - }; -}); + if (delimString.length > 0) { + delim = delimString; + delim = delim === "." ? null : delim; + } -},{"./ParseError":6,"./parseData":21,"./utils":25}],20:[function(require,module,exports){ -/** - * These objects store data about MathML nodes. This is the MathML equivalent - * of the types in domTree.js. Since MathML handles its own rendering, and - * since we're mainly using MathML to improve accessibility, we don't manage - * any of the styling state that the plain DOM nodes do. - * - * The `toNode` and `toMarkup` functions work simlarly to how they do in - * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. - */ - -var utils = require("./utils"); - -/** - * This node represents a general purpose MathML node of any type. The - * constructor requires the type of node to create (for example, `"mo"` or - * `"mspace"`, corresponding to `` and `` tags). - */ -function MathNode(type, children) { - this.type = type; - this.attributes = {}; - this.children = children || []; -} - -/** - * Sets an attribute on a MathML node. MathML depends on attributes to convey a - * semantic content, so this is used heavily. - */ -MathNode.prototype.setAttribute = function(name, value) { - this.attributes[name] = value; + return delim; }; -/** - * Converts the math node into a MathML-namespaced DOM element. - */ -MathNode.prototype.toNode = function() { - var node = document.createElementNS( - "http://www.w3.org/1998/Math/MathML", this.type); +defineFunction({ + type: "genfrac", + names: ["\\genfrac"], + props: { + numArgs: 6, + greediness: 6, + argTypes: ["math", "math", "size", "text", "math", "math"] + }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser; + var numer = args[4]; + var denom = args[5]; // Look into the parse nodes to get the desired delimiters. - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } + var leftNode = checkNodeType(args[0], "ordgroup"); + + if (leftNode) { + leftNode = assertAtomFamily(leftNode.body[0], "open"); + } else { + leftNode = assertAtomFamily(args[0], "open"); } - for (var i = 0; i < this.children.length; i++) { - node.appendChild(this.children[i].toNode()); + var leftDelim = delimFromValue(leftNode.text); + var rightNode = checkNodeType(args[1], "ordgroup"); + + if (rightNode) { + rightNode = assertAtomFamily(rightNode.body[0], "close"); + } else { + rightNode = assertAtomFamily(args[1], "close"); + } + + var rightDelim = delimFromValue(rightNode.text); + var barNode = assertNodeType(args[2], "size"); + var hasBarLine; + var barSize = null; + + if (barNode.isBlank) { + // \genfrac acts differently than \above. + // \genfrac treats an empty size group as a signal to use a + // standard bar size. \above would see size = 0 and omit the bar. + hasBarLine = true; + } else { + barSize = barNode.value; + hasBarLine = barSize.number > 0; + } // Find out if we want displaystyle, textstyle, etc. + + + var size = "auto"; + var styl = checkNodeType(args[3], "ordgroup"); + + if (styl) { + if (styl.body.length > 0) { + var textOrd = assertNodeType(styl.body[0], "textord"); + size = stylArray[Number(textOrd.text)]; + } + } else { + styl = assertNodeType(args[3], "textord"); + size = stylArray[Number(styl.text)]; + } + + return { + type: "genfrac", + mode: parser.mode, + numer: numer, + denom: denom, + continued: false, + hasBarLine: hasBarLine, + barSize: barSize, + leftDelim: leftDelim, + rightDelim: rightDelim, + size: size + }; + }, + htmlBuilder: genfrac_htmlBuilder, + mathmlBuilder: genfrac_mathmlBuilder +}); // \above is an infix fraction that also defines a fraction bar size. + +defineFunction({ + type: "infix", + names: ["\\above"], + props: { + numArgs: 1, + argTypes: ["size"], + infix: true + }, + handler: function handler(_ref4, args) { + var parser = _ref4.parser, + funcName = _ref4.funcName, + token = _ref4.token; + return { + type: "infix", + mode: parser.mode, + replaceWith: "\\\\abovefrac", + size: assertNodeType(args[0], "size").value, + token: token + }; + } +}); +defineFunction({ + type: "genfrac", + names: ["\\\\abovefrac"], + props: { + numArgs: 3, + argTypes: ["math", "size", "math"] + }, + handler: function handler(_ref5, args) { + var parser = _ref5.parser, + funcName = _ref5.funcName; + var numer = args[0]; + var barSize = assert(assertNodeType(args[1], "infix").size); + var denom = args[2]; + var hasBarLine = barSize.number > 0; + return { + type: "genfrac", + mode: parser.mode, + numer: numer, + denom: denom, + continued: false, + hasBarLine: hasBarLine, + barSize: barSize, + leftDelim: null, + rightDelim: null, + size: "auto" + }; + }, + htmlBuilder: genfrac_htmlBuilder, + mathmlBuilder: genfrac_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/horizBrace.js + + + + + + + + +// NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but +var horizBrace_htmlBuilder = function htmlBuilder(grp, options) { + var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. + + var supSubGroup; + var group; + var supSub = checkNodeType(grp, "supsub"); + + if (supSub) { + // Ref: LaTeX source2e: }}}}\limits} + // i.e. LaTeX treats the brace similar to an op and passes it + // with \limits, so we need to assign supsub style. + supSubGroup = supSub.sup ? buildHTML_buildGroup(supSub.sup, options.havingStyle(style.sup()), options) : buildHTML_buildGroup(supSub.sub, options.havingStyle(style.sub()), options); + group = assertNodeType(supSub.base, "horizBrace"); + } else { + group = assertNodeType(grp, "horizBrace"); + } // Build the base group + + + var body = buildHTML_buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element + + var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ + // This first vlist contains the content and the brace: equation + + var vlist; + + if (group.isOver) { + vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: braceBody + }] + }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. + + vlist.children[0].children[0].children[1].classes.push("svg-align"); + } else { + vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: body.depth + 0.1 + braceBody.height, + children: [{ + type: "elem", + elem: braceBody + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: body + }] + }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. + + vlist.children[0].children[0].children[0].classes.push("svg-align"); + } + + if (supSubGroup) { + // To write the supsub, wrap the first vlist in another vlist: + // They can't all go in the same vlist, because the note might be + // wider than the equation. We want the equation to control the + // brace width. + // note long note long note + // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ + // equation eqn eqn + var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); + + if (group.isOver) { + vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: vSpan + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: supSubGroup + }] + }, options); + } else { + vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, + children: [{ + type: "elem", + elem: supSubGroup + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: vSpan + }] + }, options); + } + } + + return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); +}; + +var horizBrace_mathmlBuilder = function mathmlBuilder(group, options) { + var accentNode = stretchy.mathMLnode(group.label); + return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]); +}; // Horizontal stretchy braces + + +defineFunction({ + type: "horizBrace", + names: ["\\overbrace", "\\underbrace"], + props: { + numArgs: 1 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + return { + type: "horizBrace", + mode: parser.mode, + label: funcName, + isOver: /^\\over/.test(funcName), + base: args[0] + }; + }, + htmlBuilder: horizBrace_htmlBuilder, + mathmlBuilder: horizBrace_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/href.js + + + + + + +defineFunction({ + type: "href", + names: ["\\href"], + props: { + numArgs: 2, + argTypes: ["url", "original"], + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[1]; + var href = assertNodeType(args[0], "url").url; + return { + type: "href", + mode: parser.mode, + href: href, + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildHTML_buildExpression(group.body, options, false); + return buildCommon.makeAnchor(group.href, [], elements, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var math = buildExpressionRow(group.body, options); + + if (!(math instanceof mathMLTree_MathNode)) { + math = new mathMLTree_MathNode("mrow", [math]); + } + + math.setAttribute("href", group.href); + return math; + } +}); +defineFunction({ + type: "href", + names: ["\\url"], + props: { + numArgs: 1, + argTypes: ["url"], + allowedInText: true + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var href = assertNodeType(args[0], "url").url; + var chars = []; + + for (var i = 0; i < href.length; i++) { + var c = href[i]; + + if (c === "~") { + c = "\\textasciitilde"; + } + + chars.push({ + type: "textord", + mode: "text", + text: c + }); + } + + var body = { + type: "text", + mode: parser.mode, + font: "\\texttt", + body: chars + }; + return { + type: "href", + mode: parser.mode, + href: href, + body: defineFunction_ordargument(body) + }; + } +}); +// CONCATENATED MODULE: ./src/functions/htmlmathml.js + + + + +defineFunction({ + type: "htmlmathml", + names: ["\\html@mathml"], + props: { + numArgs: 2, + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "htmlmathml", + mode: parser.mode, + html: defineFunction_ordargument(args[0]), + mathml: defineFunction_ordargument(args[1]) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildHTML_buildExpression(group.html, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return buildExpressionRow(group.mathml, options); + } +}); +// CONCATENATED MODULE: ./src/functions/kern.js +// Horizontal spacing commands + + + + + // TODO: \hskip and \mskip should support plus and minus in lengths + +defineFunction({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var size = assertNodeType(args[0], "size"); + + if (parser.settings.strict) { + var mathFunction = funcName[1] === 'm'; // \mkern, \mskip + + var muUnit = size.value.unit === 'mu'; + + if (mathFunction) { + if (!muUnit) { + parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units")); + } + + if (parser.mode !== "math") { + parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode"); + } + } else { + // !mathFunction + if (muUnit) { + parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units"); + } + } + } + + return { + type: "kern", + mode: parser.mode, + dimension: size.value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeGlue(group.dimension, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var dimension = units_calculateSize(group.dimension, options); + return new mathMLTree.SpaceNode(dimension); + } +}); +// CONCATENATED MODULE: ./src/functions/lap.js +// Horizontal overlap functions + + + + + +defineFunction({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "lap", + mode: parser.mode, + alignment: funcName.slice(5), + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // mathllap, mathrlap, mathclap + var inner; + + if (group.alignment === "clap") { + // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ + inner = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span + + inner = buildCommon.makeSpan(["inner"], [inner], options); + } else { + inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options)]); + } + + var fix = buildCommon.makeSpan(["fix"], []); + var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the + // two items involved in the lap. + // Next, use a strut to set the height of the HTML bounding box. + // Otherwise, a tall argument may be misplaced. + + var strut = buildCommon.makeSpan(["strut"]); + strut.style.height = node.height + node.depth + "em"; + strut.style.verticalAlign = -node.depth + "em"; + node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall. + + node = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node + }] + }, options); // Get the horizontal spacing correct relative to adjacent items. + + return buildCommon.makeSpan(["mord"], [node], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // mathllap, mathrlap, mathclap + var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); + + if (group.alignment !== "rlap") { + var offset = group.alignment === "llap" ? "-1" : "-0.5"; + node.setAttribute("lspace", offset + "width"); + } + + node.setAttribute("width", "0px"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/math.js + + // Switching from text mode back to math mode + +defineFunction({ + type: "styling", + names: ["\\(", "$"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: false, + consumeMode: "math" + }, + handler: function handler(_ref, args) { + var funcName = _ref.funcName, + parser = _ref.parser; + var outerMode = parser.mode; + parser.switchMode("math"); + var close = funcName === "\\(" ? "\\)" : "$"; + var body = parser.parseExpression(false, close); // We can't expand the next symbol after the closing $ until after + // switching modes back. So don't consume within expect. + + parser.expect(close, false); + parser.switchMode(outerMode); + parser.consume(); + return { + type: "styling", + mode: parser.mode, + style: "text", + body: body + }; + } +}); // Check for extra closing math delimiters + +defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\)", "\\]"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: false + }, + handler: function handler(context, args) { + throw new src_ParseError("Mismatched " + context.funcName); + } +}); +// CONCATENATED MODULE: ./src/functions/mathchoice.js + + + + + + +var mathchoice_chooseMathStyle = function chooseMathStyle(group, options) { + switch (options.style.size) { + case src_Style.DISPLAY.size: + return group.display; + + case src_Style.TEXT.size: + return group.text; + + case src_Style.SCRIPT.size: + return group.script; + + case src_Style.SCRIPTSCRIPT.size: + return group.scriptscript; + + default: + return group.text; + } +}; + +defineFunction({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { + numArgs: 4 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "mathchoice", + mode: parser.mode, + display: defineFunction_ordargument(args[0]), + text: defineFunction_ordargument(args[1]), + script: defineFunction_ordargument(args[2]), + scriptscript: defineFunction_ordargument(args[3]) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var body = mathchoice_chooseMathStyle(group, options); + var elements = buildHTML_buildExpression(body, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var body = mathchoice_chooseMathStyle(group, options); + return buildExpressionRow(body, options); + } +}); +// CONCATENATED MODULE: ./src/functions/op.js +// Limits, symbols + + + + + + + + + +// NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also +var op_htmlBuilder = function htmlBuilder(grp, options) { + // Operators are handled in the TeXbook pg. 443-444, rule 13(a). + var supGroup; + var subGroup; + var hasLimits = false; + var group; + var supSub = checkNodeType(grp, "supsub"); + + if (supSub) { + // If we have limits, supsub will pass us its group to handle. Pull + // out the superscript and subscript and set the group to the op in + // its base. + supGroup = supSub.sup; + subGroup = supSub.sub; + group = assertNodeType(supSub.base, "op"); + hasLimits = true; + } else { + group = assertNodeType(grp, "op"); + } + + var style = options.style; // Most operators have a large successor symbol, but these don't. + + var noSuccessor = ["\\smallint"]; + var large = false; + + if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) { + // Most symbol operators get larger in displaystyle (rule 13) + large = true; + } + + var base; + + if (group.symbol) { + // If this is a symbol, create the symbol. + var fontName = large ? "Size2-Regular" : "Size1-Regular"; + var stash = ""; + + if (group.name === "\\oiint" || group.name === "\\oiiint") { + // No font glyphs yet, so use a glyph w/o the oval. + // TODO: When font glyphs are available, delete this code. + stash = group.name.substr(1); // $FlowFixMe + + group.name = stash === "oiint" ? "\\iint" : "\\iiint"; + } + + base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); + + if (stash.length > 0) { + // We're in \oiint or \oiiint. Overlay the oval. + // TODO: When font glyphs are available, delete this code. + var italic = base.italic; + var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); + base = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: base, + shift: 0 + }, { + type: "elem", + elem: oval, + shift: large ? 0.08 : 0 + }] + }, options); // $FlowFixMe + + group.name = "\\" + stash; + base.classes.unshift("mop"); // $FlowFixMe + + base.italic = italic; + } + } else if (group.body) { + // If this is a list, compose that list. + var inner = buildHTML_buildExpression(group.body, options, true); + + if (inner.length === 1 && inner[0] instanceof domTree_SymbolNode) { + base = inner[0]; + base.classes[0] = "mop"; // replace old mclass + } else { + base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); + } + } else { + // Otherwise, this is a text operator. Build the text from the + // operator's name. + // TODO(emily): Add a space in the middle of some of these + // operators, like \limsup + var output = []; + + for (var i = 1; i < group.name.length; i++) { + output.push(buildCommon.mathsym(group.name[i], group.mode)); + } + + base = buildCommon.makeSpan(["mop"], output, options); + } // If content of op is a single symbol, shift it vertically. + + + var baseShift = 0; + var slant = 0; + + if ((base instanceof domTree_SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { + // We suppress the shift of the base of \overset and \underset. Otherwise, + // shift the symbol so its center lies on the axis (rule 13). It + // appears that our fonts have the centers of the symbols already + // almost on the axis, so these numbers are very small. Note we + // don't actually apply this here, but instead it is used either in + // the vlist creation or separately when there are no limits. + baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction. + // $FlowFixMe + + slant = base.italic; + } + + if (hasLimits) { + // IE 8 clips \int if it is in a display: inline-block. We wrap it + // in a new span so it is an inline, and works. + base = buildCommon.makeSpan([], [base]); + var sub; + var sup; // We manually have to handle the superscripts and subscripts. This, + // aside from the kern calculations, is copied from supsub. + + if (supGroup) { + var elem = buildHTML_buildGroup(supGroup, options.havingStyle(style.sup()), options); + sup = { + elem: elem, + kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) + }; + } + + if (subGroup) { + var _elem = buildHTML_buildGroup(subGroup, options.havingStyle(style.sub()), options); + + sub = { + elem: _elem, + kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height) + }; + } // Build the final group as a vlist of the possible subscript, base, + // and possible superscript. + + + var finalGroup; + + if (sup && sub) { + var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; + finalGroup = buildCommon.makeVList({ + positionType: "bottom", + positionData: bottom, + children: [{ + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: sub.elem, + marginLeft: -slant + "em" + }, { + type: "kern", + size: sub.kern + }, { + type: "elem", + elem: base + }, { + type: "kern", + size: sup.kern + }, { + type: "elem", + elem: sup.elem, + marginLeft: slant + "em" + }, { + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }] + }, options); + } else if (sub) { + var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note + // that we are supposed to shift the limits by 1/2 of the slant, + // but since we are centering the limits adding a full slant of + // margin will shift by 1/2 that. + + finalGroup = buildCommon.makeVList({ + positionType: "top", + positionData: top, + children: [{ + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: sub.elem, + marginLeft: -slant + "em" + }, { + type: "kern", + size: sub.kern + }, { + type: "elem", + elem: base + }] + }, options); + } else if (sup) { + var _bottom = base.depth + baseShift; + + finalGroup = buildCommon.makeVList({ + positionType: "bottom", + positionData: _bottom, + children: [{ + type: "elem", + elem: base + }, { + type: "kern", + size: sup.kern + }, { + type: "elem", + elem: sup.elem, + marginLeft: slant + "em" + }, { + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }] + }, options); + } else { + // This case probably shouldn't occur (this would mean the + // supsub was sending us a group with no superscript or + // subscript) but be safe. + return base; + } + + return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options); + } else { + if (baseShift) { + base.style.position = "relative"; + base.style.top = baseShift + "em"; + } + + return base; + } +}; + +var op_mathmlBuilder = function mathmlBuilder(group, options) { + var node; // TODO(emily): handle big operators using the `largeop` attribute + + if (group.symbol) { + // This is a symbol. Just add the symbol. + node = new mathMLTree_MathNode("mo", [buildMathML_makeText(group.name, group.mode)]); + } else if (group.body) { + // This is an operator with children. Add them. + node = new mathMLTree_MathNode("mo", buildMathML_buildExpression(group.body, options)); + } else { + // This is a text operator. Add all of the characters from the + // operator's name. + // TODO(emily): Add a space in the middle of some of these + // operators, like \limsup. + node = new mathMLTree_MathNode("mi", [new mathMLTree_TextNode(group.name.slice(1))]); // Append an . + // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 + + var operator = new mathMLTree_MathNode("mo", [buildMathML_makeText("\u2061", "text")]); + return newDocumentFragment([node, operator]); + } + + return node; +}; + +var singleCharBigOps = { + "\u220F": "\\prod", + "\u2210": "\\coprod", + "\u2211": "\\sum", + "\u22C0": "\\bigwedge", + "\u22C1": "\\bigvee", + "\u22C2": "\\bigcap", + "\u22C3": "\\bigcap", + "\u2A00": "\\bigodot", + "\u2A01": "\\bigoplus", + "\u2A02": "\\bigotimes", + "\u2A04": "\\biguplus", + "\u2A06": "\\bigsqcup" +}; +defineFunction({ + type: "op", + names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"], + props: { + numArgs: 0 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var fName = funcName; + + if (fName.length === 1) { + fName = singleCharBigOps[fName]; + } + + return { + type: "op", + mode: parser.mode, + limits: true, + symbol: true, + name: fName + }; + }, + htmlBuilder: op_htmlBuilder, + mathmlBuilder: op_mathmlBuilder +}); // Note: calling defineFunction with a type that's already been defined only +// works because the same htmlBuilder and mathmlBuilder are being used. + +defineFunction({ + type: "op", + names: ["\\mathop"], + props: { + numArgs: 1 + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var body = args[0]; + return { + type: "op", + mode: parser.mode, + limits: false, + symbol: false, + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: op_htmlBuilder, + mathmlBuilder: op_mathmlBuilder +}); // There are 2 flags for operators; whether they produce limits in +// displaystyle, and whether they are symbols and should grow in +// displaystyle. These four groups cover the four possible choices. + +var singleCharIntegrals = { + "\u222B": "\\int", + "\u222C": "\\iint", + "\u222D": "\\iiint", + "\u222E": "\\oint", + "\u222F": "\\oiint", + "\u2230": "\\oiiint" +}; // No limits, not symbols + +defineFunction({ + type: "op", + names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], + props: { + numArgs: 0 + }, + handler: function handler(_ref3) { + var parser = _ref3.parser, + funcName = _ref3.funcName; + return { + type: "op", + mode: parser.mode, + limits: false, + symbol: false, + name: funcName + }; + }, + htmlBuilder: op_htmlBuilder, + mathmlBuilder: op_mathmlBuilder +}); // Limits, not symbols + +defineFunction({ + type: "op", + names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], + props: { + numArgs: 0 + }, + handler: function handler(_ref4) { + var parser = _ref4.parser, + funcName = _ref4.funcName; + return { + type: "op", + mode: parser.mode, + limits: true, + symbol: false, + name: funcName + }; + }, + htmlBuilder: op_htmlBuilder, + mathmlBuilder: op_mathmlBuilder +}); // No limits, symbols + +defineFunction({ + type: "op", + names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"], + props: { + numArgs: 0 + }, + handler: function handler(_ref5) { + var parser = _ref5.parser, + funcName = _ref5.funcName; + var fName = funcName; + + if (fName.length === 1) { + fName = singleCharIntegrals[fName]; + } + + return { + type: "op", + mode: parser.mode, + limits: false, + symbol: true, + name: fName + }; + }, + htmlBuilder: op_htmlBuilder, + mathmlBuilder: op_mathmlBuilder +}); +// CONCATENATED MODULE: ./src/functions/operatorname.js + + + + + + // \operatorname +// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ + +defineFunction({ + type: "operatorname", + names: ["\\operatorname"], + props: { + numArgs: 1 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[0]; + return { + type: "operatorname", + mode: parser.mode, + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + if (group.body.length > 0) { + var body = group.body.map(function (child) { + // $FlowFixMe: Check if the node has a string `text` property. + var childText = child.text; + + if (typeof childText === "string") { + return { + type: "textord", + mode: child.mode, + text: childText + }; + } else { + return child; + } + }); // Consolidate function names into symbol characters. + + var expression = buildHTML_buildExpression(body, options.withFont("mathrm"), true); + + for (var i = 0; i < expression.length; i++) { + var child = expression[i]; + + if (child instanceof domTree_SymbolNode) { + // Per amsopn package, + // change minus to hyphen and \ast to asterisk + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } + } + + return buildCommon.makeSpan(["mop"], expression, options); + } else { + return buildCommon.makeSpan(["mop"], [], options); + } + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // The steps taken here are similar to the html version. + var expression = buildMathML_buildExpression(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? + + var isAllString = true; // default + + for (var i = 0; i < expression.length; i++) { + var node = expression[i]; + + if (node instanceof mathMLTree.SpaceNode) {// Do nothing + } else if (node instanceof mathMLTree.MathNode) { + switch (node.type) { + case "mi": + case "mn": + case "ms": + case "mspace": + case "mtext": + break; + // Do nothing yet. + + case "mo": + { + var child = node.children[0]; + + if (node.children.length === 1 && child instanceof mathMLTree.TextNode) { + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } else { + isAllString = false; + } + + break; + } + + default: + isAllString = false; + } + } else { + isAllString = false; + } + } + + if (isAllString) { + // Write a single TextNode instead of multiple nested tags. + var word = expression.map(function (node) { + return node.toText(); + }).join(""); // word has already been escaped by `node.toText()` + + expression = [new mathMLTree.TextNode(word, false)]; + } + + var identifier = new mathMLTree.MathNode("mi", expression); + identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ + // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp + + var operator = new mathMLTree.MathNode("mo", [buildMathML_makeText("\u2061", "text")]); + return mathMLTree.newDocumentFragment([identifier, operator]); + } +}); +// CONCATENATED MODULE: ./src/functions/ordgroup.js + + + + +defineFunctionBuilders({ + type: "ordgroup", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeSpan(["mord"], buildHTML_buildExpression(group.body, options, true), options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return buildExpressionRow(group.body, options); + } +}); +// CONCATENATED MODULE: ./src/functions/overline.js + + + + + +defineFunction({ + type: "overline", + names: ["\\overline"], + props: { + numArgs: 1 + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[0]; + return { + type: "overline", + mode: parser.mode, + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Overlines are handled in the TeXbook pg 443, Rule 9. + // Build the inner group in the cramped style. + var innerGroup = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body + + var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns + + var vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: innerGroup + }, { + type: "kern", + size: 3 * line.height + }, { + type: "elem", + elem: line + }, { + type: "kern", + size: line.height + }] + }, options); + return buildCommon.makeSpan(["mord", "overline"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); + operator.setAttribute("stretchy", "true"); + var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]); + node.setAttribute("accent", "true"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/phantom.js + + + + + +defineFunction({ + type: "phantom", + names: ["\\phantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[0]; + return { + type: "phantom", + mode: parser.mode, + body: defineFunction_ordargument(body) + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildHTML_buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. + // See "color" for more details. + + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = buildMathML_buildExpression(group.body, options); + return new mathMLTree.MathNode("mphantom", inner); + } +}); +defineFunction({ + type: "hphantom", + names: ["\\hphantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var body = args[0]; + return { + type: "hphantom", + mode: parser.mode, + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options.withPhantom())]); + node.height = 0; + node.depth = 0; + + if (node.children) { + for (var i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + node.children[i].depth = 0; + } + } // See smash for comment re: use of makeVList + + + node = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node + }] + }, options); + return node; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options); + var node = new mathMLTree.MathNode("mphantom", inner); + node.setAttribute("height", "0px"); + return node; + } +}); +defineFunction({ + type: "vphantom", + names: ["\\vphantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser; + var body = args[0]; + return { + type: "vphantom", + mode: parser.mode, + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options.withPhantom())]); + var fix = buildCommon.makeSpan(["fix"], []); + return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options); + var node = new mathMLTree.MathNode("mphantom", inner); + node.setAttribute("width", "0px"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/sizing.js + + + + + +function sizingGroup(value, options, baseOptions) { + var inner = buildHTML_buildExpression(value, options, false); + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize + // manually. Handle nested size changes. + + for (var i = 0; i < inner.length; i++) { + var pos = inner[i].classes.indexOf("sizing"); + + if (pos < 0) { + Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); + } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { + // This is a nested size change: e.g., inner[i] is the "b" in + // `\Huge a \small b`. Override the old size (the `reset-` class) + // but not the new size. + inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; + } + + inner[i].height *= multiplier; + inner[i].depth *= multiplier; + } + + return buildCommon.makeFragment(inner); +} +var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; +var sizing_htmlBuilder = function htmlBuilder(group, options) { + // Handle sizing operators like \Huge. Real TeX doesn't actually allow + // these functions inside of math expressions, so we do some special + // handling. + var newOptions = options.havingSize(group.size); + return sizingGroup(group.body, newOptions, options); +}; +defineFunction({ + type: "sizing", + names: sizeFuncs, + props: { + numArgs: 0, + allowedInText: true + }, + handler: function handler(_ref, args) { + var breakOnTokenText = _ref.breakOnTokenText, + funcName = _ref.funcName, + parser = _ref.parser; + parser.consumeSpaces(); + var body = parser.parseExpression(false, breakOnTokenText); + return { + type: "sizing", + mode: parser.mode, + // Figure out what size to use based on the list of functions above + size: sizeFuncs.indexOf(funcName) + 1, + body: body + }; + }, + htmlBuilder: sizing_htmlBuilder, + mathmlBuilder: function mathmlBuilder(group, options) { + var newOptions = options.havingSize(group.size); + var inner = buildMathML_buildExpression(group.body, newOptions); + var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size + // changes, because we don't keep state of what style we're currently + // in, so we can't reset the size to normal before changing it. Now + // that we're passing an options parameter we should be able to fix + // this. + + node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/raisebox.js + + + + + + + // Box manipulation + +defineFunction({ + type: "raisebox", + names: ["\\raisebox"], + props: { + numArgs: 2, + argTypes: ["size", "text"], + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var amount = assertNodeType(args[0], "size").value; + var body = args[1]; + return { + type: "raisebox", + mode: parser.mode, + dy: amount, + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var text = { + type: "text", + mode: group.mode, + body: defineFunction_ordargument(group.body), + font: "mathrm" // simulate \textrm + + }; + var sizedText = { + type: "sizing", + mode: group.mode, + body: [text], + size: 6 // simulate \normalsize + + }; + var body = sizing_htmlBuilder(sizedText, options); + var dy = units_calculateSize(group.dy, options); + return buildCommon.makeVList({ + positionType: "shift", + positionData: -dy, + children: [{ + type: "elem", + elem: body + }] + }, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); + var dy = group.dy.number + group.dy.unit; + node.setAttribute("voffset", dy); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/rule.js + + + + + +defineFunction({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + argTypes: ["size", "size", "size"] + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var shift = optArgs[0]; + var width = assertNodeType(args[0], "size"); + var height = assertNodeType(args[1], "size"); + return { + type: "rule", + mode: parser.mode, + shift: shift && assertNodeType(shift, "size").value, + width: width.value, + height: height.value + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Make an empty span for the rule + var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units + + var shift = 0; + + if (group.shift) { + shift = units_calculateSize(group.shift, options); + } + + var width = units_calculateSize(group.width, options); + var height = units_calculateSize(group.height, options); // Style the rule to the right size + + rule.style.borderRightWidth = width + "em"; + rule.style.borderTopWidth = height + "em"; + rule.style.bottom = shift + "em"; // Record the height and width + + rule.width = width; + rule.height = height + shift; + rule.depth = -shift; // Font size is the number large enough that the browser will + // reserve at least `absHeight` space above the baseline. + // The 1.125 factor was empirically determined + + rule.maxFontSize = height * 1.125 * options.sizeMultiplier; + return rule; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // TODO(emily): Figure out if there's an actual way to draw black boxes + // in MathML. + var node = new mathMLTree.MathNode("mrow"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/smash.js +// smash, with optional [tb], as in AMS + + + + + + +defineFunction({ + type: "smash", + names: ["\\smash"], + props: { + numArgs: 1, + numOptionalArgs: 1, + allowedInText: true + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var smashHeight = false; + var smashDepth = false; + var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); + + if (tbArg) { + // Optional [tb] argument is engaged. + // ref: amsmath: \renewcommand{\smash}[1][tb]{% + // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + var letter = ""; + + for (var i = 0; i < tbArg.body.length; ++i) { + var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. + + letter = node.text; + + if (letter === "t") { + smashHeight = true; + } else if (letter === "b") { + smashDepth = true; + } else { + smashHeight = false; + smashDepth = false; + break; + } + } + } else { + smashHeight = true; + smashDepth = true; + } + + var body = args[0]; + return { + type: "smash", + mode: parser.mode, + body: body, + smashHeight: smashHeight, + smashDepth: smashDepth + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var node = buildCommon.makeSpan(["mord"], [buildHTML_buildGroup(group.body, options)]); + + if (!group.smashHeight && !group.smashDepth) { + return node; + } + + if (group.smashHeight) { + node.height = 0; // In order to influence makeVList, we have to reset the children. + + if (node.children) { + for (var i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + } + } + } + + if (group.smashDepth) { + node.depth = 0; + + if (node.children) { + for (var _i = 0; _i < node.children.length; _i++) { + node.children[_i].depth = 0; + } + } + } // At this point, we've reset the TeX-like height and depth values. + // But the span still has an HTML line height. + // makeVList applies "display: table-cell", which prevents the browser + // from acting on that line height. So we'll call makeVList now. + + + return buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node + }] + }, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]); + + if (group.smashHeight) { + node.setAttribute("height", "0px"); + } + + if (group.smashDepth) { + node.setAttribute("depth", "0px"); } return node; + } +}); +// CONCATENATED MODULE: ./src/functions/sqrt.js + + + + + + + +defineFunction({ + type: "sqrt", + names: ["\\sqrt"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var index = optArgs[0]; + var body = args[0]; + return { + type: "sqrt", + mode: parser.mode, + body: body, + index: index + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Square roots are handled in the TeXbook pg. 443, Rule 11. + // First, we do the same steps as in overline to build the inner group + // and line + var inner = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); + + if (inner.height === 0) { + // Render a small surd. + inner.height = options.fontMetrics().xHeight; + } // Some groups can return document fragments. Handle those by wrapping + // them in a span. + + + inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter + + var metrics = options.fontMetrics(); + var theta = metrics.defaultRuleThickness; + var phi = theta; + + if (options.style.id < src_Style.TEXT.id) { + phi = options.fontMetrics().xHeight; + } // Calculate the clearance between the body and line + + + var lineClearance = theta + phi / 4; + var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size + + var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options), + img = _delimiter$sqrtImage.span, + ruleWidth = _delimiter$sqrtImage.ruleWidth, + advanceWidth = _delimiter$sqrtImage.advanceWidth; + + var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size + + if (delimDepth > inner.height + inner.depth + lineClearance) { + lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; + } // Shift the sqrt image + + + var imgShift = img.height - inner.height - lineClearance - ruleWidth; + inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument. + + var body = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: inner, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: -(inner.height + imgShift) + }, { + type: "elem", + elem: img + }, { + type: "kern", + size: ruleWidth + }] + }, options); + + if (!group.index) { + return buildCommon.makeSpan(["mord", "sqrt"], [body], options); + } else { + // Handle the optional root index + // The index is always in scriptscript style + var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT); + var rootm = buildHTML_buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX + // source, in the definition of `\r@@t`. + + var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly + + var rootVList = buildCommon.makeVList({ + positionType: "shift", + positionData: -toShift, + children: [{ + type: "elem", + elem: rootm + }] + }, options); // Add a class surrounding it so we can add on the appropriate + // kerning + + var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); + return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); + } + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var body = group.body, + index = group.index; + return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]); + } +}); +// CONCATENATED MODULE: ./src/functions/styling.js + + + + + +var styling_styleMap = { + "display": src_Style.DISPLAY, + "text": src_Style.TEXT, + "script": src_Style.SCRIPT, + "scriptscript": src_Style.SCRIPTSCRIPT }; +defineFunction({ + type: "styling", + names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], + props: { + numArgs: 0, + allowedInText: true + }, + handler: function handler(_ref, args) { + var breakOnTokenText = _ref.breakOnTokenText, + funcName = _ref.funcName, + parser = _ref.parser; + // parse out the implicit body + parser.consumeSpaces(); + var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. + // here and in buildHTML and de-dupe the enumeration of all the styles). + // $FlowFixMe: The names above exactly match the styles. + + var style = funcName.slice(1, funcName.length - 5); + return { + type: "styling", + mode: parser.mode, + // Figure out what style to use by pulling out the style from + // the function name + style: style, + body: body + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Style changes are handled in the TeXbook on pg. 442, Rule 3. + var newStyle = styling_styleMap[group.style]; + var newOptions = options.havingStyle(newStyle).withFont(''); + return sizingGroup(group.body, newOptions, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // Figure out what style we're changing to. + // TODO(kevinb): dedupe this with buildHTML.js + // This will be easier of handling of styling nodes is in the same file. + var styleMap = { + "display": src_Style.DISPLAY, + "text": src_Style.TEXT, + "script": src_Style.SCRIPT, + "scriptscript": src_Style.SCRIPTSCRIPT + }; + var newStyle = styleMap[group.style]; + var newOptions = options.havingStyle(newStyle); + var inner = buildMathML_buildExpression(group.body, newOptions); + var node = new mathMLTree.MathNode("mstyle", inner); + var styleAttributes = { + "display": ["0", "true"], + "text": ["0", "false"], + "script": ["1", "false"], + "scriptscript": ["2", "false"] + }; + var attr = styleAttributes[group.style]; + node.setAttribute("scriptlevel", attr[0]); + node.setAttribute("displaystyle", attr[1]); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/supsub.js + + + + + + + + + + + + /** - * Converts the math node into an HTML markup string. + * Sometimes, groups perform special rules when they have superscripts or + * subscripts attached to them. This function lets the `supsub` group know that + * Sometimes, groups perform special rules when they have superscripts or + * its inner element should handle the superscripts and subscripts instead of + * handling them itself. */ -MathNode.prototype.toMarkup = function() { - var markup = "<" + this.type; +var supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { + var base = group.base; - // Add the attributes - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - markup += " " + attr + "=\""; - markup += utils.escape(this.attributes[attr]); - markup += "\""; + if (!base) { + return null; + } else if (base.type === "op") { + // Operators handle supsubs differently when they have limits + // (e.g. `\displaystyle\sum_2^3`) + var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub); + return delegate ? op_htmlBuilder : null; + } else if (base.type === "accent") { + return utils.isCharacterBox(base.base) ? accent_htmlBuilder : null; + } else if (base.type === "horizBrace") { + var isSup = !group.sub; + return isSup === base.isOver ? horizBrace_htmlBuilder : null; + } else { + return null; + } +}; // Super scripts and subscripts, whose precise placement can depend on other +// functions that precede them. + + +defineFunctionBuilders({ + type: "supsub", + htmlBuilder: function htmlBuilder(group, options) { + // Superscript and subscripts are handled in the TeXbook on page + // 445-446, rules 18(a-f). + // Here is where we defer to the inner group if it should handle + // superscripts and subscripts itself. + var builderDelegate = supsub_htmlBuilderDelegate(group, options); + + if (builderDelegate) { + return builderDelegate(group, options); + } + + var valueBase = group.base, + valueSup = group.sup, + valueSub = group.sub; + var base = buildHTML_buildGroup(valueBase, options); + var supm; + var subm; + var metrics = options.fontMetrics(); // Rule 18a + + var supShift = 0; + var subShift = 0; + var isCharacterBox = valueBase && utils.isCharacterBox(valueBase); + + if (valueSup) { + var newOptions = options.havingStyle(options.style.sup()); + supm = buildHTML_buildGroup(valueSup, newOptions, options); + + if (!isCharacterBox) { + supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; + } + } + + if (valueSub) { + var _newOptions = options.havingStyle(options.style.sub()); + + subm = buildHTML_buildGroup(valueSub, _newOptions, options); + + if (!isCharacterBox) { + subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier; + } + } // Rule 18c + + + var minSupShift; + + if (options.style === src_Style.DISPLAY) { + minSupShift = metrics.sup1; + } else if (options.style.cramped) { + minSupShift = metrics.sup3; + } else { + minSupShift = metrics.sup2; + } // scriptspace is a font-size-independent size, so scale it + // appropriately for use as the marginRight. + + + var multiplier = options.sizeMultiplier; + var marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; + var marginLeft = null; + + if (subm) { + // Subscripts shouldn't be shifted by the base's italic correction. + // Account for that by shifting the subscript back the appropriate + // amount. Note we only do this when the base is a single symbol. + var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); + + if (base instanceof domTree_SymbolNode || isOiint) { + // $FlowFixMe + marginLeft = -base.italic + "em"; + } + } + + var supsub; + + if (supm && subm) { + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + subShift = Math.max(subShift, metrics.sub2); + var ruleWidth = metrics.defaultRuleThickness; // Rule 18e + + var maxWidth = 4 * ruleWidth; + + if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { + subShift = maxWidth - (supShift - supm.depth) + subm.height; + var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); + + if (psi > 0) { + supShift += psi; + subShift -= psi; } + } + + var vlistElem = [{ + type: "elem", + elem: subm, + shift: subShift, + marginRight: marginRight, + marginLeft: marginLeft + }, { + type: "elem", + elem: supm, + shift: -supShift, + marginRight: marginRight + }]; + supsub = buildCommon.makeVList({ + positionType: "individualShift", + children: vlistElem + }, options); + } else if (subm) { + // Rule 18b + subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); + var _vlistElem = [{ + type: "elem", + elem: subm, + marginLeft: marginLeft, + marginRight: marginRight + }]; + supsub = buildCommon.makeVList({ + positionType: "shift", + positionData: subShift, + children: _vlistElem + }, options); + } else if (supm) { + // Rule 18c, d + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + supsub = buildCommon.makeVList({ + positionType: "shift", + positionData: -supShift, + children: [{ + type: "elem", + elem: supm, + marginRight: marginRight + }] + }, options); + } else { + throw new Error("supsub must have either sup or sub."); + } // Wrap the supsub vlist in a span.msupsub to reset text-align. + + + var mclass = getTypeOfDomTree(base, "right") || "mord"; + return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + // Is the inner group a relevant horizonal brace? + var isBrace = false; + var isOver; + var isSup; + var horizBrace = checkNodeType(group.base, "horizBrace"); + + if (horizBrace) { + isSup = !!group.sup; + + if (isSup === horizBrace.isOver) { + isBrace = true; + isOver = horizBrace.isOver; + } } - markup += ">"; + var children = [buildMathML_buildGroup(group.base, options)]; - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); + if (group.sub) { + children.push(buildMathML_buildGroup(group.sub, options)); } - markup += ""; + if (group.sup) { + children.push(buildMathML_buildGroup(group.sup, options)); + } - return markup; + var nodeType; + + if (isBrace) { + nodeType = isOver ? "mover" : "munder"; + } else if (!group.sub) { + var base = group.base; + + if (base && base.type === "op" && base.limits && options.style === src_Style.DISPLAY) { + nodeType = "mover"; + } else { + nodeType = "msup"; + } + } else if (!group.sup) { + var _base = group.base; + + if (_base && _base.type === "op" && _base.limits && options.style === src_Style.DISPLAY) { + nodeType = "munder"; + } else { + nodeType = "msub"; + } + } else { + var _base2 = group.base; + + if (_base2 && _base2.type === "op" && _base2.limits && options.style === src_Style.DISPLAY) { + nodeType = "munderover"; + } else { + nodeType = "msubsup"; + } + } + + var node = new mathMLTree.MathNode(nodeType, children); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/symbolsOp.js + + + + // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js. + +defineFunctionBuilders({ + type: "atom", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.text, group.mode)]); + + if (group.family === "bin") { + var variant = buildMathML_getVariant(group, options); + + if (variant === "bold-italic") { + node.setAttribute("mathvariant", variant); + } + } else if (group.family === "punct") { + node.setAttribute("separator", "true"); + } + + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/symbolsOrd.js + + + + +// "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in +var defaultVariant = { + "mi": "italic", + "mn": "normal", + "mtext": "normal" +}; +defineFunctionBuilders({ + type: "mathord", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeOrd(group, options, "mathord"); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mi", [buildMathML_makeText(group.text, group.mode, options)]); + var variant = buildMathML_getVariant(group, options) || "italic"; + + if (variant !== defaultVariant[node.type]) { + node.setAttribute("mathvariant", variant); + } + + return node; + } +}); +defineFunctionBuilders({ + type: "textord", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeOrd(group, options, "textord"); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var text = buildMathML_makeText(group.text, group.mode, options); + var variant = buildMathML_getVariant(group, options) || "normal"; + var node; + + if (group.mode === 'text') { + node = new mathMLTree.MathNode("mtext", [text]); + } else if (/[0-9]/.test(group.text)) { + // TODO(kevinb) merge adjacent nodes + // do it as a post processing step + node = new mathMLTree.MathNode("mn", [text]); + } else if (group.text === "\\prime") { + node = new mathMLTree.MathNode("mo", [text]); + } else { + node = new mathMLTree.MathNode("mi", [text]); + } + + if (variant !== defaultVariant[node.type]) { + node.setAttribute("mathvariant", variant); + } + + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js + + + + // A map of CSS-based spacing functions to their CSS class. + +var cssSpace = { + "\\nobreak": "nobreak", + "\\allowbreak": "allowbreak" +}; // A lookup table to determine whether a spacing function/symbol should be +// treated like a regular space character. If a symbol or command is a key +// in this table, then it should be a regular space character. Furthermore, +// the associated value may have a `className` specifying an extra CSS class +// to add to the created `span`. + +var regularSpace = { + " ": {}, + "\\ ": {}, + "~": { + className: "nobreak" + }, + "\\space": {}, + "\\nobreakspace": { + className: "nobreak" + } +}; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in +// src/symbols.js. + +defineFunctionBuilders({ + type: "spacing", + htmlBuilder: function htmlBuilder(group, options) { + if (regularSpace.hasOwnProperty(group.text)) { + var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these + // things has an entry in the symbols table, so these will be turned + // into appropriate outputs. + + if (group.mode === "text") { + var ord = buildCommon.makeOrd(group, options, "textord"); + ord.classes.push(className); + return ord; + } else { + return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options); + } + } else if (cssSpace.hasOwnProperty(group.text)) { + // Spaces based on just a CSS class. + return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options); + } else { + throw new src_ParseError("Unknown type of space \"" + group.text + "\""); + } + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node; + + if (regularSpace.hasOwnProperty(group.text)) { + node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]); + } else if (cssSpace.hasOwnProperty(group.text)) { + // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored + return new mathMLTree.MathNode("mspace"); + } else { + throw new src_ParseError("Unknown type of space \"" + group.text + "\""); + } + + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/tag.js + + + +defineFunctionBuilders({ + type: "tag", + mathmlBuilder: function mathmlBuilder(group, options) { + var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mlabeledtr", [new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)]), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)])])]); + table.setAttribute("side", "right"); + return table; + } +}); +// CONCATENATED MODULE: ./src/functions/text.js + + + + // Non-mathy text, possibly in a font + +var textFontFamilies = { + "\\text": undefined, + "\\textrm": "textrm", + "\\textsf": "textsf", + "\\texttt": "texttt", + "\\textnormal": "textrm" +}; +var textFontWeights = { + "\\textbf": "textbf" +}; +var textFontShapes = { + "\\textit": "textit" }; -/** - * This node represents a piece of text. - */ -function TextNode(text) { - this.text = text; -} +var optionsWithFont = function optionsWithFont(group, options) { + var font = group.font; // Checks if the argument is a font family or a font style. -/** - * Converts the text node into a DOM text node. - */ -TextNode.prototype.toNode = function() { - return document.createTextNode(this.text); + if (!font) { + return options; + } else if (textFontFamilies[font]) { + return options.withTextFontFamily(textFontFamilies[font]); + } else if (textFontWeights[font]) { + return options.withTextFontWeight(textFontWeights[font]); + } else { + return options.withTextFontShape(textFontShapes[font]); + } }; -/** - * Converts the text node into HTML markup (which is just the text itself). - */ -TextNode.prototype.toMarkup = function() { - return utils.escape(this.text); -}; +defineFunction({ + type: "text", + names: [// Font families + "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights + "\\textbf", // Font Shapes + "\\textit"], + props: { + numArgs: 1, + argTypes: ["text"], + greediness: 2, + allowedInText: true, + consumeMode: "text" + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "text", + mode: parser.mode, + body: defineFunction_ordargument(body), + font: funcName + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var newOptions = optionsWithFont(group, options); + var inner = buildHTML_buildExpression(group.body, newOptions, true); + return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var newOptions = optionsWithFont(group, options); + return buildExpressionRow(group.body, newOptions); + } +}); +// CONCATENATED MODULE: ./src/functions/underline.js -module.exports = { - MathNode: MathNode, - TextNode: TextNode -}; -},{"./utils":25}],21:[function(require,module,exports){ + + + +defineFunction({ + type: "underline", + names: ["\\underline"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "underline", + mode: parser.mode, + body: args[0] + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + // Underlines are handled in the TeXbook pg 443, Rule 10. + // Build the inner group. + var innerGroup = buildHTML_buildGroup(group.body, options); // Create the line to go below the body + + var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns + + var vlist = buildCommon.makeVList({ + positionType: "top", + positionData: innerGroup.height, + children: [{ + type: "kern", + size: line.height + }, { + type: "elem", + elem: line + }, { + type: "kern", + size: 3 * line.height + }, { + type: "elem", + elem: innerGroup + }] + }, options); + return buildCommon.makeSpan(["mord", "underline"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); + operator.setAttribute("stretchy", "true"); + var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]); + node.setAttribute("accentunder", "true"); + return node; + } +}); +// CONCATENATED MODULE: ./src/functions/verb.js + + + + +defineFunction({ + type: "verb", + names: ["\\verb"], + props: { + numArgs: 0, + allowedInText: true + }, + handler: function handler(context, args, optArgs) { + // \verb and \verb* are dealt with directly in Parser.js. + // If we end up here, it's because of a failure to match the two delimiters + // in the regex in Lexer.js. LaTeX raises the following error when \verb is + // terminated by end of line (or file). + throw new src_ParseError("\\verb ended by end of line instead of matching delimiter"); + }, + htmlBuilder: function htmlBuilder(group, options) { + var text = makeVerb(group); + var body = []; // \verb enters text mode and therefore is sized like \textstyle + + var newOptions = options.havingStyle(options.style.text()); + + for (var i = 0; i < text.length; i++) { + var c = text[i]; + + if (c === '~') { + c = '\\textasciitilde'; + } + + body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"])); + } + + return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var text = new mathMLTree.TextNode(makeVerb(group)); + var node = new mathMLTree.MathNode("mtext", [text]); + node.setAttribute("mathvariant", "monospace"); + return node; + } +}); /** - * The resulting parse tree nodes of the parse tree. + * Converts verb group into body string. * - * It is possible to provide position information, so that a ParseNode can - * fulfil a role similar to a Token in error reporting. - * For details on the corresponding properties see Token constructor. - * Providing such information can lead to better error reporting. - * - * @param {string} type type of node, like e.g. "ordgroup" - * @param {?object} value type-specific representation of the node - * @param {string} mode parse mode in action for this node, - * "math" or "text" - * @param {Token=} firstToken first token of the input for this node, - * will omit position information if unset - * @param {Token=} lastToken last token of the input for this node, - * will default to firstToken if unset + * \verb* replaces each space with an open box \u2423 + * \verb replaces each space with a no-break space \xA0 */ -function ParseNode(type, value, mode, firstToken, lastToken) { - this.type = type; - this.value = value; + +var makeVerb = function makeVerb(group) { + return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0'); +}; +// CONCATENATED MODULE: ./src/functions.js +/** Include this to ensure that all functions are defined. */ + +var functions = _functions; +/* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with +// that object in this file instead of relying on side-effects. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// CONCATENATED MODULE: ./src/Lexer.js +/** + * The Lexer class handles tokenizing the input in various ways. Since our + * parser expects us to be able to backtrack, the lexer allows lexing from any + * given starting point. + * + * Its main exposed function is the `lex` function, which takes a position to + * lex from and a type of token to lex. It defers to the appropriate `_innerLex` + * function. + * + * The various `_innerLex` functions perform the actual lexing of different + * kinds. + */ + + + + +/* The following tokenRegex + * - matches typical whitespace (but not NBSP etc.) using its first group + * - does not match any control character \x00-\x1f except whitespace + * - does not match a bare backslash + * - matches any ASCII character except those just mentioned + * - does not match the BMP private use area \uE000-\uF8FF + * - does not match bare surrogate code units + * - matches any BMP character except for those just described + * - matches any valid Unicode surrogate pair + * - matches a backslash followed by one or more letters + * - matches a backslash followed by any BMP character, including newline + * Just because the Lexer matches something doesn't mean it's valid input: + * If there is no matching function or symbol definition, the Parser will + * still reject the input. + */ +var spaceRegexString = "[ \r\n\t]"; +var controlWordRegexString = "\\\\[a-zA-Z@]+"; +var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; +var controlWordWhitespaceRegexString = "" + controlWordRegexString + spaceRegexString + "*"; +var controlWordWhitespaceRegex = new RegExp("^(" + controlWordRegexString + ")" + spaceRegexString + "*$"); +var combiningDiacriticalMarkString = "[\u0300-\u036F]"; +var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"); +var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace +"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint +combiningDiacriticalMarkString + "*") + // ...plus accents +"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair +combiningDiacriticalMarkString + "*") + // ...plus accents +"|\\\\verb\\*([^]).*?\\3" + // \verb* +"|\\\\verb([^*a-zA-Z]).*?\\4" + ( // \verb unstarred +"|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces +"|" + controlSymbolRegexString + ")"); // \\, \', etc. +// These regexs are for matching results from tokenRegex, +// so they do have ^ markers. + +var controlWordRegex = new RegExp("^" + controlWordRegexString); +/** Main Lexer class */ + +var Lexer_Lexer = +/*#__PURE__*/ +function () { + function Lexer(input) { + this.input = void 0; + this.tokenRegex = void 0; + // Separate accents from characters + this.input = input; + this.tokenRegex = new RegExp(tokenRegexString, 'g'); + } + /** + * This function lexes a single token. + */ + + + var _proto = Lexer.prototype; + + _proto.lex = function lex() { + var input = this.input; + var pos = this.tokenRegex.lastIndex; + + if (pos === input.length) { + return new Token_Token("EOF", new SourceLocation(this, pos, pos)); + } + + var match = this.tokenRegex.exec(input); + + if (match === null || match.index !== pos) { + throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1))); + } + + var text = match[2] || " "; // Trim any trailing whitespace from control word match + + var controlMatch = text.match(controlWordWhitespaceRegex); + + if (controlMatch) { + text = controlMatch[1]; + } + + return new Token_Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); + }; + + return Lexer; +}(); + + +// CONCATENATED MODULE: ./src/Namespace.js +/** + * A `Namespace` refers to a space of nameable things like macros or lengths, + * which can be `set` either globally or local to a nested group, using an + * undo stack similar to how TeX implements this functionality. + * Performance-wise, `get` and local `set` take constant time, while global + * `set` takes time proportional to the depth of group nesting. + */ + + +var Namespace_Namespace = +/*#__PURE__*/ +function () { + /** + * Both arguments are optional. The first argument is an object of + * built-in mappings which never change. The second argument is an object + * of initial (global-level) mappings, which will constantly change + * according to any global/top-level `set`s done. + */ + function Namespace(builtins, globalMacros) { + if (builtins === void 0) { + builtins = {}; + } + + if (globalMacros === void 0) { + globalMacros = {}; + } + + this.current = void 0; + this.builtins = void 0; + this.undefStack = void 0; + this.current = globalMacros; + this.builtins = builtins; + this.undefStack = []; + } + /** + * Start a new nested group, affecting future local `set`s. + */ + + + var _proto = Namespace.prototype; + + _proto.beginGroup = function beginGroup() { + this.undefStack.push({}); + }; + /** + * End current nested group, restoring values before the group began. + */ + + + _proto.endGroup = function endGroup() { + if (this.undefStack.length === 0) { + throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug"); + } + + var undefs = this.undefStack.pop(); + + for (var undef in undefs) { + if (undefs.hasOwnProperty(undef)) { + if (undefs[undef] === undefined) { + delete this.current[undef]; + } else { + this.current[undef] = undefs[undef]; + } + } + } + }; + /** + * Detect whether `name` has a definition. Equivalent to + * `get(name) != null`. + */ + + + _proto.has = function has(name) { + return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name); + }; + /** + * Get the current value of a name, or `undefined` if there is no value. + * + * Note: Do not use `if (namespace.get(...))` to detect whether a macro + * is defined, as the definition may be the empty string which evaluates + * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or + * `if (namespace.has(...))`. + */ + + + _proto.get = function get(name) { + if (this.current.hasOwnProperty(name)) { + return this.current[name]; + } else { + return this.builtins[name]; + } + }; + /** + * Set the current value of a name, and optionally set it globally too. + * Local set() sets the current value and (when appropriate) adds an undo + * operation to the undo stack. Global set() may change the undo + * operation at every level, so takes time linear in their number. + */ + + + _proto.set = function set(name, value, global) { + if (global === void 0) { + global = false; + } + + if (global) { + // Global set is equivalent to setting in all groups. Simulate this + // by destroying any undos currently scheduled for this name, + // and adding an undo with the *new* value (in case it later gets + // locally reset within this environment). + for (var i = 0; i < this.undefStack.length; i++) { + delete this.undefStack[i][name]; + } + + if (this.undefStack.length > 0) { + this.undefStack[this.undefStack.length - 1][name] = value; + } + } else { + // Undo this set at end of this group (possibly to `undefined`), + // unless an undo is already in place, in which case that older + // value is the correct one. + var top = this.undefStack[this.undefStack.length - 1]; + + if (top && !top.hasOwnProperty(name)) { + top[name] = this.current[name]; + } + } + + this.current[name] = value; + }; + + return Namespace; +}(); + + +// CONCATENATED MODULE: ./src/macros.js +/** + * Predefined macros for KaTeX. + * This can be used to define some commands in terms of others. + */ + + + + + +var builtinMacros = {}; +/* harmony default export */ var macros = (builtinMacros); // This function might one day accept an additional argument and do more things. + +function defineMacro(name, body) { + builtinMacros[name] = body; +} ////////////////////////////////////////////////////////////////////// +// macro tools +// LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2 +// TeX source: \long\def\@firstoftwo#1#2{#1} + +defineMacro("\\@firstoftwo", function (context) { + var args = context.consumeArgs(2); + return { + tokens: args[0], + numArgs: 0 + }; +}); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1 +// TeX source: \long\def\@secondoftwo#1#2{#2} + +defineMacro("\\@secondoftwo", function (context) { + var args = context.consumeArgs(2); + return { + tokens: args[1], + numArgs: 0 + }; +}); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded) +// symbol. If it matches #1, then the macro expands to #2; otherwise, #3. +// Note, however, that it does not consume the next symbol in either case. + +defineMacro("\\@ifnextchar", function (context) { + var args = context.consumeArgs(3); // symbol, if, else + + var nextToken = context.future(); + + if (args[0].length === 1 && args[0][0].text === nextToken.text) { + return { + tokens: args[1], + numArgs: 0 + }; + } else { + return { + tokens: args[2], + numArgs: 0 + }; + } +}); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol. +// If it is `*`, then it consumes the symbol, and the macro expands to #1; +// otherwise, the macro expands to #2 (without consuming the symbol). +// TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} + +defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode + +defineMacro("\\TextOrMath", function (context) { + var args = context.consumeArgs(2); + + if (context.mode === 'text') { + return { + tokens: args[0], + numArgs: 0 + }; + } else { + return { + tokens: args[1], + numArgs: 0 + }; + } +}); // Lookup table for parsing numbers in base 8 through 16 + +var digitToNumber = { + "0": 0, + "1": 1, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7, + "8": 8, + "9": 9, + "a": 10, + "A": 10, + "b": 11, + "B": 11, + "c": 12, + "C": 12, + "d": 13, + "D": 13, + "e": 14, + "E": 14, + "f": 15, + "F": 15 +}; // TeX \char makes a literal character (catcode 12) using the following forms: +// (see The TeXBook, p. 43) +// \char123 -- decimal +// \char'123 -- octal +// \char"123 -- hex +// \char`x -- character that can be written (i.e. isn't active) +// \char`\x -- character that cannot be written (e.g. %) +// These all refer to characters from the font, so we turn them into special +// calls to a function \@char dealt with in the Parser. + +defineMacro("\\char", function (context) { + var token = context.popToken(); + var base; + var number = ''; + + if (token.text === "'") { + base = 8; + token = context.popToken(); + } else if (token.text === '"') { + base = 16; + token = context.popToken(); + } else if (token.text === "`") { + token = context.popToken(); + + if (token.text[0] === "\\") { + number = token.text.charCodeAt(1); + } else if (token.text === "EOF") { + throw new src_ParseError("\\char` missing argument"); + } else { + number = token.text.charCodeAt(0); + } + } else { + base = 10; + } + + if (base) { + // Parse a number in the given base, starting with first `token`. + number = digitToNumber[token.text]; + + if (number == null || number >= base) { + throw new src_ParseError("Invalid base-" + base + " digit " + token.text); + } + + var digit; + + while ((digit = digitToNumber[context.future().text]) != null && digit < base) { + number *= base; + number += digit; + context.popToken(); + } + } + + return "\\@char{" + number + "}"; +}); // Basic support for macro definitions: +// \def\macro{expansion} +// \def\macro#1{expansion} +// \def\macro#1#2{expansion} +// \def\macro#1#2#3#4#5#6#7#8#9{expansion} +// Also the \gdef and \global\def equivalents + +var macros_def = function def(context, global) { + var arg = context.consumeArgs(1)[0]; + + if (arg.length !== 1) { + throw new src_ParseError("\\gdef's first argument must be a macro name"); + } + + var name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... + + var numArgs = 0; + arg = context.consumeArgs(1)[0]; + + while (arg.length === 1 && arg[0].text === "#") { + arg = context.consumeArgs(1)[0]; + + if (arg.length !== 1) { + throw new src_ParseError("Invalid argument number length \"" + arg.length + "\""); + } + + if (!/^[1-9]$/.test(arg[0].text)) { + throw new src_ParseError("Invalid argument number \"" + arg[0].text + "\""); + } + + numArgs++; + + if (parseInt(arg[0].text) !== numArgs) { + throw new src_ParseError("Argument number \"" + arg[0].text + "\" out of order"); + } + + arg = context.consumeArgs(1)[0]; + } // Final arg is the expansion of the macro + + + context.macros.set(name, { + tokens: arg, + numArgs: numArgs + }, global); + return ''; +}; + +defineMacro("\\gdef", function (context) { + return macros_def(context, true); +}); +defineMacro("\\def", function (context) { + return macros_def(context, false); +}); +defineMacro("\\global", function (context) { + var next = context.consumeArgs(1)[0]; + + if (next.length !== 1) { + throw new src_ParseError("Invalid command after \\global"); + } + + var command = next[0].text; // TODO: Should expand command + + if (command === "\\def") { + // \global\def is equivalent to \gdef + return macros_def(context, true); + } else { + throw new src_ParseError("Invalid command '" + command + "' after \\global"); + } +}); // \newcommand{\macro}[args]{definition} +// \renewcommand{\macro}[args]{definition} +// TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} + +var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) { + var arg = context.consumeArgs(1)[0]; + + if (arg.length !== 1) { + throw new src_ParseError("\\newcommand's first argument must be a macro name"); + } + + var name = arg[0].text; + var exists = context.isDefined(name); + + if (exists && !existsOK) { + throw new src_ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand")); + } + + if (!exists && !nonexistsOK) { + throw new src_ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand"); + } + + var numArgs = 0; + arg = context.consumeArgs(1)[0]; + + if (arg.length === 1 && arg[0].text === "[") { + var argText = ''; + var token = context.expandNextToken(); + + while (token.text !== "]" && token.text !== "EOF") { + // TODO: Should properly expand arg, e.g., ignore {}s + argText += token.text; + token = context.expandNextToken(); + } + + if (!argText.match(/^\s*[0-9]+\s*$/)) { + throw new src_ParseError("Invalid number of arguments: " + argText); + } + + numArgs = parseInt(argText); + arg = context.consumeArgs(1)[0]; + } // Final arg is the expansion of the macro + + + context.macros.set(name, { + tokens: arg, + numArgs: numArgs + }); + return ''; +}; + +defineMacro("\\newcommand", function (context) { + return macros_newcommand(context, false, true); +}); +defineMacro("\\renewcommand", function (context) { + return macros_newcommand(context, true, false); +}); +defineMacro("\\providecommand", function (context) { + return macros_newcommand(context, true, true); +}); ////////////////////////////////////////////////////////////////////// +// Grouping +// \let\bgroup={ \let\egroup=} + +defineMacro("\\bgroup", "{"); +defineMacro("\\egroup", "}"); +defineMacro("\\begingroup", "{"); +defineMacro("\\endgroup", "}"); // Symbols from latex.ltx: +// \def\lq{`} +// \def\rq{'} +// \def \aa {\r a} +// \def \AA {\r A} + +defineMacro("\\lq", "`"); +defineMacro("\\rq", "'"); +defineMacro("\\aa", "\\r a"); +defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML. +// \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}} +// \DeclareTextCommandDefault{\textregistered}{\textcircled{% +// \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}} +// \DeclareRobustCommand{\copyright}{% +// \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi} + +defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); +defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); +defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Unicode double-struck letters + +defineMacro("\u2102", "\\mathbb{C}"); +defineMacro("\u210D", "\\mathbb{H}"); +defineMacro("\u2115", "\\mathbb{N}"); +defineMacro("\u2119", "\\mathbb{P}"); +defineMacro("\u211A", "\\mathbb{Q}"); +defineMacro("\u211D", "\\mathbb{R}"); +defineMacro("\u2124", "\\mathbb{Z}"); +defineMacro("\u210E", "\\mathit{h}"); // Planck constant +// Characters omitted from Unicode range 1D400–1D7FF + +defineMacro("\u212C", "\\mathscr{B}"); // script + +defineMacro("\u2130", "\\mathscr{E}"); +defineMacro("\u2131", "\\mathscr{F}"); +defineMacro("\u210B", "\\mathscr{H}"); +defineMacro("\u2110", "\\mathscr{I}"); +defineMacro("\u2112", "\\mathscr{L}"); +defineMacro("\u2133", "\\mathscr{M}"); +defineMacro("\u211B", "\\mathscr{R}"); +defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur + +defineMacro("\u210C", "\\mathfrak{H}"); +defineMacro("\u2128", "\\mathfrak{Z}"); // Unicode middle dot +// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays +// the dot at U+22C5 and gives it punct spacing. + +defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text mode + +defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); +defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); +defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via +// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} +// It's thus treated like a \mathrel, but defined by a symbol that has zero +// width but extends to the right. We use \rlap to get that spacing. + +defineMacro("\\not", '\\mathrel{\\mathrlap\\@not}'); // Negated symbols from base/fontmath.ltx: +// \def\neq{\not=} \let\ne=\neq +// \DeclareRobustCommand +// \notin{\mathrel{\m@th\mathpalette\c@ncel\in}} +// \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}} + +defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); +defineMacro("\\ne", "\\neq"); +defineMacro("\u2260", "\\neq"); +defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}"); +defineMacro("\u2209", "\\notin"); // Unicode stacked relations + +defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}"); +defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}"); +defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}"); +defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}"); +defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}"); +defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}"); +defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode + +defineMacro("\u27C2", "\\perp"); +defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); +defineMacro("\u220C", "\\notni"); +defineMacro("\u231C", "\\ulcorner"); +defineMacro("\u231D", "\\urcorner"); +defineMacro("\u231E", "\\llcorner"); +defineMacro("\u231F", "\\lrcorner"); +defineMacro("\xA9", "\\copyright"); +defineMacro("\xAE", "\\textregistered"); +defineMacro("\uFE0F", "\\textregistered"); ////////////////////////////////////////////////////////////////////// +// LaTeX_2ε +// \vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ +// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}} +// We'll call \varvdots, which gets a glyph from symbols.js. +// The zero-width rule gets us an equivalent to the vertical 6pt kern. + +defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); +defineMacro("\u22EE", "\\vdots"); ////////////////////////////////////////////////////////////////////// +// amsmath.sty +// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf +// Italic Greek capital letters. AMS defines these with \DeclareMathSymbol, +// but they are equivalent to \mathit{\Letter}. + +defineMacro("\\varGamma", "\\mathit{\\Gamma}"); +defineMacro("\\varDelta", "\\mathit{\\Delta}"); +defineMacro("\\varTheta", "\\mathit{\\Theta}"); +defineMacro("\\varLambda", "\\mathit{\\Lambda}"); +defineMacro("\\varXi", "\\mathit{\\Xi}"); +defineMacro("\\varPi", "\\mathit{\\Pi}"); +defineMacro("\\varSigma", "\\mathit{\\Sigma}"); +defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); +defineMacro("\\varPhi", "\\mathit{\\Phi}"); +defineMacro("\\varPsi", "\\mathit{\\Psi}"); +defineMacro("\\varOmega", "\\mathit{\\Omega}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript +// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} + +defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} + +defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;} +// \def\implies{\DOTSB\;\Longrightarrow\;} +// \def\impliedby{\DOTSB\;\Longleftarrow\;} + +defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); +defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); +defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro. + +var dotsByToken = { + ',': '\\dotsc', + '\\not': '\\dotsb', + // \keybin@ checks for the following: + '+': '\\dotsb', + '=': '\\dotsb', + '<': '\\dotsb', + '>': '\\dotsb', + '-': '\\dotsb', + '*': '\\dotsb', + ':': '\\dotsb', + // Symbols whose definition starts with \DOTSB: + '\\DOTSB': '\\dotsb', + '\\coprod': '\\dotsb', + '\\bigvee': '\\dotsb', + '\\bigwedge': '\\dotsb', + '\\biguplus': '\\dotsb', + '\\bigcap': '\\dotsb', + '\\bigcup': '\\dotsb', + '\\prod': '\\dotsb', + '\\sum': '\\dotsb', + '\\bigotimes': '\\dotsb', + '\\bigoplus': '\\dotsb', + '\\bigodot': '\\dotsb', + '\\bigsqcup': '\\dotsb', + '\\And': '\\dotsb', + '\\longrightarrow': '\\dotsb', + '\\Longrightarrow': '\\dotsb', + '\\longleftarrow': '\\dotsb', + '\\Longleftarrow': '\\dotsb', + '\\longleftrightarrow': '\\dotsb', + '\\Longleftrightarrow': '\\dotsb', + '\\mapsto': '\\dotsb', + '\\longmapsto': '\\dotsb', + '\\hookrightarrow': '\\dotsb', + '\\doteq': '\\dotsb', + // Symbols whose definition starts with \mathbin: + '\\mathbin': '\\dotsb', + // Symbols whose definition starts with \mathrel: + '\\mathrel': '\\dotsb', + '\\relbar': '\\dotsb', + '\\Relbar': '\\dotsb', + '\\xrightarrow': '\\dotsb', + '\\xleftarrow': '\\dotsb', + // Symbols whose definition starts with \DOTSI: + '\\DOTSI': '\\dotsi', + '\\int': '\\dotsi', + '\\oint': '\\dotsi', + '\\iint': '\\dotsi', + '\\iiint': '\\dotsi', + '\\iiiint': '\\dotsi', + '\\idotsint': '\\dotsi', + // Symbols whose definition starts with \DOTSX: + '\\DOTSX': '\\dotsx' +}; +defineMacro("\\dots", function (context) { + // TODO: If used in text mode, should expand to \textellipsis. + // However, in KaTeX, \textellipsis and \ldots behave the same + // (in text mode), and it's unlikely we'd see any of the math commands + // that affect the behavior of \dots when in text mode. So fine for now + // (until we support \ifmmode ... \else ... \fi). + var thedots = '\\dotso'; + var next = context.expandAfterFuture().text; + + if (next in dotsByToken) { + thedots = dotsByToken[next]; + } else if (next.substr(0, 4) === '\\not') { + thedots = '\\dotsb'; + } else if (next in src_symbols.math) { + if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) { + thedots = '\\dotsb'; + } + } + + return thedots; +}); +var spaceAfterDots = { + // \rightdelim@ checks for the following: + ')': true, + ']': true, + '\\rbrack': true, + '\\}': true, + '\\rbrace': true, + '\\rangle': true, + '\\rceil': true, + '\\rfloor': true, + '\\rgroup': true, + '\\rmoustache': true, + '\\right': true, + '\\bigr': true, + '\\biggr': true, + '\\Bigr': true, + '\\Biggr': true, + // \extra@ also tests for the following: + '$': true, + // \extrap@ checks for the following: + ';': true, + '.': true, + ',': true +}; +defineMacro("\\dotso", function (context) { + var next = context.future().text; + + if (next in spaceAfterDots) { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } +}); +defineMacro("\\dotsc", function (context) { + var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for + // ';' and '.', but doesn't check for ','. + + if (next in spaceAfterDots && next !== ',') { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } +}); +defineMacro("\\cdots", function (context) { + var next = context.future().text; + + if (next in spaceAfterDots) { + return "\\@cdots\\,"; + } else { + return "\\@cdots"; + } +}); +defineMacro("\\dotsb", "\\cdots"); +defineMacro("\\dotsm", "\\cdots"); +defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro +// starting with \DOTSX implies \dotso, and then \extra@ detects this case +// and forces the added `\,`. + +defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax +// \let\DOTSB\relax +// \let\DOTSX\relax + +defineMacro("\\DOTSI", "\\relax"); +defineMacro("\\DOTSB", "\\relax"); +defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults +// \DeclareRobustCommand{\tmspace}[3]{% +// \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} + +defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} +// TODO: math mode should use \thinmuskip + +defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\, + +defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip} +// \renewcommand{\:}{\tmspace+\medmuskip{.2222em}} +// TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu + +defineMacro("\\>", "\\mskip{4mu}"); +defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\: + +defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} +// TODO: math mode should use \thickmuskip = 5mu plus 5mu + +defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\; + +defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} +// TODO: math mode should use \thinmuskip + +defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\! + +defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} +// TODO: math mode should use \medmuskip + +defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} +// TODO: math mode should use \thickmuskip + +defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em } + +defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax} + +defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax} + +defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax} + +defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag + +defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); +defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); +defineMacro("\\tag@literal", function (context) { + if (context.macros.get("\\df@tag")) { + throw new src_ParseError("Multiple \\tag"); + } + + return "\\gdef\\df@tag{\\text{#1}}"; +}); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin +// {\operator@font mod}\penalty900 +// \mkern5mu\nonscript\mskip-\medmuskip} +// \newcommand{\pod}[1]{\allowbreak +// \if@display\mkern18mu\else\mkern8mu\fi(#1)} +// \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} +// \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu +// \else\mkern12mu\fi{\operator@font mod}\,\,#1} +// TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu + +defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); +defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); +defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); +defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb -- A simulation of bold. +// It works by typesetting three copies of the argument with small offsets. +// Ref: a rather lengthy macro in ambsy.sty + +defineMacro("\\pmb", "\\html@mathml{\\@binrel{#1}{" + "\\mathrlap{#1}" + "\\mathrlap{\\mkern0.4mu\\raisebox{0.4mu}{$#1$}}" + "{\\mkern0.8mu#1}" + "}}{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// +// LaTeX source2e +// \\ defaults to \newline, but changes to \cr within array environment + +defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} +// TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't +// support \@ yet, so that's omitted, and we add \text so that the result +// doesn't look funny in math mode. + +defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em% +// {\sbox\z@ T% +// \vbox to\ht\z@{\hbox{\check@mathfonts +// \fontsize\sf@size\z@ +// \math@fontsfalse\selectfont +// A}% +// \vss}% +// }% +// \kern-.15em% +// \TeX} +// This code aligns the top of the A with the T (from the perspective of TeX's +// boxes, though visually the A appears to extend above slightly). +// We compute the corresponding \raisebox when A is rendered at \scriptsize, +// which is size3, which has a scale factor of 0.7 (see Options.js). + +var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em"; +defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptsize A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo + +defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptsize A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} +// \def\@hspace#1{\hskip #1\relax} +// \def\@hspacer#1{\vrule \@width\z@\nobreak +// \hskip #1\hskip \z@skip} + +defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); +defineMacro("\\@hspace", "\\hskip #1\\relax"); +defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); ////////////////////////////////////////////////////////////////////// +// mathtools.sty +//\providecommand\ordinarycolon{:} + +defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} +//TODO(edemaine): Not yet centered. Fix via \raisebox or #726 + +defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} + +defineMacro("\\dblcolon", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} + +defineMacro("\\coloneqq", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}"); // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} + +defineMacro("\\Coloneqq", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} + +defineMacro("\\coloneq", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} + +defineMacro("\\Coloneq", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} + +defineMacro("\\eqqcolon", "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} + +defineMacro("\\Eqqcolon", "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} + +defineMacro("\\eqcolon", "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} + +defineMacro("\\Eqcolon", "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} + +defineMacro("\\colonapprox", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} + +defineMacro("\\Colonapprox", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} + +defineMacro("\\colonsim", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} + +defineMacro("\\Colonsim", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}"); // Some Unicode characters are implemented with macros to mathtools functions. + +defineMacro("\u2254", "\\coloneqq"); // := + +defineMacro("\u2255", "\\eqqcolon"); // =: + +defineMacro("\u2A74", "\\Coloneqq"); // ::= +////////////////////////////////////////////////////////////////////// +// colonequals.sty +// Alternate names for mathtools's macros: + +defineMacro("\\ratio", "\\vcentcolon"); +defineMacro("\\coloncolon", "\\dblcolon"); +defineMacro("\\colonequals", "\\coloneqq"); +defineMacro("\\coloncolonequals", "\\Coloneqq"); +defineMacro("\\equalscolon", "\\eqqcolon"); +defineMacro("\\equalscoloncolon", "\\Eqqcolon"); +defineMacro("\\colonminus", "\\coloneq"); +defineMacro("\\coloncolonminus", "\\Coloneq"); +defineMacro("\\minuscolon", "\\eqcolon"); +defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals. + +defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals. + +defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions: + +defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); +defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts + +defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); +defineMacro("\\limsup", "\\DOTSB\\mathop{\\operatorname{lim\\,sup}}\\limits"); +defineMacro("\\liminf", "\\DOTSB\\mathop{\\operatorname{lim\\,inf}}\\limits"); ////////////////////////////////////////////////////////////////////// +// semantic +// The semantic package renders the next two items by calling a glyph from the +// bbold package. Those glyphs do not exist in the KaTeX fonts. Hence the macros. + +defineMacro("\u27E6", "\\mathopen{[\\mkern-3.2mu[}"); // blackboard bold [ + +defineMacro("\u27E7", "\\mathclose{]\\mkern-3.2mu]}"); // blackboard bold ] +// TODO: Create variable sized versions of the last two items. I believe that +// will require new font glyphs. +////////////////////////////////////////////////////////////////////// +// texvc.sty +// The texvc package contains macros available in mediawiki pages. +// We omit the functions deprecated at +// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax +// We also omit texvc's \O, which conflicts with \text{\O} + +defineMacro("\\darr", "\\downarrow"); +defineMacro("\\dArr", "\\Downarrow"); +defineMacro("\\Darr", "\\Downarrow"); +defineMacro("\\lang", "\\langle"); +defineMacro("\\rang", "\\rangle"); +defineMacro("\\uarr", "\\uparrow"); +defineMacro("\\uArr", "\\Uparrow"); +defineMacro("\\Uarr", "\\Uparrow"); +defineMacro("\\N", "\\mathbb{N}"); +defineMacro("\\R", "\\mathbb{R}"); +defineMacro("\\Z", "\\mathbb{Z}"); +defineMacro("\\alef", "\\aleph"); +defineMacro("\\alefsym", "\\aleph"); +defineMacro("\\Alpha", "\\mathrm{A}"); +defineMacro("\\Beta", "\\mathrm{B}"); +defineMacro("\\bull", "\\bullet"); +defineMacro("\\Chi", "\\mathrm{X}"); +defineMacro("\\clubs", "\\clubsuit"); +defineMacro("\\cnums", "\\mathbb{C}"); +defineMacro("\\Complex", "\\mathbb{C}"); +defineMacro("\\Dagger", "\\ddagger"); +defineMacro("\\diamonds", "\\diamondsuit"); +defineMacro("\\empty", "\\emptyset"); +defineMacro("\\Epsilon", "\\mathrm{E}"); +defineMacro("\\Eta", "\\mathrm{H}"); +defineMacro("\\exist", "\\exists"); +defineMacro("\\harr", "\\leftrightarrow"); +defineMacro("\\hArr", "\\Leftrightarrow"); +defineMacro("\\Harr", "\\Leftrightarrow"); +defineMacro("\\hearts", "\\heartsuit"); +defineMacro("\\image", "\\Im"); +defineMacro("\\infin", "\\infty"); +defineMacro("\\Iota", "\\mathrm{I}"); +defineMacro("\\isin", "\\in"); +defineMacro("\\Kappa", "\\mathrm{K}"); +defineMacro("\\larr", "\\leftarrow"); +defineMacro("\\lArr", "\\Leftarrow"); +defineMacro("\\Larr", "\\Leftarrow"); +defineMacro("\\lrarr", "\\leftrightarrow"); +defineMacro("\\lrArr", "\\Leftrightarrow"); +defineMacro("\\Lrarr", "\\Leftrightarrow"); +defineMacro("\\Mu", "\\mathrm{M}"); +defineMacro("\\natnums", "\\mathbb{N}"); +defineMacro("\\Nu", "\\mathrm{N}"); +defineMacro("\\Omicron", "\\mathrm{O}"); +defineMacro("\\plusmn", "\\pm"); +defineMacro("\\rarr", "\\rightarrow"); +defineMacro("\\rArr", "\\Rightarrow"); +defineMacro("\\Rarr", "\\Rightarrow"); +defineMacro("\\real", "\\Re"); +defineMacro("\\reals", "\\mathbb{R}"); +defineMacro("\\Reals", "\\mathbb{R}"); +defineMacro("\\Rho", "\\mathrm{R}"); +defineMacro("\\sdot", "\\cdot"); +defineMacro("\\sect", "\\S"); +defineMacro("\\spades", "\\spadesuit"); +defineMacro("\\sub", "\\subset"); +defineMacro("\\sube", "\\subseteq"); +defineMacro("\\supe", "\\supseteq"); +defineMacro("\\Tau", "\\mathrm{T}"); +defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}"); + +defineMacro("\\weierp", "\\wp"); +defineMacro("\\Zeta", "\\mathrm{Z}"); +// CONCATENATED MODULE: ./src/MacroExpander.js +/** + * This file contains the “gullet” where macros are expanded + * until only non-macro tokens remain. + */ + + + + + + + +// List of commands that act like macros but aren't defined as a macro, +// function, or symbol. Used in `isDefined`. +var implicitCommands = { + "\\relax": true, + // MacroExpander.js + "^": true, + // Parser.js + "_": true, + // Parser.js + "\\limits": true, + // Parser.js + "\\nolimits": true // Parser.js + +}; + +var MacroExpander_MacroExpander = +/*#__PURE__*/ +function () { + function MacroExpander(input, settings, mode) { + this.settings = void 0; + this.expansionCount = void 0; + this.lexer = void 0; + this.macros = void 0; + this.stack = void 0; + this.mode = void 0; + this.settings = settings; + this.expansionCount = 0; + this.feed(input); // Make new global namespace + + this.macros = new Namespace_Namespace(macros, settings.macros); this.mode = mode; - if (firstToken && (!lastToken || lastToken.lexer === firstToken.lexer)) { - this.lexer = firstToken.lexer; - this.start = firstToken.start; - this.end = (lastToken || firstToken).end; + this.stack = []; // contains tokens in REVERSE order + } + /** + * Feed a new input string to the same MacroExpander + * (with existing macros etc.). + */ + + + var _proto = MacroExpander.prototype; + + _proto.feed = function feed(input) { + this.lexer = new Lexer_Lexer(input); + }; + /** + * Switches between "text" and "math" modes. + */ + + + _proto.switchMode = function switchMode(newMode) { + this.mode = newMode; + }; + /** + * Start a new group nesting within all namespaces. + */ + + + _proto.beginGroup = function beginGroup() { + this.macros.beginGroup(); + }; + /** + * End current group nesting within all namespaces. + */ + + + _proto.endGroup = function endGroup() { + this.macros.endGroup(); + }; + /** + * Returns the topmost token on the stack, without expanding it. + * Similar in behavior to TeX's `\futurelet`. + */ + + + _proto.future = function future() { + if (this.stack.length === 0) { + this.pushToken(this.lexer.lex()); } -} -module.exports = { - ParseNode: ParseNode -}; + return this.stack[this.stack.length - 1]; + }; + /** + * Remove and return the next unexpanded token. + */ -},{}],22:[function(require,module,exports){ + _proto.popToken = function popToken() { + this.future(); // ensure non-empty stack + + return this.stack.pop(); + }; + /** + * Add a given token to the token stack. In particular, this get be used + * to put back a token returned from one of the other methods. + */ + + + _proto.pushToken = function pushToken(token) { + this.stack.push(token); + }; + /** + * Append an array of tokens to the token stack. + */ + + + _proto.pushTokens = function pushTokens(tokens) { + var _this$stack; + + (_this$stack = this.stack).push.apply(_this$stack, tokens); + }; + /** + * Consume all following space tokens, without expansion. + */ + + + _proto.consumeSpaces = function consumeSpaces() { + for (;;) { + var token = this.future(); + + if (token.text === " ") { + this.stack.pop(); + } else { + break; + } + } + }; + /** + * Consume the specified number of arguments from the token stream, + * and return the resulting array of arguments. + */ + + + _proto.consumeArgs = function consumeArgs(numArgs) { + var args = []; // obtain arguments, either single token or balanced {…} group + + for (var i = 0; i < numArgs; ++i) { + this.consumeSpaces(); // ignore spaces before each argument + + var startOfArg = this.popToken(); + + if (startOfArg.text === "{") { + var arg = []; + var depth = 1; + + while (depth !== 0) { + var tok = this.popToken(); + arg.push(tok); + + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; + } else if (tok.text === "EOF") { + throw new src_ParseError("End of input in macro argument", startOfArg); + } + } + + arg.pop(); // remove last } + + arg.reverse(); // like above, to fit in with stack order + + args[i] = arg; + } else if (startOfArg.text === "EOF") { + throw new src_ParseError("End of input expecting macro argument"); + } else { + args[i] = [startOfArg]; + } + } + + return args; + }; + /** + * Expand the next token only once if possible. + * + * If the token is expanded, the resulting tokens will be pushed onto + * the stack in reverse order and will be returned as an array, + * also in reverse order. + * + * If not, the next token will be returned without removing it + * from the stack. This case can be detected by a `Token` return value + * instead of an `Array` return value. + * + * In either case, the next token will be on the top of the stack, + * or the stack will be empty. + * + * Used to implement `expandAfterFuture` and `expandNextToken`. + * + * At the moment, macro expansion doesn't handle delimited macros, + * i.e. things like those defined by \def\foo#1\end{…}. + * See the TeX book page 202ff. for details on how those should behave. + */ + + + _proto.expandOnce = function expandOnce() { + var topToken = this.popToken(); + var name = topToken.text; + + var expansion = this._getExpansion(name); + + if (expansion == null) { + // mainly checking for undefined here + // Fully expanded + this.pushToken(topToken); + return topToken; + } + + this.expansionCount++; + + if (this.expansionCount > this.settings.maxExpand) { + throw new src_ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting"); + } + + var tokens = expansion.tokens; + + if (expansion.numArgs) { + var args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders + + tokens = tokens.slice(); // make a shallow copy + + for (var i = tokens.length - 1; i >= 0; --i) { + var tok = tokens[i]; + + if (tok.text === "#") { + if (i === 0) { + throw new src_ParseError("Incomplete placeholder at end of macro body", tok); + } + + tok = tokens[--i]; // next token on stack + + if (tok.text === "#") { + // ## → # + tokens.splice(i + 1, 1); // drop first # + } else if (/^[1-9]$/.test(tok.text)) { + var _tokens; + + // replace the placeholder with the indicated argument + (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1])); + } else { + throw new src_ParseError("Not a valid argument number", tok); + } + } + } + } // Concatenate expansion onto top of stack. + + + this.pushTokens(tokens); + return tokens; + }; + /** + * Expand the next token only once (if possible), and return the resulting + * top token on the stack (without removing anything from the stack). + * Similar in behavior to TeX's `\expandafter\futurelet`. + * Equivalent to expandOnce() followed by future(). + */ + + + _proto.expandAfterFuture = function expandAfterFuture() { + this.expandOnce(); + return this.future(); + }; + /** + * Recursively expand first token, then return first non-expandable token. + */ + + + _proto.expandNextToken = function expandNextToken() { + for (;;) { + var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. + + if (expanded instanceof Token_Token) { + // \relax stops the expansion, but shouldn't get returned (a + // null return value couldn't get implemented as a function). + if (expanded.text === "\\relax") { + this.stack.pop(); + } else { + return this.stack.pop(); // === expanded + } + } + } // Flow unable to figure out that this pathway is impossible. + // https://github.com/facebook/flow/issues/4808 + + + throw new Error(); // eslint-disable-line no-unreachable + }; + /** + * Fully expand the given macro name and return the resulting list of + * tokens, or return `undefined` if no such macro is defined. + */ + + + _proto.expandMacro = function expandMacro(name) { + if (!this.macros.get(name)) { + return undefined; + } + + var output = []; + var oldStackLength = this.stack.length; + this.pushToken(new Token_Token(name)); + + while (this.stack.length > oldStackLength) { + var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. + + if (expanded instanceof Token_Token) { + output.push(this.stack.pop()); + } + } + + return output; + }; + /** + * Fully expand the given macro name and return the result as a string, + * or return `undefined` if no such macro is defined. + */ + + + _proto.expandMacroAsText = function expandMacroAsText(name) { + var tokens = this.expandMacro(name); + + if (tokens) { + return tokens.map(function (token) { + return token.text; + }).join(""); + } else { + return tokens; + } + }; + /** + * Returns the expanded macro as a reversed array of tokens and a macro + * argument count. Or returns `null` if no such macro. + */ + + + _proto._getExpansion = function _getExpansion(name) { + var definition = this.macros.get(name); + + if (definition == null) { + // mainly checking for undefined here + return definition; + } + + var expansion = typeof definition === "function" ? definition(this) : definition; + + if (typeof expansion === "string") { + var numArgs = 0; + + if (expansion.indexOf("#") !== -1) { + var stripped = expansion.replace(/##/g, ""); + + while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { + ++numArgs; + } + } + + var bodyLexer = new Lexer_Lexer(expansion); + var tokens = []; + var tok = bodyLexer.lex(); + + while (tok.text !== "EOF") { + tokens.push(tok); + tok = bodyLexer.lex(); + } + + tokens.reverse(); // to fit in with stack using push and pop + + var expanded = { + tokens: tokens, + numArgs: numArgs + }; + return expanded; + } + + return expansion; + }; + /** + * Determine whether a command is currently "defined" (has some + * functionality), meaning that it's a macro (in the current group), + * a function, a symbol, or one of the special commands listed in + * `implicitCommands`. + */ + + + _proto.isDefined = function isDefined(name) { + return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name); + }; + + return MacroExpander; +}(); + + +// CONCATENATED MODULE: ./src/unicodeAccents.js +// Mapping of Unicode accent characters to their LaTeX equivalent in text and +// math mode (when they exist). +/* harmony default export */ var unicodeAccents = ({ + "\u0301": { + text: "\\'", + math: '\\acute' + }, + "\u0300": { + text: '\\`', + math: '\\grave' + }, + "\u0308": { + text: '\\"', + math: '\\ddot' + }, + "\u0303": { + text: '\\~', + math: '\\tilde' + }, + "\u0304": { + text: '\\=', + math: '\\bar' + }, + "\u0306": { + text: "\\u", + math: '\\breve' + }, + "\u030C": { + text: '\\v', + math: '\\check' + }, + "\u0302": { + text: '\\^', + math: '\\hat' + }, + "\u0307": { + text: '\\.', + math: '\\dot' + }, + "\u030A": { + text: '\\r', + math: '\\mathring' + }, + "\u030B": { + text: '\\H' + } +}); +// CONCATENATED MODULE: ./src/unicodeSymbols.js +// This file is GENERATED by unicodeMake.js. DO NOT MODIFY. +/* harmony default export */ var unicodeSymbols = ({ + "\xE1": "a\u0301", + // á = \'{a} + "\xE0": "a\u0300", + // à = \`{a} + "\xE4": "a\u0308", + // ä = \"{a} + "\u01DF": "a\u0308\u0304", + // ǟ = \"\={a} + "\xE3": "a\u0303", + // ã = \~{a} + "\u0101": "a\u0304", + // ā = \={a} + "\u0103": "a\u0306", + // ă = \u{a} + "\u1EAF": "a\u0306\u0301", + // ắ = \u\'{a} + "\u1EB1": "a\u0306\u0300", + // ằ = \u\`{a} + "\u1EB5": "a\u0306\u0303", + // ẵ = \u\~{a} + "\u01CE": "a\u030C", + // ǎ = \v{a} + "\xE2": "a\u0302", + // â = \^{a} + "\u1EA5": "a\u0302\u0301", + // ấ = \^\'{a} + "\u1EA7": "a\u0302\u0300", + // ầ = \^\`{a} + "\u1EAB": "a\u0302\u0303", + // ẫ = \^\~{a} + "\u0227": "a\u0307", + // ȧ = \.{a} + "\u01E1": "a\u0307\u0304", + // ǡ = \.\={a} + "\xE5": "a\u030A", + // å = \r{a} + "\u01FB": "a\u030A\u0301", + // ǻ = \r\'{a} + "\u1E03": "b\u0307", + // ḃ = \.{b} + "\u0107": "c\u0301", + // ć = \'{c} + "\u010D": "c\u030C", + // č = \v{c} + "\u0109": "c\u0302", + // ĉ = \^{c} + "\u010B": "c\u0307", + // ċ = \.{c} + "\u010F": "d\u030C", + // ď = \v{d} + "\u1E0B": "d\u0307", + // ḋ = \.{d} + "\xE9": "e\u0301", + // é = \'{e} + "\xE8": "e\u0300", + // è = \`{e} + "\xEB": "e\u0308", + // ë = \"{e} + "\u1EBD": "e\u0303", + // ẽ = \~{e} + "\u0113": "e\u0304", + // ē = \={e} + "\u1E17": "e\u0304\u0301", + // ḗ = \=\'{e} + "\u1E15": "e\u0304\u0300", + // ḕ = \=\`{e} + "\u0115": "e\u0306", + // ĕ = \u{e} + "\u011B": "e\u030C", + // ě = \v{e} + "\xEA": "e\u0302", + // ê = \^{e} + "\u1EBF": "e\u0302\u0301", + // ế = \^\'{e} + "\u1EC1": "e\u0302\u0300", + // ề = \^\`{e} + "\u1EC5": "e\u0302\u0303", + // ễ = \^\~{e} + "\u0117": "e\u0307", + // ė = \.{e} + "\u1E1F": "f\u0307", + // ḟ = \.{f} + "\u01F5": "g\u0301", + // ǵ = \'{g} + "\u1E21": "g\u0304", + // ḡ = \={g} + "\u011F": "g\u0306", + // ğ = \u{g} + "\u01E7": "g\u030C", + // ǧ = \v{g} + "\u011D": "g\u0302", + // ĝ = \^{g} + "\u0121": "g\u0307", + // ġ = \.{g} + "\u1E27": "h\u0308", + // ḧ = \"{h} + "\u021F": "h\u030C", + // ȟ = \v{h} + "\u0125": "h\u0302", + // ĥ = \^{h} + "\u1E23": "h\u0307", + // ḣ = \.{h} + "\xED": "i\u0301", + // í = \'{i} + "\xEC": "i\u0300", + // ì = \`{i} + "\xEF": "i\u0308", + // ï = \"{i} + "\u1E2F": "i\u0308\u0301", + // ḯ = \"\'{i} + "\u0129": "i\u0303", + // ĩ = \~{i} + "\u012B": "i\u0304", + // ī = \={i} + "\u012D": "i\u0306", + // ĭ = \u{i} + "\u01D0": "i\u030C", + // ǐ = \v{i} + "\xEE": "i\u0302", + // î = \^{i} + "\u01F0": "j\u030C", + // ǰ = \v{j} + "\u0135": "j\u0302", + // ĵ = \^{j} + "\u1E31": "k\u0301", + // ḱ = \'{k} + "\u01E9": "k\u030C", + // ǩ = \v{k} + "\u013A": "l\u0301", + // ĺ = \'{l} + "\u013E": "l\u030C", + // ľ = \v{l} + "\u1E3F": "m\u0301", + // ḿ = \'{m} + "\u1E41": "m\u0307", + // ṁ = \.{m} + "\u0144": "n\u0301", + // ń = \'{n} + "\u01F9": "n\u0300", + // ǹ = \`{n} + "\xF1": "n\u0303", + // ñ = \~{n} + "\u0148": "n\u030C", + // ň = \v{n} + "\u1E45": "n\u0307", + // ṅ = \.{n} + "\xF3": "o\u0301", + // ó = \'{o} + "\xF2": "o\u0300", + // ò = \`{o} + "\xF6": "o\u0308", + // ö = \"{o} + "\u022B": "o\u0308\u0304", + // ȫ = \"\={o} + "\xF5": "o\u0303", + // õ = \~{o} + "\u1E4D": "o\u0303\u0301", + // ṍ = \~\'{o} + "\u1E4F": "o\u0303\u0308", + // ṏ = \~\"{o} + "\u022D": "o\u0303\u0304", + // ȭ = \~\={o} + "\u014D": "o\u0304", + // ō = \={o} + "\u1E53": "o\u0304\u0301", + // ṓ = \=\'{o} + "\u1E51": "o\u0304\u0300", + // ṑ = \=\`{o} + "\u014F": "o\u0306", + // ŏ = \u{o} + "\u01D2": "o\u030C", + // ǒ = \v{o} + "\xF4": "o\u0302", + // ô = \^{o} + "\u1ED1": "o\u0302\u0301", + // ố = \^\'{o} + "\u1ED3": "o\u0302\u0300", + // ồ = \^\`{o} + "\u1ED7": "o\u0302\u0303", + // ỗ = \^\~{o} + "\u022F": "o\u0307", + // ȯ = \.{o} + "\u0231": "o\u0307\u0304", + // ȱ = \.\={o} + "\u0151": "o\u030B", + // ő = \H{o} + "\u1E55": "p\u0301", + // ṕ = \'{p} + "\u1E57": "p\u0307", + // ṗ = \.{p} + "\u0155": "r\u0301", + // ŕ = \'{r} + "\u0159": "r\u030C", + // ř = \v{r} + "\u1E59": "r\u0307", + // ṙ = \.{r} + "\u015B": "s\u0301", + // ś = \'{s} + "\u1E65": "s\u0301\u0307", + // ṥ = \'\.{s} + "\u0161": "s\u030C", + // š = \v{s} + "\u1E67": "s\u030C\u0307", + // ṧ = \v\.{s} + "\u015D": "s\u0302", + // ŝ = \^{s} + "\u1E61": "s\u0307", + // ṡ = \.{s} + "\u1E97": "t\u0308", + // ẗ = \"{t} + "\u0165": "t\u030C", + // ť = \v{t} + "\u1E6B": "t\u0307", + // ṫ = \.{t} + "\xFA": "u\u0301", + // ú = \'{u} + "\xF9": "u\u0300", + // ù = \`{u} + "\xFC": "u\u0308", + // ü = \"{u} + "\u01D8": "u\u0308\u0301", + // ǘ = \"\'{u} + "\u01DC": "u\u0308\u0300", + // ǜ = \"\`{u} + "\u01D6": "u\u0308\u0304", + // ǖ = \"\={u} + "\u01DA": "u\u0308\u030C", + // ǚ = \"\v{u} + "\u0169": "u\u0303", + // ũ = \~{u} + "\u1E79": "u\u0303\u0301", + // ṹ = \~\'{u} + "\u016B": "u\u0304", + // ū = \={u} + "\u1E7B": "u\u0304\u0308", + // ṻ = \=\"{u} + "\u016D": "u\u0306", + // ŭ = \u{u} + "\u01D4": "u\u030C", + // ǔ = \v{u} + "\xFB": "u\u0302", + // û = \^{u} + "\u016F": "u\u030A", + // ů = \r{u} + "\u0171": "u\u030B", + // ű = \H{u} + "\u1E7D": "v\u0303", + // ṽ = \~{v} + "\u1E83": "w\u0301", + // ẃ = \'{w} + "\u1E81": "w\u0300", + // ẁ = \`{w} + "\u1E85": "w\u0308", + // ẅ = \"{w} + "\u0175": "w\u0302", + // ŵ = \^{w} + "\u1E87": "w\u0307", + // ẇ = \.{w} + "\u1E98": "w\u030A", + // ẘ = \r{w} + "\u1E8D": "x\u0308", + // ẍ = \"{x} + "\u1E8B": "x\u0307", + // ẋ = \.{x} + "\xFD": "y\u0301", + // ý = \'{y} + "\u1EF3": "y\u0300", + // ỳ = \`{y} + "\xFF": "y\u0308", + // ÿ = \"{y} + "\u1EF9": "y\u0303", + // ỹ = \~{y} + "\u0233": "y\u0304", + // ȳ = \={y} + "\u0177": "y\u0302", + // ŷ = \^{y} + "\u1E8F": "y\u0307", + // ẏ = \.{y} + "\u1E99": "y\u030A", + // ẙ = \r{y} + "\u017A": "z\u0301", + // ź = \'{z} + "\u017E": "z\u030C", + // ž = \v{z} + "\u1E91": "z\u0302", + // ẑ = \^{z} + "\u017C": "z\u0307", + // ż = \.{z} + "\xC1": "A\u0301", + // Á = \'{A} + "\xC0": "A\u0300", + // À = \`{A} + "\xC4": "A\u0308", + // Ä = \"{A} + "\u01DE": "A\u0308\u0304", + // Ǟ = \"\={A} + "\xC3": "A\u0303", + // Ã = \~{A} + "\u0100": "A\u0304", + // Ā = \={A} + "\u0102": "A\u0306", + // Ă = \u{A} + "\u1EAE": "A\u0306\u0301", + // Ắ = \u\'{A} + "\u1EB0": "A\u0306\u0300", + // Ằ = \u\`{A} + "\u1EB4": "A\u0306\u0303", + // Ẵ = \u\~{A} + "\u01CD": "A\u030C", + // Ǎ = \v{A} + "\xC2": "A\u0302", + // Â = \^{A} + "\u1EA4": "A\u0302\u0301", + // Ấ = \^\'{A} + "\u1EA6": "A\u0302\u0300", + // Ầ = \^\`{A} + "\u1EAA": "A\u0302\u0303", + // Ẫ = \^\~{A} + "\u0226": "A\u0307", + // Ȧ = \.{A} + "\u01E0": "A\u0307\u0304", + // Ǡ = \.\={A} + "\xC5": "A\u030A", + // Å = \r{A} + "\u01FA": "A\u030A\u0301", + // Ǻ = \r\'{A} + "\u1E02": "B\u0307", + // Ḃ = \.{B} + "\u0106": "C\u0301", + // Ć = \'{C} + "\u010C": "C\u030C", + // Č = \v{C} + "\u0108": "C\u0302", + // Ĉ = \^{C} + "\u010A": "C\u0307", + // Ċ = \.{C} + "\u010E": "D\u030C", + // Ď = \v{D} + "\u1E0A": "D\u0307", + // Ḋ = \.{D} + "\xC9": "E\u0301", + // É = \'{E} + "\xC8": "E\u0300", + // È = \`{E} + "\xCB": "E\u0308", + // Ë = \"{E} + "\u1EBC": "E\u0303", + // Ẽ = \~{E} + "\u0112": "E\u0304", + // Ē = \={E} + "\u1E16": "E\u0304\u0301", + // Ḗ = \=\'{E} + "\u1E14": "E\u0304\u0300", + // Ḕ = \=\`{E} + "\u0114": "E\u0306", + // Ĕ = \u{E} + "\u011A": "E\u030C", + // Ě = \v{E} + "\xCA": "E\u0302", + // Ê = \^{E} + "\u1EBE": "E\u0302\u0301", + // Ế = \^\'{E} + "\u1EC0": "E\u0302\u0300", + // Ề = \^\`{E} + "\u1EC4": "E\u0302\u0303", + // Ễ = \^\~{E} + "\u0116": "E\u0307", + // Ė = \.{E} + "\u1E1E": "F\u0307", + // Ḟ = \.{F} + "\u01F4": "G\u0301", + // Ǵ = \'{G} + "\u1E20": "G\u0304", + // Ḡ = \={G} + "\u011E": "G\u0306", + // Ğ = \u{G} + "\u01E6": "G\u030C", + // Ǧ = \v{G} + "\u011C": "G\u0302", + // Ĝ = \^{G} + "\u0120": "G\u0307", + // Ġ = \.{G} + "\u1E26": "H\u0308", + // Ḧ = \"{H} + "\u021E": "H\u030C", + // Ȟ = \v{H} + "\u0124": "H\u0302", + // Ĥ = \^{H} + "\u1E22": "H\u0307", + // Ḣ = \.{H} + "\xCD": "I\u0301", + // Í = \'{I} + "\xCC": "I\u0300", + // Ì = \`{I} + "\xCF": "I\u0308", + // Ï = \"{I} + "\u1E2E": "I\u0308\u0301", + // Ḯ = \"\'{I} + "\u0128": "I\u0303", + // Ĩ = \~{I} + "\u012A": "I\u0304", + // Ī = \={I} + "\u012C": "I\u0306", + // Ĭ = \u{I} + "\u01CF": "I\u030C", + // Ǐ = \v{I} + "\xCE": "I\u0302", + // Î = \^{I} + "\u0130": "I\u0307", + // İ = \.{I} + "\u0134": "J\u0302", + // Ĵ = \^{J} + "\u1E30": "K\u0301", + // Ḱ = \'{K} + "\u01E8": "K\u030C", + // Ǩ = \v{K} + "\u0139": "L\u0301", + // Ĺ = \'{L} + "\u013D": "L\u030C", + // Ľ = \v{L} + "\u1E3E": "M\u0301", + // Ḿ = \'{M} + "\u1E40": "M\u0307", + // Ṁ = \.{M} + "\u0143": "N\u0301", + // Ń = \'{N} + "\u01F8": "N\u0300", + // Ǹ = \`{N} + "\xD1": "N\u0303", + // Ñ = \~{N} + "\u0147": "N\u030C", + // Ň = \v{N} + "\u1E44": "N\u0307", + // Ṅ = \.{N} + "\xD3": "O\u0301", + // Ó = \'{O} + "\xD2": "O\u0300", + // Ò = \`{O} + "\xD6": "O\u0308", + // Ö = \"{O} + "\u022A": "O\u0308\u0304", + // Ȫ = \"\={O} + "\xD5": "O\u0303", + // Õ = \~{O} + "\u1E4C": "O\u0303\u0301", + // Ṍ = \~\'{O} + "\u1E4E": "O\u0303\u0308", + // Ṏ = \~\"{O} + "\u022C": "O\u0303\u0304", + // Ȭ = \~\={O} + "\u014C": "O\u0304", + // Ō = \={O} + "\u1E52": "O\u0304\u0301", + // Ṓ = \=\'{O} + "\u1E50": "O\u0304\u0300", + // Ṑ = \=\`{O} + "\u014E": "O\u0306", + // Ŏ = \u{O} + "\u01D1": "O\u030C", + // Ǒ = \v{O} + "\xD4": "O\u0302", + // Ô = \^{O} + "\u1ED0": "O\u0302\u0301", + // Ố = \^\'{O} + "\u1ED2": "O\u0302\u0300", + // Ồ = \^\`{O} + "\u1ED6": "O\u0302\u0303", + // Ỗ = \^\~{O} + "\u022E": "O\u0307", + // Ȯ = \.{O} + "\u0230": "O\u0307\u0304", + // Ȱ = \.\={O} + "\u0150": "O\u030B", + // Ő = \H{O} + "\u1E54": "P\u0301", + // Ṕ = \'{P} + "\u1E56": "P\u0307", + // Ṗ = \.{P} + "\u0154": "R\u0301", + // Ŕ = \'{R} + "\u0158": "R\u030C", + // Ř = \v{R} + "\u1E58": "R\u0307", + // Ṙ = \.{R} + "\u015A": "S\u0301", + // Ś = \'{S} + "\u1E64": "S\u0301\u0307", + // Ṥ = \'\.{S} + "\u0160": "S\u030C", + // Š = \v{S} + "\u1E66": "S\u030C\u0307", + // Ṧ = \v\.{S} + "\u015C": "S\u0302", + // Ŝ = \^{S} + "\u1E60": "S\u0307", + // Ṡ = \.{S} + "\u0164": "T\u030C", + // Ť = \v{T} + "\u1E6A": "T\u0307", + // Ṫ = \.{T} + "\xDA": "U\u0301", + // Ú = \'{U} + "\xD9": "U\u0300", + // Ù = \`{U} + "\xDC": "U\u0308", + // Ü = \"{U} + "\u01D7": "U\u0308\u0301", + // Ǘ = \"\'{U} + "\u01DB": "U\u0308\u0300", + // Ǜ = \"\`{U} + "\u01D5": "U\u0308\u0304", + // Ǖ = \"\={U} + "\u01D9": "U\u0308\u030C", + // Ǚ = \"\v{U} + "\u0168": "U\u0303", + // Ũ = \~{U} + "\u1E78": "U\u0303\u0301", + // Ṹ = \~\'{U} + "\u016A": "U\u0304", + // Ū = \={U} + "\u1E7A": "U\u0304\u0308", + // Ṻ = \=\"{U} + "\u016C": "U\u0306", + // Ŭ = \u{U} + "\u01D3": "U\u030C", + // Ǔ = \v{U} + "\xDB": "U\u0302", + // Û = \^{U} + "\u016E": "U\u030A", + // Ů = \r{U} + "\u0170": "U\u030B", + // Ű = \H{U} + "\u1E7C": "V\u0303", + // Ṽ = \~{V} + "\u1E82": "W\u0301", + // Ẃ = \'{W} + "\u1E80": "W\u0300", + // Ẁ = \`{W} + "\u1E84": "W\u0308", + // Ẅ = \"{W} + "\u0174": "W\u0302", + // Ŵ = \^{W} + "\u1E86": "W\u0307", + // Ẇ = \.{W} + "\u1E8C": "X\u0308", + // Ẍ = \"{X} + "\u1E8A": "X\u0307", + // Ẋ = \.{X} + "\xDD": "Y\u0301", + // Ý = \'{Y} + "\u1EF2": "Y\u0300", + // Ỳ = \`{Y} + "\u0178": "Y\u0308", + // Ÿ = \"{Y} + "\u1EF8": "Y\u0303", + // Ỹ = \~{Y} + "\u0232": "Y\u0304", + // Ȳ = \={Y} + "\u0176": "Y\u0302", + // Ŷ = \^{Y} + "\u1E8E": "Y\u0307", + // Ẏ = \.{Y} + "\u0179": "Z\u0301", + // Ź = \'{Z} + "\u017D": "Z\u030C", + // Ž = \v{Z} + "\u1E90": "Z\u0302", + // Ẑ = \^{Z} + "\u017B": "Z\u0307", + // Ż = \.{Z} + "\u03AC": "\u03B1\u0301", + // ά = \'{α} + "\u1F70": "\u03B1\u0300", + // ὰ = \`{α} + "\u1FB1": "\u03B1\u0304", + // ᾱ = \={α} + "\u1FB0": "\u03B1\u0306", + // ᾰ = \u{α} + "\u03AD": "\u03B5\u0301", + // έ = \'{ε} + "\u1F72": "\u03B5\u0300", + // ὲ = \`{ε} + "\u03AE": "\u03B7\u0301", + // ή = \'{η} + "\u1F74": "\u03B7\u0300", + // ὴ = \`{η} + "\u03AF": "\u03B9\u0301", + // ί = \'{ι} + "\u1F76": "\u03B9\u0300", + // ὶ = \`{ι} + "\u03CA": "\u03B9\u0308", + // ϊ = \"{ι} + "\u0390": "\u03B9\u0308\u0301", + // ΐ = \"\'{ι} + "\u1FD2": "\u03B9\u0308\u0300", + // ῒ = \"\`{ι} + "\u1FD1": "\u03B9\u0304", + // ῑ = \={ι} + "\u1FD0": "\u03B9\u0306", + // ῐ = \u{ι} + "\u03CC": "\u03BF\u0301", + // ό = \'{ο} + "\u1F78": "\u03BF\u0300", + // ὸ = \`{ο} + "\u03CD": "\u03C5\u0301", + // ύ = \'{υ} + "\u1F7A": "\u03C5\u0300", + // ὺ = \`{υ} + "\u03CB": "\u03C5\u0308", + // ϋ = \"{υ} + "\u03B0": "\u03C5\u0308\u0301", + // ΰ = \"\'{υ} + "\u1FE2": "\u03C5\u0308\u0300", + // ῢ = \"\`{υ} + "\u1FE1": "\u03C5\u0304", + // ῡ = \={υ} + "\u1FE0": "\u03C5\u0306", + // ῠ = \u{υ} + "\u03CE": "\u03C9\u0301", + // ώ = \'{ω} + "\u1F7C": "\u03C9\u0300", + // ὼ = \`{ω} + "\u038E": "\u03A5\u0301", + // Ύ = \'{Υ} + "\u1FEA": "\u03A5\u0300", + // Ὺ = \`{Υ} + "\u03AB": "\u03A5\u0308", + // Ϋ = \"{Υ} + "\u1FE9": "\u03A5\u0304", + // Ῡ = \={Υ} + "\u1FE8": "\u03A5\u0306", + // Ῠ = \u{Υ} + "\u038F": "\u03A9\u0301", + // Ώ = \'{Ω} + "\u1FFA": "\u03A9\u0300" // Ὼ = \`{Ω} + +}); +// CONCATENATED MODULE: ./src/Parser.js +/* eslint no-constant-condition:0 */ + + + + + + + + + + + + + + + +/** + * This file contains the parser used to parse out a TeX expression from the + * input. Since TeX isn't context-free, standard parsers don't work particularly + * well. + * + * The strategy of this parser is as such: + * + * The main functions (the `.parse...` ones) take a position in the current + * parse string to parse tokens from. The lexer (found in Lexer.js, stored at + * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When + * individual tokens are needed at a position, the lexer is called to pull out a + * token, which is then used. + * + * The parser has a property called "mode" indicating the mode that + * the parser is currently in. Currently it has to be one of "math" or + * "text", which denotes whether the current environment is a math-y + * one or a text-y one (e.g. inside \text). Currently, this serves to + * limit the functions which can be used in text mode. + * + * The main functions then return an object which contains the useful data that + * was parsed at its given point, and a new position at the end of the parsed + * data. The main functions can call each other and continue the parsing by + * using the returned position as a new starting point. + * + * There are also extra `.handle...` functions, which pull out some reused + * functionality into self-contained functions. + * + * The functions return ParseNodes. + */ +var Parser_Parser = +/*#__PURE__*/ +function () { + function Parser(input, settings) { + this.mode = void 0; + this.gullet = void 0; + this.settings = void 0; + this.leftrightDepth = void 0; + this.nextToken = void 0; + // Start in math mode + this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a + // new lexer (mouth) for this parser (stomach, in the language of TeX) + + this.gullet = new MacroExpander_MacroExpander(input, settings, this.mode); // Store the settings for use in parsing + + this.settings = settings; // Count leftright depth (for \middle errors) + + this.leftrightDepth = 0; + } + /** + * Checks a result to make sure it has the right type, and throws an + * appropriate error otherwise. + */ + + + var _proto = Parser.prototype; + + _proto.expect = function expect(text, consume) { + if (consume === void 0) { + consume = true; + } + + if (this.nextToken.text !== text) { + throw new src_ParseError("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken); + } + + if (consume) { + this.consume(); + } + }; + /** + * Considers the current look ahead token as consumed, + * and fetches the one after that as the new look ahead. + */ + + + _proto.consume = function consume() { + this.nextToken = this.gullet.expandNextToken(); + }; + /** + * Switches between "text" and "math" modes. + */ + + + _proto.switchMode = function switchMode(newMode) { + this.mode = newMode; + this.gullet.switchMode(newMode); + }; + /** + * Main parsing function, which parses an entire input. + */ + + + _proto.parse = function parse() { + // Create a group namespace for the math expression. + // (LaTeX creates a new group for every $...$, $$...$$, \[...\].) + this.gullet.beginGroup(); // Use old \color behavior (same as LaTeX's \textcolor) if requested. + // We do this within the group for the math expression, so it doesn't + // pollute settings.macros. + + if (this.settings.colorIsTextColor) { + this.gullet.macros.set("\\color", "\\textcolor"); + } // Try to parse the input + + + this.consume(); + var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end + + this.expect("EOF", false); // End the group namespace for the expression + + this.gullet.endGroup(); + return parse; + }; + + /** + * Parses an "expression", which is a list of atoms. + * + * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This + * happens when functions have higher precendence han infix + * nodes in implicit parses. + * + * `breakOnTokenText`: The text of the token that the expression should end + * with, or `null` if something else should end the + * expression. + */ + _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) { + var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either + // we reached the end, a }, or a \right) + + while (true) { + // Ignore spaces in math mode + if (this.mode === "math") { + this.consumeSpaces(); + } + + var lex = this.nextToken; + + if (Parser.endOfExpression.indexOf(lex.text) !== -1) { + break; + } + + if (breakOnTokenText && lex.text === breakOnTokenText) { + break; + } + + if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) { + break; + } + + var atom = this.parseAtom(breakOnTokenText); + + if (!atom) { + break; + } + + body.push(atom); + } + + if (this.mode === "text") { + this.formLigatures(body); + } + + return this.handleInfixNodes(body); + }; + /** + * Rewrites infix operators such as \over with corresponding commands such + * as \frac. + * + * There can only be one infix operator per group. If there's more than one + * then the expression is ambiguous. This can be resolved by adding {}. + */ + + + _proto.handleInfixNodes = function handleInfixNodes(body) { + var overIndex = -1; + var funcName; + + for (var i = 0; i < body.length; i++) { + var node = checkNodeType(body[i], "infix"); + + if (node) { + if (overIndex !== -1) { + throw new src_ParseError("only one infix operator per group", node.token); + } + + overIndex = i; + funcName = node.replaceWith; + } + } + + if (overIndex !== -1 && funcName) { + var numerNode; + var denomNode; + var numerBody = body.slice(0, overIndex); + var denomBody = body.slice(overIndex + 1); + + if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { + numerNode = numerBody[0]; + } else { + numerNode = { + type: "ordgroup", + mode: this.mode, + body: numerBody + }; + } + + if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { + denomNode = denomBody[0]; + } else { + denomNode = { + type: "ordgroup", + mode: this.mode, + body: denomBody + }; + } + + var _node; + + if (funcName === "\\\\abovefrac") { + _node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); + } else { + _node = this.callFunction(funcName, [numerNode, denomNode], []); + } + + return [_node]; + } else { + return body; + } + }; // The greediness of a superscript or subscript + + + /** + * Handle a subscript or superscript with nice errors. + */ + _proto.handleSupSubscript = function handleSupSubscript(name) { + var symbolToken = this.nextToken; + var symbol = symbolToken.text; + this.consume(); + this.consumeSpaces(); // ignore spaces before sup/subscript argument + + var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS); + + if (!group) { + throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken); + } + + return group; + }; + /** + * Converts the textual input of an unsupported command into a text node + * contained within a color node whose color is determined by errorColor + */ + + + _proto.handleUnsupportedCmd = function handleUnsupportedCmd() { + var text = this.nextToken.text; + var textordArray = []; + + for (var i = 0; i < text.length; i++) { + textordArray.push({ + type: "textord", + mode: "text", + text: text[i] + }); + } + + var textNode = { + type: "text", + mode: this.mode, + body: textordArray + }; + var colorNode = { + type: "color", + mode: this.mode, + color: this.settings.errorColor, + body: [textNode] + }; + this.consume(); + return colorNode; + }; + /** + * Parses a group with optional super/subscripts. + */ + + + _proto.parseAtom = function parseAtom(breakOnTokenText) { + // The body of an atom is an implicit group, so that things like + // \left(x\right)^2 work correctly. + var base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts + + if (this.mode === "text") { + return base; + } // Note that base may be empty (i.e. null) at this point. + + + var superscript; + var subscript; + + while (true) { + // Guaranteed in math mode, so eat any spaces first. + this.consumeSpaces(); // Lex the first token + + var lex = this.nextToken; + + if (lex.text === "\\limits" || lex.text === "\\nolimits") { + // We got a limit control + var opNode = checkNodeType(base, "op"); + + if (opNode) { + var limits = lex.text === "\\limits"; + opNode.limits = limits; + opNode.alwaysHandleSupSub = true; + } else { + throw new src_ParseError("Limit controls must follow a math operator", lex); + } + + this.consume(); + } else if (lex.text === "^") { + // We got a superscript start + if (superscript) { + throw new src_ParseError("Double superscript", lex); + } + + superscript = this.handleSupSubscript("superscript"); + } else if (lex.text === "_") { + // We got a subscript start + if (subscript) { + throw new src_ParseError("Double subscript", lex); + } + + subscript = this.handleSupSubscript("subscript"); + } else if (lex.text === "'") { + // We got a prime + if (superscript) { + throw new src_ParseError("Double superscript", lex); + } + + var prime = { + type: "textord", + mode: this.mode, + text: "\\prime" + }; // Many primes can be grouped together, so we handle this here + + var primes = [prime]; + this.consume(); // Keep lexing tokens until we get something that's not a prime + + while (this.nextToken.text === "'") { + // For each one, add another prime to the list + primes.push(prime); + this.consume(); + } // If there's a superscript following the primes, combine that + // superscript in with the primes. + + + if (this.nextToken.text === "^") { + primes.push(this.handleSupSubscript("superscript")); + } // Put everything into an ordgroup as the superscript + + + superscript = { + type: "ordgroup", + mode: this.mode, + body: primes + }; + } else if (lex.text === "%") { + this.consumeComment(); + } else { + // If it wasn't ^, _, or ', stop parsing super/subscripts + break; + } + } // Base must be set if superscript or subscript are set per logic above, + // but need to check here for type check to pass. + + + if (superscript || subscript) { + // If we got either a superscript or subscript, create a supsub + return { + type: "supsub", + mode: this.mode, + base: base, + sup: superscript, + sub: subscript + }; + } else { + // Otherwise return the original body + return base; + } + }; + /** + * Parses an entire function, including its base and all of its arguments. + */ + + + _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting. + greediness) { + var token = this.nextToken; + var func = token.text; + var funcData = src_functions[func]; + + if (!funcData) { + return null; + } + + if (greediness != null && funcData.greediness <= greediness) { + throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); + } else if (this.mode === "text" && !funcData.allowedInText) { + throw new src_ParseError("Can't use function '" + func + "' in text mode", token); + } else if (this.mode === "math" && funcData.allowedInMath === false) { + throw new src_ParseError("Can't use function '" + func + "' in math mode", token); + } // Consume the command token after possibly switching to the + // mode specified by the function (for instant mode switching), + // and then immediately switch back. + + + if (funcData.consumeMode) { + var oldMode = this.mode; + this.switchMode(funcData.consumeMode); + this.consume(); + this.switchMode(oldMode); + } else { + this.consume(); + } + + var _this$parseArguments = this.parseArguments(func, funcData), + args = _this$parseArguments.args, + optArgs = _this$parseArguments.optArgs; + + return this.callFunction(func, args, optArgs, token, breakOnTokenText); + }; + /** + * Call a function handler with a suitable context and arguments. + */ + + + _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) { + var context = { + funcName: name, + parser: this, + token: token, + breakOnTokenText: breakOnTokenText + }; + var func = src_functions[name]; + + if (func && func.handler) { + return func.handler(context, args, optArgs); + } else { + throw new src_ParseError("No function handler for " + name); + } + }; + /** + * Parses the arguments of a function or environment + */ + + + _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}". + funcData) { + var totalArgs = funcData.numArgs + funcData.numOptionalArgs; + + if (totalArgs === 0) { + return { + args: [], + optArgs: [] + }; + } + + var baseGreediness = funcData.greediness; + var args = []; + var optArgs = []; + + for (var i = 0; i < totalArgs; i++) { + var argType = funcData.argTypes && funcData.argTypes[i]; + var isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: + // "After you have said ‘\def\row#1#2{...}’, you are allowed to + // put spaces between the arguments (e.g., ‘\row x n’), because + // TeX doesn’t use single spaces as undelimited arguments." + + if (i > 0 && !isOptional) { + this.consumeSpaces(); + } // Also consume leading spaces in math mode, as parseSymbol + // won't know what to do with them. This can only happen with + // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. + // In LaTeX, the \foo's get treated as (blank) arguments). + // In KaTeX, for now, both spaces will get consumed. + // TODO(edemaine) + + + if (i === 0 && !isOptional && this.mode === "math") { + this.consumeSpaces(); + } + + var nextToken = this.nextToken; + var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness); + + if (!arg) { + if (isOptional) { + optArgs.push(null); + continue; + } + + throw new src_ParseError("Expected group after '" + func + "'", nextToken); + } + + (isOptional ? optArgs : args).push(arg); + } + + return { + args: args, + optArgs: optArgs + }; + }; + /** + * Parses a group when the mode is changing. + */ + + + _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness) { + switch (type) { + case "color": + return this.parseColorGroup(optional); + + case "size": + return this.parseSizeGroup(optional); + + case "url": + return this.parseUrlGroup(optional); + + case "math": + case "text": + return this.parseGroup(name, optional, greediness, undefined, type); + + case "original": + case null: + case undefined: + return this.parseGroup(name, optional, greediness); + + default: + throw new src_ParseError("Unknown group type as " + name, this.nextToken); + } + }; + + _proto.consumeSpaces = function consumeSpaces() { + while (this.nextToken.text === " ") { + this.consume(); + } + }; + + _proto.consumeComment = function consumeComment() { + // the newline character is normalized in Lexer, check original source + while (this.nextToken.text !== "EOF" && this.nextToken.loc && this.nextToken.loc.getSource().indexOf("\n") === -1) { + this.consume(); + } + + if (this.nextToken.text === "EOF") { + this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)"); + } + + if (this.mode === "math") { + this.consumeSpaces(); // ignore spaces in math mode + } else if (this.nextToken.loc) { + // text mode + var source = this.nextToken.loc.getSource(); + + if (source.indexOf("\n") === source.length - 1) { + this.consumeSpaces(); // if no space after the first newline + } + } + }; + /** + * Parses a group, essentially returning the string formed by the + * brace-enclosed tokens plus some position information. + */ + + + _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages. + optional, raw) { + var groupBegin = optional ? "[" : "{"; + var groupEnd = optional ? "]" : "}"; + var nextToken = this.nextToken; + + if (nextToken.text !== groupBegin) { + if (optional) { + return null; + } else if (raw && nextToken.text !== "EOF" && /[^{}[\]]/.test(nextToken.text)) { + // allow a single character in raw string group + this.consume(); + return nextToken; + } + } + + var outerMode = this.mode; + this.mode = "text"; + this.expect(groupBegin); + var str = ""; + var firstToken = this.nextToken; + var nested = 0; // allow nested braces in raw string group + + var lastToken = firstToken; + + while (raw && nested > 0 || this.nextToken.text !== groupEnd) { + switch (this.nextToken.text) { + case "EOF": + throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); + + case "%": + if (!raw) { + // allow % in raw string group + this.consumeComment(); + continue; + } + + break; + + case groupBegin: + nested++; + break; + + case groupEnd: + nested--; + break; + } + + lastToken = this.nextToken; + str += lastToken.text; + this.consume(); + } + + this.mode = outerMode; + this.expect(groupEnd); + return firstToken.range(lastToken, str); + }; + /** + * Parses a regex-delimited group: the largest sequence of tokens + * whose concatenated strings match `regex`. Returns the string + * formed by the tokens plus some position information. + */ + + + _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) { + var outerMode = this.mode; + this.mode = "text"; + var firstToken = this.nextToken; + var lastToken = firstToken; + var str = ""; + + while (this.nextToken.text !== "EOF" && (regex.test(str + this.nextToken.text) || this.nextToken.text === "%")) { + if (this.nextToken.text === "%") { + this.consumeComment(); + continue; + } + + lastToken = this.nextToken; + str += lastToken.text; + this.consume(); + } + + if (str === "") { + throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); + } + + this.mode = outerMode; + return firstToken.range(lastToken, str); + }; + /** + * Parses a color description. + */ + + + _proto.parseColorGroup = function parseColorGroup(optional) { + var res = this.parseStringGroup("color", optional); + + if (!res) { + return null; + } + + var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); + + if (!match) { + throw new src_ParseError("Invalid color: '" + res.text + "'", res); + } + + var color = match[0]; + + if (/^[0-9a-f]{6}$/i.test(color)) { + // We allow a 6-digit HTML color spec without a leading "#". + // This follows the xcolor package's HTML color model. + // Predefined color names are all missed by this RegEx pattern. + color = "#" + color; + } + + return { + type: "color-token", + mode: this.mode, + color: color + }; + }; + /** + * Parses a size specification, consisting of magnitude and unit. + */ + + + _proto.parseSizeGroup = function parseSizeGroup(optional) { + var res; + var isBlank = false; + + if (!optional && this.nextToken.text !== "{") { + res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); + } else { + res = this.parseStringGroup("size", optional); + } + + if (!res) { + return null; + } + + if (!optional && res.text.length === 0) { + // Because we've tested for what is !optional, this block won't + // affect \kern, \hspace, etc. It will capture the mandatory arguments + // to \genfrac and \above. + res.text = "0pt"; // Enable \above{} + + isBlank = true; // This is here specifically for \genfrac + } + + var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); + + if (!match) { + throw new src_ParseError("Invalid size: '" + res.text + "'", res); + } + + var data = { + number: +(match[1] + match[2]), + // sign + magnitude, cast to number + unit: match[3] + }; + + if (!validUnit(data)) { + throw new src_ParseError("Invalid unit: '" + data.unit + "'", res); + } + + return { + type: "size", + mode: this.mode, + value: data, + isBlank: isBlank + }; + }; + /** + * Parses an URL, checking escaped letters and allowed protocols. + */ + + + _proto.parseUrlGroup = function parseUrlGroup(optional) { + var res = this.parseStringGroup("url", optional, true); // get raw string + + if (!res) { + return null; + } // hyperref package allows backslashes alone in href, but doesn't + // generate valid links in such cases; we interpret this as + // "undefined" behaviour, and keep them as-is. Some browser will + // replace backslashes with forward slashes. + + + var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); + var protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); + protocol = protocol != null ? protocol[1] : "_relative"; + var allowed = this.settings.allowedProtocols; + + if (!utils.contains(allowed, "*") && !utils.contains(allowed, protocol)) { + throw new src_ParseError("Forbidden protocol '" + protocol + "'", res); + } + + return { + type: "url", + mode: this.mode, + url: url + }; + }; + /** + * If `optional` is false or absent, this parses an ordinary group, + * which is either a single nucleus (like "x") or an expression + * in braces (like "{x+y}") or an implicit group, a group that starts + * at the current position, and ends right before a higher explicit + * group ends, or at EOF. + * If `optional` is true, it parses either a bracket-delimited expression + * (like "[x+y]") or returns null to indicate the absence of a + * bracket-enclosed group. + * If `mode` is present, switches to that mode while parsing the group, + * and switches back after. + */ + + + _proto.parseGroup = function parseGroup(name, // For error reporting. + optional, greediness, breakOnTokenText, mode) { + var outerMode = this.mode; + var firstToken = this.nextToken; + var text = firstToken.text; // Switch to specified mode + + if (mode) { + this.switchMode(mode); + } + + var result; // Try to parse an open brace + + if (text === (optional ? "[" : "{")) { + // Start a new group namespace + this.gullet.beginGroup(); // If we get a brace, parse an expression + + this.consume(); + var expression = this.parseExpression(false, optional ? "]" : "}"); + var lastToken = this.nextToken; // Switch mode back before consuming symbol after close brace + + if (mode) { + this.switchMode(outerMode); + } // End group namespace before consuming symbol after close brace + + + this.gullet.endGroup(); // Make sure we get a close brace + + this.expect(optional ? "]" : "}"); + return { + type: "ordgroup", + mode: this.mode, + loc: SourceLocation.range(firstToken, lastToken), + body: expression + }; + } else if (optional) { + // Return nothing for an optional group + result = null; + } else { + // If there exists a function with this name, parse the function. + // Otherwise, just return a nucleus + result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); + + if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { + if (this.settings.throwOnError) { + throw new src_ParseError("Undefined control sequence: " + text, firstToken); + } + + result = this.handleUnsupportedCmd(); + } + } // Switch mode back + + + if (mode) { + this.switchMode(outerMode); + } + + return result; + }; + /** + * Form ligature-like combinations of characters for text mode. + * This includes inputs like "--", "---", "``" and "''". + * The result will simply replace multiple textord nodes with a single + * character in each value by a single textord node having multiple + * characters in its value. The representation is still ASCII source. + * The group will be modified in place. + */ + + + _proto.formLigatures = function formLigatures(group) { + var n = group.length - 1; + + for (var i = 0; i < n; ++i) { + var a = group[i]; // $FlowFixMe: Not every node type has a `text` property. + + var v = a.text; + + if (v === "-" && group[i + 1].text === "-") { + if (i + 1 < n && group[i + 2].text === "-") { + group.splice(i, 3, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 2]), + text: "---" + }); + n -= 2; + } else { + group.splice(i, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 1]), + text: "--" + }); + n -= 1; + } + } + + if ((v === "'" || v === "`") && group[i + 1].text === v) { + group.splice(i, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 1]), + text: v + v + }); + n -= 1; + } + } + }; + /** + * Parse a single symbol out of the string. Here, we handle single character + * symbols and special functions like verbatim + */ + + + _proto.parseSymbol = function parseSymbol() { + var nucleus = this.nextToken; + var text = nucleus.text; + + if (/^\\verb[^a-zA-Z]/.test(text)) { + this.consume(); + var arg = text.slice(5); + var star = arg.charAt(0) === "*"; + + if (star) { + arg = arg.slice(1); + } // Lexer's tokenRegex is constructed to always have matching + // first/last characters. + + + if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { + throw new src_ParseError("\\verb assertion failed --\n please report what input caused this bug"); + } + + arg = arg.slice(1, -1); // remove first and last char + + return { + type: "verb", + mode: "text", + body: arg, + star: star + }; + } else if (text === "%") { + this.consumeComment(); + return this.parseSymbol(); + } // At this point, we should have a symbol, possibly with accents. + // First expand any accented base symbol according to unicodeSymbols. + + + if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) { + // This behavior is not strict (XeTeX-compatible) in math mode. + if (this.settings.strict && this.mode === "math") { + this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); + } + + text = unicodeSymbols[text[0]] + text.substr(1); + } // Strip off any combining characters + + + var match = combiningDiacriticalMarksEndRegex.exec(text); + + if (match) { + text = text.substring(0, match.index); + + if (text === 'i') { + text = "\u0131"; // dotless i, in math and text mode + } else if (text === 'j') { + text = "\u0237"; // dotless j, in math and text mode + } + } // Recognize base symbol + + + var symbol; + + if (src_symbols[this.mode][text]) { + if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) { + this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus); + } + + var group = src_symbols[this.mode][text].group; + var loc = SourceLocation.range(nucleus); + var s; + + if (ATOMS.hasOwnProperty(group)) { + // $FlowFixMe + var family = group; + s = { + type: "atom", + mode: this.mode, + family: family, + loc: loc, + text: text + }; + } else { + // $FlowFixMe + s = { + type: group, + mode: this.mode, + loc: loc, + text: text + }; + } + + symbol = s; + } else if (text.charCodeAt(0) >= 0x80) { + // no symbol for e.g. ^ + if (this.settings.strict) { + if (!supportedCodepoint(text.charCodeAt(0))) { + this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus); + } else if (this.mode === "math") { + this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus); + } + } + + symbol = { + type: "textord", + mode: this.mode, + loc: SourceLocation.range(nucleus), + text: text + }; + } else { + return null; // EOF, ^, _, {, }, etc. + } + + this.consume(); // Transform combining characters into accents + + if (match) { + for (var i = 0; i < match[0].length; i++) { + var accent = match[0][i]; + + if (!unicodeAccents[accent]) { + throw new src_ParseError("Unknown accent ' " + accent + "'", nucleus); + } + + var command = unicodeAccents[accent][this.mode]; + + if (!command) { + throw new src_ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus); + } + + symbol = { + type: "accent", + mode: this.mode, + loc: SourceLocation.range(nucleus), + label: command, + isStretchy: false, + isShifty: true, + base: symbol + }; + } + } + + return symbol; + }; + + return Parser; +}(); + +Parser_Parser.endOfExpression = ["}", "\\end", "\\right", "&"]; +Parser_Parser.SUPSUB_GREEDINESS = 1; + +// CONCATENATED MODULE: ./src/parseTree.js /** * Provides a single function for parsing an expression using a Parser * TODO(emily): Remove this */ -var Parser = require("./Parser"); + /** * Parses an expression using a Parser, then returns the parsed result. */ -var parseTree = function(toParse, settings) { - if (!(typeof toParse === 'string' || toParse instanceof String)) { - throw new TypeError('KaTeX can only parse string typed expression'); - } - var parser = new Parser(toParse, settings); +var parseTree_parseTree = function parseTree(toParse, settings) { + if (!(typeof toParse === 'string' || toParse instanceof String)) { + throw new TypeError('KaTeX can only parse string typed expression'); + } - return parser.parse(); + var parser = new Parser_Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors + + delete parser.gullet.macros.current["\\df@tag"]; + var tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. + // In this case, we separately parse the tag and wrap the tree. + + if (parser.gullet.macros.get("\\df@tag")) { + if (!settings.displayMode) { + throw new src_ParseError("\\tag works only in display equations"); + } + + parser.gullet.feed("\\df@tag"); + tree = [{ + type: "tag", + mode: "text", + body: tree, + tag: parser.parse() + }]; + } + + return tree; }; -module.exports = parseTree; +/* harmony default export */ var src_parseTree = (parseTree_parseTree); +// CONCATENATED MODULE: ./katex.js +/* eslint no-console:0 */ -},{"./Parser":7}],23:[function(require,module,exports){ /** - * This file holds a list of all no-argument functions and single-character - * symbols (like 'a' or ';'). + * This is the main entry point for KaTeX. Here, we expose functions for + * rendering expressions either to DOM nodes or to markup strings. * - * For each of the symbols, there are three properties they can have: - * - font (required): the font to be used for this symbol. Either "main" (the - normal font), or "ams" (the ams fonts). - * - group (required): the ParseNode group type the symbol should have (i.e. - "textord", "mathord", etc). - See https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types - * - replace: the character that this symbol or function should be - * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi - * character in the main font). - * - * The outermost map in the table indicates what mode the symbols should be - * accepted in (e.g. "math" or "text"). + * We also expose the ParseError class to check if errors thrown from KaTeX are + * errors in the expression, or errors in javascript handling. */ -module.exports = { - math: {}, - text: {} -}; -function defineSymbol(mode, font, group, replace, name) { - module.exports[mode][name] = { - font: font, - group: group, - replace: replace - }; -} -// Some abbreviations for commonly used strings. -// This helps minify the code, and also spotting typos using jshint. -// modes: -var math = "math"; -var text = "text"; -// fonts: -var main = "main"; -var ams = "ams"; -// groups: -var accent = "accent"; -var bin = "bin"; -var close = "close"; -var inner = "inner"; -var mathord = "mathord"; -var op = "op"; -var open = "open"; -var punct = "punct"; -var rel = "rel"; -var spacing = "spacing"; -var textord = "textord"; -// Now comes the symbol table -// Relation Symbols -defineSymbol(math, main, rel, "\u2261", "\\equiv"); -defineSymbol(math, main, rel, "\u227a", "\\prec"); -defineSymbol(math, main, rel, "\u227b", "\\succ"); -defineSymbol(math, main, rel, "\u223c", "\\sim"); -defineSymbol(math, main, rel, "\u22a5", "\\perp"); -defineSymbol(math, main, rel, "\u2aaf", "\\preceq"); -defineSymbol(math, main, rel, "\u2ab0", "\\succeq"); -defineSymbol(math, main, rel, "\u2243", "\\simeq"); -defineSymbol(math, main, rel, "\u2223", "\\mid"); -defineSymbol(math, main, rel, "\u226a", "\\ll"); -defineSymbol(math, main, rel, "\u226b", "\\gg"); -defineSymbol(math, main, rel, "\u224d", "\\asymp"); -defineSymbol(math, main, rel, "\u2225", "\\parallel"); -defineSymbol(math, main, rel, "\u22c8", "\\bowtie"); -defineSymbol(math, main, rel, "\u2323", "\\smile"); -defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq"); -defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq"); -defineSymbol(math, main, rel, "\u2250", "\\doteq"); -defineSymbol(math, main, rel, "\u2322", "\\frown"); -defineSymbol(math, main, rel, "\u220b", "\\ni"); -defineSymbol(math, main, rel, "\u221d", "\\propto"); -defineSymbol(math, main, rel, "\u22a2", "\\vdash"); -defineSymbol(math, main, rel, "\u22a3", "\\dashv"); -defineSymbol(math, main, rel, "\u220b", "\\owns"); -// Punctuation -defineSymbol(math, main, punct, "\u002e", "\\ldotp"); -defineSymbol(math, main, punct, "\u22c5", "\\cdotp"); - -// Misc Symbols -defineSymbol(math, main, textord, "\u0023", "\\#"); -defineSymbol(text, main, textord, "\u0023", "\\#"); -defineSymbol(math, main, textord, "\u0026", "\\&"); -defineSymbol(text, main, textord, "\u0026", "\\&"); -defineSymbol(math, main, textord, "\u2135", "\\aleph"); -defineSymbol(math, main, textord, "\u2200", "\\forall"); -defineSymbol(math, main, textord, "\u210f", "\\hbar"); -defineSymbol(math, main, textord, "\u2203", "\\exists"); -defineSymbol(math, main, textord, "\u2207", "\\nabla"); -defineSymbol(math, main, textord, "\u266d", "\\flat"); -defineSymbol(math, main, textord, "\u2113", "\\ell"); -defineSymbol(math, main, textord, "\u266e", "\\natural"); -defineSymbol(math, main, textord, "\u2663", "\\clubsuit"); -defineSymbol(math, main, textord, "\u2118", "\\wp"); -defineSymbol(math, main, textord, "\u266f", "\\sharp"); -defineSymbol(math, main, textord, "\u2662", "\\diamondsuit"); -defineSymbol(math, main, textord, "\u211c", "\\Re"); -defineSymbol(math, main, textord, "\u2661", "\\heartsuit"); -defineSymbol(math, main, textord, "\u2111", "\\Im"); -defineSymbol(math, main, textord, "\u2660", "\\spadesuit"); - -// Math and Text -defineSymbol(math, main, textord, "\u2020", "\\dag"); -defineSymbol(math, main, textord, "\u2021", "\\ddag"); - -// Large Delimiters -defineSymbol(math, main, close, "\u23b1", "\\rmoustache"); -defineSymbol(math, main, open, "\u23b0", "\\lmoustache"); -defineSymbol(math, main, close, "\u27ef", "\\rgroup"); -defineSymbol(math, main, open, "\u27ee", "\\lgroup"); - -// Binary Operators -defineSymbol(math, main, bin, "\u2213", "\\mp"); -defineSymbol(math, main, bin, "\u2296", "\\ominus"); -defineSymbol(math, main, bin, "\u228e", "\\uplus"); -defineSymbol(math, main, bin, "\u2293", "\\sqcap"); -defineSymbol(math, main, bin, "\u2217", "\\ast"); -defineSymbol(math, main, bin, "\u2294", "\\sqcup"); -defineSymbol(math, main, bin, "\u25ef", "\\bigcirc"); -defineSymbol(math, main, bin, "\u2219", "\\bullet"); -defineSymbol(math, main, bin, "\u2021", "\\ddagger"); -defineSymbol(math, main, bin, "\u2240", "\\wr"); -defineSymbol(math, main, bin, "\u2a3f", "\\amalg"); - -// Arrow Symbols -defineSymbol(math, main, rel, "\u27f5", "\\longleftarrow"); -defineSymbol(math, main, rel, "\u21d0", "\\Leftarrow"); -defineSymbol(math, main, rel, "\u27f8", "\\Longleftarrow"); -defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow"); -defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow"); -defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow"); -defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow"); -defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow"); -defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow"); -defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow"); -defineSymbol(math, main, rel, "\u21a6", "\\mapsto"); -defineSymbol(math, main, rel, "\u27fc", "\\longmapsto"); -defineSymbol(math, main, rel, "\u2197", "\\nearrow"); -defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow"); -defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow"); -defineSymbol(math, main, rel, "\u2198", "\\searrow"); -defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup"); -defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup"); -defineSymbol(math, main, rel, "\u2199", "\\swarrow"); -defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown"); -defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown"); -defineSymbol(math, main, rel, "\u2196", "\\nwarrow"); -defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons"); - -// AMS Negated Binary Relations -defineSymbol(math, ams, rel, "\u226e", "\\nless"); -defineSymbol(math, ams, rel, "\ue010", "\\nleqslant"); -defineSymbol(math, ams, rel, "\ue011", "\\nleqq"); -defineSymbol(math, ams, rel, "\u2a87", "\\lneq"); -defineSymbol(math, ams, rel, "\u2268", "\\lneqq"); -defineSymbol(math, ams, rel, "\ue00c", "\\lvertneqq"); -defineSymbol(math, ams, rel, "\u22e6", "\\lnsim"); -defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox"); -defineSymbol(math, ams, rel, "\u2280", "\\nprec"); -defineSymbol(math, ams, rel, "\u22e0", "\\npreceq"); -defineSymbol(math, ams, rel, "\u22e8", "\\precnsim"); -defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox"); -defineSymbol(math, ams, rel, "\u2241", "\\nsim"); -defineSymbol(math, ams, rel, "\ue006", "\\nshortmid"); -defineSymbol(math, ams, rel, "\u2224", "\\nmid"); -defineSymbol(math, ams, rel, "\u22ac", "\\nvdash"); -defineSymbol(math, ams, rel, "\u22ad", "\\nvDash"); -defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft"); -defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq"); -defineSymbol(math, ams, rel, "\u228a", "\\subsetneq"); -defineSymbol(math, ams, rel, "\ue01a", "\\varsubsetneq"); -defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq"); -defineSymbol(math, ams, rel, "\ue017", "\\varsubsetneqq"); -defineSymbol(math, ams, rel, "\u226f", "\\ngtr"); -defineSymbol(math, ams, rel, "\ue00f", "\\ngeqslant"); -defineSymbol(math, ams, rel, "\ue00e", "\\ngeqq"); -defineSymbol(math, ams, rel, "\u2a88", "\\gneq"); -defineSymbol(math, ams, rel, "\u2269", "\\gneqq"); -defineSymbol(math, ams, rel, "\ue00d", "\\gvertneqq"); -defineSymbol(math, ams, rel, "\u22e7", "\\gnsim"); -defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox"); -defineSymbol(math, ams, rel, "\u2281", "\\nsucc"); -defineSymbol(math, ams, rel, "\u22e1", "\\nsucceq"); -defineSymbol(math, ams, rel, "\u22e9", "\\succnsim"); -defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox"); -defineSymbol(math, ams, rel, "\u2246", "\\ncong"); -defineSymbol(math, ams, rel, "\ue007", "\\nshortparallel"); -defineSymbol(math, ams, rel, "\u2226", "\\nparallel"); -defineSymbol(math, ams, rel, "\u22af", "\\nVDash"); -defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright"); -defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq"); -defineSymbol(math, ams, rel, "\ue018", "\\nsupseteqq"); -defineSymbol(math, ams, rel, "\u228b", "\\supsetneq"); -defineSymbol(math, ams, rel, "\ue01b", "\\varsupsetneq"); -defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq"); -defineSymbol(math, ams, rel, "\ue019", "\\varsupsetneqq"); -defineSymbol(math, ams, rel, "\u22ae", "\\nVdash"); -defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq"); -defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq"); -defineSymbol(math, ams, rel, "\ue016", "\\nsubseteqq"); -defineSymbol(math, ams, bin, "\u22b4", "\\unlhd"); -defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); - -// AMS Negated Arrows -defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow"); -defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow"); -defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow"); -defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow"); -defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow"); -defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow"); - -// AMS Misc -defineSymbol(math, ams, rel, "\u25b3", "\\vartriangle"); -defineSymbol(math, ams, textord, "\u210f", "\\hslash"); -defineSymbol(math, ams, textord, "\u25bd", "\\triangledown"); -defineSymbol(math, ams, textord, "\u25ca", "\\lozenge"); -defineSymbol(math, ams, textord, "\u24c8", "\\circledS"); -defineSymbol(math, ams, textord, "\u00ae", "\\circledR"); -defineSymbol(math, ams, textord, "\u2221", "\\measuredangle"); -defineSymbol(math, ams, textord, "\u2204", "\\nexists"); -defineSymbol(math, ams, textord, "\u2127", "\\mho"); -defineSymbol(math, ams, textord, "\u2132", "\\Finv"); -defineSymbol(math, ams, textord, "\u2141", "\\Game"); -defineSymbol(math, ams, textord, "\u006b", "\\Bbbk"); -defineSymbol(math, ams, textord, "\u2035", "\\backprime"); -defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle"); -defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown"); -defineSymbol(math, ams, textord, "\u25a0", "\\blacksquare"); -defineSymbol(math, ams, textord, "\u29eb", "\\blacklozenge"); -defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); -defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle"); -defineSymbol(math, ams, textord, "\u2201", "\\complement"); -defineSymbol(math, ams, textord, "\u00f0", "\\eth"); -defineSymbol(math, ams, textord, "\u2571", "\\diagup"); -defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); -defineSymbol(math, ams, textord, "\u25a1", "\\square"); -defineSymbol(math, ams, textord, "\u25a1", "\\Box"); -defineSymbol(math, ams, textord, "\u25ca", "\\Diamond"); -defineSymbol(math, ams, textord, "\u00a5", "\\yen"); -defineSymbol(math, ams, textord, "\u2713", "\\checkmark"); - -// AMS Hebrew -defineSymbol(math, ams, textord, "\u2136", "\\beth"); -defineSymbol(math, ams, textord, "\u2138", "\\daleth"); -defineSymbol(math, ams, textord, "\u2137", "\\gimel"); - -// AMS Greek -defineSymbol(math, ams, textord, "\u03dd", "\\digamma"); -defineSymbol(math, ams, textord, "\u03f0", "\\varkappa"); - -// AMS Delimiters -defineSymbol(math, ams, open, "\u250c", "\\ulcorner"); -defineSymbol(math, ams, close, "\u2510", "\\urcorner"); -defineSymbol(math, ams, open, "\u2514", "\\llcorner"); -defineSymbol(math, ams, close, "\u2518", "\\lrcorner"); - -// AMS Binary Relations -defineSymbol(math, ams, rel, "\u2266", "\\leqq"); -defineSymbol(math, ams, rel, "\u2a7d", "\\leqslant"); -defineSymbol(math, ams, rel, "\u2a95", "\\eqslantless"); -defineSymbol(math, ams, rel, "\u2272", "\\lesssim"); -defineSymbol(math, ams, rel, "\u2a85", "\\lessapprox"); -defineSymbol(math, ams, rel, "\u224a", "\\approxeq"); -defineSymbol(math, ams, bin, "\u22d6", "\\lessdot"); -defineSymbol(math, ams, rel, "\u22d8", "\\lll"); -defineSymbol(math, ams, rel, "\u2276", "\\lessgtr"); -defineSymbol(math, ams, rel, "\u22da", "\\lesseqgtr"); -defineSymbol(math, ams, rel, "\u2a8b", "\\lesseqqgtr"); -defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); -defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq"); -defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq"); -defineSymbol(math, ams, rel, "\u223d", "\\backsim"); -defineSymbol(math, ams, rel, "\u22cd", "\\backsimeq"); -defineSymbol(math, ams, rel, "\u2ac5", "\\subseteqq"); -defineSymbol(math, ams, rel, "\u22d0", "\\Subset"); -defineSymbol(math, ams, rel, "\u228f", "\\sqsubset"); -defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq"); -defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec"); -defineSymbol(math, ams, rel, "\u227e", "\\precsim"); -defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox"); -defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft"); -defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq"); -defineSymbol(math, ams, rel, "\u22a8", "\\vDash"); -defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash"); -defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); -defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); -defineSymbol(math, ams, rel, "\u224f", "\\bumpeq"); -defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq"); -defineSymbol(math, ams, rel, "\u2267", "\\geqq"); -defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant"); -defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr"); -defineSymbol(math, ams, rel, "\u2273", "\\gtrsim"); -defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox"); -defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot"); -defineSymbol(math, ams, rel, "\u22d9", "\\ggg"); -defineSymbol(math, ams, rel, "\u2277", "\\gtrless"); -defineSymbol(math, ams, rel, "\u22db", "\\gtreqless"); -defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless"); -defineSymbol(math, ams, rel, "\u2256", "\\eqcirc"); -defineSymbol(math, ams, rel, "\u2257", "\\circeq"); -defineSymbol(math, ams, rel, "\u225c", "\\triangleq"); -defineSymbol(math, ams, rel, "\u223c", "\\thicksim"); -defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); -defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq"); -defineSymbol(math, ams, rel, "\u22d1", "\\Supset"); -defineSymbol(math, ams, rel, "\u2290", "\\sqsupset"); -defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq"); -defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc"); -defineSymbol(math, ams, rel, "\u227f", "\\succsim"); -defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox"); -defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright"); -defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq"); -defineSymbol(math, ams, rel, "\u22a9", "\\Vdash"); -defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); -defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); -defineSymbol(math, ams, rel, "\u226c", "\\between"); -defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork"); -defineSymbol(math, ams, rel, "\u221d", "\\varpropto"); -defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft"); -defineSymbol(math, ams, rel, "\u2234", "\\therefore"); -defineSymbol(math, ams, rel, "\u220d", "\\backepsilon"); -defineSymbol(math, ams, rel, "\u25b6", "\\blacktriangleright"); -defineSymbol(math, ams, rel, "\u2235", "\\because"); -defineSymbol(math, ams, rel, "\u22d8", "\\llless"); -defineSymbol(math, ams, rel, "\u22d9", "\\gggtr"); -defineSymbol(math, ams, bin, "\u22b2", "\\lhd"); -defineSymbol(math, ams, bin, "\u22b3", "\\rhd"); -defineSymbol(math, ams, rel, "\u2242", "\\eqsim"); -defineSymbol(math, main, rel, "\u22c8", "\\Join"); -defineSymbol(math, ams, rel, "\u2251", "\\Doteq"); - -// AMS Binary Operators -defineSymbol(math, ams, bin, "\u2214", "\\dotplus"); -defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); -defineSymbol(math, ams, bin, "\u22d2", "\\Cap"); -defineSymbol(math, ams, bin, "\u22d3", "\\Cup"); -defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge"); -defineSymbol(math, ams, bin, "\u229f", "\\boxminus"); -defineSymbol(math, ams, bin, "\u229e", "\\boxplus"); -defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes"); -defineSymbol(math, ams, bin, "\u22c9", "\\ltimes"); -defineSymbol(math, ams, bin, "\u22ca", "\\rtimes"); -defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes"); -defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes"); -defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge"); -defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee"); -defineSymbol(math, ams, bin, "\u229d", "\\circleddash"); -defineSymbol(math, ams, bin, "\u229b", "\\circledast"); -defineSymbol(math, ams, bin, "\u22c5", "\\centerdot"); -defineSymbol(math, ams, bin, "\u22ba", "\\intercal"); -defineSymbol(math, ams, bin, "\u22d2", "\\doublecap"); -defineSymbol(math, ams, bin, "\u22d3", "\\doublecup"); -defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes"); - -// AMS Arrows -defineSymbol(math, ams, rel, "\u21e2", "\\dashrightarrow"); -defineSymbol(math, ams, rel, "\u21e0", "\\dashleftarrow"); -defineSymbol(math, ams, rel, "\u21c7", "\\leftleftarrows"); -defineSymbol(math, ams, rel, "\u21c6", "\\leftrightarrows"); -defineSymbol(math, ams, rel, "\u21da", "\\Lleftarrow"); -defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow"); -defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail"); -defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft"); -defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons"); -defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft"); -defineSymbol(math, ams, rel, "\u21ba", "\\circlearrowleft"); -defineSymbol(math, ams, rel, "\u21b0", "\\Lsh"); -defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows"); -defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft"); -defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft"); -defineSymbol(math, ams, rel, "\u22b8", "\\multimap"); -defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow"); -defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows"); -defineSymbol(math, ams, rel, "\u21c4", "\\rightleftarrows"); -defineSymbol(math, ams, rel, "\u21a0", "\\twoheadrightarrow"); -defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail"); -defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright"); -defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright"); -defineSymbol(math, ams, rel, "\u21bb", "\\circlearrowright"); -defineSymbol(math, ams, rel, "\u21b1", "\\Rsh"); -defineSymbol(math, ams, rel, "\u21ca", "\\downdownarrows"); -defineSymbol(math, ams, rel, "\u21be", "\\upharpoonright"); -defineSymbol(math, ams, rel, "\u21c2", "\\downharpoonright"); -defineSymbol(math, ams, rel, "\u21dd", "\\rightsquigarrow"); -defineSymbol(math, ams, rel, "\u21dd", "\\leadsto"); -defineSymbol(math, ams, rel, "\u21db", "\\Rrightarrow"); -defineSymbol(math, ams, rel, "\u21be", "\\restriction"); - -defineSymbol(math, main, textord, "\u2018", "`"); -defineSymbol(math, main, textord, "$", "\\$"); -defineSymbol(text, main, textord, "$", "\\$"); -defineSymbol(math, main, textord, "%", "\\%"); -defineSymbol(text, main, textord, "%", "\\%"); -defineSymbol(math, main, textord, "_", "\\_"); -defineSymbol(text, main, textord, "_", "\\_"); -defineSymbol(math, main, textord, "\u2220", "\\angle"); -defineSymbol(math, main, textord, "\u221e", "\\infty"); -defineSymbol(math, main, textord, "\u2032", "\\prime"); -defineSymbol(math, main, textord, "\u25b3", "\\triangle"); -defineSymbol(math, main, textord, "\u0393", "\\Gamma"); -defineSymbol(math, main, textord, "\u0394", "\\Delta"); -defineSymbol(math, main, textord, "\u0398", "\\Theta"); -defineSymbol(math, main, textord, "\u039b", "\\Lambda"); -defineSymbol(math, main, textord, "\u039e", "\\Xi"); -defineSymbol(math, main, textord, "\u03a0", "\\Pi"); -defineSymbol(math, main, textord, "\u03a3", "\\Sigma"); -defineSymbol(math, main, textord, "\u03a5", "\\Upsilon"); -defineSymbol(math, main, textord, "\u03a6", "\\Phi"); -defineSymbol(math, main, textord, "\u03a8", "\\Psi"); -defineSymbol(math, main, textord, "\u03a9", "\\Omega"); -defineSymbol(math, main, textord, "\u00ac", "\\neg"); -defineSymbol(math, main, textord, "\u00ac", "\\lnot"); -defineSymbol(math, main, textord, "\u22a4", "\\top"); -defineSymbol(math, main, textord, "\u22a5", "\\bot"); -defineSymbol(math, main, textord, "\u2205", "\\emptyset"); -defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); -defineSymbol(math, main, mathord, "\u03b1", "\\alpha"); -defineSymbol(math, main, mathord, "\u03b2", "\\beta"); -defineSymbol(math, main, mathord, "\u03b3", "\\gamma"); -defineSymbol(math, main, mathord, "\u03b4", "\\delta"); -defineSymbol(math, main, mathord, "\u03f5", "\\epsilon"); -defineSymbol(math, main, mathord, "\u03b6", "\\zeta"); -defineSymbol(math, main, mathord, "\u03b7", "\\eta"); -defineSymbol(math, main, mathord, "\u03b8", "\\theta"); -defineSymbol(math, main, mathord, "\u03b9", "\\iota"); -defineSymbol(math, main, mathord, "\u03ba", "\\kappa"); -defineSymbol(math, main, mathord, "\u03bb", "\\lambda"); -defineSymbol(math, main, mathord, "\u03bc", "\\mu"); -defineSymbol(math, main, mathord, "\u03bd", "\\nu"); -defineSymbol(math, main, mathord, "\u03be", "\\xi"); -defineSymbol(math, main, mathord, "o", "\\omicron"); -defineSymbol(math, main, mathord, "\u03c0", "\\pi"); -defineSymbol(math, main, mathord, "\u03c1", "\\rho"); -defineSymbol(math, main, mathord, "\u03c3", "\\sigma"); -defineSymbol(math, main, mathord, "\u03c4", "\\tau"); -defineSymbol(math, main, mathord, "\u03c5", "\\upsilon"); -defineSymbol(math, main, mathord, "\u03d5", "\\phi"); -defineSymbol(math, main, mathord, "\u03c7", "\\chi"); -defineSymbol(math, main, mathord, "\u03c8", "\\psi"); -defineSymbol(math, main, mathord, "\u03c9", "\\omega"); -defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon"); -defineSymbol(math, main, mathord, "\u03d1", "\\vartheta"); -defineSymbol(math, main, mathord, "\u03d6", "\\varpi"); -defineSymbol(math, main, mathord, "\u03f1", "\\varrho"); -defineSymbol(math, main, mathord, "\u03c2", "\\varsigma"); -defineSymbol(math, main, mathord, "\u03c6", "\\varphi"); -defineSymbol(math, main, bin, "\u2217", "*"); -defineSymbol(math, main, bin, "+", "+"); -defineSymbol(math, main, bin, "\u2212", "-"); -defineSymbol(math, main, bin, "\u22c5", "\\cdot"); -defineSymbol(math, main, bin, "\u2218", "\\circ"); -defineSymbol(math, main, bin, "\u00f7", "\\div"); -defineSymbol(math, main, bin, "\u00b1", "\\pm"); -defineSymbol(math, main, bin, "\u00d7", "\\times"); -defineSymbol(math, main, bin, "\u2229", "\\cap"); -defineSymbol(math, main, bin, "\u222a", "\\cup"); -defineSymbol(math, main, bin, "\u2216", "\\setminus"); -defineSymbol(math, main, bin, "\u2227", "\\land"); -defineSymbol(math, main, bin, "\u2228", "\\lor"); -defineSymbol(math, main, bin, "\u2227", "\\wedge"); -defineSymbol(math, main, bin, "\u2228", "\\vee"); -defineSymbol(math, main, textord, "\u221a", "\\surd"); -defineSymbol(math, main, open, "(", "("); -defineSymbol(math, main, open, "[", "["); -defineSymbol(math, main, open, "\u27e8", "\\langle"); -defineSymbol(math, main, open, "\u2223", "\\lvert"); -defineSymbol(math, main, open, "\u2225", "\\lVert"); -defineSymbol(math, main, close, ")", ")"); -defineSymbol(math, main, close, "]", "]"); -defineSymbol(math, main, close, "?", "?"); -defineSymbol(math, main, close, "!", "!"); -defineSymbol(math, main, close, "\u27e9", "\\rangle"); -defineSymbol(math, main, close, "\u2223", "\\rvert"); -defineSymbol(math, main, close, "\u2225", "\\rVert"); -defineSymbol(math, main, rel, "=", "="); -defineSymbol(math, main, rel, "<", "<"); -defineSymbol(math, main, rel, ">", ">"); -defineSymbol(math, main, rel, ":", ":"); -defineSymbol(math, main, rel, "\u2248", "\\approx"); -defineSymbol(math, main, rel, "\u2245", "\\cong"); -defineSymbol(math, main, rel, "\u2265", "\\ge"); -defineSymbol(math, main, rel, "\u2265", "\\geq"); -defineSymbol(math, main, rel, "\u2190", "\\gets"); -defineSymbol(math, main, rel, ">", "\\gt"); -defineSymbol(math, main, rel, "\u2208", "\\in"); -defineSymbol(math, main, rel, "\u2209", "\\notin"); -defineSymbol(math, main, rel, "\u2282", "\\subset"); -defineSymbol(math, main, rel, "\u2283", "\\supset"); -defineSymbol(math, main, rel, "\u2286", "\\subseteq"); -defineSymbol(math, main, rel, "\u2287", "\\supseteq"); -defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq"); -defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq"); -defineSymbol(math, main, rel, "\u22a8", "\\models"); -defineSymbol(math, main, rel, "\u2190", "\\leftarrow"); -defineSymbol(math, main, rel, "\u2264", "\\le"); -defineSymbol(math, main, rel, "\u2264", "\\leq"); -defineSymbol(math, main, rel, "<", "\\lt"); -defineSymbol(math, main, rel, "\u2260", "\\ne"); -defineSymbol(math, main, rel, "\u2260", "\\neq"); -defineSymbol(math, main, rel, "\u2192", "\\rightarrow"); -defineSymbol(math, main, rel, "\u2192", "\\to"); -defineSymbol(math, ams, rel, "\u2271", "\\ngeq"); -defineSymbol(math, ams, rel, "\u2270", "\\nleq"); -defineSymbol(math, main, spacing, null, "\\!"); -defineSymbol(math, main, spacing, "\u00a0", "\\ "); -defineSymbol(math, main, spacing, "\u00a0", "~"); -defineSymbol(math, main, spacing, null, "\\,"); -defineSymbol(math, main, spacing, null, "\\:"); -defineSymbol(math, main, spacing, null, "\\;"); -defineSymbol(math, main, spacing, null, "\\enspace"); -defineSymbol(math, main, spacing, null, "\\qquad"); -defineSymbol(math, main, spacing, null, "\\quad"); -defineSymbol(math, main, spacing, "\u00a0", "\\space"); -defineSymbol(math, main, punct, ",", ","); -defineSymbol(math, main, punct, ";", ";"); -defineSymbol(math, main, punct, ":", "\\colon"); -defineSymbol(math, ams, bin, "\u22bc", "\\barwedge"); -defineSymbol(math, ams, bin, "\u22bb", "\\veebar"); -defineSymbol(math, main, bin, "\u2299", "\\odot"); -defineSymbol(math, main, bin, "\u2295", "\\oplus"); -defineSymbol(math, main, bin, "\u2297", "\\otimes"); -defineSymbol(math, main, textord, "\u2202", "\\partial"); -defineSymbol(math, main, bin, "\u2298", "\\oslash"); -defineSymbol(math, ams, bin, "\u229a", "\\circledcirc"); -defineSymbol(math, ams, bin, "\u22a1", "\\boxdot"); -defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup"); -defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown"); -defineSymbol(math, main, bin, "\u2020", "\\dagger"); -defineSymbol(math, main, bin, "\u22c4", "\\diamond"); -defineSymbol(math, main, bin, "\u22c6", "\\star"); -defineSymbol(math, main, bin, "\u25c3", "\\triangleleft"); -defineSymbol(math, main, bin, "\u25b9", "\\triangleright"); -defineSymbol(math, main, open, "{", "\\{"); -defineSymbol(text, main, textord, "{", "\\{"); -defineSymbol(math, main, close, "}", "\\}"); -defineSymbol(text, main, textord, "}", "\\}"); -defineSymbol(math, main, open, "{", "\\lbrace"); -defineSymbol(math, main, close, "}", "\\rbrace"); -defineSymbol(math, main, open, "[", "\\lbrack"); -defineSymbol(math, main, close, "]", "\\rbrack"); -defineSymbol(math, main, open, "\u230a", "\\lfloor"); -defineSymbol(math, main, close, "\u230b", "\\rfloor"); -defineSymbol(math, main, open, "\u2308", "\\lceil"); -defineSymbol(math, main, close, "\u2309", "\\rceil"); -defineSymbol(math, main, textord, "\\", "\\backslash"); -defineSymbol(math, main, textord, "\u2223", "|"); -defineSymbol(math, main, textord, "\u2223", "\\vert"); -defineSymbol(math, main, textord, "\u2225", "\\|"); -defineSymbol(math, main, textord, "\u2225", "\\Vert"); -defineSymbol(math, main, rel, "\u2191", "\\uparrow"); -defineSymbol(math, main, rel, "\u21d1", "\\Uparrow"); -defineSymbol(math, main, rel, "\u2193", "\\downarrow"); -defineSymbol(math, main, rel, "\u21d3", "\\Downarrow"); -defineSymbol(math, main, rel, "\u2195", "\\updownarrow"); -defineSymbol(math, main, rel, "\u21d5", "\\Updownarrow"); -defineSymbol(math, math, op, "\u2210", "\\coprod"); -defineSymbol(math, math, op, "\u22c1", "\\bigvee"); -defineSymbol(math, math, op, "\u22c0", "\\bigwedge"); -defineSymbol(math, math, op, "\u2a04", "\\biguplus"); -defineSymbol(math, math, op, "\u22c2", "\\bigcap"); -defineSymbol(math, math, op, "\u22c3", "\\bigcup"); -defineSymbol(math, math, op, "\u222b", "\\int"); -defineSymbol(math, math, op, "\u222b", "\\intop"); -defineSymbol(math, math, op, "\u222c", "\\iint"); -defineSymbol(math, math, op, "\u222d", "\\iiint"); -defineSymbol(math, math, op, "\u220f", "\\prod"); -defineSymbol(math, math, op, "\u2211", "\\sum"); -defineSymbol(math, math, op, "\u2a02", "\\bigotimes"); -defineSymbol(math, math, op, "\u2a01", "\\bigoplus"); -defineSymbol(math, math, op, "\u2a00", "\\bigodot"); -defineSymbol(math, math, op, "\u222e", "\\oint"); -defineSymbol(math, math, op, "\u2a06", "\\bigsqcup"); -defineSymbol(math, math, op, "\u222b", "\\smallint"); -defineSymbol(text, main, inner, "\u2026", "\\textellipsis"); -defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); -defineSymbol(text, main, inner, "\u2026", "\\ldots"); -defineSymbol(math, main, inner, "\u2026", "\\ldots"); -defineSymbol(math, main, inner, "\u22ef", "\\cdots"); -defineSymbol(math, main, inner, "\u22f1", "\\ddots"); -defineSymbol(math, main, textord, "\u22ee", "\\vdots"); -defineSymbol(math, main, accent, "\u00b4", "\\acute"); -defineSymbol(math, main, accent, "\u0060", "\\grave"); -defineSymbol(math, main, accent, "\u00a8", "\\ddot"); -defineSymbol(math, main, accent, "\u007e", "\\tilde"); -defineSymbol(math, main, accent, "\u00af", "\\bar"); -defineSymbol(math, main, accent, "\u02d8", "\\breve"); -defineSymbol(math, main, accent, "\u02c7", "\\check"); -defineSymbol(math, main, accent, "\u005e", "\\hat"); -defineSymbol(math, main, accent, "\u20d7", "\\vec"); -defineSymbol(math, main, accent, "\u02d9", "\\dot"); -defineSymbol(math, main, mathord, "\u0131", "\\imath"); -defineSymbol(math, main, mathord, "\u0237", "\\jmath"); - -defineSymbol(text, main, textord, "\u2013", "--"); -defineSymbol(text, main, textord, "\u2014", "---"); -defineSymbol(text, main, textord, "\u2018", "`"); -defineSymbol(text, main, textord, "\u2019", "'"); -defineSymbol(text, main, textord, "\u201c", "``"); -defineSymbol(text, main, textord, "\u201d", "''"); -defineSymbol(math, main, textord, "\u00b0", "\\degree"); -defineSymbol(text, main, textord, "\u00b0", "\\degree"); -defineSymbol(math, main, mathord, "\u00a3", "\\pounds"); -defineSymbol(math, ams, textord, "\u2720", "\\maltese"); -defineSymbol(text, ams, textord, "\u2720", "\\maltese"); - -defineSymbol(text, main, spacing, "\u00a0", "\\ "); -defineSymbol(text, main, spacing, "\u00a0", " "); -defineSymbol(text, main, spacing, "\u00a0", "~"); - -// There are lots of symbols which are the same, so we add them in afterwards. -var i; -var ch; - -// All of these are textords in math mode -var mathTextSymbols = "0123456789/@.\""; -for (i = 0; i < mathTextSymbols.length; i++) { - ch = mathTextSymbols.charAt(i); - defineSymbol(math, main, textord, ch, ch); -} - -// All of these are textords in text mode -var textSymbols = "0123456789!@*()-=+[]\";:?/.,"; -for (i = 0; i < textSymbols.length; i++) { - ch = textSymbols.charAt(i); - defineSymbol(text, main, textord, ch, ch); -} - -// All of these are textords in text mode, and mathords in math mode -var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -for (i = 0; i < letters.length; i++) { - ch = letters.charAt(i); - defineSymbol(math, main, mathord, ch, ch); - defineSymbol(text, main, textord, ch, ch); -} - -// Latin-1 letters -for (i = 0x00C0; i <= 0x00D6; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); -} - -for (i = 0x00D8; i <= 0x00F6; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); -} - -for (i = 0x00F8; i <= 0x00FF; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); -} - -// Cyrillic -for (i = 0x0410; i <= 0x044F; i++) { - ch = String.fromCharCode(i); - defineSymbol(text, main, textord, ch, ch); -} - -// Unicode versions of existing characters -defineSymbol(text, main, textord, "\u2013", "–"); -defineSymbol(text, main, textord, "\u2014", "—"); -defineSymbol(text, main, textord, "\u2018", "‘"); -defineSymbol(text, main, textord, "\u2019", "’"); -defineSymbol(text, main, textord, "\u201c", "“"); -defineSymbol(text, main, textord, "\u201d", "”"); - -},{}],24:[function(require,module,exports){ -var hangulRegex = /[\uAC00-\uD7AF]/; - -// This regex combines -// - Hiragana: [\u3040-\u309F] -// - Katakana: [\u30A0-\u30FF] -// - CJK ideograms: [\u4E00-\u9FAF] -// - Hangul syllables: [\uAC00-\uD7AF] -// Notably missing are halfwidth Katakana and Romanji glyphs. -var cjkRegex = - /[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/; - -module.exports = { - cjkRegex: cjkRegex, - hangulRegex: hangulRegex -}; - -},{}],25:[function(require,module,exports){ -/** - * This file contains a list of utility functions which are useful in other - * files. - */ /** - * Provide an `indexOf` function which works in IE8, but defers to native if - * possible. + * Parse and build an expression, and place that expression in the DOM node + * given. */ -var nativeIndexOf = Array.prototype.indexOf; -var indexOf = function(list, elem) { - if (list == null) { - return -1; - } - if (nativeIndexOf && list.indexOf === nativeIndexOf) { - return list.indexOf(elem); - } - var i = 0; - var l = list.length; - for (; i < l; i++) { - if (list[i] === elem) { - return i; - } - } - return -1; -}; +var katex_render = function render(expression, baseNode, options) { + baseNode.textContent = ""; + var node = katex_renderToDomTree(expression, options).toNode(); + baseNode.appendChild(node); +}; // KaTeX's styles don't work properly in quirks mode. Print out an error, and +// disable rendering. -/** - * Return whether an element is contained in a list - */ -var contains = function(list, elem) { - return indexOf(list, elem) !== -1; -}; -/** - * Provide a default value if a setting is undefined - */ -var deflt = function(setting, defaultIfUndefined) { - return setting === undefined ? defaultIfUndefined : setting; -}; - -// hyphenate and escape adapted from Facebook's React under Apache 2 license - -var uppercase = /([A-Z])/g; -var hyphenate = function(str) { - return str.replace(uppercase, "-$1").toLowerCase(); -}; - -var ESCAPE_LOOKUP = { - "&": "&", - ">": ">", - "<": "<", - "\"": """, - "'": "'" -}; - -var ESCAPE_REGEX = /[&><"']/g; - -function escaper(match) { - return ESCAPE_LOOKUP[match]; -} - -/** - * Escapes text to prevent scripting attacks. - * - * @param {*} text Text value to escape. - * @return {string} An escaped string. - */ -function escape(text) { - return ("" + text).replace(ESCAPE_REGEX, escaper); -} - -/** - * A function to set the text content of a DOM element in all supported - * browsers. Note that we don't define this if there is no document. - */ -var setTextContent; if (typeof document !== "undefined") { - var testNode = document.createElement("span"); - if ("textContent" in testNode) { - setTextContent = function(node, text) { - node.textContent = text; - }; - } else { - setTextContent = function(node, text) { - node.innerText = text; - }; - } -} + if (document.compatMode !== "CSS1Compat") { + typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype."); + katex_render = function render() { + throw new src_ParseError("KaTeX doesn't work in quirks mode."); + }; + } +} /** - * A function to clear a node. + * Parse and build an expression, and return the markup for that. */ -function clearNode(node) { - setTextContent(node, ""); -} -module.exports = { - contains: contains, - deflt: deflt, - escape: escape, - hyphenate: hyphenate, - indexOf: indexOf, - setTextContent: setTextContent, - clearNode: clearNode + +var renderToString = function renderToString(expression, options) { + var markup = katex_renderToDomTree(expression, options).toMarkup(); + return markup; +}; +/** + * Parse an expression and return the parse tree. + */ + + +var katex_generateParseTree = function generateParseTree(expression, options) { + var settings = new src_Settings(options); + return src_parseTree(expression, settings); +}; +/** + * If the given error is a KaTeX ParseError and options.throwOnError is false, + * renders the invalid LaTeX as a span with hover title giving the KaTeX + * error message. Otherwise, simply throws the error. + */ + + +var katex_renderError = function renderError(error, expression, options) { + if (options.throwOnError || !(error instanceof src_ParseError)) { + throw error; + } + + var node = buildCommon.makeSpan(["katex-error"], [new domTree_SymbolNode(expression)]); + node.setAttribute("title", error.toString()); + node.setAttribute("style", "color:" + options.errorColor); + return node; +}; +/** + * Generates and returns the katex build tree. This is used for advanced + * use cases (like rendering to custom output). + */ + + +var katex_renderToDomTree = function renderToDomTree(expression, options) { + var settings = new src_Settings(options); + + try { + var tree = src_parseTree(expression, settings); + return buildTree_buildTree(tree, expression, settings); + } catch (error) { + return katex_renderError(error, expression, settings); + } +}; +/** + * Generates and returns the katex build tree, with just HTML (no MathML). + * This is used for advanced use cases (like rendering to custom output). + */ + + +var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) { + var settings = new src_Settings(options); + + try { + var tree = src_parseTree(expression, settings); + return buildTree_buildHTMLTree(tree, expression, settings); + } catch (error) { + return katex_renderError(error, expression, settings); + } }; -},{}]},{},[1])(1) +/* harmony default export */ var katex_0 = ({ + /** + * Current KaTeX version + */ + version: "0.10.0", + + /** + * Renders the given LaTeX into an HTML+MathML combination, and adds + * it as a child to the specified DOM node. + */ + render: katex_render, + + /** + * Renders the given LaTeX into an HTML+MathML combination string, + * for sending to the client. + */ + renderToString: renderToString, + + /** + * KaTeX error, usually during parsing. + */ + ParseError: src_ParseError, + + /** + * Parses the given LaTeX into KaTeX's internal parse tree structure, + * without rendering to HTML or MathML. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __parse: katex_generateParseTree, + + /** + * Renders the given LaTeX into an HTML+MathML internal DOM tree + * representation, without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToDomTree: katex_renderToDomTree, + + /** + * Renders the given LaTeX into an HTML internal DOM tree representation, + * without MathML and without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToHTMLTree: katex_renderToHTMLTree, + + /** + * extends internal font metrics object with a new object + * each key in the new object represents a font name + */ + __setFontMetrics: setFontMetrics, + + /** + * adds a new symbol to builtin symbols table + */ + __defineSymbol: defineSymbol, + + /** + * adds a new macro to builtin macro list + */ + __defineMacro: defineMacro, + + /** + * Expose the dom tree node types, which can be useful for type checking nodes. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __domTree: { + Span: domTree_Span, + Anchor: domTree_Anchor, + SymbolNode: domTree_SymbolNode, + SvgNode: SvgNode, + PathNode: domTree_PathNode, + LineNode: LineNode + } +}); +// CONCATENATED MODULE: ./katex.webpack.js +/** + * This is the webpack entry point for KaTeX. As flow[1] and jest[2] doesn't support + * CSS modules natively, a separate entry point is used and it is not flowtyped. + * + * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef + * [2] https://facebook.github.io/jest/docs/en/webpack.html + */ + + +/* harmony default export */ var katex_webpack = __webpack_exports__["default"] = (katex_0); + +/***/ }) +/******/ ])["default"]; }); \ No newline at end of file diff --git a/katex/katex.min.css b/katex/katex.min.css index d6fb8374..7d6908e6 100644 --- a/katex/katex.min.css +++ b/katex/katex.min.css @@ -1 +1 @@ -@font-face{font-family:KaTeX_AMS;src:url(fonts/KaTeX_AMS-Regular.eot);src:url(fonts/KaTeX_AMS-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'),url(fonts/KaTeX_AMS-Regular.woff) format('woff'),url(fonts/KaTeX_AMS-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Bold.eot);src:url(fonts/KaTeX_Caligraphic-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Caligraphic;src:url(fonts/KaTeX_Caligraphic-Regular.eot);src:url(fonts/KaTeX_Caligraphic-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Caligraphic-Regular.woff2) format('woff2'),url(fonts/KaTeX_Caligraphic-Regular.woff) format('woff'),url(fonts/KaTeX_Caligraphic-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Bold.eot);src:url(fonts/KaTeX_Fraktur-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Bold.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Bold.woff) format('woff'),url(fonts/KaTeX_Fraktur-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Fraktur;src:url(fonts/KaTeX_Fraktur-Regular.eot);src:url(fonts/KaTeX_Fraktur-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Fraktur-Regular.woff2) format('woff2'),url(fonts/KaTeX_Fraktur-Regular.woff) format('woff'),url(fonts/KaTeX_Fraktur-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Bold.eot);src:url(fonts/KaTeX_Main-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Bold.woff2) format('woff2'),url(fonts/KaTeX_Main-Bold.woff) format('woff'),url(fonts/KaTeX_Main-Bold.ttf) format('truetype');font-weight:700;font-style:normal}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Italic.eot);src:url(fonts/KaTeX_Main-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Italic.woff2) format('woff2'),url(fonts/KaTeX_Main-Italic.woff) format('woff'),url(fonts/KaTeX_Main-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_Main;src:url(fonts/KaTeX_Main-Regular.eot);src:url(fonts/KaTeX_Main-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Main-Regular.woff2) format('woff2'),url(fonts/KaTeX_Main-Regular.woff) format('woff'),url(fonts/KaTeX_Main-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Math;src:url(fonts/KaTeX_Math-Italic.eot);src:url(fonts/KaTeX_Math-Italic.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Math-Italic.woff2) format('woff2'),url(fonts/KaTeX_Math-Italic.woff) format('woff'),url(fonts/KaTeX_Math-Italic.ttf) format('truetype');font-weight:400;font-style:italic}@font-face{font-family:KaTeX_SansSerif;src:url(fonts/KaTeX_SansSerif-Regular.eot);src:url(fonts/KaTeX_SansSerif-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Regular.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Regular.woff) format('woff'),url(fonts/KaTeX_SansSerif-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Script;src:url(fonts/KaTeX_Script-Regular.eot);src:url(fonts/KaTeX_Script-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Script-Regular.woff2) format('woff2'),url(fonts/KaTeX_Script-Regular.woff) format('woff'),url(fonts/KaTeX_Script-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size1;src:url(fonts/KaTeX_Size1-Regular.eot);src:url(fonts/KaTeX_Size1-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size1-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size1-Regular.woff) format('woff'),url(fonts/KaTeX_Size1-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size2;src:url(fonts/KaTeX_Size2-Regular.eot);src:url(fonts/KaTeX_Size2-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size2-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size2-Regular.woff) format('woff'),url(fonts/KaTeX_Size2-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size3;src:url(fonts/KaTeX_Size3-Regular.eot);src:url(fonts/KaTeX_Size3-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size3-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size3-Regular.woff) format('woff'),url(fonts/KaTeX_Size3-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Size4;src:url(fonts/KaTeX_Size4-Regular.eot);src:url(fonts/KaTeX_Size4-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Size4-Regular.woff2) format('woff2'),url(fonts/KaTeX_Size4-Regular.woff) format('woff'),url(fonts/KaTeX_Size4-Regular.ttf) format('truetype');font-weight:400;font-style:normal}@font-face{font-family:KaTeX_Typewriter;src:url(fonts/KaTeX_Typewriter-Regular.eot);src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('truetype');font-weight:400;font-style:normal}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:inline-block;text-align:initial}.katex{font:400 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;white-space:nowrap;text-indent:0}.katex .katex-html{display:inline-block}.katex .katex-mathml{position:absolute;clip:rect(1px,1px,1px,1px);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .base,.katex .strut{display:inline-block}.katex .mathrm{font-style:normal}.katex .textit{font-style:italic}.katex .mathit{font-family:KaTeX_Math;font-style:italic}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .amsrm,.katex .mathbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr{font-family:KaTeX_Script}.katex .mathsf{font-family:KaTeX_SansSerif}.katex .mainit{font-family:KaTeX_Main;font-style:italic}.katex .mord+.mop{margin-left:.16667em}.katex .mord+.mbin{margin-left:.22222em}.katex .mord+.mrel{margin-left:.27778em}.katex .mop+.mop,.katex .mop+.mord,.katex .mord+.minner{margin-left:.16667em}.katex .mop+.mrel{margin-left:.27778em}.katex .mop+.minner{margin-left:.16667em}.katex .mbin+.minner,.katex .mbin+.mop,.katex .mbin+.mopen,.katex .mbin+.mord{margin-left:.22222em}.katex .mrel+.minner,.katex .mrel+.mop,.katex .mrel+.mopen,.katex .mrel+.mord{margin-left:.27778em}.katex .mclose+.mop{margin-left:.16667em}.katex .mclose+.mbin{margin-left:.22222em}.katex .mclose+.mrel{margin-left:.27778em}.katex .mclose+.minner,.katex .minner+.mop,.katex .minner+.mord,.katex .mpunct+.mclose,.katex .mpunct+.minner,.katex .mpunct+.mop,.katex .mpunct+.mopen,.katex .mpunct+.mord,.katex .mpunct+.mpunct,.katex .mpunct+.mrel{margin-left:.16667em}.katex .minner+.mbin{margin-left:.22222em}.katex .minner+.mrel{margin-left:.27778em}.katex .minner+.minner,.katex .minner+.mopen,.katex .minner+.mpunct{margin-left:.16667em}.katex .mbin.mtight,.katex .mclose.mtight,.katex .minner.mtight,.katex .mop.mtight,.katex .mopen.mtight,.katex .mord.mtight,.katex .mpunct.mtight,.katex .mrel.mtight{margin-left:0}.katex .mclose+.mop.mtight,.katex .minner+.mop.mtight,.katex .mop+.mop.mtight,.katex .mop+.mord.mtight,.katex .mord+.mop.mtight{margin-left:.16667em}.katex .reset-textstyle.textstyle{font-size:1em}.katex .reset-textstyle.scriptstyle{font-size:.7em}.katex .reset-textstyle.scriptscriptstyle{font-size:.5em}.katex .reset-scriptstyle.textstyle{font-size:1.42857em}.katex .reset-scriptstyle.scriptstyle{font-size:1em}.katex .reset-scriptstyle.scriptscriptstyle{font-size:.71429em}.katex .reset-scriptscriptstyle.textstyle{font-size:2em}.katex .reset-scriptscriptstyle.scriptstyle{font-size:1.4em}.katex .reset-scriptscriptstyle.scriptscriptstyle{font-size:1em}.katex .style-wrap{position:relative}.katex .vlist{display:inline-block}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist .baseline-fix{display:inline-table;table-layout:fixed}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{width:100%}.katex .mfrac .frac-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .mfrac .frac-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .mspace{display:inline-block}.katex .mspace.negativethinspace{margin-left:-.16667em}.katex .mspace.thinspace{width:.16667em}.katex .mspace.negativemediumspace{margin-left:-.22222em}.katex .mspace.mediumspace{width:.22222em}.katex .mspace.thickspace{width:.27778em}.katex .mspace.sixmuspace{width:.333333em}.katex .mspace.eightmuspace{width:.444444em}.katex .mspace.enspace{width:.5em}.katex .mspace.twelvemuspace{width:.666667em}.katex .mspace.quad{width:1em}.katex .mspace.qquad{width:2em}.katex .llap,.katex .rlap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner{left:0}.katex .katex-logo .a{font-size:.75em;margin-left:-.32em;position:relative;top:-.2em}.katex .katex-logo .t{margin-left:-.23em}.katex .katex-logo .e{margin-left:-.1667em;position:relative;top:.2155em}.katex .katex-logo .x{margin-left:-.125em}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .overline .overline-line,.katex .underline .underline-line{width:100%}.katex .overline .overline-line:before,.katex .underline .underline-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .overline .overline-line:after,.katex .underline .underline-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.sqrt-sign{position:relative}.katex .sqrt .sqrt-line{width:100%}.katex .sqrt .sqrt-line:before{border-bottom-style:solid;border-bottom-width:1px;content:"";display:block}.katex .sqrt .sqrt-line:after{border-bottom-style:solid;border-bottom-width:.04em;content:"";display:block;margin-top:-1px}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:2em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:3.46em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:4.14em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.98em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.47142857em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.95714286em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.55714286em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.875em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.125em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.25em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.5em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.8em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.1625em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.5875em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:3.1125em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.77777778em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.88888889em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.6em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.92222222em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.3em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.76666667em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.7em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.8em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.9em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.2em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.44em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.73em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:2.07em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.49em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.58333333em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.66666667em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.75em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.83333333em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44166667em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.725em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.075em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.48611111em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.55555556em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.625em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.69444444em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.20138889em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.4375em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72916667em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.28901734em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.40462428em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.46242775em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.52023121em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.57803468em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69364162em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83236994em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.19653179em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.43930636em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.24154589em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.33816425em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.38647343em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.43478261em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.48309179em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.57971014em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69565217em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83574879em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20289855em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.20080321em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2811245em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.32128514em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.36144578em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.40160643em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48192771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57831325em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69477912em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8313253em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist>span,.katex .op-limits>.vlist>span{text-align:center}.katex .accent .accent-body>span{width:0}.katex .accent .accent-body.accent-vec>span{position:relative;left:.326em}.katex .mtable .vertical-separator{display:inline-block;margin:0 -.025em;border-right:.05em solid #000}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist{text-align:center}.katex .mtable .col-align-l>.vlist{text-align:left}.katex .mtable .col-align-r>.vlist{text-align:right} \ No newline at end of file +@font-face{font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype")}@font-face{font-family:"KaTeX_SansSerif";font-style:normal;font-weight:700;src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype")}@font-face{font-family:"KaTeX_SansSerif";font-style:italic;font-weight:400;src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype")}@font-face{font-family:"KaTeX_SansSerif";font-style:normal;font-weight:400;src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype")}.katex{font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important}.katex .katex-mathml{border:0;clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathdefault{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer,.katex .sizing{display:inline-block}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .op-limits>.vlist-t{text-align:center}.katex .accent>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{border-right:.05em solid;display:inline-block;margin:0 -.025em;min-width:1px}.katex .mtable .vs-dashed{border-right:.05em dashed}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;fill:currentColor;fill-opacity:1;fill-rule:nonzero;height:inherit;position:absolute;stroke:currentColor;stroke-dasharray:none;stroke-dashoffset:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-width:1;width:100%}.katex svg path{stroke:none}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox{border:.04em solid #000;box-sizing:border-box}.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0} diff --git a/katex/katex.min.js b/katex/katex.min.js index 66c08216..eb71f913 100644 --- a/katex/katex.min.js +++ b/katex/katex.min.js @@ -1,4 +1 @@ -(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.katex=e()}})(function(){var e,t,r;return function a(e,t,r){function i(s,l){if(!t[s]){if(!e[s]){var o=typeof require=="function"&&require;if(!l&&o)return o(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=t[s]={exports:{}};e[s][0].call(p.exports,function(t){var r=e[s][1][t];return i(r?r:t)},p,p.exports,a,e,t,r)}return t[s].exports}var n=typeof require=="function"&&require;for(var s=0;s15){o="\u2026"+s.slice(i-15,i)}else{o=s.slice(0,i)}var u;if(n+15v){return this.parseFunction(i)}else{throw new p("Got function '"+i.result+"' with no arguments "+"as "+e,t)}}else{return i.result}};h.prototype.handleUnsupportedCmd=function(){var e=this.nextToken.text;var t=[];for(var r=0;ri){c=this.parseFunction(h)}else{throw new p("Got function '"+h.result+"' as "+"argument to '"+e+"'",o)}}else{c=h.result}s.push(c);n.push(this.pos)}s.push(n);return s};h.prototype.parseGroupOfType=function(e,t){var r=this.mode;if(e==="original"){e=r}if(e==="color"){return this.parseColorGroup(t)}if(e==="size"){return this.parseSizeGroup(t)}this.switchMode(e);if(e==="text"){while(this.nextToken.text===" "){this.consume()}}var a=this.parseGroup(t);this.switchMode(r);return a};h.prototype.parseStringGroup=function(e,t){if(t&&this.nextToken.text!=="["){return null}var r=this.mode;this.mode="text";this.expect(t?"[":"{");var a="";var i=this.nextToken;var n=i;while(this.nextToken.text!==(t?"]":"}")){if(this.nextToken.text==="EOF"){throw new p("Unexpected end of input in "+e,i.range(this.nextToken,a))}n=this.nextToken;a+=n.text;this.consume()}this.mode=r;this.expect(t?"]":"}");return i.range(n,a)};h.prototype.parseRegexGroup=function(e,t){var r=this.mode;this.mode="text";var a=this.nextToken;var i=a;var n="";while(this.nextToken.text!=="EOF"&&e.test(n+this.nextToken.text)){i=this.nextToken;n+=i.text;this.consume()}if(n===""){throw new p("Invalid "+t+": '"+a.text+"'",a)}this.mode=r;return a.range(i,n)};h.prototype.parseColorGroup=function(e){var t=this.parseStringGroup("color",e);if(!t){return null}var r=/^(#[a-z0-9]+|[a-z]+)$/i.exec(t.text);if(!r){throw new p("Invalid color: '"+t.text+"'",t)}return new m(new c("color",r[0],this.mode),false)};h.prototype.parseSizeGroup=function(e){var t;if(!e&&this.nextToken.text!=="{"){t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2}$/,"size")}else{t=this.parseStringGroup("size",e)}if(!t){return null}var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r){throw new p("Invalid size: '"+t.text+"'",t)}var a={number:+(r[1]+r[2]),unit:r[3]};if(a.unit!=="em"&&a.unit!=="ex"&&a.unit!=="mu"){throw new p("Invalid unit: '"+a.unit+"'",t)}return new m(new c("color",a,this.mode),false)};h.prototype.parseGroup=function(e){var t=this.nextToken;if(this.nextToken.text===(e?"[":"{")){this.consume();var r=this.parseExpression(false,e?"]":null);var a=this.nextToken;this.expect(e?"]":"}");if(this.mode==="text"){this.formLigatures(r)}return new m(new c("ordgroup",r,this.mode,t,a),false)}else{return e?null:this.parseSymbol()}};h.prototype.formLigatures=function(e){var t;var r=e.length-1;for(t=0;t0?t-1:0]}l.prototype.sup=function(){return y[x[this.id]]};l.prototype.sub=function(){return y[b[this.id]]};l.prototype.fracNum=function(){return y[w[this.id]]};l.prototype.fracDen=function(){return y[k[this.id]]};l.prototype.cramp=function(){return y[z[this.id]]};l.prototype.cls=function(){return d[this.size]+(this.cramped?" cramped":" uncramped")};l.prototype.reset=function(){return g[this.size]};l.prototype.isTight=function(){return this.size>=2};var o=0;var u=1;var p=2;var h=3;var c=4;var m=5;var f=6;var v=7;var d=["displaystyle textstyle","textstyle","scriptstyle","scriptscriptstyle"];var g=["reset-textstyle","reset-textstyle","reset-scriptstyle","reset-scriptscriptstyle"];var y=[new l(o,0,1,false),new l(u,0,1,true),new l(p,1,1,false),new l(h,1,1,true),new l(c,2,.7,false),new l(m,2,.7,true),new l(f,3,.5,false),new l(v,3,.5,true)];var x=[c,m,c,m,f,v,f,v];var b=[m,m,m,m,v,v,v,v];var w=[p,h,c,m,f,v,f,v];var k=[h,h,m,m,v,v,v,v];var z=[u,u,h,h,m,m,v,v];t.exports={DISPLAY:y[o],TEXT:y[p],SCRIPT:y[c],SCRIPTSCRIPT:y[f]}},{"./fontMetrics.js":17}],10:[function(e,t,r){var a=e("./domTree");var i=e("./fontMetrics");var n=e("./symbols");var s=e("./utils");var l=["\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega"];var o=["\u0131","\u0237","\xa3"];var u=function(e,t,r,s,l){if(n[r][e]&&n[r][e].replace){e=n[r][e].replace}var o=i.getCharacterMetrics(e,t);var u;if(o){var p=o.italic;if(r==="text"){p=0}u=new a.symbolNode(e,o.height,o.depth,p,o.skew,l)}else{typeof console!=="undefined"&&console.warn("No character metrics for '"+e+"' in style '"+t+"'");u=new a.symbolNode(e,0,0,0,0,l)}if(s){if(s.style.isTight()){u.classes.push("mtight")}if(s.getColor()){u.style.color=s.getColor()}}return u};var p=function(e,t,r,a){if(e==="\\"||n[t][e].font==="main"){return u(e,"Main-Regular",t,r,a)}else{return u(e,"AMS-Regular",t,r,a.concat(["amsrm"]))}};var h=function(e,t,r,a,i){if(i==="mathord"){return c(e,t,r,a)}else if(i==="textord"){return u(e,"Main-Regular",t,r,a.concat(["mathrm"]))}else{throw new Error("unexpected type: "+i+" in mathDefault")}};var c=function(e,t,r,a){if(/[0-9]/.test(e.charAt(0))||s.contains(o,e)||s.contains(l,e)){return u(e,"Main-Italic",t,r,a.concat(["mainit"]))}else{return u(e,"Math-Italic",t,r,a.concat(["mathit"]))}};var m=function(e,t,r){var a=e.mode;var l=e.value;if(n[a][l]&&n[a][l].replace){l=n[a][l].replace}var p=["mord"];var m=t.font;if(m){if(m==="mathit"||s.contains(o,l)){return c(l,a,t,p)}else{var f=k[m].fontName;if(i.getCharacterMetrics(l,f)){return u(l,f,a,t,p.concat([m]))}else{return h(l,a,t,p,r)}}}else{return h(l,a,t,p,r)}};var f=function(e){var t=0;var r=0;var a=0;if(e.children){for(var i=0;it){t=e.children[i].height}if(e.children[i].depth>r){r=e.children[i].depth}if(e.children[i].maxFontSize>a){a=e.children[i].maxFontSize}}}e.height=t;e.depth=r;e.maxFontSize=a};var v=function(e,t,r){var i=new a.span(e,t,r);f(i);return i};var d=function(e,t){e.children=t.concat(e.children);f(e)};var g=function(e){var t=new a.documentFragment(e);f(t);return t};var y=function(e,t){var r=v([],[new a.symbolNode("\u200b")]);r.style.fontSize=t/e.style.sizeMultiplier+"em";var i=v(["fontsize-ensurer","reset-"+e.size,"size5"],[r]);return i};var x=function(e,t,r,i){var n;var s;var l;if(t==="individualShift"){var o=e;e=[o[0]];n=-o[0].shift-o[0].elem.depth;s=n;for(l=1;l0){f+=T;v-=T}}S=n.makeVList([{type:"elem",elem:s,shift:v},{type:"elem",elem:a,shift:-f}],"individualShift",null,t);if(r instanceof l.symbolNode){S.children[0].style.marginLeft=-r.italic+"em"}S.children[0].style.marginRight=k;S.children[1].style.marginRight=k}var A=d(r)||"mord";return p([A],[r,p(["msupsub"],[S])],t)};w.genfrac=function(e,t){var r=t.style;if(e.value.size==="display"){r=i.DISPLAY}else if(e.value.size==="text"){r=i.TEXT}var a=r.fracNum();var l=r.fracDen();var u;u=t.withStyle(a);var h=z(e.value.numer,u);var c=p([r.reset(),a.cls()],[h],u);u=t.withStyle(l);var m=z(e.value.denom,u);var f=p([r.reset(),l.cls()],[m],u);var v;if(e.value.hasBarLine){v=o.metrics.defaultRuleThickness/t.style.sizeMultiplier}else{v=0}var d;var g;var y;if(r.size===i.DISPLAY.size){d=r.metrics.num1;if(v>0){g=3*v}else{g=7*o.metrics.defaultRuleThickness}y=r.metrics.denom1}else{if(v>0){d=r.metrics.num2;g=v}else{d=r.metrics.num3;g=3*o.metrics.defaultRuleThickness}y=r.metrics.denom2}var x;if(v===0){var w=d-h.depth-(m.height-y);if(w0){N+=x;if(M=l){continue}var I;if(i>0||e.value.hskipBeforeAndAfter){I=u.deflt(O.pregap,f);if(I!==0){C=p(["arraycolsep"],[]);C.style.width=I+"em";E.push(C)}}var L=[];for(r=0;ra.height+a.depth+c){c=(c+d-a.height-a.depth)/2}var g=-(a.height+c+l)+v.height;v.style.top=g+"em";v.height-=g;v.depth+=g;var y;if(a.height===0&&a.depth===0){y=p()}else{y=n.makeVList([{type:"elem",elem:a},{type:"kern",size:c},{type:"elem",elem:u},{type:"kern",size:l}],"firstBaseline",null,t)}if(!e.value.index){return p(["mord","sqrt"],[v,y],t)}else{var x=t.withStyle(i.SCRIPTSCRIPT);var b=z(e.value.index,x);var w=p([r.reset(),i.SCRIPTSCRIPT.cls()],[b],x);var k=Math.max(v.height,y.height);var S=Math.max(v.depth,y.depth);var M=.6*(k-S);var T=n.makeVList([{type:"elem",elem:w}],"shift",-M,t);var A=p(["root"],[T]);return p(["mord","sqrt"],[A,v,y],t)}};w.sizing=function(e,t){var r=v(e.value.value,t.withSize(e.value.size),false);var a=t.style;var i=n.sizingMultiplier[e.value.size];i=i*a.sizeMultiplier;for(var s=0;s","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"];var b=[0,1.2,1.8,2.4,3];var w=function(e,t,r,i,n){if(e==="<"||e==="\\lt"){e="\\langle"}else if(e===">"||e==="\\gt"){e="\\rangle"}if(o.contains(g,e)||o.contains(x,e)){return f(e,t,false,r,i,n)}else if(o.contains(y,e)){return d(e,b[t],false,r,i,n)}else{throw new a("Illegal delimiter: '"+e+"'")}};var k=[{type:"small",style:i.SCRIPTSCRIPT},{type:"small",style:i.SCRIPT},{type:"small",style:i.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}];var z=[{type:"small",style:i.SCRIPTSCRIPT},{type:"small",style:i.SCRIPT},{type:"small",style:i.TEXT},{type:"stack"}];var S=[{type:"small",style:i.SCRIPTSCRIPT},{type:"small",style:i.SCRIPT},{type:"small",style:i.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];var M=function(e){if(e.type==="small"){return"Main-Regular"}else if(e.type==="large"){return"Size"+e.size+"-Regular"}else if(e.type==="stack"){return"Size4-Regular"}};var T=function(e,t,r,a){var i=Math.min(2,3-a.style.size);for(var n=i;nt){return r[n]}}return r[r.length-1]};var A=function(e,t,r,a,i,n){if(e==="<"||e==="\\lt"){e="\\langle"}else if(e===">"||e==="\\gt"){e="\\rangle"}var s;if(o.contains(x,e)){s=k}else if(o.contains(g,e)){s=S}else{s=z}var l=T(e,t,s,a);if(l.type==="small"){return m(e,l.style,r,a,i,n)}else if(l.type==="large"){return f(e,l.size,r,a,i,n)}else if(l.type==="stack"){return d(e,t,r,a,i,n)}};var N=function(e,t,r,a,i,n){var l=a.style.metrics.axisHeight*a.style.sizeMultiplier;var o=901;var u=5/s.metrics.ptPerEm;var p=Math.max(t-l,r+l);var h=Math.max(p/500*o,2*p-u);return A(e,h,true,a,i,n)};t.exports={sizedDelim:w,customSizedDelim:A,leftRightDelim:N}},{"./ParseError":6,"./Style":9,"./buildCommon":10,"./fontMetrics":17,"./symbols":23,"./utils":25}],15:[function(e,t,r){var a=e("./unicodeRegexes");var i=e("./utils");var n=function(e){e=e.slice();for(var t=e.length-1;t>=0;t--){if(!e[t]){e.splice(t,1)}}return e.join(" ")};function s(e,t,r){this.classes=e||[];this.children=t||[];this.height=0;this.depth=0;this.maxFontSize=0;this.style={};this.attributes={};if(r){if(r.style.isTight()){this.classes.push("mtight")}if(r.getColor()){this.style.color=r.getColor()}}}s.prototype.setAttribute=function(e,t){this.attributes[e]=t};s.prototype.tryCombine=function(e){return false};s.prototype.toNode=function(){var e=document.createElement("span");e.className=n(this.classes);for(var t in this.style){if(Object.prototype.hasOwnProperty.call(this.style,t)){e.style[t]=this.style[t]}}for(var r in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,r)){e.setAttribute(r,this.attributes[r])}}for(var a=0;a";return e};function l(e){this.children=e||[];this.height=0;this.depth=0;this.maxFontSize=0}l.prototype.toNode=function(){var e=document.createDocumentFragment();for(var t=0;t0||n(this.classes)!==n(e.classes)||this.skew!==e.skew||this.maxFontSize!==e.maxFontSize){return false}for(var t in this.style){if(this.style.hasOwnProperty(t)&&this.style[t]!==e.style[t]){return false}}for(t in e.style){if(e.style.hasOwnProperty(t)&&this.style[t]!==e.style[t]){return false}}this.value+=e.value;this.height=Math.max(this.height,e.height);this.depth=Math.max(this.depth,e.depth);this.italic=e.italic;return true};u.prototype.toNode=function(){var e=document.createTextNode(this.value);var t=null;if(this.italic>0){t=document.createElement("span");t.style.marginRight=this.italic+"em"}if(this.classes.length>0){t=t||document.createElement("span");t.className=n(this.classes)}for(var r in this.style){if(this.style.hasOwnProperty(r)){t=t||document.createElement("span");t.style[r]=this.style[r]}}if(t){t.appendChild(e);return t}else{return e}};u.prototype.toMarkup=function(){var e=false;var t="0){r+="margin-right:"+this.italic+"em;"}for(var a in this.style){if(this.style.hasOwnProperty(a)){r+=i.hyphenate(a)+":"+this.style[a]+";"}}if(r){e=true;t+=' style="'+i.escape(r)+'"'}var s=i.escape(this.value);if(e){t+=">";t+=s;t+="";return t}else{return s}};t.exports={span:s,documentFragment:l,symbolNode:u}},{"./unicodeRegexes":24,"./utils":25}],16:[function(e,t,r){var a=e("./parseData");var i=e("./ParseError");var n=e("./Style");var s=a.ParseNode;function l(e,t){var r=[];var a=[r];var n=[];while(true){var l=e.parseExpression(false,null);r.push(new s("ordgroup",l,e.mode));var o=e.nextToken.text;if(o==="&"){e.consume()}else if(o==="\\end"){break}else if(o==="\\\\"||o==="\\cr"){var u=e.parseFunction();n.push(u.value.size);r=[];a.push(r)}else{throw new i("Expected & or \\\\ or \\end",e.nextToken)}}t.body=a;t.rowGaps=n;return new s(t.type,t,e.mode)}function o(e,r,a){if(typeof e==="string"){e=[e]}if(typeof r==="number"){r={numArgs:r}}var i={numArgs:r.numArgs||0,argTypes:r.argTypes,greediness:1,allowedInText:!!r.allowedInText,numOptionalArgs:r.numOptionalArgs||0,handler:a};for(var n=0;n0){o=2}t.value.cols[i]={type:"align",align:n,pregap:o,postgap:0}}return t})},{"./ParseError":6,"./Style":9,"./parseData":21}],17:[function(e,t,r){var a=e("./Style");var i=e("./unicodeRegexes").cjkRegex;var n={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25]};var s=0;var l=0;var o=0;var u=0;var p=.431;var h=1;var c=0;var m=.04;var f=.111;var v=.166;var d=.2;var g=.6;var y=.1;var x=10;var b=2/x;var w={defaultRuleThickness:m,bigOpSpacing1:f,bigOpSpacing2:v,bigOpSpacing3:d,bigOpSpacing4:g,bigOpSpacing5:y,ptPerEm:x,doubleRuleSep:b};var k=e("./fontMetricsData");var z={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xc6":"A","\xc7":"C","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xd0":"D","\xd1":"N","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xdd":"Y","\xde":"o","\xdf":"B","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xe6":"a","\xe7":"c","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xf0":"d","\xf1":"n","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xfd":"y","\xfe":"o","\xff":"y","\u0410":"A","\u0411":"B","\u0412":"B","\u0413":"F","\u0414":"A","\u0415":"E","\u0416":"K","\u0417":"3","\u0418":"N","\u0419":"N","\u041a":"K","\u041b":"N","\u041c":"M","\u041d":"H","\u041e":"O","\u041f":"N","\u0420":"P","\u0421":"C","\u0422":"T","\u0423":"y","\u0424":"O","\u0425":"X","\u0426":"U","\u0427":"h","\u0428":"W","\u0429":"W","\u042a":"B","\u042b":"X","\u042c":"B","\u042d":"3","\u042e":"X","\u042f":"R","\u0430":"a","\u0431":"b","\u0432":"a","\u0433":"r","\u0434":"y","\u0435":"e","\u0436":"m","\u0437":"e","\u0438":"n","\u0439":"n","\u043a":"n","\u043b":"n","\u043c":"m","\u043d":"n","\u043e":"o","\u043f":"n","\u0440":"p","\u0441":"c","\u0442":"o","\u0443":"y","\u0444":"b","\u0445":"x","\u0446":"n","\u0447":"n","\u0448":"w","\u0449":"w","\u044a":"a","\u044b":"m","\u044c":"a","\u044d":"e","\u044e":"m","\u044f":"r"};var S=function(e,t){var r=e.charCodeAt(0);if(e[0]in z){r=z[e[0]].charCodeAt(0)}else if(i.test(e[0])){r="M".charCodeAt(0)}var a=k[t][r];if(a){return{depth:a[0],height:a[1],italic:a[2],skew:a[3],width:a[4]}}};t.exports={metrics:w,sigmas:n,getCharacterMetrics:S}},{"./Style":9,"./fontMetricsData":18,"./unicodeRegexes":24}],18:[function(e,t,r){t.exports={"AMS-Regular":{65:[0,.68889,0,0],66:[0,.68889,0,0],67:[0,.68889,0,0],68:[0,.68889,0,0],69:[0,.68889,0,0],70:[0,.68889,0,0],71:[0,.68889,0,0],72:[0,.68889,0,0],73:[0,.68889,0,0],74:[.16667,.68889,0,0],75:[0,.68889,0,0],76:[0,.68889,0,0],77:[0,.68889,0,0],78:[0,.68889,0,0],79:[.16667,.68889,0,0],80:[0,.68889,0,0],81:[.16667,.68889,0,0],82:[0,.68889,0,0],83:[0,.68889,0,0],84:[0,.68889,0,0],85:[0,.68889,0,0],86:[0,.68889,0,0],87:[0,.68889,0,0],88:[0,.68889,0,0],89:[0,.68889,0,0],90:[0,.68889,0,0],107:[0,.68889,0,0],165:[0,.675,.025,0],174:[.15559,.69224,0,0],240:[0,.68889,0,0],295:[0,.68889,0,0],710:[0,.825,0,0],732:[0,.9,0,0],770:[0,.825,0,0],771:[0,.9,0,0],989:[.08167,.58167,0,0],1008:[0,.43056,.04028,0],8245:[0,.54986,0,0],8463:[0,.68889,0,0],8487:[0,.68889,0,0],8498:[0,.68889,0,0],8502:[0,.68889,0,0],8503:[0,.68889,0,0],8504:[0,.68889,0,0],8513:[0,.68889,0,0],8592:[-.03598,.46402,0,0],8594:[-.03598,.46402,0,0],8602:[-.13313,.36687,0,0],8603:[-.13313,.36687,0,0],8606:[.01354,.52239,0,0],8608:[.01354,.52239,0,0],8610:[.01354,.52239,0,0],8611:[.01354,.52239,0,0],8619:[0,.54986,0,0],8620:[0,.54986,0,0],8621:[-.13313,.37788,0,0],8622:[-.13313,.36687,0,0],8624:[0,.69224,0,0],8625:[0,.69224,0,0],8630:[0,.43056,0,0],8631:[0,.43056,0,0],8634:[.08198,.58198,0,0],8635:[.08198,.58198,0,0],8638:[.19444,.69224,0,0],8639:[.19444,.69224,0,0],8642:[.19444,.69224,0,0],8643:[.19444,.69224,0,0],8644:[.1808,.675,0,0],8646:[.1808,.675,0,0],8647:[.1808,.675,0,0],8648:[.19444,.69224,0,0],8649:[.1808,.675,0,0],8650:[.19444,.69224,0,0],8651:[.01354,.52239,0,0],8652:[.01354,.52239,0,0],8653:[-.13313,.36687,0,0],8654:[-.13313,.36687,0,0],8655:[-.13313,.36687,0,0],8666:[.13667,.63667,0,0],8667:[.13667,.63667,0,0],8669:[-.13313,.37788,0,0],8672:[-.064,.437,0,0],8674:[-.064,.437,0,0],8705:[0,.825,0,0],8708:[0,.68889,0,0],8709:[.08167,.58167,0,0],8717:[0,.43056,0,0],8722:[-.03598,.46402,0,0],8724:[.08198,.69224,0,0],8726:[.08167,.58167,0,0],8733:[0,.69224,0,0],8736:[0,.69224,0,0],8737:[0,.69224,0,0],8738:[.03517,.52239,0,0],8739:[.08167,.58167,0,0],8740:[.25142,.74111,0,0],8741:[.08167,.58167,0,0],8742:[.25142,.74111,0,0],8756:[0,.69224,0,0],8757:[0,.69224,0,0],8764:[-.13313,.36687,0,0],8765:[-.13313,.37788,0,0],8769:[-.13313,.36687,0,0],8770:[-.03625,.46375,0,0],8774:[.30274,.79383,0,0],8776:[-.01688,.48312,0,0],8778:[.08167,.58167,0,0],8782:[.06062,.54986,0,0],8783:[.06062,.54986,0,0],8785:[.08198,.58198,0,0],8786:[.08198,.58198,0,0],8787:[.08198,.58198,0,0],8790:[0,.69224,0,0],8791:[.22958,.72958,0,0],8796:[.08198,.91667,0,0],8806:[.25583,.75583,0,0], -8807:[.25583,.75583,0,0],8808:[.25142,.75726,0,0],8809:[.25142,.75726,0,0],8812:[.25583,.75583,0,0],8814:[.20576,.70576,0,0],8815:[.20576,.70576,0,0],8816:[.30274,.79383,0,0],8817:[.30274,.79383,0,0],8818:[.22958,.72958,0,0],8819:[.22958,.72958,0,0],8822:[.1808,.675,0,0],8823:[.1808,.675,0,0],8828:[.13667,.63667,0,0],8829:[.13667,.63667,0,0],8830:[.22958,.72958,0,0],8831:[.22958,.72958,0,0],8832:[.20576,.70576,0,0],8833:[.20576,.70576,0,0],8840:[.30274,.79383,0,0],8841:[.30274,.79383,0,0],8842:[.13597,.63597,0,0],8843:[.13597,.63597,0,0],8847:[.03517,.54986,0,0],8848:[.03517,.54986,0,0],8858:[.08198,.58198,0,0],8859:[.08198,.58198,0,0],8861:[.08198,.58198,0,0],8862:[0,.675,0,0],8863:[0,.675,0,0],8864:[0,.675,0,0],8865:[0,.675,0,0],8872:[0,.69224,0,0],8873:[0,.69224,0,0],8874:[0,.69224,0,0],8876:[0,.68889,0,0],8877:[0,.68889,0,0],8878:[0,.68889,0,0],8879:[0,.68889,0,0],8882:[.03517,.54986,0,0],8883:[.03517,.54986,0,0],8884:[.13667,.63667,0,0],8885:[.13667,.63667,0,0],8888:[0,.54986,0,0],8890:[.19444,.43056,0,0],8891:[.19444,.69224,0,0],8892:[.19444,.69224,0,0],8901:[0,.54986,0,0],8903:[.08167,.58167,0,0],8905:[.08167,.58167,0,0],8906:[.08167,.58167,0,0],8907:[0,.69224,0,0],8908:[0,.69224,0,0],8909:[-.03598,.46402,0,0],8910:[0,.54986,0,0],8911:[0,.54986,0,0],8912:[.03517,.54986,0,0],8913:[.03517,.54986,0,0],8914:[0,.54986,0,0],8915:[0,.54986,0,0],8916:[0,.69224,0,0],8918:[.0391,.5391,0,0],8919:[.0391,.5391,0,0],8920:[.03517,.54986,0,0],8921:[.03517,.54986,0,0],8922:[.38569,.88569,0,0],8923:[.38569,.88569,0,0],8926:[.13667,.63667,0,0],8927:[.13667,.63667,0,0],8928:[.30274,.79383,0,0],8929:[.30274,.79383,0,0],8934:[.23222,.74111,0,0],8935:[.23222,.74111,0,0],8936:[.23222,.74111,0,0],8937:[.23222,.74111,0,0],8938:[.20576,.70576,0,0],8939:[.20576,.70576,0,0],8940:[.30274,.79383,0,0],8941:[.30274,.79383,0,0],8994:[.19444,.69224,0,0],8995:[.19444,.69224,0,0],9416:[.15559,.69224,0,0],9484:[0,.69224,0,0],9488:[0,.69224,0,0],9492:[0,.37788,0,0],9496:[0,.37788,0,0],9585:[.19444,.68889,0,0],9586:[.19444,.74111,0,0],9632:[0,.675,0,0],9633:[0,.675,0,0],9650:[0,.54986,0,0],9651:[0,.54986,0,0],9654:[.03517,.54986,0,0],9660:[0,.54986,0,0],9661:[0,.54986,0,0],9664:[.03517,.54986,0,0],9674:[.11111,.69224,0,0],9733:[.19444,.69224,0,0],10003:[0,.69224,0,0],10016:[0,.69224,0,0],10731:[.11111,.69224,0,0],10846:[.19444,.75583,0,0],10877:[.13667,.63667,0,0],10878:[.13667,.63667,0,0],10885:[.25583,.75583,0,0],10886:[.25583,.75583,0,0],10887:[.13597,.63597,0,0],10888:[.13597,.63597,0,0],10889:[.26167,.75726,0,0],10890:[.26167,.75726,0,0],10891:[.48256,.98256,0,0],10892:[.48256,.98256,0,0],10901:[.13667,.63667,0,0],10902:[.13667,.63667,0,0],10933:[.25142,.75726,0,0],10934:[.25142,.75726,0,0],10935:[.26167,.75726,0,0],10936:[.26167,.75726,0,0],10937:[.26167,.75726,0,0],10938:[.26167,.75726,0,0],10949:[.25583,.75583,0,0],10950:[.25583,.75583,0,0],10955:[.28481,.79383,0,0],10956:[.28481,.79383,0,0],57350:[.08167,.58167,0,0],57351:[.08167,.58167,0,0],57352:[.08167,.58167,0,0],57353:[0,.43056,.04028,0],57356:[.25142,.75726,0,0],57357:[.25142,.75726,0,0],57358:[.41951,.91951,0,0],57359:[.30274,.79383,0,0],57360:[.30274,.79383,0,0],57361:[.41951,.91951,0,0],57366:[.25142,.75726,0,0],57367:[.25142,.75726,0,0],57368:[.25142,.75726,0,0],57369:[.25142,.75726,0,0],57370:[.13597,.63597,0,0],57371:[.13597,.63597,0,0]},"Caligraphic-Regular":{48:[0,.43056,0,0],49:[0,.43056,0,0],50:[0,.43056,0,0],51:[.19444,.43056,0,0],52:[.19444,.43056,0,0],53:[.19444,.43056,0,0],54:[0,.64444,0,0],55:[.19444,.43056,0,0],56:[0,.64444,0,0],57:[.19444,.43056,0,0],65:[0,.68333,0,.19445],66:[0,.68333,.03041,.13889],67:[0,.68333,.05834,.13889],68:[0,.68333,.02778,.08334],69:[0,.68333,.08944,.11111],70:[0,.68333,.09931,.11111],71:[.09722,.68333,.0593,.11111],72:[0,.68333,.00965,.11111],73:[0,.68333,.07382,0],74:[.09722,.68333,.18472,.16667],75:[0,.68333,.01445,.05556],76:[0,.68333,0,.13889],77:[0,.68333,0,.13889],78:[0,.68333,.14736,.08334],79:[0,.68333,.02778,.11111],80:[0,.68333,.08222,.08334],81:[.09722,.68333,0,.11111],82:[0,.68333,0,.08334],83:[0,.68333,.075,.13889],84:[0,.68333,.25417,0],85:[0,.68333,.09931,.08334],86:[0,.68333,.08222,0],87:[0,.68333,.08222,.08334],88:[0,.68333,.14643,.13889],89:[.09722,.68333,.08222,.08334],90:[0,.68333,.07944,.13889]},"Fraktur-Regular":{33:[0,.69141,0,0],34:[0,.69141,0,0],38:[0,.69141,0,0],39:[0,.69141,0,0],40:[.24982,.74947,0,0],41:[.24982,.74947,0,0],42:[0,.62119,0,0],43:[.08319,.58283,0,0],44:[0,.10803,0,0],45:[.08319,.58283,0,0],46:[0,.10803,0,0],47:[.24982,.74947,0,0],48:[0,.47534,0,0],49:[0,.47534,0,0],50:[0,.47534,0,0],51:[.18906,.47534,0,0],52:[.18906,.47534,0,0],53:[.18906,.47534,0,0],54:[0,.69141,0,0],55:[.18906,.47534,0,0],56:[0,.69141,0,0],57:[.18906,.47534,0,0],58:[0,.47534,0,0],59:[.12604,.47534,0,0],61:[-.13099,.36866,0,0],63:[0,.69141,0,0],65:[0,.69141,0,0],66:[0,.69141,0,0],67:[0,.69141,0,0],68:[0,.69141,0,0],69:[0,.69141,0,0],70:[.12604,.69141,0,0],71:[0,.69141,0,0],72:[.06302,.69141,0,0],73:[0,.69141,0,0],74:[.12604,.69141,0,0],75:[0,.69141,0,0],76:[0,.69141,0,0],77:[0,.69141,0,0],78:[0,.69141,0,0],79:[0,.69141,0,0],80:[.18906,.69141,0,0],81:[.03781,.69141,0,0],82:[0,.69141,0,0],83:[0,.69141,0,0],84:[0,.69141,0,0],85:[0,.69141,0,0],86:[0,.69141,0,0],87:[0,.69141,0,0],88:[0,.69141,0,0],89:[.18906,.69141,0,0],90:[.12604,.69141,0,0],91:[.24982,.74947,0,0],93:[.24982,.74947,0,0],94:[0,.69141,0,0],97:[0,.47534,0,0],98:[0,.69141,0,0],99:[0,.47534,0,0],100:[0,.62119,0,0],101:[0,.47534,0,0],102:[.18906,.69141,0,0],103:[.18906,.47534,0,0],104:[.18906,.69141,0,0],105:[0,.69141,0,0],106:[0,.69141,0,0],107:[0,.69141,0,0],108:[0,.69141,0,0],109:[0,.47534,0,0],110:[0,.47534,0,0],111:[0,.47534,0,0],112:[.18906,.52396,0,0],113:[.18906,.47534,0,0],114:[0,.47534,0,0],115:[0,.47534,0,0],116:[0,.62119,0,0],117:[0,.47534,0,0],118:[0,.52396,0,0],119:[0,.52396,0,0],120:[.18906,.47534,0,0],121:[.18906,.47534,0,0],122:[.18906,.47534,0,0],8216:[0,.69141,0,0],8217:[0,.69141,0,0],58112:[0,.62119,0,0],58113:[0,.62119,0,0],58114:[.18906,.69141,0,0],58115:[.18906,.69141,0,0],58116:[.18906,.47534,0,0],58117:[0,.69141,0,0],58118:[0,.62119,0,0],58119:[0,.47534,0,0]},"Main-Bold":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.13333,.63333,0,0],44:[.19444,.15556,0,0],45:[0,.44444,0,0],46:[0,.15556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.44444,0,0],59:[.19444,.44444,0,0],60:[.08556,.58556,0,0],61:[-.10889,.39111,0,0],62:[.08556,.58556,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,0,0],67:[0,.68611,0,0],68:[0,.68611,0,0],69:[0,.68611,0,0],70:[0,.68611,0,0],71:[0,.68611,0,0],72:[0,.68611,0,0],73:[0,.68611,0,0],74:[0,.68611,0,0],75:[0,.68611,0,0],76:[0,.68611,0,0],77:[0,.68611,0,0],78:[0,.68611,0,0],79:[0,.68611,0,0],80:[0,.68611,0,0],81:[.19444,.68611,0,0],82:[0,.68611,0,0],83:[0,.68611,0,0],84:[0,.68611,0,0],85:[0,.68611,0,0],86:[0,.68611,.01597,0],87:[0,.68611,.01597,0],88:[0,.68611,0,0],89:[0,.68611,.02875,0],90:[0,.68611,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.13444,.03194,0],96:[0,.69444,0,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.10903,0],103:[.19444,.44444,.01597,0],104:[0,.69444,0,0],105:[0,.69444,0,0],106:[.19444,.69444,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,0,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.01597,0],119:[0,.44444,.01597,0],120:[0,.44444,0,0],121:[.19444,.44444,.01597,0],122:[0,.44444,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.34444,0,0],168:[0,.69444,0,0],172:[0,.44444,0,0],175:[0,.59611,0,0],176:[0,.69444,0,0],177:[.13333,.63333,0,0],180:[0,.69444,0,0],215:[.13333,.63333,0,0],247:[.13333,.63333,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],710:[0,.69444,0,0],711:[0,.63194,0,0],713:[0,.59611,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.69444,0,0],730:[0,.69444,0,0],732:[0,.69444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.69444,0,0],772:[0,.59611,0,0],774:[0,.69444,0,0],775:[0,.69444,0,0],776:[0,.69444,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],824:[.19444,.69444,0,0],915:[0,.68611,0,0],916:[0,.68611,0,0],920:[0,.68611,0,0],923:[0,.68611,0,0],926:[0,.68611,0,0],928:[0,.68611,0,0],931:[0,.68611,0,0],933:[0,.68611,0,0],934:[0,.68611,0,0],936:[0,.68611,0,0],937:[0,.68611,0,0],8211:[0,.44444,.03194,0],8212:[0,.44444,.03194,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8242:[0,.55556,0,0],8407:[0,.72444,.15486,0],8463:[0,.69444,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,0],8472:[.19444,.44444,0,0],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.10889,.39111,0,0],8593:[.19444,.69444,0,0],8594:[-.10889,.39111,0,0],8595:[.19444,.69444,0,0],8596:[-.10889,.39111,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8636:[-.10889,.39111,0,0],8637:[-.10889,.39111,0,0],8640:[-.10889,.39111,0,0],8641:[-.10889,.39111,0,0],8656:[-.10889,.39111,0,0],8657:[.19444,.69444,0,0],8658:[-.10889,.39111,0,0],8659:[.19444,.69444,0,0],8660:[-.10889,.39111,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.06389,0],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68611,0,0],8712:[.08556,.58556,0,0],8715:[.08556,.58556,0,0],8722:[.13333,.63333,0,0],8723:[.13333,.63333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.02778,.47222,0,0],8728:[-.02639,.47361,0,0],8729:[-.02639,.47361,0,0],8730:[.18,.82,0,0],8733:[0,.44444,0,0],8734:[0,.44444,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.12778,0],8764:[-.10889,.39111,0,0],8768:[.19444,.69444,0,0],8771:[.00222,.50222,0,0],8776:[.02444,.52444,0,0],8781:[.00222,.50222,0,0],8801:[.00222,.50222,0,0],8804:[.19667,.69667,0,0],8805:[.19667,.69667,0,0],8810:[.08556,.58556,0,0],8811:[.08556,.58556,0,0],8826:[.08556,.58556,0,0],8827:[.08556,.58556,0,0],8834:[.08556,.58556,0,0],8835:[.08556,.58556,0,0],8838:[.19667,.69667,0,0],8839:[.19667,.69667,0,0],8846:[0,.55556,0,0],8849:[.19667,.69667,0,0],8850:[.19667,.69667,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.13333,.63333,0,0],8854:[.13333,.63333,0,0],8855:[.13333,.63333,0,0],8856:[.13333,.63333,0,0],8857:[.13333,.63333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8900:[-.02639,.47361,0,0],8901:[-.02639,.47361,0,0],8902:[-.02778,.47222,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.13889,.36111,0,0],8995:[-.13889,.36111,0,0],9651:[.19444,.69444,0,0],9657:[-.02778,.47222,0,0],9661:[.19444,.69444,0,0],9667:[-.02778,.47222,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10815:[0,.68611,0,0],10927:[.19667,.69667,0,0],10928:[.19667,.69667,0,0]},"Main-Italic":{33:[0,.69444,.12417,0],34:[0,.69444,.06961,0],35:[.19444,.69444,.06616,0],37:[.05556,.75,.13639,0],38:[0,.69444,.09694,0],39:[0,.69444,.12417,0],40:[.25,.75,.16194,0],41:[.25,.75,.03694,0],42:[0,.75,.14917,0],43:[.05667,.56167,.03694,0],44:[.19444,.10556,0,0],45:[0,.43056,.02826,0],46:[0,.10556,0,0],47:[.25,.75,.16194,0],48:[0,.64444,.13556,0],49:[0,.64444,.13556,0],50:[0,.64444,.13556,0],51:[0,.64444,.13556,0],52:[.19444,.64444,.13556,0],53:[0,.64444,.13556,0],54:[0,.64444,.13556,0],55:[.19444,.64444,.13556,0],56:[0,.64444,.13556,0],57:[0,.64444,.13556,0],58:[0,.43056,.0582,0],59:[.19444,.43056,.0582,0],61:[-.13313,.36687,.06616,0],63:[0,.69444,.1225,0],64:[0,.69444,.09597,0],65:[0,.68333,0,0],66:[0,.68333,.10257,0],67:[0,.68333,.14528,0],68:[0,.68333,.09403,0],69:[0,.68333,.12028,0],70:[0,.68333,.13305,0],71:[0,.68333,.08722,0],72:[0,.68333,.16389,0],73:[0,.68333,.15806,0],74:[0,.68333,.14028,0],75:[0,.68333,.14528,0],76:[0,.68333,0,0],77:[0,.68333,.16389,0],78:[0,.68333,.16389,0],79:[0,.68333,.09403,0],80:[0,.68333,.10257,0],81:[.19444,.68333,.09403,0],82:[0,.68333,.03868,0],83:[0,.68333,.11972,0],84:[0,.68333,.13305,0],85:[0,.68333,.16389,0],86:[0,.68333,.18361,0],87:[0,.68333,.18361,0],88:[0,.68333,.15806,0],89:[0,.68333,.19383,0],90:[0,.68333,.14528,0],91:[.25,.75,.1875,0],93:[.25,.75,.10528,0],94:[0,.69444,.06646,0],95:[.31,.12056,.09208,0],97:[0,.43056,.07671,0],98:[0,.69444,.06312,0],99:[0,.43056,.05653,0],100:[0,.69444,.10333,0],101:[0,.43056,.07514,0],102:[.19444,.69444,.21194,0],103:[.19444,.43056,.08847,0],104:[0,.69444,.07671,0],105:[0,.65536,.1019,0],106:[.19444,.65536,.14467,0],107:[0,.69444,.10764,0],108:[0,.69444,.10333,0],109:[0,.43056,.07671,0],110:[0,.43056,.07671,0],111:[0,.43056,.06312,0],112:[.19444,.43056,.06312,0],113:[.19444,.43056,.08847,0],114:[0,.43056,.10764,0],115:[0,.43056,.08208,0],116:[0,.61508,.09486,0],117:[0,.43056,.07671,0],118:[0,.43056,.10764,0],119:[0,.43056,.10764,0],120:[0,.43056,.12042,0],121:[.19444,.43056,.08847,0],122:[0,.43056,.12292,0],126:[.35,.31786,.11585,0],163:[0,.69444,0,0],305:[0,.43056,0,.02778],567:[.19444,.43056,0,.08334],768:[0,.69444,0,0],769:[0,.69444,.09694,0],770:[0,.69444,.06646,0],771:[0,.66786,.11585,0],772:[0,.56167,.10333,0],774:[0,.69444,.10806,0],775:[0,.66786,.11752,0],776:[0,.66786,.10474,0],778:[0,.69444,0,0],779:[0,.69444,.1225,0],780:[0,.62847,.08295,0],915:[0,.68333,.13305,0],916:[0,.68333,0,0],920:[0,.68333,.09403,0],923:[0,.68333,0,0],926:[0,.68333,.15294,0],928:[0,.68333,.16389,0],931:[0,.68333,.12028,0],933:[0,.68333,.11111,0],934:[0,.68333,.05986,0],936:[0,.68333,.11111,0],937:[0,.68333,.10257,0],8211:[0,.43056,.09208,0],8212:[0,.43056,.09208,0],8216:[0,.69444,.12417,0],8217:[0,.69444,.12417,0],8220:[0,.69444,.1685,0],8221:[0,.69444,.06961,0],8463:[0,.68889,0,0]},"Main-Regular":{32:[0,0,0,0],33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.19444,.10556,0,0],45:[0,.43056,0,0],46:[0,.10556,0,0],47:[.25,.75,0,0],48:[0,.64444,0,0],49:[0,.64444,0,0],50:[0,.64444,0,0],51:[0,.64444,0,0],52:[0,.64444,0,0],53:[0,.64444,0,0],54:[0,.64444,0,0],55:[0,.64444,0,0],56:[0,.64444,0,0],57:[0,.64444,0,0],58:[0,.43056,0,0],59:[.19444,.43056,0,0],60:[.0391,.5391,0,0],61:[-.13313,.36687,0,0],62:[.0391,.5391,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.68333,0,0],66:[0,.68333,0,0],67:[0,.68333,0,0],68:[0,.68333,0,0],69:[0,.68333,0,0],70:[0,.68333,0,0],71:[0,.68333,0,0],72:[0,.68333,0,0],73:[0,.68333,0,0],74:[0,.68333,0,0],75:[0,.68333,0,0],76:[0,.68333,0,0],77:[0,.68333,0,0],78:[0,.68333,0,0],79:[0,.68333,0,0],80:[0,.68333,0,0],81:[.19444,.68333,0,0],82:[0,.68333,0,0],83:[0,.68333,0,0],84:[0,.68333,0,0],85:[0,.68333,0,0],86:[0,.68333,.01389,0],87:[0,.68333,.01389,0],88:[0,.68333,0,0],89:[0,.68333,.025,0],90:[0,.68333,0,0],91:[.25,.75,0,0],92:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.31,.12056,.02778,0],96:[0,.69444,0,0],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,0],100:[0,.69444,0,0],101:[0,.43056,0,0],102:[0,.69444,.07778,0],103:[.19444,.43056,.01389,0],104:[0,.69444,0,0],105:[0,.66786,0,0],106:[.19444,.66786,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.19444,.43056,0,0],113:[.19444,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.61508,0,0],117:[0,.43056,0,0],118:[0,.43056,.01389,0],119:[0,.43056,.01389,0],120:[0,.43056,0,0],121:[.19444,.43056,.01389,0],122:[0,.43056,0,0],123:[.25,.75,0,0],124:[.25,.75,0,0],125:[.25,.75,0,0],126:[.35,.31786,0,0],160:[0,0,0,0],168:[0,.66786,0,0],172:[0,.43056,0,0],175:[0,.56778,0,0],176:[0,.69444,0,0],177:[.08333,.58333,0,0],180:[0,.69444,0,0],215:[.08333,.58333,0,0],247:[.08333,.58333,0,0],305:[0,.43056,0,0],567:[.19444,.43056,0,0],710:[0,.69444,0,0],711:[0,.62847,0,0],713:[0,.56778,0,0],714:[0,.69444,0,0],715:[0,.69444,0,0],728:[0,.69444,0,0],729:[0,.66786,0,0],730:[0,.69444,0,0],732:[0,.66786,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.66786,0,0],772:[0,.56778,0,0],774:[0,.69444,0,0],775:[0,.66786,0,0],776:[0,.66786,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.62847,0,0],824:[.19444,.69444,0,0],915:[0,.68333,0,0],916:[0,.68333,0,0],920:[0,.68333,0,0],923:[0,.68333,0,0],926:[0,.68333,0,0],928:[0,.68333,0,0],931:[0,.68333,0,0],933:[0,.68333,0,0],934:[0,.68333,0,0],936:[0,.68333,0,0],937:[0,.68333,0,0],8211:[0,.43056,.02778,0],8212:[0,.43056,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0],8224:[.19444,.69444,0,0],8225:[.19444,.69444,0,0],8230:[0,.12,0,0],8242:[0,.55556,0,0],8407:[0,.71444,.15382,0],8463:[0,.68889,0,0],8465:[0,.69444,0,0],8467:[0,.69444,0,.11111],8472:[.19444,.43056,0,.11111],8476:[0,.69444,0,0],8501:[0,.69444,0,0],8592:[-.13313,.36687,0,0],8593:[.19444,.69444,0,0],8594:[-.13313,.36687,0,0],8595:[.19444,.69444,0,0],8596:[-.13313,.36687,0,0],8597:[.25,.75,0,0],8598:[.19444,.69444,0,0],8599:[.19444,.69444,0,0],8600:[.19444,.69444,0,0],8601:[.19444,.69444,0,0],8614:[.011,.511,0,0],8617:[.011,.511,0,0],8618:[.011,.511,0,0],8636:[-.13313,.36687,0,0],8637:[-.13313,.36687,0,0],8640:[-.13313,.36687,0,0],8641:[-.13313,.36687,0,0],8652:[.011,.671,0,0],8656:[-.13313,.36687,0,0],8657:[.19444,.69444,0,0],8658:[-.13313,.36687,0,0],8659:[.19444,.69444,0,0],8660:[-.13313,.36687,0,0],8661:[.25,.75,0,0],8704:[0,.69444,0,0],8706:[0,.69444,.05556,.08334],8707:[0,.69444,0,0],8709:[.05556,.75,0,0],8711:[0,.68333,0,0],8712:[.0391,.5391,0,0],8715:[.0391,.5391,0,0],8722:[.08333,.58333,0,0],8723:[.08333,.58333,0,0],8725:[.25,.75,0,0],8726:[.25,.75,0,0],8727:[-.03472,.46528,0,0],8728:[-.05555,.44445,0,0],8729:[-.05555,.44445,0,0],8730:[.2,.8,0,0],8733:[0,.43056,0,0],8734:[0,.43056,0,0],8736:[0,.69224,0,0],8739:[.25,.75,0,0],8741:[.25,.75,0,0],8743:[0,.55556,0,0],8744:[0,.55556,0,0],8745:[0,.55556,0,0],8746:[0,.55556,0,0],8747:[.19444,.69444,.11111,0],8764:[-.13313,.36687,0,0],8768:[.19444,.69444,0,0],8771:[-.03625,.46375,0,0],8773:[-.022,.589,0,0],8776:[-.01688,.48312,0,0],8781:[-.03625,.46375,0,0],8784:[-.133,.67,0,0],8800:[.215,.716,0,0],8801:[-.03625,.46375,0,0],8804:[.13597,.63597,0,0],8805:[.13597,.63597,0,0],8810:[.0391,.5391,0,0],8811:[.0391,.5391,0,0],8826:[.0391,.5391,0,0],8827:[.0391,.5391,0,0],8834:[.0391,.5391,0,0],8835:[.0391,.5391,0,0],8838:[.13597,.63597,0,0],8839:[.13597,.63597,0,0],8846:[0,.55556,0,0],8849:[.13597,.63597,0,0],8850:[.13597,.63597,0,0],8851:[0,.55556,0,0],8852:[0,.55556,0,0],8853:[.08333,.58333,0,0],8854:[.08333,.58333,0,0],8855:[.08333,.58333,0,0],8856:[.08333,.58333,0,0],8857:[.08333,.58333,0,0],8866:[0,.69444,0,0],8867:[0,.69444,0,0],8868:[0,.69444,0,0],8869:[0,.69444,0,0],8872:[.249,.75,0,0],8900:[-.05555,.44445,0,0],8901:[-.05555,.44445,0,0],8902:[-.03472,.46528,0,0],8904:[.005,.505,0,0],8942:[.03,.9,0,0],8943:[-.19,.31,0,0],8945:[-.1,.82,0,0],8968:[.25,.75,0,0],8969:[.25,.75,0,0],8970:[.25,.75,0,0],8971:[.25,.75,0,0],8994:[-.14236,.35764,0,0],8995:[-.14236,.35764,0,0],9136:[.244,.744,0,0],9137:[.244,.744,0,0],9651:[.19444,.69444,0,0],9657:[-.03472,.46528,0,0],9661:[.19444,.69444,0,0],9667:[-.03472,.46528,0,0],9711:[.19444,.69444,0,0],9824:[.12963,.69444,0,0],9825:[.12963,.69444,0,0],9826:[.12963,.69444,0,0],9827:[.12963,.69444,0,0],9837:[0,.75,0,0],9838:[.19444,.69444,0,0],9839:[.19444,.69444,0,0],10216:[.25,.75,0,0],10217:[.25,.75,0,0],10222:[.244,.744,0,0],10223:[.244,.744,0,0],10229:[.011,.511,0,0],10230:[.011,.511,0,0],10231:[.011,.511,0,0],10232:[.024,.525,0,0],10233:[.024,.525,0,0],10234:[.024,.525,0,0],10236:[.011,.511,0,0],10815:[0,.68333,0,0],10927:[.13597,.63597,0,0],10928:[.13597,.63597,0,0]},"Math-BoldItalic":{47:[.19444,.69444,0,0],65:[0,.68611,0,0],66:[0,.68611,.04835,0],67:[0,.68611,.06979,0],68:[0,.68611,.03194,0],69:[0,.68611,.05451,0],70:[0,.68611,.15972,0],71:[0,.68611,0,0],72:[0,.68611,.08229,0],73:[0,.68611,.07778,0],74:[0,.68611,.10069,0],75:[0,.68611,.06979,0],76:[0,.68611,0,0],77:[0,.68611,.11424,0],78:[0,.68611,.11424,0],79:[0,.68611,.03194,0],80:[0,.68611,.15972,0],81:[.19444,.68611,0,0],82:[0,.68611,.00421,0],83:[0,.68611,.05382,0],84:[0,.68611,.15972,0],85:[0,.68611,.11424,0],86:[0,.68611,.25555,0],87:[0,.68611,.15972,0],88:[0,.68611,.07778,0],89:[0,.68611,.25555,0],90:[0,.68611,.06979,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[.19444,.69444,.11042,0],103:[.19444,.44444,.03704,0],104:[0,.69444,0,0],105:[0,.69326,0,0],106:[.19444,.69326,.0622,0],107:[0,.69444,.01852,0],108:[0,.69444,.0088,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,.03704,0],114:[0,.44444,.03194,0],115:[0,.44444,0,0],116:[0,.63492,0,0],117:[0,.44444,0,0],118:[0,.44444,.03704,0],119:[0,.44444,.02778,0],120:[0,.44444,0,0],121:[.19444,.44444,.03704,0],122:[0,.44444,.04213,0],915:[0,.68611,.15972,0],916:[0,.68611,0,0],920:[0,.68611,.03194,0],923:[0,.68611,0,0],926:[0,.68611,.07458,0],928:[0,.68611,.08229,0],931:[0,.68611,.05451,0],933:[0,.68611,.15972,0],934:[0,.68611,0,0],936:[0,.68611,.11653,0],937:[0,.68611,.04835,0],945:[0,.44444,0,0],946:[.19444,.69444,.03403,0],947:[.19444,.44444,.06389,0],948:[0,.69444,.03819,0],949:[0,.44444,0,0],950:[.19444,.69444,.06215,0],951:[.19444,.44444,.03704,0],952:[0,.69444,.03194,0],953:[0,.44444,0,0],954:[0,.44444,0,0],955:[0,.69444,0,0],956:[.19444,.44444,0,0],957:[0,.44444,.06898,0],958:[.19444,.69444,.03021,0],959:[0,.44444,0,0],960:[0,.44444,.03704,0],961:[.19444,.44444,0,0],962:[.09722,.44444,.07917,0],963:[0,.44444,.03704,0],964:[0,.44444,.13472,0],965:[0,.44444,.03704,0],966:[.19444,.44444,0,0],967:[.19444,.44444,0,0],968:[.19444,.69444,.03704,0],969:[0,.44444,.03704,0],977:[0,.69444,0,0],981:[.19444,.69444,0,0],982:[0,.44444,.03194,0],1009:[.19444,.44444,0,0],1013:[0,.44444,0,0]},"Math-Italic":{47:[.19444,.69444,0,0],65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"Math-Regular":{65:[0,.68333,0,.13889],66:[0,.68333,.05017,.08334],67:[0,.68333,.07153,.08334],68:[0,.68333,.02778,.05556],69:[0,.68333,.05764,.08334],70:[0,.68333,.13889,.08334],71:[0,.68333,0,.08334],72:[0,.68333,.08125,.05556],73:[0,.68333,.07847,.11111],74:[0,.68333,.09618,.16667],75:[0,.68333,.07153,.05556],76:[0,.68333,0,.02778],77:[0,.68333,.10903,.08334],78:[0,.68333,.10903,.08334],79:[0,.68333,.02778,.08334],80:[0,.68333,.13889,.08334],81:[.19444,.68333,0,.08334],82:[0,.68333,.00773,.08334],83:[0,.68333,.05764,.08334],84:[0,.68333,.13889,.08334],85:[0,.68333,.10903,.02778],86:[0,.68333,.22222,0],87:[0,.68333,.13889,0],88:[0,.68333,.07847,.08334],89:[0,.68333,.22222,0],90:[0,.68333,.07153,.08334],97:[0,.43056,0,0],98:[0,.69444,0,0],99:[0,.43056,0,.05556],100:[0,.69444,0,.16667],101:[0,.43056,0,.05556],102:[.19444,.69444,.10764,.16667],103:[.19444,.43056,.03588,.02778],104:[0,.69444,0,0],105:[0,.65952,0,0],106:[.19444,.65952,.05724,0],107:[0,.69444,.03148,0],108:[0,.69444,.01968,.08334],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,.05556],112:[.19444,.43056,0,.08334],113:[.19444,.43056,.03588,.08334],114:[0,.43056,.02778,.05556],115:[0,.43056,0,.05556],116:[0,.61508,0,.08334],117:[0,.43056,0,.02778],118:[0,.43056,.03588,.02778],119:[0,.43056,.02691,.08334],120:[0,.43056,0,.02778],121:[.19444,.43056,.03588,.05556],122:[0,.43056,.04398,.05556],915:[0,.68333,.13889,.08334],916:[0,.68333,0,.16667],920:[0,.68333,.02778,.08334],923:[0,.68333,0,.16667],926:[0,.68333,.07569,.08334],928:[0,.68333,.08125,.05556],931:[0,.68333,.05764,.08334],933:[0,.68333,.13889,.05556],934:[0,.68333,0,.08334],936:[0,.68333,.11,.05556],937:[0,.68333,.05017,.08334],945:[0,.43056,.0037,.02778],946:[.19444,.69444,.05278,.08334],947:[.19444,.43056,.05556,0],948:[0,.69444,.03785,.05556],949:[0,.43056,0,.08334],950:[.19444,.69444,.07378,.08334],951:[.19444,.43056,.03588,.05556],952:[0,.69444,.02778,.08334],953:[0,.43056,0,.05556],954:[0,.43056,0,0],955:[0,.69444,0,0],956:[.19444,.43056,0,.02778],957:[0,.43056,.06366,.02778],958:[.19444,.69444,.04601,.11111],959:[0,.43056,0,.05556],960:[0,.43056,.03588,0],961:[.19444,.43056,0,.08334],962:[.09722,.43056,.07986,.08334],963:[0,.43056,.03588,0],964:[0,.43056,.1132,.02778],965:[0,.43056,.03588,.02778],966:[.19444,.43056,0,.08334],967:[.19444,.43056,0,.05556],968:[.19444,.69444,.03588,.11111],969:[0,.43056,.03588,0],977:[0,.69444,0,.08334],981:[.19444,.69444,0,.08334],982:[0,.43056,.02778,0],1009:[.19444,.43056,0,.08334],1013:[0,.43056,0,.05556]},"SansSerif-Regular":{33:[0,.69444,0,0],34:[0,.69444,0,0],35:[.19444,.69444,0,0],36:[.05556,.75,0,0],37:[.05556,.75,0,0],38:[0,.69444,0,0],39:[0,.69444,0,0],40:[.25,.75,0,0],41:[.25,.75,0,0],42:[0,.75,0,0],43:[.08333,.58333,0,0],44:[.125,.08333,0,0],45:[0,.44444,0,0],46:[0,.08333,0,0],47:[.25,.75,0,0],48:[0,.65556,0,0],49:[0,.65556,0,0],50:[0,.65556,0,0],51:[0,.65556,0,0],52:[0,.65556,0,0],53:[0,.65556,0,0],54:[0,.65556,0,0],55:[0,.65556,0,0],56:[0,.65556,0,0],57:[0,.65556,0,0],58:[0,.44444,0,0],59:[.125,.44444,0,0],61:[-.13,.37,0,0],63:[0,.69444,0,0],64:[0,.69444,0,0],65:[0,.69444,0,0],66:[0,.69444,0,0],67:[0,.69444,0,0],68:[0,.69444,0,0],69:[0,.69444,0,0],70:[0,.69444,0,0],71:[0,.69444,0,0],72:[0,.69444,0,0],73:[0,.69444,0,0],74:[0,.69444,0,0],75:[0,.69444,0,0],76:[0,.69444,0,0],77:[0,.69444,0,0],78:[0,.69444,0,0],79:[0,.69444,0,0],80:[0,.69444,0,0],81:[.125,.69444,0,0],82:[0,.69444,0,0],83:[0,.69444,0,0],84:[0,.69444,0,0],85:[0,.69444,0,0],86:[0,.69444,.01389,0],87:[0,.69444,.01389,0],88:[0,.69444,0,0],89:[0,.69444,.025,0],90:[0,.69444,0,0],91:[.25,.75,0,0],93:[.25,.75,0,0],94:[0,.69444,0,0],95:[.35,.09444,.02778,0],97:[0,.44444,0,0],98:[0,.69444,0,0],99:[0,.44444,0,0],100:[0,.69444,0,0],101:[0,.44444,0,0],102:[0,.69444,.06944,0],103:[.19444,.44444,.01389,0],104:[0,.69444,0,0],105:[0,.67937,0,0],106:[.19444,.67937,0,0],107:[0,.69444,0,0],108:[0,.69444,0,0],109:[0,.44444,0,0],110:[0,.44444,0,0],111:[0,.44444,0,0],112:[.19444,.44444,0,0],113:[.19444,.44444,0,0],114:[0,.44444,.01389,0],115:[0,.44444,0,0],116:[0,.57143,0,0],117:[0,.44444,0,0],118:[0,.44444,.01389,0],119:[0,.44444,.01389,0],120:[0,.44444,0,0],121:[.19444,.44444,.01389,0],122:[0,.44444,0,0],126:[.35,.32659,0,0],305:[0,.44444,0,0],567:[.19444,.44444,0,0],768:[0,.69444,0,0],769:[0,.69444,0,0],770:[0,.69444,0,0],771:[0,.67659,0,0],772:[0,.60889,0,0],774:[0,.69444,0,0],775:[0,.67937,0,0],776:[0,.67937,0,0],778:[0,.69444,0,0],779:[0,.69444,0,0],780:[0,.63194,0,0],915:[0,.69444,0,0],916:[0,.69444,0,0],920:[0,.69444,0,0],923:[0,.69444,0,0],926:[0,.69444,0,0],928:[0,.69444,0,0],931:[0,.69444,0,0],933:[0,.69444,0,0],934:[0,.69444,0,0],936:[0,.69444,0,0],937:[0,.69444,0,0],8211:[0,.44444,.02778,0],8212:[0,.44444,.02778,0],8216:[0,.69444,0,0],8217:[0,.69444,0,0],8220:[0,.69444,0,0],8221:[0,.69444,0,0]},"Script-Regular":{65:[0,.7,.22925,0],66:[0,.7,.04087,0],67:[0,.7,.1689,0],68:[0,.7,.09371,0],69:[0,.7,.18583,0],70:[0,.7,.13634,0],71:[0,.7,.17322,0],72:[0,.7,.29694,0],73:[0,.7,.19189,0],74:[.27778,.7,.19189,0],75:[0,.7,.31259,0],76:[0,.7,.19189,0],77:[0,.7,.15981,0],78:[0,.7,.3525,0],79:[0,.7,.08078,0],80:[0,.7,.08078,0],81:[0,.7,.03305,0],82:[0,.7,.06259,0],83:[0,.7,.19189,0],84:[0,.7,.29087,0],85:[0,.7,.25815,0],86:[0,.7,.27523,0],87:[0,.7,.27523,0],88:[0,.7,.26006,0],89:[0,.7,.2939,0],90:[0,.7,.24037,0]},"Size1-Regular":{40:[.35001,.85,0,0],41:[.35001,.85,0,0],47:[.35001,.85,0,0],91:[.35001,.85,0,0],92:[.35001,.85,0,0],93:[.35001,.85,0,0],123:[.35001,.85,0,0],125:[.35001,.85,0,0],710:[0,.72222,0,0],732:[0,.72222,0,0],770:[0,.72222,0,0],771:[0,.72222,0,0],8214:[-99e-5,.601,0,0],8593:[1e-5,.6,0,0],8595:[1e-5,.6,0,0],8657:[1e-5,.6,0,0],8659:[1e-5,.6,0,0],8719:[.25001,.75,0,0],8720:[.25001,.75,0,0],8721:[.25001,.75,0,0],8730:[.35001,.85,0,0],8739:[-.00599,.606,0,0],8741:[-.00599,.606,0,0],8747:[.30612,.805,.19445,0],8748:[.306,.805,.19445,0],8749:[.306,.805,.19445,0],8750:[.30612,.805,.19445,0],8896:[.25001,.75,0,0],8897:[.25001,.75,0,0],8898:[.25001,.75,0,0],8899:[.25001,.75,0,0],8968:[.35001,.85,0,0],8969:[.35001,.85,0,0],8970:[.35001,.85,0,0],8971:[.35001,.85,0,0],9168:[-99e-5,.601,0,0],10216:[.35001,.85,0,0],10217:[.35001,.85,0,0],10752:[.25001,.75,0,0],10753:[.25001,.75,0,0],10754:[.25001,.75,0,0],10756:[.25001,.75,0,0],10758:[.25001,.75,0,0]},"Size2-Regular":{40:[.65002,1.15,0,0],41:[.65002,1.15,0,0],47:[.65002,1.15,0,0],91:[.65002,1.15,0,0],92:[.65002,1.15,0,0],93:[.65002,1.15,0,0],123:[.65002,1.15,0,0],125:[.65002,1.15,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8719:[.55001,1.05,0,0],8720:[.55001,1.05,0,0],8721:[.55001,1.05,0,0],8730:[.65002,1.15,0,0],8747:[.86225,1.36,.44445,0],8748:[.862,1.36,.44445,0],8749:[.862,1.36,.44445,0],8750:[.86225,1.36,.44445,0],8896:[.55001,1.05,0,0],8897:[.55001,1.05,0,0],8898:[.55001,1.05,0,0],8899:[.55001,1.05,0,0],8968:[.65002,1.15,0,0],8969:[.65002,1.15,0,0],8970:[.65002,1.15,0,0],8971:[.65002,1.15,0,0],10216:[.65002,1.15,0,0],10217:[.65002,1.15,0,0],10752:[.55001,1.05,0,0],10753:[.55001,1.05,0,0],10754:[.55001,1.05,0,0], -10756:[.55001,1.05,0,0],10758:[.55001,1.05,0,0]},"Size3-Regular":{40:[.95003,1.45,0,0],41:[.95003,1.45,0,0],47:[.95003,1.45,0,0],91:[.95003,1.45,0,0],92:[.95003,1.45,0,0],93:[.95003,1.45,0,0],123:[.95003,1.45,0,0],125:[.95003,1.45,0,0],710:[0,.75,0,0],732:[0,.75,0,0],770:[0,.75,0,0],771:[0,.75,0,0],8730:[.95003,1.45,0,0],8968:[.95003,1.45,0,0],8969:[.95003,1.45,0,0],8970:[.95003,1.45,0,0],8971:[.95003,1.45,0,0],10216:[.95003,1.45,0,0],10217:[.95003,1.45,0,0]},"Size4-Regular":{40:[1.25003,1.75,0,0],41:[1.25003,1.75,0,0],47:[1.25003,1.75,0,0],91:[1.25003,1.75,0,0],92:[1.25003,1.75,0,0],93:[1.25003,1.75,0,0],123:[1.25003,1.75,0,0],125:[1.25003,1.75,0,0],710:[0,.825,0,0],732:[0,.825,0,0],770:[0,.825,0,0],771:[0,.825,0,0],8730:[1.25003,1.75,0,0],8968:[1.25003,1.75,0,0],8969:[1.25003,1.75,0,0],8970:[1.25003,1.75,0,0],8971:[1.25003,1.75,0,0],9115:[.64502,1.155,0,0],9116:[1e-5,.6,0,0],9117:[.64502,1.155,0,0],9118:[.64502,1.155,0,0],9119:[1e-5,.6,0,0],9120:[.64502,1.155,0,0],9121:[.64502,1.155,0,0],9122:[-99e-5,.601,0,0],9123:[.64502,1.155,0,0],9124:[.64502,1.155,0,0],9125:[-99e-5,.601,0,0],9126:[.64502,1.155,0,0],9127:[1e-5,.9,0,0],9128:[.65002,1.15,0,0],9129:[.90001,0,0,0],9130:[0,.3,0,0],9131:[1e-5,.9,0,0],9132:[.65002,1.15,0,0],9133:[.90001,0,0,0],9143:[.88502,.915,0,0],10216:[1.25003,1.75,0,0],10217:[1.25003,1.75,0,0],57344:[-.00499,.605,0,0],57345:[-.00499,.605,0,0],57680:[0,.12,0,0],57681:[0,.12,0,0],57682:[0,.12,0,0],57683:[0,.12,0,0]},"Typewriter-Regular":{33:[0,.61111,0,0],34:[0,.61111,0,0],35:[0,.61111,0,0],36:[.08333,.69444,0,0],37:[.08333,.69444,0,0],38:[0,.61111,0,0],39:[0,.61111,0,0],40:[.08333,.69444,0,0],41:[.08333,.69444,0,0],42:[0,.52083,0,0],43:[-.08056,.53055,0,0],44:[.13889,.125,0,0],45:[-.08056,.53055,0,0],46:[0,.125,0,0],47:[.08333,.69444,0,0],48:[0,.61111,0,0],49:[0,.61111,0,0],50:[0,.61111,0,0],51:[0,.61111,0,0],52:[0,.61111,0,0],53:[0,.61111,0,0],54:[0,.61111,0,0],55:[0,.61111,0,0],56:[0,.61111,0,0],57:[0,.61111,0,0],58:[0,.43056,0,0],59:[.13889,.43056,0,0],60:[-.05556,.55556,0,0],61:[-.19549,.41562,0,0],62:[-.05556,.55556,0,0],63:[0,.61111,0,0],64:[0,.61111,0,0],65:[0,.61111,0,0],66:[0,.61111,0,0],67:[0,.61111,0,0],68:[0,.61111,0,0],69:[0,.61111,0,0],70:[0,.61111,0,0],71:[0,.61111,0,0],72:[0,.61111,0,0],73:[0,.61111,0,0],74:[0,.61111,0,0],75:[0,.61111,0,0],76:[0,.61111,0,0],77:[0,.61111,0,0],78:[0,.61111,0,0],79:[0,.61111,0,0],80:[0,.61111,0,0],81:[.13889,.61111,0,0],82:[0,.61111,0,0],83:[0,.61111,0,0],84:[0,.61111,0,0],85:[0,.61111,0,0],86:[0,.61111,0,0],87:[0,.61111,0,0],88:[0,.61111,0,0],89:[0,.61111,0,0],90:[0,.61111,0,0],91:[.08333,.69444,0,0],92:[.08333,.69444,0,0],93:[.08333,.69444,0,0],94:[0,.61111,0,0],95:[.09514,0,0,0],96:[0,.61111,0,0],97:[0,.43056,0,0],98:[0,.61111,0,0],99:[0,.43056,0,0],100:[0,.61111,0,0],101:[0,.43056,0,0],102:[0,.61111,0,0],103:[.22222,.43056,0,0],104:[0,.61111,0,0],105:[0,.61111,0,0],106:[.22222,.61111,0,0],107:[0,.61111,0,0],108:[0,.61111,0,0],109:[0,.43056,0,0],110:[0,.43056,0,0],111:[0,.43056,0,0],112:[.22222,.43056,0,0],113:[.22222,.43056,0,0],114:[0,.43056,0,0],115:[0,.43056,0,0],116:[0,.55358,0,0],117:[0,.43056,0,0],118:[0,.43056,0,0],119:[0,.43056,0,0],120:[0,.43056,0,0],121:[.22222,.43056,0,0],122:[0,.43056,0,0],123:[.08333,.69444,0,0],124:[.08333,.69444,0,0],125:[.08333,.69444,0,0],126:[0,.61111,0,0],127:[0,.61111,0,0],305:[0,.43056,0,0],567:[.22222,.43056,0,0],768:[0,.61111,0,0],769:[0,.61111,0,0],770:[0,.61111,0,0],771:[0,.61111,0,0],772:[0,.56555,0,0],774:[0,.61111,0,0],776:[0,.61111,0,0],778:[0,.61111,0,0],780:[0,.56597,0,0],915:[0,.61111,0,0],916:[0,.61111,0,0],920:[0,.61111,0,0],923:[0,.61111,0,0],926:[0,.61111,0,0],928:[0,.61111,0,0],931:[0,.61111,0,0],933:[0,.61111,0,0],934:[0,.61111,0,0],936:[0,.61111,0,0],937:[0,.61111,0,0],2018:[0,.61111,0,0],2019:[0,.61111,0,0],8242:[0,.61111,0,0]}}},{}],19:[function(e,t,r){var a=e("./utils");var i=e("./ParseError");var n=e("./parseData");var s=n.ParseNode;function l(e,r,a){if(typeof e==="string"){e=[e]}if(typeof r==="number"){r={numArgs:r}}var i={numArgs:r.numArgs,argTypes:r.argTypes,greediness:r.greediness===undefined?1:r.greediness,allowedInText:!!r.allowedInText,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,handler:a};for(var n=0;n","\\langle","\\rangle","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];var c={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};l(["\\blue","\\orange","\\pink","\\red","\\green","\\gray","\\purple","\\blueA","\\blueB","\\blueC","\\blueD","\\blueE","\\tealA","\\tealB","\\tealC","\\tealD","\\tealE","\\greenA","\\greenB","\\greenC","\\greenD","\\greenE","\\goldA","\\goldB","\\goldC","\\goldD","\\goldE","\\redA","\\redB","\\redC","\\redD","\\redE","\\maroonA","\\maroonB","\\maroonC","\\maroonD","\\maroonE","\\purpleA","\\purpleB","\\purpleC","\\purpleD","\\purpleE","\\mintA","\\mintB","\\mintC","\\grayA","\\grayB","\\grayC","\\grayD","\\grayE","\\grayF","\\grayG","\\grayH","\\grayI","\\kaBlue","\\kaGreen"],{numArgs:1,allowedInText:true,greediness:3},function(e,t){var r=t[0];return{type:"color",color:"katex-"+e.funcName.slice(1),value:o(r)}});l(["\\arcsin","\\arccos","\\arctan","\\arg","\\cos","\\cosh","\\cot","\\coth","\\csc","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\tan","\\tanh"],{numArgs:0},function(e){return{type:"op",limits:false,symbol:false,body:e.funcName}});l(["\\det","\\gcd","\\inf","\\lim","\\liminf","\\limsup","\\max","\\min","\\Pr","\\sup"],{numArgs:0},function(e){return{type:"op",limits:true,symbol:false,body:e.funcName}});l(["\\int","\\iint","\\iiint","\\oint"],{numArgs:0},function(e){return{type:"op",limits:false,symbol:true,body:e.funcName}});l(["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint"],{numArgs:0},function(e){return{type:"op",limits:true,symbol:true,body:e.funcName}});l("\\mathop",{numArgs:1},function(e,t){var r=t[0];return{type:"op",limits:false,symbol:false,value:o(r)}});l(["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac"],{numArgs:2,greediness:2},function(e,t){var r=t[0];var a=t[1];var i;var n=null;var s=null;var l="auto";switch(e.funcName){case"\\dfrac":case"\\frac":case"\\tfrac":i=true;break;case"\\\\atopfrac":i=false;break;case"\\dbinom":case"\\binom":case"\\tbinom":i=false;n="(";s=")";break;default:throw new Error("Unrecognized genfrac command")}switch(e.funcName){case"\\dfrac":case"\\dbinom":l="display";break;case"\\tfrac":case"\\tbinom":l="text";break}return{type:"genfrac",numer:r,denom:a,hasBarLine:i,leftDelim:n,rightDelim:s,size:l}});l(["\\llap","\\rlap"],{numArgs:1,allowedInText:true},function(e,t){var r=t[0];return{type:e.funcName.slice(1),body:r}});var m=function(e,t){if(a.contains(h,e.value)){return e}else{throw new i("Invalid delimiter: '"+e.value+"' after '"+t.funcName+"'",e)}};l(["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],{numArgs:1},function(e,t){var r=m(t[0],e);return{type:"delimsizing",size:p[e.funcName].size,mclass:p[e.funcName].mclass,value:r.value}});l(["\\left","\\right"],{numArgs:1},function(e,t){var r=m(t[0],e);return{type:"leftright",value:r.value}});l("\\middle",{numArgs:1},function(e,t){var r=m(t[0],e);if(!e.parser.leftrightDepth){throw new i("\\middle without preceding \\left",r)}return{type:"middle",value:r.value}});l(["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],0,null);l(["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],0,null);l(["\\mathrm","\\mathit","\\mathbf","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],{numArgs:1,greediness:2},function(e,t){var r=t[0];var a=e.funcName;if(a in c){a=c[a]}return{type:"font",font:a.slice(1),body:r}});l(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot"],{numArgs:1},function(e,t){var r=t[0];return{type:"accent",accent:e.funcName,base:r}});l(["\\over","\\choose","\\atop"],{numArgs:0,infix:true},function(e){var t;switch(e.funcName){case"\\over":t="\\frac";break;case"\\choose":t="\\binom";break;case"\\atop":t="\\\\atopfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",replaceWith:t,token:e.token}});l(["\\\\","\\cr"],{numArgs:0,numOptionalArgs:1,argTypes:["size"]},function(e,t){var r=t[0];return{type:"cr",size:r}});l(["\\begin","\\end"],{numArgs:1,argTypes:["text"]},function(e,t){var r=t[0];if(r.type!=="ordgroup"){throw new i("Invalid environment name",r)}var a="";for(var n=0;n";return e};function n(e){this.text=e}n.prototype.toNode=function(){return document.createTextNode(this.text)};n.prototype.toMarkup=function(){return a.escape(this.text)};t.exports={MathNode:i,TextNode:n}},{"./utils":25}],21:[function(e,t,r){function a(e,t,r,a,i){this.type=e;this.value=t;this.mode=r;if(a&&(!i||i.lexer===a.lexer)){this.lexer=a.lexer;this.start=a.start;this.end=(i||a).end}}t.exports={ParseNode:a}},{}],22:[function(e,t,r){var a=e("./Parser");var i=function(e,t){if(!(typeof e==="string"||e instanceof String)){throw new TypeError("KaTeX can only parse string typed expression")}var r=new a(e,t);return r.parse()};t.exports=i},{"./Parser":7}],23:[function(e,t,r){t.exports={math:{},text:{}};function a(e,r,a,i,n){t.exports[e][n]={font:r,group:a,replace:i}}var i="math";var n="text";var s="main";var l="ams";var o="accent";var u="bin";var p="close";var h="inner";var c="mathord";var m="op";var f="open";var v="punct";var d="rel";var g="spacing";var y="textord";a(i,s,d,"\u2261","\\equiv");a(i,s,d,"\u227a","\\prec");a(i,s,d,"\u227b","\\succ");a(i,s,d,"\u223c","\\sim");a(i,s,d,"\u22a5","\\perp");a(i,s,d,"\u2aaf","\\preceq");a(i,s,d,"\u2ab0","\\succeq");a(i,s,d,"\u2243","\\simeq");a(i,s,d,"\u2223","\\mid");a(i,s,d,"\u226a","\\ll");a(i,s,d,"\u226b","\\gg");a(i,s,d,"\u224d","\\asymp");a(i,s,d,"\u2225","\\parallel");a(i,s,d,"\u22c8","\\bowtie");a(i,s,d,"\u2323","\\smile");a(i,s,d,"\u2291","\\sqsubseteq");a(i,s,d,"\u2292","\\sqsupseteq");a(i,s,d,"\u2250","\\doteq");a(i,s,d,"\u2322","\\frown");a(i,s,d,"\u220b","\\ni");a(i,s,d,"\u221d","\\propto");a(i,s,d,"\u22a2","\\vdash");a(i,s,d,"\u22a3","\\dashv");a(i,s,d,"\u220b","\\owns");a(i,s,v,".","\\ldotp");a(i,s,v,"\u22c5","\\cdotp");a(i,s,y,"#","\\#");a(n,s,y,"#","\\#");a(i,s,y,"&","\\&");a(n,s,y,"&","\\&");a(i,s,y,"\u2135","\\aleph");a(i,s,y,"\u2200","\\forall");a(i,s,y,"\u210f","\\hbar");a(i,s,y,"\u2203","\\exists");a(i,s,y,"\u2207","\\nabla");a(i,s,y,"\u266d","\\flat");a(i,s,y,"\u2113","\\ell");a(i,s,y,"\u266e","\\natural");a(i,s,y,"\u2663","\\clubsuit");a(i,s,y,"\u2118","\\wp");a(i,s,y,"\u266f","\\sharp");a(i,s,y,"\u2662","\\diamondsuit");a(i,s,y,"\u211c","\\Re");a(i,s,y,"\u2661","\\heartsuit");a(i,s,y,"\u2111","\\Im");a(i,s,y,"\u2660","\\spadesuit");a(i,s,y,"\u2020","\\dag");a(i,s,y,"\u2021","\\ddag");a(i,s,p,"\u23b1","\\rmoustache");a(i,s,f,"\u23b0","\\lmoustache");a(i,s,p,"\u27ef","\\rgroup");a(i,s,f,"\u27ee","\\lgroup");a(i,s,u,"\u2213","\\mp");a(i,s,u,"\u2296","\\ominus");a(i,s,u,"\u228e","\\uplus");a(i,s,u,"\u2293","\\sqcap");a(i,s,u,"\u2217","\\ast");a(i,s,u,"\u2294","\\sqcup");a(i,s,u,"\u25ef","\\bigcirc");a(i,s,u,"\u2219","\\bullet");a(i,s,u,"\u2021","\\ddagger");a(i,s,u,"\u2240","\\wr");a(i,s,u,"\u2a3f","\\amalg");a(i,s,d,"\u27f5","\\longleftarrow");a(i,s,d,"\u21d0","\\Leftarrow");a(i,s,d,"\u27f8","\\Longleftarrow");a(i,s,d,"\u27f6","\\longrightarrow");a(i,s,d,"\u21d2","\\Rightarrow");a(i,s,d,"\u27f9","\\Longrightarrow");a(i,s,d,"\u2194","\\leftrightarrow");a(i,s,d,"\u27f7","\\longleftrightarrow");a(i,s,d,"\u21d4","\\Leftrightarrow");a(i,s,d,"\u27fa","\\Longleftrightarrow");a(i,s,d,"\u21a6","\\mapsto");a(i,s,d,"\u27fc","\\longmapsto");a(i,s,d,"\u2197","\\nearrow");a(i,s,d,"\u21a9","\\hookleftarrow");a(i,s,d,"\u21aa","\\hookrightarrow");a(i,s,d,"\u2198","\\searrow");a(i,s,d,"\u21bc","\\leftharpoonup");a(i,s,d,"\u21c0","\\rightharpoonup");a(i,s,d,"\u2199","\\swarrow");a(i,s,d,"\u21bd","\\leftharpoondown");a(i,s,d,"\u21c1","\\rightharpoondown");a(i,s,d,"\u2196","\\nwarrow");a(i,s,d,"\u21cc","\\rightleftharpoons");a(i,l,d,"\u226e","\\nless");a(i,l,d,"\ue010","\\nleqslant");a(i,l,d,"\ue011","\\nleqq");a(i,l,d,"\u2a87","\\lneq");a(i,l,d,"\u2268","\\lneqq");a(i,l,d,"\ue00c","\\lvertneqq");a(i,l,d,"\u22e6","\\lnsim");a(i,l,d,"\u2a89","\\lnapprox");a(i,l,d,"\u2280","\\nprec");a(i,l,d,"\u22e0","\\npreceq");a(i,l,d,"\u22e8","\\precnsim");a(i,l,d,"\u2ab9","\\precnapprox");a(i,l,d,"\u2241","\\nsim");a(i,l,d,"\ue006","\\nshortmid");a(i,l,d,"\u2224","\\nmid");a(i,l,d,"\u22ac","\\nvdash");a(i,l,d,"\u22ad","\\nvDash");a(i,l,d,"\u22ea","\\ntriangleleft");a(i,l,d,"\u22ec","\\ntrianglelefteq");a(i,l,d,"\u228a","\\subsetneq");a(i,l,d,"\ue01a","\\varsubsetneq");a(i,l,d,"\u2acb","\\subsetneqq");a(i,l,d,"\ue017","\\varsubsetneqq");a(i,l,d,"\u226f","\\ngtr");a(i,l,d,"\ue00f","\\ngeqslant");a(i,l,d,"\ue00e","\\ngeqq");a(i,l,d,"\u2a88","\\gneq");a(i,l,d,"\u2269","\\gneqq");a(i,l,d,"\ue00d","\\gvertneqq");a(i,l,d,"\u22e7","\\gnsim");a(i,l,d,"\u2a8a","\\gnapprox");a(i,l,d,"\u2281","\\nsucc");a(i,l,d,"\u22e1","\\nsucceq");a(i,l,d,"\u22e9","\\succnsim");a(i,l,d,"\u2aba","\\succnapprox");a(i,l,d,"\u2246","\\ncong");a(i,l,d,"\ue007","\\nshortparallel");a(i,l,d,"\u2226","\\nparallel");a(i,l,d,"\u22af","\\nVDash");a(i,l,d,"\u22eb","\\ntriangleright");a(i,l,d,"\u22ed","\\ntrianglerighteq");a(i,l,d,"\ue018","\\nsupseteqq");a(i,l,d,"\u228b","\\supsetneq");a(i,l,d,"\ue01b","\\varsupsetneq");a(i,l,d,"\u2acc","\\supsetneqq");a(i,l,d,"\ue019","\\varsupsetneqq");a(i,l,d,"\u22ae","\\nVdash");a(i,l,d,"\u2ab5","\\precneqq");a(i,l,d,"\u2ab6","\\succneqq");a(i,l,d,"\ue016","\\nsubseteqq");a(i,l,u,"\u22b4","\\unlhd");a(i,l,u,"\u22b5","\\unrhd");a(i,l,d,"\u219a","\\nleftarrow");a(i,l,d,"\u219b","\\nrightarrow");a(i,l,d,"\u21cd","\\nLeftarrow");a(i,l,d,"\u21cf","\\nRightarrow");a(i,l,d,"\u21ae","\\nleftrightarrow");a(i,l,d,"\u21ce","\\nLeftrightarrow");a(i,l,d,"\u25b3","\\vartriangle");a(i,l,y,"\u210f","\\hslash");a(i,l,y,"\u25bd","\\triangledown");a(i,l,y,"\u25ca","\\lozenge");a(i,l,y,"\u24c8","\\circledS");a(i,l,y,"\xae","\\circledR");a(i,l,y,"\u2221","\\measuredangle");a(i,l,y,"\u2204","\\nexists");a(i,l,y,"\u2127","\\mho");a(i,l,y,"\u2132","\\Finv");a(i,l,y,"\u2141","\\Game");a(i,l,y,"k","\\Bbbk");a(i,l,y,"\u2035","\\backprime");a(i,l,y,"\u25b2","\\blacktriangle");a(i,l,y,"\u25bc","\\blacktriangledown");a(i,l,y,"\u25a0","\\blacksquare");a(i,l,y,"\u29eb","\\blacklozenge");a(i,l,y,"\u2605","\\bigstar");a(i,l,y,"\u2222","\\sphericalangle");a(i,l,y,"\u2201","\\complement");a(i,l,y,"\xf0","\\eth");a(i,l,y,"\u2571","\\diagup");a(i,l,y,"\u2572","\\diagdown");a(i,l,y,"\u25a1","\\square");a(i,l,y,"\u25a1","\\Box");a(i,l,y,"\u25ca","\\Diamond");a(i,l,y,"\xa5","\\yen");a(i,l,y,"\u2713","\\checkmark");a(i,l,y,"\u2136","\\beth");a(i,l,y,"\u2138","\\daleth");a(i,l,y,"\u2137","\\gimel");a(i,l,y,"\u03dd","\\digamma");a(i,l,y,"\u03f0","\\varkappa");a(i,l,f,"\u250c","\\ulcorner");a(i,l,p,"\u2510","\\urcorner");a(i,l,f,"\u2514","\\llcorner");a(i,l,p,"\u2518","\\lrcorner");a(i,l,d,"\u2266","\\leqq");a(i,l,d,"\u2a7d","\\leqslant");a(i,l,d,"\u2a95","\\eqslantless");a(i,l,d,"\u2272","\\lesssim");a(i,l,d,"\u2a85","\\lessapprox");a(i,l,d,"\u224a","\\approxeq");a(i,l,u,"\u22d6","\\lessdot");a(i,l,d,"\u22d8","\\lll");a(i,l,d,"\u2276","\\lessgtr");a(i,l,d,"\u22da","\\lesseqgtr");a(i,l,d,"\u2a8b","\\lesseqqgtr");a(i,l,d,"\u2251","\\doteqdot");a(i,l,d,"\u2253","\\risingdotseq");a(i,l,d,"\u2252","\\fallingdotseq");a(i,l,d,"\u223d","\\backsim");a(i,l,d,"\u22cd","\\backsimeq");a(i,l,d,"\u2ac5","\\subseteqq");a(i,l,d,"\u22d0","\\Subset");a(i,l,d,"\u228f","\\sqsubset");a(i,l,d,"\u227c","\\preccurlyeq");a(i,l,d,"\u22de","\\curlyeqprec");a(i,l,d,"\u227e","\\precsim");a(i,l,d,"\u2ab7","\\precapprox");a(i,l,d,"\u22b2","\\vartriangleleft");a(i,l,d,"\u22b4","\\trianglelefteq");a(i,l,d,"\u22a8","\\vDash");a(i,l,d,"\u22aa","\\Vvdash");a(i,l,d,"\u2323","\\smallsmile");a(i,l,d,"\u2322","\\smallfrown");a(i,l,d,"\u224f","\\bumpeq");a(i,l,d,"\u224e","\\Bumpeq");a(i,l,d,"\u2267","\\geqq");a(i,l,d,"\u2a7e","\\geqslant");a(i,l,d,"\u2a96","\\eqslantgtr");a(i,l,d,"\u2273","\\gtrsim");a(i,l,d,"\u2a86","\\gtrapprox");a(i,l,u,"\u22d7","\\gtrdot");a(i,l,d,"\u22d9","\\ggg");a(i,l,d,"\u2277","\\gtrless");a(i,l,d,"\u22db","\\gtreqless");a(i,l,d,"\u2a8c","\\gtreqqless");a(i,l,d,"\u2256","\\eqcirc");a(i,l,d,"\u2257","\\circeq");a(i,l,d,"\u225c","\\triangleq");a(i,l,d,"\u223c","\\thicksim");a(i,l,d,"\u2248","\\thickapprox");a(i,l,d,"\u2ac6","\\supseteqq");a(i,l,d,"\u22d1","\\Supset");a(i,l,d,"\u2290","\\sqsupset");a(i,l,d,"\u227d","\\succcurlyeq");a(i,l,d,"\u22df","\\curlyeqsucc");a(i,l,d,"\u227f","\\succsim");a(i,l,d,"\u2ab8","\\succapprox");a(i,l,d,"\u22b3","\\vartriangleright");a(i,l,d,"\u22b5","\\trianglerighteq");a(i,l,d,"\u22a9","\\Vdash");a(i,l,d,"\u2223","\\shortmid");a(i,l,d,"\u2225","\\shortparallel");a(i,l,d,"\u226c","\\between");a(i,l,d,"\u22d4","\\pitchfork");a(i,l,d,"\u221d","\\varpropto");a(i,l,d,"\u25c0","\\blacktriangleleft");a(i,l,d,"\u2234","\\therefore");a(i,l,d,"\u220d","\\backepsilon");a(i,l,d,"\u25b6","\\blacktriangleright");a(i,l,d,"\u2235","\\because");a(i,l,d,"\u22d8","\\llless");a(i,l,d,"\u22d9","\\gggtr");a(i,l,u,"\u22b2","\\lhd");a(i,l,u,"\u22b3","\\rhd");a(i,l,d,"\u2242","\\eqsim");a(i,s,d,"\u22c8","\\Join");a(i,l,d,"\u2251","\\Doteq");a(i,l,u,"\u2214","\\dotplus");a(i,l,u,"\u2216","\\smallsetminus");a(i,l,u,"\u22d2","\\Cap");a(i,l,u,"\u22d3","\\Cup");a(i,l,u,"\u2a5e","\\doublebarwedge");a(i,l,u,"\u229f","\\boxminus");a(i,l,u,"\u229e","\\boxplus");a(i,l,u,"\u22c7","\\divideontimes");a(i,l,u,"\u22c9","\\ltimes");a(i,l,u,"\u22ca","\\rtimes");a(i,l,u,"\u22cb","\\leftthreetimes");a(i,l,u,"\u22cc","\\rightthreetimes");a(i,l,u,"\u22cf","\\curlywedge");a(i,l,u,"\u22ce","\\curlyvee");a(i,l,u,"\u229d","\\circleddash");a(i,l,u,"\u229b","\\circledast");a(i,l,u,"\u22c5","\\centerdot");a(i,l,u,"\u22ba","\\intercal");a(i,l,u,"\u22d2","\\doublecap");a(i,l,u,"\u22d3","\\doublecup");a(i,l,u,"\u22a0","\\boxtimes");a(i,l,d,"\u21e2","\\dashrightarrow");a(i,l,d,"\u21e0","\\dashleftarrow");a(i,l,d,"\u21c7","\\leftleftarrows");a(i,l,d,"\u21c6","\\leftrightarrows");a(i,l,d,"\u21da","\\Lleftarrow");a(i,l,d,"\u219e","\\twoheadleftarrow");a(i,l,d,"\u21a2","\\leftarrowtail");a(i,l,d,"\u21ab","\\looparrowleft");a(i,l,d,"\u21cb","\\leftrightharpoons");a(i,l,d,"\u21b6","\\curvearrowleft");a(i,l,d,"\u21ba","\\circlearrowleft");a(i,l,d,"\u21b0","\\Lsh");a(i,l,d,"\u21c8","\\upuparrows");a(i,l,d,"\u21bf","\\upharpoonleft");a(i,l,d,"\u21c3","\\downharpoonleft");a(i,l,d,"\u22b8","\\multimap");a(i,l,d,"\u21ad","\\leftrightsquigarrow");a(i,l,d,"\u21c9","\\rightrightarrows");a(i,l,d,"\u21c4","\\rightleftarrows");a(i,l,d,"\u21a0","\\twoheadrightarrow");a(i,l,d,"\u21a3","\\rightarrowtail");a(i,l,d,"\u21ac","\\looparrowright");a(i,l,d,"\u21b7","\\curvearrowright");a(i,l,d,"\u21bb","\\circlearrowright");a(i,l,d,"\u21b1","\\Rsh");a(i,l,d,"\u21ca","\\downdownarrows");a(i,l,d,"\u21be","\\upharpoonright");a(i,l,d,"\u21c2","\\downharpoonright");a(i,l,d,"\u21dd","\\rightsquigarrow");a(i,l,d,"\u21dd","\\leadsto");a(i,l,d,"\u21db","\\Rrightarrow");a(i,l,d,"\u21be","\\restriction");a(i,s,y,"\u2018","`");a(i,s,y,"$","\\$");a(n,s,y,"$","\\$");a(i,s,y,"%","\\%");a(n,s,y,"%","\\%");a(i,s,y,"_","\\_");a(n,s,y,"_","\\_");a(i,s,y,"\u2220","\\angle");a(i,s,y,"\u221e","\\infty");a(i,s,y,"\u2032","\\prime");a(i,s,y,"\u25b3","\\triangle");a(i,s,y,"\u0393","\\Gamma");a(i,s,y,"\u0394","\\Delta");a(i,s,y,"\u0398","\\Theta");a(i,s,y,"\u039b","\\Lambda");a(i,s,y,"\u039e","\\Xi");a(i,s,y,"\u03a0","\\Pi");a(i,s,y,"\u03a3","\\Sigma");a(i,s,y,"\u03a5","\\Upsilon");a(i,s,y,"\u03a6","\\Phi");a(i,s,y,"\u03a8","\\Psi");a(i,s,y,"\u03a9","\\Omega");a(i,s,y,"\xac","\\neg");a(i,s,y,"\xac","\\lnot");a(i,s,y,"\u22a4","\\top");a(i,s,y,"\u22a5","\\bot");a(i,s,y,"\u2205","\\emptyset");a(i,l,y,"\u2205","\\varnothing");a(i,s,c,"\u03b1","\\alpha");a(i,s,c,"\u03b2","\\beta");a(i,s,c,"\u03b3","\\gamma");a(i,s,c,"\u03b4","\\delta");a(i,s,c,"\u03f5","\\epsilon");a(i,s,c,"\u03b6","\\zeta");a(i,s,c,"\u03b7","\\eta");a(i,s,c,"\u03b8","\\theta");a(i,s,c,"\u03b9","\\iota");a(i,s,c,"\u03ba","\\kappa");a(i,s,c,"\u03bb","\\lambda");a(i,s,c,"\u03bc","\\mu");a(i,s,c,"\u03bd","\\nu");a(i,s,c,"\u03be","\\xi");a(i,s,c,"o","\\omicron");a(i,s,c,"\u03c0","\\pi");a(i,s,c,"\u03c1","\\rho");a(i,s,c,"\u03c3","\\sigma");a(i,s,c,"\u03c4","\\tau");a(i,s,c,"\u03c5","\\upsilon");a(i,s,c,"\u03d5","\\phi");a(i,s,c,"\u03c7","\\chi");a(i,s,c,"\u03c8","\\psi");a(i,s,c,"\u03c9","\\omega");a(i,s,c,"\u03b5","\\varepsilon");a(i,s,c,"\u03d1","\\vartheta");a(i,s,c,"\u03d6","\\varpi");a(i,s,c,"\u03f1","\\varrho");a(i,s,c,"\u03c2","\\varsigma");a(i,s,c,"\u03c6","\\varphi");a(i,s,u,"\u2217","*");a(i,s,u,"+","+");a(i,s,u,"\u2212","-");a(i,s,u,"\u22c5","\\cdot");a(i,s,u,"\u2218","\\circ");a(i,s,u,"\xf7","\\div");a(i,s,u,"\xb1","\\pm");a(i,s,u,"\xd7","\\times");a(i,s,u,"\u2229","\\cap");a(i,s,u,"\u222a","\\cup");a(i,s,u,"\u2216","\\setminus");a(i,s,u,"\u2227","\\land");a(i,s,u,"\u2228","\\lor");a(i,s,u,"\u2227","\\wedge");a(i,s,u,"\u2228","\\vee");a(i,s,y,"\u221a","\\surd");a(i,s,f,"(","(");a(i,s,f,"[","[");a(i,s,f,"\u27e8","\\langle");a(i,s,f,"\u2223","\\lvert");a(i,s,f,"\u2225","\\lVert");a(i,s,p,")",")");a(i,s,p,"]","]");a(i,s,p,"?","?");a(i,s,p,"!","!");a(i,s,p,"\u27e9","\\rangle");a(i,s,p,"\u2223","\\rvert");a(i,s,p,"\u2225","\\rVert");a(i,s,d,"=","=");a(i,s,d,"<","<");a(i,s,d,">",">");a(i,s,d,":",":");a(i,s,d,"\u2248","\\approx");a(i,s,d,"\u2245","\\cong");a(i,s,d,"\u2265","\\ge");a(i,s,d,"\u2265","\\geq");a(i,s,d,"\u2190","\\gets");a(i,s,d,">","\\gt");a(i,s,d,"\u2208","\\in");a(i,s,d,"\u2209","\\notin");a(i,s,d,"\u2282","\\subset");a(i,s,d,"\u2283","\\supset");a(i,s,d,"\u2286","\\subseteq");a(i,s,d,"\u2287","\\supseteq");a(i,l,d,"\u2288","\\nsubseteq");a(i,l,d,"\u2289","\\nsupseteq");a(i,s,d,"\u22a8","\\models");a(i,s,d,"\u2190","\\leftarrow");a(i,s,d,"\u2264","\\le");a(i,s,d,"\u2264","\\leq");a(i,s,d,"<","\\lt");a(i,s,d,"\u2260","\\ne");a(i,s,d,"\u2260","\\neq");a(i,s,d,"\u2192","\\rightarrow");a(i,s,d,"\u2192","\\to");a(i,l,d,"\u2271","\\ngeq");a(i,l,d,"\u2270","\\nleq");a(i,s,g,null,"\\!");a(i,s,g,"\xa0","\\ ");a(i,s,g,"\xa0","~");a(i,s,g,null,"\\,");a(i,s,g,null,"\\:");a(i,s,g,null,"\\;");a(i,s,g,null,"\\enspace");a(i,s,g,null,"\\qquad");a(i,s,g,null,"\\quad");a(i,s,g,"\xa0","\\space");a(i,s,v,",",",");a(i,s,v,";",";");a(i,s,v,":","\\colon");a(i,l,u,"\u22bc","\\barwedge");a(i,l,u,"\u22bb","\\veebar");a(i,s,u,"\u2299","\\odot");a(i,s,u,"\u2295","\\oplus");a(i,s,u,"\u2297","\\otimes");a(i,s,y,"\u2202","\\partial");a(i,s,u,"\u2298","\\oslash");a(i,l,u,"\u229a","\\circledcirc");a(i,l,u,"\u22a1","\\boxdot");a(i,s,u,"\u25b3","\\bigtriangleup");a(i,s,u,"\u25bd","\\bigtriangledown");a(i,s,u,"\u2020","\\dagger");a(i,s,u,"\u22c4","\\diamond");a(i,s,u,"\u22c6","\\star");a(i,s,u,"\u25c3","\\triangleleft");a(i,s,u,"\u25b9","\\triangleright");a(i,s,f,"{","\\{");a(n,s,y,"{","\\{");a(i,s,p,"}","\\}");a(n,s,y,"}","\\}");a(i,s,f,"{","\\lbrace");a(i,s,p,"}","\\rbrace");a(i,s,f,"[","\\lbrack");a(i,s,p,"]","\\rbrack");a(i,s,f,"\u230a","\\lfloor");a(i,s,p,"\u230b","\\rfloor");a(i,s,f,"\u2308","\\lceil");a(i,s,p,"\u2309","\\rceil");a(i,s,y,"\\","\\backslash");a(i,s,y,"\u2223","|");a(i,s,y,"\u2223","\\vert");a(i,s,y,"\u2225","\\|");a(i,s,y,"\u2225","\\Vert");a(i,s,d,"\u2191","\\uparrow");a(i,s,d,"\u21d1","\\Uparrow");a(i,s,d,"\u2193","\\downarrow");a(i,s,d,"\u21d3","\\Downarrow");a(i,s,d,"\u2195","\\updownarrow");a(i,s,d,"\u21d5","\\Updownarrow");a(i,i,m,"\u2210","\\coprod");a(i,i,m,"\u22c1","\\bigvee");a(i,i,m,"\u22c0","\\bigwedge");a(i,i,m,"\u2a04","\\biguplus");a(i,i,m,"\u22c2","\\bigcap");a(i,i,m,"\u22c3","\\bigcup");a(i,i,m,"\u222b","\\int");a(i,i,m,"\u222b","\\intop");a(i,i,m,"\u222c","\\iint");a(i,i,m,"\u222d","\\iiint");a(i,i,m,"\u220f","\\prod");a(i,i,m,"\u2211","\\sum");a(i,i,m,"\u2a02","\\bigotimes");a(i,i,m,"\u2a01","\\bigoplus");a(i,i,m,"\u2a00","\\bigodot");a(i,i,m,"\u222e","\\oint");a(i,i,m,"\u2a06","\\bigsqcup");a(i,i,m,"\u222b","\\smallint");a(n,s,h,"\u2026","\\textellipsis");a(i,s,h,"\u2026","\\mathellipsis");a(n,s,h,"\u2026","\\ldots");a(i,s,h,"\u2026","\\ldots");a(i,s,h,"\u22ef","\\cdots");a(i,s,h,"\u22f1","\\ddots");a(i,s,y,"\u22ee","\\vdots");a(i,s,o,"\xb4","\\acute");a(i,s,o,"`","\\grave");a(i,s,o,"\xa8","\\ddot");a(i,s,o,"~","\\tilde");a(i,s,o,"\xaf","\\bar");a(i,s,o,"\u02d8","\\breve");a(i,s,o,"\u02c7","\\check");a(i,s,o,"^","\\hat");a(i,s,o,"\u20d7","\\vec");a(i,s,o,"\u02d9","\\dot");a(i,s,c,"\u0131","\\imath");a(i,s,c,"\u0237","\\jmath");a(n,s,y,"\u2013","--");a(n,s,y,"\u2014","---");a(n,s,y,"\u2018","`");a(n,s,y,"\u2019","'");a(n,s,y,"\u201c","``");a(n,s,y,"\u201d","''");a(i,s,y,"\xb0","\\degree");a(n,s,y,"\xb0","\\degree");a(i,s,c,"\xa3","\\pounds");a(i,l,y,"\u2720","\\maltese");a(n,l,y,"\u2720","\\maltese");a(n,s,g,"\xa0","\\ ");a(n,s,g,"\xa0"," ");a(n,s,g,"\xa0","~");var x;var b;var w='0123456789/@."';for(x=0;x":">","<":"<",'"':""","'":"'"};var p=/[&><"']/g;function h(e){return u[e]}function c(e){return(""+e).replace(p,h)}var m;if(typeof document!=="undefined"){var f=document.createElement("span");if("textContent"in f){m=function(e,t){e.textContent=t}}else{m=function(e,t){e.innerText=t}}}function v(e){m(e,"")}t.exports={contains:n,deflt:s,escape:c,hyphenate:o,indexOf:i,setTextContent:m,clearNode:v}},{}]},{},[1])(1)}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.katex=t():e.katex=t()}("undefined"!=typeof self?self:this,function(){return function(r){var n={};function i(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}return i.m=r,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=2)}([function(e,t,r){},,function(e,t,r){"use strict";r.r(t);r(0);var p=function(){function r(e,t,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=r}return r.prototype.getSource=function(){return this.lexer.input.slice(this.start,this.end)},r.range=function(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new r(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc},r}(),a=function(){function r(e,t){this.text=void 0,this.loc=void 0,this.text=e,this.loc=t}return r.prototype.range=function(e,t){return new r(t,p.range(this,e))},r}(),n=function e(t,r){this.position=void 0;var n,i="KaTeX parse error: "+t,a=r&&r.loc;if(a&&a.start<=a.end){var o=a.lexer.input;n=a.start;var s=a.end;n===o.length?i+=" at end of input: ":i+=" at position "+(n+1)+": ";var l=o.slice(n,s).replace(/[^]/g,"$&\u0332");i+=(15":">","<":"<",'"':""","'":"'"},s=/[&><"']/g;var l=function e(t){return"ordgroup"===t.type?1===t.body.length?e(t.body[0]):t:"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},T=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Y={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(s,function(e){return o[e]})},hyphenate:function(e){return e.replace(i,"-$1").toLowerCase()},getBaseElem:l,isCharacterBox:function(e){var t=l(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type}},h=function(){function e(e){this.displayMode=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.allowedProtocols=void 0,e=e||{},this.displayMode=Y.deflt(e.displayMode,!1),this.throwOnError=Y.deflt(e.throwOnError,!0),this.errorColor=Y.deflt(e.errorColor,"#cc0000"),this.macros=e.macros||{},this.colorIsTextColor=Y.deflt(e.colorIsTextColor,!1),this.strict=Y.deflt(e.strict,"warn"),this.maxSize=Math.max(0,Y.deflt(e.maxSize,1/0)),this.maxExpand=Math.max(0,Y.deflt(e.maxExpand,1e3)),this.allowedProtocols=Y.deflt(e.allowedProtocols,["http","https","mailto","_relative"])}var t=e.prototype;return t.reportNonstrict=function(e,t,r){var n=this.strict;if("function"==typeof n&&(n=n(e,t,r)),n&&"ignore"!==n){if(!0===n||"error"===n)throw new X("LaTeX-incompatible input and strict mode is set to 'error': "+t+" ["+e+"]",r);"warn"===n?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+n+"': "+t+" ["+e+"]")}},t.useStrictBehavior=function(e,t,r){var n=this.strict;if("function"==typeof n)try{n=n(e,t,r)}catch(e){n="error"}return!(!n||"ignore"===n)&&(!0===n||"error"===n||("warn"===n?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+t+" ["+e+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+n+"': "+t+" ["+e+"]"),!1))},e}(),m=function(){function e(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}var t=e.prototype;return t.sup=function(){return c[u[this.id]]},t.sub=function(){return c[d[this.id]]},t.fracNum=function(){return c[f[this.id]]},t.fracDen=function(){return c[g[this.id]]},t.cramp=function(){return c[v[this.id]]},t.text=function(){return c[y[this.id]]},t.isTight=function(){return 2<=this.size},e}(),c=[new m(0,0,!1),new m(1,0,!0),new m(2,1,!1),new m(3,1,!0),new m(4,2,!1),new m(5,2,!0),new m(6,3,!1),new m(7,3,!0)],u=[4,5,4,5,6,7,6,7],d=[5,5,5,5,7,7,7,7],f=[2,3,4,5,6,7,6,7],g=[3,3,5,5,7,7,7,7],v=[1,1,3,3,5,5,7,7],y=[0,1,2,3,2,3,2,3],q={DISPLAY:c[0],TEXT:c[2],SCRIPT:c[4],SCRIPTSCRIPT:c[6]},b=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var x=[];function w(e){for(var t=0;t=x[t]&&e<=x[t+1])return!0;return!1}b.forEach(function(e){return e.blocks.forEach(function(e){return x.push.apply(x,e)})});var k={path:{sqrtMain:"M95,702c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,\n-10,-9.5,-14c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54c44.2,-33.3,65.8,\n-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10s173,378,173,378c0.7,0,\n35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429c69,-144,104.5,-217.7,106.5,\n-221c5.3,-9.3,12,-14,20,-14H400000v40H845.2724s-225.272,467,-225.272,467\ns-235,486,-235,486c-2.7,4.7,-9,7,-19,7c-6,0,-10,-1,-12,-3s-194,-422,-194,-422\ns-65,47,-65,47z M834 80H400000v40H845z",sqrtSize1:"M263,681c0.7,0,18,39.7,52,119c34,79.3,68.167,\n158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120c340,-704.7,510.7,-1060.3,512,-1067\nc4.7,-7.3,11,-11,19,-11H40000v40H1012.3s-271.3,567,-271.3,567c-38.7,80.7,-84,\n175,-136,283c-52,108,-89.167,185.3,-111.5,232c-22.3,46.7,-33.8,70.3,-34.5,71\nc-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1s-109,-253,-109,-253c-72.7,-168,-109.3,\n-252,-110,-252c-10.7,8,-22,16.7,-34,26c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26\ns76,-59,76,-59s76,-60,76,-60z M1001 80H40000v40H1012z",sqrtSize2:"M1001,80H400000v40H1013.1s-83.4,268,-264.1,840c-180.7,\n572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,\n-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744c-10,12,-21,25,-33,39s-32,39,-32,39\nc-6,-5.3,-15,-14,-27,-26s25,-30,25,-30c26.7,-32.7,52,-63,76,-91s52,-60,52,-60\ns208,722,208,722c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,\n-658.5c53.7,-170.3,84.5,-266.8,92.5,-289.5c4,-6.7,10,-10,18,-10z\nM1001 80H400000v40H1013z",sqrtSize3:"M424,2478c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,\n-342,-109.8,-513.3,-110.5,-514c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,\n25c-5.7,9.3,-9.8,16,-12.5,20s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,\n-13s76,-122,76,-122s77,-121,77,-121s209,968,209,968c0,-2,84.7,-361.7,254,-1079\nc169.3,-717.3,254.7,-1077.7,256,-1081c4,-6.7,10,-10,18,-10H400000v40H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M1001 80H400000v40H1014z",sqrtSize4:"M473,2793c339.3,-1799.3,509.3,-2700,510,-2702\nc3.3,-7.3,9.3,-11,18,-11H400000v40H1017.7s-90.5,478,-276.2,1466c-185.7,988,\n-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,\n-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200c0,-1.3,-5.3,8.7,-16,30c-10.7,\n21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26s76,-153,76,-153s77,-151,\n77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,606z\nM1001 80H400000v40H1017z",doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 241v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"}},A=function(){function e(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var t=e.prototype;return t.hasClass=function(e){return Y.contains(this.classes,e)},t.toNode=function(){for(var e=document.createDocumentFragment(),t=0;t"},C=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,z.call(this,e,r,n),this.children=t||[]}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return Y.contains(this.classes,e)},t.toNode=function(){return M.call(this,"span")},t.toMarkup=function(){return B.call(this,"span")},e}(),N=function(){function e(e,t,r,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,z.call(this,t,n),this.children=r||[],this.setAttribute("href",e)}var t=e.prototype;return t.setAttribute=function(e,t){this.attributes[e]=t},t.hasClass=function(e){return Y.contains(this.classes,e)},t.toNode=function(){return M.call(this,"a")},t.toMarkup=function(){return B.call(this,"a")},e}(),E={"\xee":"\u0131\u0302","\xef":"\u0131\u0308","\xed":"\u0131\u0301","\xec":"\u0131\u0300"},O=function(){function e(e,t,r,n,i,a,o,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=r||0,this.italic=n||0,this.skew=i||0,this.width=a||0,this.classes=o||[],this.style=s||{},this.maxFontSize=0;var l=function(e){for(var t=0;t=i[0]&&e<=i[1])return r.name}return null}(this.text.charCodeAt(0));l&&this.classes.push(l+"_fallback"),/[\xee\xef\xed\xec]/.test(this.text)&&(this.text=E[this.text])}var t=e.prototype;return t.hasClass=function(e){return Y.contains(this.classes,e)},t.toNode=function(){var e=document.createTextNode(this.text),t=null;for(var r in 0"):i},e}(),I=function(){function e(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);for(var r=0;r":""},e}(),L=function(){function e(e){this.attributes=void 0,this.attributes=e||{}}var t=e.prototype;return t.toNode=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","line");for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);return e},t.toMarkup=function(){var e="",">"),j($,K,se,":",":"),j($,K,se,"\u2248","\\approx",!0),j($,K,se,"\u2245","\\cong",!0),j($,K,se,"\u2265","\\ge"),j($,K,se,"\u2265","\\geq",!0),j($,K,se,"\u2190","\\gets"),j($,K,se,">","\\gt"),j($,K,se,"\u2208","\\in",!0),j($,K,se,"\u0338","\\@not"),j($,K,se,"\u2282","\\subset",!0),j($,K,se,"\u2283","\\supset",!0),j($,K,se,"\u2286","\\subseteq",!0),j($,K,se,"\u2287","\\supseteq",!0),j($,J,se,"\u2288","\\nsubseteq",!0),j($,J,se,"\u2289","\\nsupseteq",!0),j($,K,se,"\u22a8","\\models"),j($,K,se,"\u2190","\\leftarrow",!0),j($,K,se,"\u2264","\\le"),j($,K,se,"\u2264","\\leq",!0),j($,K,se,"<","\\lt"),j($,K,se,"\u2192","\\rightarrow",!0),j($,K,se,"\u2192","\\to"),j($,J,se,"\u2271","\\ngeq",!0),j($,J,se,"\u2270","\\nleq",!0),j($,K,le,"\xa0","\\ "),j($,K,le,"\xa0","~"),j($,K,le,"\xa0","\\space"),j($,K,le,"\xa0","\\nobreakspace"),j(Z,K,le,"\xa0","\\ "),j(Z,K,le,"\xa0","~"),j(Z,K,le,"\xa0","\\space"),j(Z,K,le,"\xa0","\\nobreakspace"),j($,K,le,null,"\\nobreak"),j($,K,le,null,"\\allowbreak"),j($,K,oe,",",","),j($,K,oe,";",";"),j($,J,ee,"\u22bc","\\barwedge",!0),j($,J,ee,"\u22bb","\\veebar",!0),j($,K,ee,"\u2299","\\odot",!0),j($,K,ee,"\u2295","\\oplus",!0),j($,K,ee,"\u2297","\\otimes",!0),j($,K,he,"\u2202","\\partial",!0),j($,K,ee,"\u2298","\\oslash",!0),j($,J,ee,"\u229a","\\circledcirc",!0),j($,J,ee,"\u22a1","\\boxdot",!0),j($,K,ee,"\u25b3","\\bigtriangleup"),j($,K,ee,"\u25bd","\\bigtriangledown"),j($,K,ee,"\u2020","\\dagger"),j($,K,ee,"\u22c4","\\diamond"),j($,K,ee,"\u22c6","\\star"),j($,K,ee,"\u25c3","\\triangleleft"),j($,K,ee,"\u25b9","\\triangleright"),j($,K,ae,"{","\\{"),j(Z,K,he,"{","\\{"),j(Z,K,he,"{","\\textbraceleft"),j($,K,te,"}","\\}"),j(Z,K,he,"}","\\}"),j(Z,K,he,"}","\\textbraceright"),j($,K,ae,"{","\\lbrace"),j($,K,te,"}","\\rbrace"),j($,K,ae,"[","\\lbrack"),j(Z,K,he,"[","\\lbrack"),j($,K,te,"]","\\rbrack"),j(Z,K,he,"]","\\rbrack"),j($,K,ae,"(","\\lparen"),j($,K,te,")","\\rparen"),j(Z,K,he,"<","\\textless"),j(Z,K,he,">","\\textgreater"),j($,K,ae,"\u230a","\\lfloor",!0),j($,K,te,"\u230b","\\rfloor",!0),j($,K,ae,"\u2308","\\lceil",!0),j($,K,te,"\u2309","\\rceil",!0),j($,K,he,"\\","\\backslash"),j($,K,he,"\u2223","|"),j($,K,he,"\u2223","\\vert"),j(Z,K,he,"|","\\textbar"),j($,K,he,"\u2225","\\|"),j($,K,he,"\u2225","\\Vert"),j(Z,K,he,"\u2225","\\textbardbl"),j(Z,K,he,"~","\\textasciitilde"),j($,K,se,"\u2191","\\uparrow",!0),j($,K,se,"\u21d1","\\Uparrow",!0),j($,K,se,"\u2193","\\downarrow",!0),j($,K,se,"\u21d3","\\Downarrow",!0),j($,K,se,"\u2195","\\updownarrow",!0),j($,K,se,"\u21d5","\\Updownarrow",!0),j($,K,ie,"\u2210","\\coprod"),j($,K,ie,"\u22c1","\\bigvee"),j($,K,ie,"\u22c0","\\bigwedge"),j($,K,ie,"\u2a04","\\biguplus"),j($,K,ie,"\u22c2","\\bigcap"),j($,K,ie,"\u22c3","\\bigcup"),j($,K,ie,"\u222b","\\int"),j($,K,ie,"\u222b","\\intop"),j($,K,ie,"\u222c","\\iint"),j($,K,ie,"\u222d","\\iiint"),j($,K,ie,"\u220f","\\prod"),j($,K,ie,"\u2211","\\sum"),j($,K,ie,"\u2a02","\\bigotimes"),j($,K,ie,"\u2a01","\\bigoplus"),j($,K,ie,"\u2a00","\\bigodot"),j($,K,ie,"\u222e","\\oint"),j($,K,ie,"\u222f","\\oiint"),j($,K,ie,"\u2230","\\oiiint"),j($,K,ie,"\u2a06","\\bigsqcup"),j($,K,ie,"\u222b","\\smallint"),j(Z,K,re,"\u2026","\\textellipsis"),j($,K,re,"\u2026","\\mathellipsis"),j(Z,K,re,"\u2026","\\ldots",!0),j($,K,re,"\u2026","\\ldots",!0),j($,K,re,"\u22ef","\\@cdots",!0),j($,K,re,"\u22f1","\\ddots",!0),j($,K,he,"\u22ee","\\varvdots"),j($,K,Q,"\u02ca","\\acute"),j($,K,Q,"\u02cb","\\grave"),j($,K,Q,"\xa8","\\ddot"),j($,K,Q,"~","\\tilde"),j($,K,Q,"\u02c9","\\bar"),j($,K,Q,"\u02d8","\\breve"),j($,K,Q,"\u02c7","\\check"),j($,K,Q,"^","\\hat"),j($,K,Q,"\u20d7","\\vec"),j($,K,Q,"\u02d9","\\dot"),j($,K,Q,"\u02da","\\mathring"),j($,K,ne,"\u0131","\\imath",!0),j($,K,ne,"\u0237","\\jmath",!0),j(Z,K,he,"\u0131","\\i",!0),j(Z,K,he,"\u0237","\\j",!0),j(Z,K,he,"\xdf","\\ss",!0),j(Z,K,he,"\xe6","\\ae",!0),j(Z,K,he,"\xe6","\\ae",!0),j(Z,K,he,"\u0153","\\oe",!0),j(Z,K,he,"\xf8","\\o",!0),j(Z,K,he,"\xc6","\\AE",!0),j(Z,K,he,"\u0152","\\OE",!0),j(Z,K,he,"\xd8","\\O",!0),j(Z,K,Q,"\u02ca","\\'"),j(Z,K,Q,"\u02cb","\\`"),j(Z,K,Q,"\u02c6","\\^"),j(Z,K,Q,"\u02dc","\\~"),j(Z,K,Q,"\u02c9","\\="),j(Z,K,Q,"\u02d8","\\u"),j(Z,K,Q,"\u02d9","\\."),j(Z,K,Q,"\u02da","\\r"),j(Z,K,Q,"\u02c7","\\v"),j(Z,K,Q,"\xa8",'\\"'),j(Z,K,Q,"\u02dd","\\H"),j(Z,K,Q,"\u25ef","\\textcircled");var me={"--":!0,"---":!0,"``":!0,"''":!0};j(Z,K,he,"\u2013","--"),j(Z,K,he,"\u2013","\\textendash"),j(Z,K,he,"\u2014","---"),j(Z,K,he,"\u2014","\\textemdash"),j(Z,K,he,"\u2018","`"),j(Z,K,he,"\u2018","\\textquoteleft"),j(Z,K,he,"\u2019","'"),j(Z,K,he,"\u2019","\\textquoteright"),j(Z,K,he,"\u201c","``"),j(Z,K,he,"\u201c","\\textquotedblleft"),j(Z,K,he,"\u201d","''"),j(Z,K,he,"\u201d","\\textquotedblright"),j($,K,he,"\xb0","\\degree",!0),j(Z,K,he,"\xb0","\\degree"),j(Z,K,he,"\xb0","\\textdegree",!0),j($,K,ne,"\xa3","\\pounds"),j($,K,ne,"\xa3","\\mathsterling",!0),j(Z,K,ne,"\xa3","\\pounds"),j(Z,K,ne,"\xa3","\\textsterling",!0),j($,J,he,"\u2720","\\maltese"),j(Z,J,he,"\u2720","\\maltese"),j(Z,K,le,"\xa0","\\ "),j(Z,K,le,"\xa0"," "),j(Z,K,le,"\xa0","~");for(var ce='0123456789/@."',ue=0;uet&&(t=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>n&&(n=a.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=n},Ge=function(e,t,r,n){var i=new C(e,t,r,n);return Ue(i),i},Xe=function(e,t,r,n){return new C(e,t,r,n)},Ye=function(e){var t=new A(e);return Ue(t),t},_e=function(e,t,r){var n="";switch(e){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=e}return n+"-"+("textbf"===t&&"textit"===r?"BoldItalic":"textbf"===t?"Bold":"textit"===t?"Italic":"Regular")},We={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},je={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},$e={fontMap:We,makeSymbol:Fe,mathsym:function(e,t,r,n){return void 0===n&&(n=[]),r&&r.font&&"boldsymbol"===r.font&&Pe(e,"Main-Bold",t).metrics?Fe(e,"Main-Bold",t,r,n.concat(["mathbf"])):"\\"===e||"main"===W[t][e].font?Fe(e,"Main-Regular",t,r,n):Fe(e,"AMS-Regular",t,r,n.concat(["amsrm"]))},makeSpan:Ge,makeSvgSpan:Xe,makeLineSpan:function(e,t,r){var n=Ge([e],[],t);return n.height=r||t.fontMetrics().defaultRuleThickness,n.style.borderBottomWidth=n.height+"em",n.maxFontSize=1,n},makeAnchor:function(e,t,r,n){var i=new N(e,t,r,n);return Ue(i),i},makeFragment:Ye,wrapFragment:function(e,t){return e instanceof A?Ge([],[e],t):e},makeVList:function(e,t){for(var r=function(e){if("individualShift"===e.positionType){for(var t=e.children,r=[t[0]],n=-t[0].shift-t[0].elem.depth,i=n,a=1;a"},t.toText=function(){return this.children.map(function(e){return e.toText()}).join("")},e}(),zt=function(){function e(e,t){void 0===t&&(t=!0),this.text=void 0,this.needsEscape=void 0,this.text=e,this.needsEscape=t}var t=e.prototype;return t.toNode=function(){return document.createTextNode(this.toText())},t.toMarkup=function(){return this.toText()},t.toText=function(){return this.needsEscape?Y.escape(this.text):this.text},e}(),Mt={MathNode:St,TextNode:zt,SpaceNode:function(){function e(e){this.width=void 0,this.character=void 0,this.width=e,this.character=.05555<=e&&e<=.05556?" ":.1666<=e&&e<=.1667?" ":.2222<=e&&e<=.2223?" ":.2777<=e&&e<=.2778?"  ":-.05556<=e&&e<=-.05555?"​":-.1667<=e&&e<=-.1666?"​":-.2223<=e&&e<=-.2222?"​":-.2778<=e&&e<=-.2777?"​":null}var t=e.prototype;return t.toNode=function(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",this.width+"em"),e},t.toMarkup=function(){return this.character?""+this.character+"":''},t.toText=function(){return this.character?this.character:" "},e}(),newDocumentFragment:kt},Tt=function(e,t,r){return!W[t][e]||!W[t][e].replace||55349===e.charCodeAt(0)||me.hasOwnProperty(e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.substr(4,2)||r.font&&"tt"===r.font.substr(4,2))||(e=W[t][e].replace),new Mt.TextNode(e)},At=function(e){return 1===e.length?e[0]:new Mt.MathNode("mrow",e)},Bt=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";var r=t.font;if(!r||"mathnormal"===r)return null;var n=e.mode;if("mathit"===r)return"italic";if("boldsymbol"===r)return"bold-italic";var i=e.text;return Y.contains(["\\imath","\\jmath"],i)?null:(W[n][i]&&W[n][i].replace&&(i=W[n][i].replace),F(i,$e.fontMap[r].fontName,n)?$e.fontMap[r].variant:null)},Ct=function(e,t){for(var r,n=[],i=0;i but got "+String(e)+".")}(bt(a,t)),a.base=n):r=(n=Ze(e,"accent")).base;var o=bt(r,t.havingCrampedStyle()),s=0;if(n.isShifty&&Y.isCharacterBox(r)){var l=Y.getBaseElem(r);s=function(e){if(e instanceof O)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}(bt(l,t.havingCrampedStyle())).skew}var h,m=Math.min(o.height,t.fontMetrics().xHeight);if(n.isStretchy)h=Dt(n,t),h=$e.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:h,wrapperClasses:["svg-align"],wrapperStyle:0","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],er=[0,1.2,1.8,2.4,3],tr=[{type:"small",style:q.SCRIPTSCRIPT},{type:"small",style:q.SCRIPT},{type:"small",style:q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],rr=[{type:"small",style:q.SCRIPTSCRIPT},{type:"small",style:q.SCRIPT},{type:"small",style:q.TEXT},{type:"stack"}],nr=[{type:"small",style:q.SCRIPTSCRIPT},{type:"small",style:q.SCRIPT},{type:"small",style:q.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],ir=function(e){if("small"===e.type)return"Main-Regular";if("large"===e.type)return"Size"+e.size+"-Regular";if("stack"===e.type)return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},ar=function(e,t,r,n){for(var i=Math.min(2,3-n.style.size);i"!==e&&"\\gt"!==e&&"\u27e9"!==e||(e="\\rangle"),o=Y.contains(Qt,e)?tr:Y.contains(Kt,e)?nr:rr;var s,l,h,m,c,u,p,d,f=ar(e,t,o,n);return"small"===f.type?(s=e,l=f.style,h=r,m=n,c=i,u=a,p=$e.makeSymbol(s,"Main-Regular",c,m),d=Yt(p,l,m,u),h&&_t(d,m,l),d):"large"===f.type?Wt(e,f.size,r,n,i,a):$t(e,t,r,n,i,a)},sr=function(e,t){var r,n,i=t.havingBaseSizing(),a=ar("\\surd",e*i.sizeMultiplier,nr,i),o=i.sizeMultiplier,s=0,l=0,h=0;return n="small"===a.type?(e<1?o=1:e<1.4&&(o=.7),l=1/o,(r=Zt("sqrtMain",s=1.08/o,h=1080,t)).style.minWidth="0.853em",.833/o):"large"===a.type?(h=1080*er[a.size],l=er[a.size]/o,s=(er[a.size]+.08)/o,(r=Zt("sqrtSize"+a.size,s,h,t)).style.minWidth="1.02em",1/o):(s=e+.08,l=e,h=Math.floor(1e3*e)+80,(r=Zt("sqrtTall",s,h,t)).style.minWidth="0.742em",1.056),r.height=l,r.style.height=s+"em",{span:r,advanceWidth:n,ruleWidth:t.fontMetrics().sqrtRuleThickness*o}},lr=function(e,t,r,n,i){if("<"===e||"\\lt"===e||"\u27e8"===e?e="\\langle":">"!==e&&"\\gt"!==e&&"\u27e9"!==e||(e="\\rangle"),Y.contains(Kt,e)||Y.contains(Qt,e))return Wt(e,t,!1,r,n,i);if(Y.contains(Jt,e))return $t(e,er[t],!1,r,n,i);throw new X("Illegal delimiter: '"+e+"'")},hr=or,mr=function(e,t,r,n,i,a){var o=n.fontMetrics().axisHeight*n.sizeMultiplier,s=5/n.fontMetrics().ptPerEm,l=Math.max(t-o,r+o),h=Math.max(l/500*901,2*l-s);return or(e,h,!0,n,i,a)},cr={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},ur=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27e8","\\rangle","\u27e9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function pr(e,t){var r=Qe(e);if(r&&Y.contains(ur,r.text))return r;throw new X("Invalid delimiter: '"+(r?r.text:JSON.stringify(e))+"' after '"+t.funcName+"'",e)}function dr(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}lt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1},handler:function(e,t){var r=pr(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:cr[e.funcName].size,mclass:cr[e.funcName].mclass,delim:r.text}},htmlBuilder:function(e,t){return"."===e.delim?$e.makeSpan([e.mclass]):lr(e.delim,e.size,t,e.mode,[e.mclass])},mathmlBuilder:function(e){var t=[];"."!==e.delim&&t.push(Tt(e.delim,e.mode));var r=new Mt.MathNode("mo",t);return"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r}}),lt({type:"leftright-right",names:["\\right"],props:{numArgs:1},handler:function(e,t){return{type:"leftright-right",mode:e.parser.mode,delim:pr(t[0],e).text}}}),lt({type:"leftright",names:["\\left"],props:{numArgs:1},handler:function(e,t){var r=pr(t[0],e),n=e.parser;++n.leftrightDepth;var i=n.parseExpression(!1);--n.leftrightDepth,n.expect("\\right",!1);var a=Ze(n.parseFunction(),"leftright-right");return{type:"leftright",mode:n.mode,body:i,left:r.text,right:a.delim}},htmlBuilder:function(e,t){dr(e);for(var r,n,i=dt(e.body,t,!0,[null,"mclose"]),a=0,o=0,s=!1,l=0;lr.height+r.depth+a&&(a=(a+c-r.height-r.depth)/2);var u=l.height-r.height-a-h;r.style.paddingLeft=m+"em";var p=$e.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:l},{type:"kern",size:h}]},t);if(e.index){var d=t.havingStyle(q.SCRIPTSCRIPT),f=bt(e.index,d,t),g=.6*(p.height-p.depth),v=$e.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:f}]},t),y=$e.makeSpan(["root"],[v]);return $e.makeSpan(["mord","sqrt"],[y,p],t)}return $e.makeSpan(["mord","sqrt"],[p],t)},mathmlBuilder:function(e,t){var r=e.body,n=e.index;return n?new Mt.MathNode("mroot",[qt(r,t),qt(n,t)]):new Mt.MathNode("msqrt",[qt(r,t)])}});var _r={display:q.DISPLAY,text:q.TEXT,script:q.SCRIPT,scriptscript:q.SCRIPTSCRIPT};lt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0},handler:function(e,t){var r=e.breakOnTokenText,n=e.funcName,i=e.parser;i.consumeSpaces();var a=i.parseExpression(!0,r),o=n.slice(1,n.length-5);return{type:"styling",mode:i.mode,style:o,body:a}},htmlBuilder:function(e,t){var r=_r[e.style],n=t.havingStyle(r).withFont("");return Gr(e.body,n,t)},mathmlBuilder:function(e,t){var r={display:q.DISPLAY,text:q.TEXT,script:q.SCRIPT,scriptscript:q.SCRIPTSCRIPT}[e.style],n=t.havingStyle(r),i=Ct(e.body,n),a=new Mt.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[e.style];return a.setAttribute("scriptlevel",o[0]),a.setAttribute("displaystyle",o[1]),a}});ht({type:"supsub",htmlBuilder:function(e,t){var r,n,i,a=(n=t,(i=(r=e).base)?"op"!==i.type?"accent"===i.type?Y.isCharacterBox(i.base)?Pt:null:"horizBrace"!==i.type?null:!r.sub===i.isOver?Hr:null:i.limits&&(n.style.size===q.DISPLAY.size||i.alwaysHandleSupSub)?Pr:null:null);if(a)return a(e,t);var o,s,l,h=e.base,m=e.sup,c=e.sub,u=bt(h,t),p=t.fontMetrics(),d=0,f=0,g=h&&Y.isCharacterBox(h);if(m){var v=t.havingStyle(t.style.sup());o=bt(m,v,t),g||(d=u.height-v.fontMetrics().supDrop*v.sizeMultiplier/t.sizeMultiplier)}if(c){var y=t.havingStyle(t.style.sub());s=bt(c,y,t),g||(f=u.depth+y.fontMetrics().subDrop*y.sizeMultiplier/t.sizeMultiplier)}l=t.style===q.DISPLAY?p.sup1:t.style.cramped?p.sup3:p.sup2;var b,x=t.sizeMultiplier,w=.5/p.ptPerEm/x+"em",k=null;if(s){var S=e.base&&"op"===e.base.type&&e.base.name&&("\\oiint"===e.base.name||"\\oiiint"===e.base.name);(u instanceof O||S)&&(k=-u.italic+"em")}if(o&&s){d=Math.max(d,l,o.depth+.25*p.xHeight),f=Math.max(f,p.sub2);var z=4*p.defaultRuleThickness;if(d-o.depth-(s.height-f)":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};un("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in gn?t=gn[r]:"\\not"===r.substr(0,4)?t="\\dotsb":r in W.math&&Y.contains(["bin","rel"],W.math[r].group)&&(t="\\dotsb"),t});var vn={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};un("\\dotso",function(e){return e.future().text in vn?"\\ldots\\,":"\\ldots"}),un("\\dotsc",function(e){var t=e.future().text;return t in vn&&","!==t?"\\ldots\\,":"\\ldots"}),un("\\cdots",function(e){return e.future().text in vn?"\\@cdots\\,":"\\@cdots"}),un("\\dotsb","\\cdots"),un("\\dotsm","\\cdots"),un("\\dotsi","\\!\\cdots"),un("\\dotsx","\\ldots\\,"),un("\\DOTSI","\\relax"),un("\\DOTSB","\\relax"),un("\\DOTSX","\\relax"),un("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),un("\\,","\\tmspace+{3mu}{.1667em}"),un("\\thinspace","\\,"),un("\\>","\\mskip{4mu}"),un("\\:","\\tmspace+{4mu}{.2222em}"),un("\\medspace","\\:"),un("\\;","\\tmspace+{5mu}{.2777em}"),un("\\thickspace","\\;"),un("\\!","\\tmspace-{3mu}{.1667em}"),un("\\negthinspace","\\!"),un("\\negmedspace","\\tmspace-{4mu}{.2222em}"),un("\\negthickspace","\\tmspace-{5mu}{.277em}"),un("\\enspace","\\kern.5em "),un("\\enskip","\\hskip.5em\\relax"),un("\\quad","\\hskip1em\\relax"),un("\\qquad","\\hskip2em\\relax"),un("\\tag","\\@ifstar\\tag@literal\\tag@paren"),un("\\tag@paren","\\tag@literal{({#1})}"),un("\\tag@literal",function(e){if(e.macros.get("\\df@tag"))throw new X("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),un("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),un("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),un("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),un("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),un("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\mathrlap{\\mkern0.4mu\\raisebox{0.4mu}{$#1$}}{\\mkern0.8mu#1}}}{\\mathbf{#1}}"),un("\\\\","\\newline"),un("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var yn=H["Main-Regular"]["T".charCodeAt(0)][1]-.7*H["Main-Regular"]["A".charCodeAt(0)][1]+"em";un("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+yn+"}{\\scriptsize A}\\kern-.15em\\TeX}{LaTeX}}"),un("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+yn+"}{\\scriptsize A}\\kern-.15em\\TeX}{KaTeX}}"),un("\\hspace","\\@ifstar\\@hspacer\\@hspace"),un("\\@hspace","\\hskip #1\\relax"),un("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),un("\\ordinarycolon",":"),un("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),un("\\dblcolon","\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}"),un("\\coloneqq","\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}"),un("\\Coloneqq","\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}"),un("\\coloneq","\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"),un("\\Coloneq","\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"),un("\\eqqcolon","\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),un("\\Eqqcolon","\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}"),un("\\eqcolon","\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),un("\\Eqcolon","\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"),un("\\colonapprox","\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}"),un("\\Colonapprox","\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}"),un("\\colonsim","\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}"),un("\\Colonsim","\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}"),un("\u2254","\\coloneqq"),un("\u2255","\\eqqcolon"),un("\u2a74","\\Coloneqq"),un("\\ratio","\\vcentcolon"),un("\\coloncolon","\\dblcolon"),un("\\colonequals","\\coloneqq"),un("\\coloncolonequals","\\Coloneqq"),un("\\equalscolon","\\eqqcolon"),un("\\equalscoloncolon","\\Eqqcolon"),un("\\colonminus","\\coloneq"),un("\\coloncolonminus","\\Coloneq"),un("\\minuscolon","\\eqcolon"),un("\\minuscoloncolon","\\Eqcolon"),un("\\coloncolonapprox","\\Colonapprox"),un("\\coloncolonsim","\\Colonsim"),un("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),un("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),un("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),un("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),un("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220c}}"),un("\\limsup","\\DOTSB\\mathop{\\operatorname{lim\\,sup}}\\limits"),un("\\liminf","\\DOTSB\\mathop{\\operatorname{lim\\,inf}}\\limits"),un("\u27e6","\\mathopen{[\\mkern-3.2mu[}"),un("\u27e7","\\mathclose{]\\mkern-3.2mu]}"),un("\\darr","\\downarrow"),un("\\dArr","\\Downarrow"),un("\\Darr","\\Downarrow"),un("\\lang","\\langle"),un("\\rang","\\rangle"),un("\\uarr","\\uparrow"),un("\\uArr","\\Uparrow"),un("\\Uarr","\\Uparrow"),un("\\N","\\mathbb{N}"),un("\\R","\\mathbb{R}"),un("\\Z","\\mathbb{Z}"),un("\\alef","\\aleph"),un("\\alefsym","\\aleph"),un("\\Alpha","\\mathrm{A}"),un("\\Beta","\\mathrm{B}"),un("\\bull","\\bullet"),un("\\Chi","\\mathrm{X}"),un("\\clubs","\\clubsuit"),un("\\cnums","\\mathbb{C}"),un("\\Complex","\\mathbb{C}"),un("\\Dagger","\\ddagger"),un("\\diamonds","\\diamondsuit"),un("\\empty","\\emptyset"),un("\\Epsilon","\\mathrm{E}"),un("\\Eta","\\mathrm{H}"),un("\\exist","\\exists"),un("\\harr","\\leftrightarrow"),un("\\hArr","\\Leftrightarrow"),un("\\Harr","\\Leftrightarrow"),un("\\hearts","\\heartsuit"),un("\\image","\\Im"),un("\\infin","\\infty"),un("\\Iota","\\mathrm{I}"),un("\\isin","\\in"),un("\\Kappa","\\mathrm{K}"),un("\\larr","\\leftarrow"),un("\\lArr","\\Leftarrow"),un("\\Larr","\\Leftarrow"),un("\\lrarr","\\leftrightarrow"),un("\\lrArr","\\Leftrightarrow"),un("\\Lrarr","\\Leftrightarrow"),un("\\Mu","\\mathrm{M}"),un("\\natnums","\\mathbb{N}"),un("\\Nu","\\mathrm{N}"),un("\\Omicron","\\mathrm{O}"),un("\\plusmn","\\pm"),un("\\rarr","\\rightarrow"),un("\\rArr","\\Rightarrow"),un("\\Rarr","\\Rightarrow"),un("\\real","\\Re"),un("\\reals","\\mathbb{R}"),un("\\Reals","\\mathbb{R}"),un("\\Rho","\\mathrm{R}"),un("\\sdot","\\cdot"),un("\\sect","\\S"),un("\\spades","\\spadesuit"),un("\\sub","\\subset"),un("\\sube","\\subseteq"),un("\\supe","\\supseteq"),un("\\Tau","\\mathrm{T}"),un("\\thetasym","\\vartheta"),un("\\weierp","\\wp"),un("\\Zeta","\\mathrm{Z}");var bn={"\\relax":!0,"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},xn=function(){function e(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new hn(cn,t.macros),this.mode=r,this.stack=[]}var t=e.prototype;return t.feed=function(e){this.lexer=new ln(e)},t.switchMode=function(e){this.mode=e},t.beginGroup=function(){this.macros.beginGroup()},t.endGroup=function(){this.macros.endGroup()},t.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},t.popToken=function(){return this.future(),this.stack.pop()},t.pushToken=function(e){this.stack.push(e)},t.pushTokens=function(e){var t;(t=this.stack).push.apply(t,e)},t.consumeSpaces=function(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}},t.consumeArgs=function(e){for(var t=[],r=0;rthis.settings.maxExpand)throw new X("Too many expansions: infinite loop or need to increase maxExpand setting");var n=r.tokens;if(r.numArgs)for(var i=this.consumeArgs(r.numArgs),a=(n=n.slice()).length-1;0<=a;--a){var o=n[a];if("#"===o.text){if(0===a)throw new X("Incomplete placeholder at end of macro body",o);if("#"===(o=n[--a]).text)n.splice(a+1,1);else{if(!/^[1-9]$/.test(o.text))throw new X("Not a valid argument number",o);var s;(s=n).splice.apply(s,[a,2].concat(i[+o.text-1]))}}}return this.pushTokens(n),n},t.expandAfterFuture=function(){return this.expandOnce(),this.future()},t.expandNextToken=function(){for(;;){var e=this.expandOnce();if(e instanceof a){if("\\relax"!==e.text)return this.stack.pop();this.stack.pop()}}throw new Error},t.expandMacro=function(e){if(this.macros.get(e)){var t=[],r=this.stack.length;for(this.pushToken(new a(e));this.stack.length>r;){this.expandOnce()instanceof a&&t.push(this.stack.pop())}return t}},t.expandMacroAsText=function(e){var t=this.expandMacro(e);return t?t.map(function(e){return e.text}).join(""):t},t._getExpansion=function(e){var t=this.macros.get(e);if(null==t)return t;var r="function"==typeof t?t(this):t;if("string"!=typeof r)return r;var n=0;if(-1!==r.indexOf("#"))for(var i=r.replace(/##/g,"");-1!==i.indexOf("#"+(n+1));)++n;for(var a=new ln(r),o=[],s=a.lex();"EOF"!==s.text;)o.push(s),s=a.lex();return o.reverse(),{tokens:o,numArgs:n}},t.isDefined=function(e){return this.macros.has(e)||tn.hasOwnProperty(e)||W.math.hasOwnProperty(e)||W.text.hasOwnProperty(e)||bn.hasOwnProperty(e)},e}(),wn={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030c":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030a":{text:"\\r",math:"\\mathring"},"\u030b":{text:"\\H"}},kn={"\xe1":"a\u0301","\xe0":"a\u0300","\xe4":"a\u0308","\u01df":"a\u0308\u0304","\xe3":"a\u0303","\u0101":"a\u0304","\u0103":"a\u0306","\u1eaf":"a\u0306\u0301","\u1eb1":"a\u0306\u0300","\u1eb5":"a\u0306\u0303","\u01ce":"a\u030c","\xe2":"a\u0302","\u1ea5":"a\u0302\u0301","\u1ea7":"a\u0302\u0300","\u1eab":"a\u0302\u0303","\u0227":"a\u0307","\u01e1":"a\u0307\u0304","\xe5":"a\u030a","\u01fb":"a\u030a\u0301","\u1e03":"b\u0307","\u0107":"c\u0301","\u010d":"c\u030c","\u0109":"c\u0302","\u010b":"c\u0307","\u010f":"d\u030c","\u1e0b":"d\u0307","\xe9":"e\u0301","\xe8":"e\u0300","\xeb":"e\u0308","\u1ebd":"e\u0303","\u0113":"e\u0304","\u1e17":"e\u0304\u0301","\u1e15":"e\u0304\u0300","\u0115":"e\u0306","\u011b":"e\u030c","\xea":"e\u0302","\u1ebf":"e\u0302\u0301","\u1ec1":"e\u0302\u0300","\u1ec5":"e\u0302\u0303","\u0117":"e\u0307","\u1e1f":"f\u0307","\u01f5":"g\u0301","\u1e21":"g\u0304","\u011f":"g\u0306","\u01e7":"g\u030c","\u011d":"g\u0302","\u0121":"g\u0307","\u1e27":"h\u0308","\u021f":"h\u030c","\u0125":"h\u0302","\u1e23":"h\u0307","\xed":"i\u0301","\xec":"i\u0300","\xef":"i\u0308","\u1e2f":"i\u0308\u0301","\u0129":"i\u0303","\u012b":"i\u0304","\u012d":"i\u0306","\u01d0":"i\u030c","\xee":"i\u0302","\u01f0":"j\u030c","\u0135":"j\u0302","\u1e31":"k\u0301","\u01e9":"k\u030c","\u013a":"l\u0301","\u013e":"l\u030c","\u1e3f":"m\u0301","\u1e41":"m\u0307","\u0144":"n\u0301","\u01f9":"n\u0300","\xf1":"n\u0303","\u0148":"n\u030c","\u1e45":"n\u0307","\xf3":"o\u0301","\xf2":"o\u0300","\xf6":"o\u0308","\u022b":"o\u0308\u0304","\xf5":"o\u0303","\u1e4d":"o\u0303\u0301","\u1e4f":"o\u0303\u0308","\u022d":"o\u0303\u0304","\u014d":"o\u0304","\u1e53":"o\u0304\u0301","\u1e51":"o\u0304\u0300","\u014f":"o\u0306","\u01d2":"o\u030c","\xf4":"o\u0302","\u1ed1":"o\u0302\u0301","\u1ed3":"o\u0302\u0300","\u1ed7":"o\u0302\u0303","\u022f":"o\u0307","\u0231":"o\u0307\u0304","\u0151":"o\u030b","\u1e55":"p\u0301","\u1e57":"p\u0307","\u0155":"r\u0301","\u0159":"r\u030c","\u1e59":"r\u0307","\u015b":"s\u0301","\u1e65":"s\u0301\u0307","\u0161":"s\u030c","\u1e67":"s\u030c\u0307","\u015d":"s\u0302","\u1e61":"s\u0307","\u1e97":"t\u0308","\u0165":"t\u030c","\u1e6b":"t\u0307","\xfa":"u\u0301","\xf9":"u\u0300","\xfc":"u\u0308","\u01d8":"u\u0308\u0301","\u01dc":"u\u0308\u0300","\u01d6":"u\u0308\u0304","\u01da":"u\u0308\u030c","\u0169":"u\u0303","\u1e79":"u\u0303\u0301","\u016b":"u\u0304","\u1e7b":"u\u0304\u0308","\u016d":"u\u0306","\u01d4":"u\u030c","\xfb":"u\u0302","\u016f":"u\u030a","\u0171":"u\u030b","\u1e7d":"v\u0303","\u1e83":"w\u0301","\u1e81":"w\u0300","\u1e85":"w\u0308","\u0175":"w\u0302","\u1e87":"w\u0307","\u1e98":"w\u030a","\u1e8d":"x\u0308","\u1e8b":"x\u0307","\xfd":"y\u0301","\u1ef3":"y\u0300","\xff":"y\u0308","\u1ef9":"y\u0303","\u0233":"y\u0304","\u0177":"y\u0302","\u1e8f":"y\u0307","\u1e99":"y\u030a","\u017a":"z\u0301","\u017e":"z\u030c","\u1e91":"z\u0302","\u017c":"z\u0307","\xc1":"A\u0301","\xc0":"A\u0300","\xc4":"A\u0308","\u01de":"A\u0308\u0304","\xc3":"A\u0303","\u0100":"A\u0304","\u0102":"A\u0306","\u1eae":"A\u0306\u0301","\u1eb0":"A\u0306\u0300","\u1eb4":"A\u0306\u0303","\u01cd":"A\u030c","\xc2":"A\u0302","\u1ea4":"A\u0302\u0301","\u1ea6":"A\u0302\u0300","\u1eaa":"A\u0302\u0303","\u0226":"A\u0307","\u01e0":"A\u0307\u0304","\xc5":"A\u030a","\u01fa":"A\u030a\u0301","\u1e02":"B\u0307","\u0106":"C\u0301","\u010c":"C\u030c","\u0108":"C\u0302","\u010a":"C\u0307","\u010e":"D\u030c","\u1e0a":"D\u0307","\xc9":"E\u0301","\xc8":"E\u0300","\xcb":"E\u0308","\u1ebc":"E\u0303","\u0112":"E\u0304","\u1e16":"E\u0304\u0301","\u1e14":"E\u0304\u0300","\u0114":"E\u0306","\u011a":"E\u030c","\xca":"E\u0302","\u1ebe":"E\u0302\u0301","\u1ec0":"E\u0302\u0300","\u1ec4":"E\u0302\u0303","\u0116":"E\u0307","\u1e1e":"F\u0307","\u01f4":"G\u0301","\u1e20":"G\u0304","\u011e":"G\u0306","\u01e6":"G\u030c","\u011c":"G\u0302","\u0120":"G\u0307","\u1e26":"H\u0308","\u021e":"H\u030c","\u0124":"H\u0302","\u1e22":"H\u0307","\xcd":"I\u0301","\xcc":"I\u0300","\xcf":"I\u0308","\u1e2e":"I\u0308\u0301","\u0128":"I\u0303","\u012a":"I\u0304","\u012c":"I\u0306","\u01cf":"I\u030c","\xce":"I\u0302","\u0130":"I\u0307","\u0134":"J\u0302","\u1e30":"K\u0301","\u01e8":"K\u030c","\u0139":"L\u0301","\u013d":"L\u030c","\u1e3e":"M\u0301","\u1e40":"M\u0307","\u0143":"N\u0301","\u01f8":"N\u0300","\xd1":"N\u0303","\u0147":"N\u030c","\u1e44":"N\u0307","\xd3":"O\u0301","\xd2":"O\u0300","\xd6":"O\u0308","\u022a":"O\u0308\u0304","\xd5":"O\u0303","\u1e4c":"O\u0303\u0301","\u1e4e":"O\u0303\u0308","\u022c":"O\u0303\u0304","\u014c":"O\u0304","\u1e52":"O\u0304\u0301","\u1e50":"O\u0304\u0300","\u014e":"O\u0306","\u01d1":"O\u030c","\xd4":"O\u0302","\u1ed0":"O\u0302\u0301","\u1ed2":"O\u0302\u0300","\u1ed6":"O\u0302\u0303","\u022e":"O\u0307","\u0230":"O\u0307\u0304","\u0150":"O\u030b","\u1e54":"P\u0301","\u1e56":"P\u0307","\u0154":"R\u0301","\u0158":"R\u030c","\u1e58":"R\u0307","\u015a":"S\u0301","\u1e64":"S\u0301\u0307","\u0160":"S\u030c","\u1e66":"S\u030c\u0307","\u015c":"S\u0302","\u1e60":"S\u0307","\u0164":"T\u030c","\u1e6a":"T\u0307","\xda":"U\u0301","\xd9":"U\u0300","\xdc":"U\u0308","\u01d7":"U\u0308\u0301","\u01db":"U\u0308\u0300","\u01d5":"U\u0308\u0304","\u01d9":"U\u0308\u030c","\u0168":"U\u0303","\u1e78":"U\u0303\u0301","\u016a":"U\u0304","\u1e7a":"U\u0304\u0308","\u016c":"U\u0306","\u01d3":"U\u030c","\xdb":"U\u0302","\u016e":"U\u030a","\u0170":"U\u030b","\u1e7c":"V\u0303","\u1e82":"W\u0301","\u1e80":"W\u0300","\u1e84":"W\u0308","\u0174":"W\u0302","\u1e86":"W\u0307","\u1e8c":"X\u0308","\u1e8a":"X\u0307","\xdd":"Y\u0301","\u1ef2":"Y\u0300","\u0178":"Y\u0308","\u1ef8":"Y\u0303","\u0232":"Y\u0304","\u0176":"Y\u0302","\u1e8e":"Y\u0307","\u0179":"Z\u0301","\u017d":"Z\u030c","\u1e90":"Z\u0302","\u017b":"Z\u0307","\u03ac":"\u03b1\u0301","\u1f70":"\u03b1\u0300","\u1fb1":"\u03b1\u0304","\u1fb0":"\u03b1\u0306","\u03ad":"\u03b5\u0301","\u1f72":"\u03b5\u0300","\u03ae":"\u03b7\u0301","\u1f74":"\u03b7\u0300","\u03af":"\u03b9\u0301","\u1f76":"\u03b9\u0300","\u03ca":"\u03b9\u0308","\u0390":"\u03b9\u0308\u0301","\u1fd2":"\u03b9\u0308\u0300","\u1fd1":"\u03b9\u0304","\u1fd0":"\u03b9\u0306","\u03cc":"\u03bf\u0301","\u1f78":"\u03bf\u0300","\u03cd":"\u03c5\u0301","\u1f7a":"\u03c5\u0300","\u03cb":"\u03c5\u0308","\u03b0":"\u03c5\u0308\u0301","\u1fe2":"\u03c5\u0308\u0300","\u1fe1":"\u03c5\u0304","\u1fe0":"\u03c5\u0306","\u03ce":"\u03c9\u0301","\u1f7c":"\u03c9\u0300","\u038e":"\u03a5\u0301","\u1fea":"\u03a5\u0300","\u03ab":"\u03a5\u0308","\u1fe9":"\u03a5\u0304","\u1fe8":"\u03a5\u0306","\u038f":"\u03a9\u0301","\u1ffa":"\u03a9\u0300"},Sn=function(){function a(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new xn(e,t,this.mode),this.settings=t,this.leftrightDepth=0}var e=a.prototype;return e.expect=function(e,t){if(void 0===t&&(t=!0),this.nextToken.text!==e)throw new X("Expected '"+e+"', got '"+this.nextToken.text+"'",this.nextToken);t&&this.consume()},e.consume=function(){this.nextToken=this.gullet.expandNextToken()},e.switchMode=function(e){this.mode=e,this.gullet.switchMode(e)},e.parse=function(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor"),this.consume();var e=this.parseExpression(!1);return this.expect("EOF",!1),this.gullet.endGroup(),e},e.parseExpression=function(e,t){for(var r=[];;){"math"===this.mode&&this.consumeSpaces();var n=this.nextToken;if(-1!==a.endOfExpression.indexOf(n.text))break;if(t&&n.text===t)break;if(e&&tn[n.text]&&tn[n.text].infix)break;var i=this.parseAtom(t);if(!i)break;r.push(i)}return"text"===this.mode&&this.formLigatures(r),this.handleInfixNodes(r)},e.handleInfixNodes=function(e){for(var t,r=-1,n=0;n 15) { + left = "…" + input.slice(start - 15, start); + } else { + left = input.slice(0, start); + } + + let right; + + if (end + 15 < input.length) { + right = input.slice(end, end + 15) + "…"; + } else { + right = input.slice(end); + } + + error += left + underlined + right; + } // Some hackery to make ParseError a prototype of Error + // See http://stackoverflow.com/a/8460753 + + + const self = new Error(error); + self.name = "ParseError"; // $FlowFixMe + + self.__proto__ = ParseError.prototype; // $FlowFixMe + + self.position = start; + return self; + } + +} // $FlowFixMe More hackery + + +ParseError.prototype.__proto__ = Error.prototype; + +/** + * This file contains a list of utility functions which are useful in other + * files. + */ + +/** + * Return whether an element is contained in a list + */ +const contains = function contains(list, elem) { + return list.indexOf(elem) !== -1; +}; +/** + * Provide a default value if a setting is undefined + * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022. + */ + + +const deflt = function deflt(setting, defaultIfUndefined) { + return setting === undefined ? defaultIfUndefined : setting; +}; // hyphenate and escape adapted from Facebook's React under Apache 2 license + + +const uppercase = /([A-Z])/g; + +const hyphenate = function hyphenate(str) { + return str.replace(uppercase, "-$1").toLowerCase(); +}; + +const ESCAPE_LOOKUP = { + "&": "&", + ">": ">", + "<": "<", + "\"": """, + "'": "'" +}; +const ESCAPE_REGEX = /[&><"']/g; +/** + * Escapes text to prevent scripting attacks. + */ + +function escape(text) { + return String(text).replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]); +} +/** + * Sometimes we want to pull out the innermost element of a group. In most + * cases, this will just be the group itself, but when ordgroups and colors have + * a single element, we want to pull that out. + */ + + +const getBaseElem = function getBaseElem(group) { + if (group.type === "ordgroup") { + if (group.body.length === 1) { + return getBaseElem(group.body[0]); + } else { + return group; + } + } else if (group.type === "color") { + if (group.body.length === 1) { + return getBaseElem(group.body[0]); + } else { + return group; + } + } else if (group.type === "font") { + return getBaseElem(group.body); + } else { + return group; + } +}; +/** + * TeXbook algorithms often reference "character boxes", which are simply groups + * with a single character in them. To decide if something is a character box, + * we find its innermost group, and see if it is a single character. + */ + + +const isCharacterBox = function isCharacterBox(group) { + const baseElem = getBaseElem(group); // These are all they types of groups which hold single characters + + return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; +}; + +const assert = function assert(value) { + if (!value) { + throw new Error('Expected non-null, but got ' + String(value)); + } + + return value; +}; +var utils = { + contains, + deflt, + escape, + hyphenate, + getBaseElem, + isCharacterBox +}; + +/* eslint no-console:0 */ + +/** + * The main Settings object + * + * The current options stored are: + * - displayMode: Whether the expression should be typeset as inline math + * (false, the default), meaning that the math starts in + * \textstyle and is placed in an inline-block); or as display + * math (true), meaning that the math starts in \displaystyle + * and is placed in a block with vertical margin. + */ +class Settings { + constructor(options) { + this.displayMode = void 0; + this.throwOnError = void 0; + this.errorColor = void 0; + this.macros = void 0; + this.colorIsTextColor = void 0; + this.strict = void 0; + this.maxSize = void 0; + this.maxExpand = void 0; + this.allowedProtocols = void 0; + // allow null options + options = options || {}; + this.displayMode = utils.deflt(options.displayMode, false); + this.throwOnError = utils.deflt(options.throwOnError, true); + this.errorColor = utils.deflt(options.errorColor, "#cc0000"); + this.macros = options.macros || {}; + this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false); + this.strict = utils.deflt(options.strict, "warn"); + this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity)); + this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000)); + this.allowedProtocols = utils.deflt(options.allowedProtocols, ["http", "https", "mailto", "_relative"]); + } + /** + * Report nonstrict (non-LaTeX-compatible) input. + * Can safely not be called if `this.strict` is false in JavaScript. + */ + + + reportNonstrict(errorCode, errorMsg, token) { + let strict = this.strict; + + if (typeof strict === "function") { + // Allow return value of strict function to be boolean or string + // (or null/undefined, meaning no further processing). + strict = strict(errorCode, errorMsg, token); + } + + if (!strict || strict === "ignore") { + return; + } else if (strict === true || strict === "error") { + throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + `${errorMsg} [${errorCode}]`, token); + } else if (strict === "warn") { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + `${errorMsg} [${errorCode}]`); + } else { + // won't happen in type-safe code + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + `unrecognized '${strict}': ${errorMsg} [${errorCode}]`); + } + } + /** + * Check whether to apply strict (LaTeX-adhering) behavior for unusual + * input (like `\\`). Unlike `nonstrict`, will not throw an error; + * instead, "error" translates to a return value of `true`, while "ignore" + * translates to a return value of `false`. May still print a warning: + * "warn" prints a warning and returns `false`. + * This is for the second category of `errorCode`s listed in the README. + */ + + + useStrictBehavior(errorCode, errorMsg, token) { + let strict = this.strict; + + if (typeof strict === "function") { + // Allow return value of strict function to be boolean or string + // (or null/undefined, meaning no further processing). + // But catch any exceptions thrown by function, treating them + // like "error". + try { + strict = strict(errorCode, errorMsg, token); + } catch (error) { + strict = "error"; + } + } + + if (!strict || strict === "ignore") { + return false; + } else if (strict === true || strict === "error") { + return true; + } else if (strict === "warn") { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + `${errorMsg} [${errorCode}]`); + return false; + } else { + // won't happen in type-safe code + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + `unrecognized '${strict}': ${errorMsg} [${errorCode}]`); + return false; + } + } + +} + +/** + * This file contains information and classes for the various kinds of styles + * used in TeX. It provides a generic `Style` class, which holds information + * about a specific style. It then provides instances of all the different kinds + * of styles possible, and provides functions to move between them and get + * information about them. + */ + +/** + * The main style class. Contains a unique id for the style, a size (which is + * the same for cramped and uncramped version of a style), and a cramped flag. + */ +class Style { + constructor(id, size, cramped) { + this.id = void 0; + this.size = void 0; + this.cramped = void 0; + this.id = id; + this.size = size; + this.cramped = cramped; + } + /** + * Get the style of a superscript given a base in the current style. + */ + + + sup() { + return styles[sup[this.id]]; + } + /** + * Get the style of a subscript given a base in the current style. + */ + + + sub() { + return styles[sub[this.id]]; + } + /** + * Get the style of a fraction numerator given the fraction in the current + * style. + */ + + + fracNum() { + return styles[fracNum[this.id]]; + } + /** + * Get the style of a fraction denominator given the fraction in the current + * style. + */ + + + fracDen() { + return styles[fracDen[this.id]]; + } + /** + * Get the cramped version of a style (in particular, cramping a cramped style + * doesn't change the style). + */ + + + cramp() { + return styles[cramp[this.id]]; + } + /** + * Get a text or display version of this style. + */ + + + text() { + return styles[text[this.id]]; + } + /** + * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) + */ + + + isTight() { + return this.size >= 2; + } + +} // Export an interface for type checking, but don't expose the implementation. +// This way, no more styles can be generated. + + +// IDs of the different styles +const D = 0; +const Dc = 1; +const T = 2; +const Tc = 3; +const S = 4; +const Sc = 5; +const SS = 6; +const SSc = 7; // Instances of the different styles + +const styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; // Lookup tables for switching from one style to another + +const sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; +const sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; +const fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; +const fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; +const cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; +const text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles. + +var Style$1 = { + DISPLAY: styles[D], + TEXT: styles[T], + SCRIPT: styles[S], + SCRIPTSCRIPT: styles[SS] +}; + +/* + * This file defines the Unicode scripts and script families that we + * support. To add new scripts or families, just add a new entry to the + * scriptData array below. Adding scripts to the scriptData array allows + * characters from that script to appear in \text{} environments. + */ + +/** + * Each script or script family has a name and an array of blocks. + * Each block is an array of two numbers which specify the start and + * end points (inclusive) of a block of Unicode codepoints. + */ + +/** + * Unicode block data for the families of scripts we support in \text{}. + * Scripts only need to appear here if they do not have font metrics. + */ +const scriptData = [{ + // Latin characters beyond the Latin-1 characters we have metrics for. + // Needed for Czech, Hungarian and Turkish text, for example. + name: 'latin', + blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B + [0x0300, 0x036f]] +}, { + // The Cyrillic script used by Russian and related languages. + // A Cyrillic subset used to be supported as explicitly defined + // symbols in symbols.js + name: 'cyrillic', + blocks: [[0x0400, 0x04ff]] +}, { + // The Brahmic scripts of South and Southeast Asia + // Devanagari (0900–097F) + // Bengali (0980–09FF) + // Gurmukhi (0A00–0A7F) + // Gujarati (0A80–0AFF) + // Oriya (0B00–0B7F) + // Tamil (0B80–0BFF) + // Telugu (0C00–0C7F) + // Kannada (0C80–0CFF) + // Malayalam (0D00–0D7F) + // Sinhala (0D80–0DFF) + // Thai (0E00–0E7F) + // Lao (0E80–0EFF) + // Tibetan (0F00–0FFF) + // Myanmar (1000–109F) + name: 'brahmic', + blocks: [[0x0900, 0x109F]] +}, { + name: 'georgian', + blocks: [[0x10A0, 0x10ff]] +}, { + // Chinese and Japanese. + // The "k" in cjk is for Korean, but we've separated Korean out + name: "cjk", + blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana + [0x4E00, 0x9FAF], // CJK ideograms + [0xFF00, 0xFF60]] +}, { + // Korean + name: 'hangul', + blocks: [[0xAC00, 0xD7AF]] +}]; +/** + * Given a codepoint, return the name of the script or script family + * it is from, or null if it is not part of a known block + */ + +function scriptFromCodepoint(codepoint) { + for (let i = 0; i < scriptData.length; i++) { + const script = scriptData[i]; + + for (let i = 0; i < script.blocks.length; i++) { + const block = script.blocks[i]; + + if (codepoint >= block[0] && codepoint <= block[1]) { + return script.name; + } + } + } + + return null; +} +/** + * A flattened version of all the supported blocks in a single array. + * This is an optimization to make supportedCodepoint() fast. + */ + +const allBlocks = []; +scriptData.forEach(s => s.blocks.forEach(b => allBlocks.push(...b))); +/** + * Given a codepoint, return true if it falls within one of the + * scripts or script families defined above and false otherwise. + * + * Micro benchmarks shows that this is faster than + * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test() + * in Firefox, Chrome and Node. + */ + +function supportedCodepoint(codepoint) { + for (let i = 0; i < allBlocks.length; i += 2) { + if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { + return true; + } + } + + return false; +} + +/** + * This file provides support to domTree.js + * It's a storehouse of path geometry for SVG images. + */ +// In all paths below, the viewBox-to-em scale is 1000:1. +const hLinePad = 80; // padding above a sqrt viniculum. + +const path = { + // sqrtMain path geometry is from glyph U221A in the font KaTeX Main + // All surds have 80 units padding above the viniculumn. + sqrtMain: `M95,${622 + hLinePad}c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5, +-10,-9.5,-14c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54c44.2,-33.3,65.8, +-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10s173,378,173,378c0.7,0, +35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429c69,-144,104.5,-217.7,106.5, +-221c5.3,-9.3,12,-14,20,-14H400000v40H845.2724s-225.272,467,-225.272,467 +s-235,486,-235,486c-2.7,4.7,-9,7,-19,7c-6,0,-10,-1,-12,-3s-194,-422,-194,-422 +s-65,47,-65,47z M834 ${hLinePad}H400000v40H845z`, + // size1 is from glyph U221A in the font KaTeX_Size1-Regular + sqrtSize1: `M263,${601 + hLinePad}c0.7,0,18,39.7,52,119c34,79.3,68.167, +158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120c340,-704.7,510.7,-1060.3,512,-1067 +c4.7,-7.3,11,-11,19,-11H40000v40H1012.3s-271.3,567,-271.3,567c-38.7,80.7,-84, +175,-136,283c-52,108,-89.167,185.3,-111.5,232c-22.3,46.7,-33.8,70.3,-34.5,71 +c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1s-109,-253,-109,-253c-72.7,-168,-109.3, +-252,-110,-252c-10.7,8,-22,16.7,-34,26c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26 +s76,-59,76,-59s76,-60,76,-60z M1001 ${hLinePad}H40000v40H1012z`, + // size2 is from glyph U221A in the font KaTeX_Size2-Regular + // The 80 units padding is most obvious here. Note start node at M1001 80. + sqrtSize2: `M1001,${hLinePad}H400000v40H1013.1s-83.4,268,-264.1,840c-180.7, +572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7, +-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744c-10,12,-21,25,-33,39s-32,39,-32,39 +c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30c26.7,-32.7,52,-63,76,-91s52,-60,52,-60 +s208,722,208,722c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5, +-658.5c53.7,-170.3,84.5,-266.8,92.5,-289.5c4,-6.7,10,-10,18,-10z +M1001 ${hLinePad}H400000v40H1013z`, + // size3 is from glyph U221A in the font KaTeX_Size3-Regular + sqrtSize3: `M424,${2398 + hLinePad}c-1.3,-0.7,-38.5,-172,-111.5,-514c-73, +-342,-109.8,-513.3,-110.5,-514c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5, +25c-5.7,9.3,-9.8,16,-12.5,20s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13, +-13s76,-122,76,-122s77,-121,77,-121s209,968,209,968c0,-2,84.7,-361.7,254,-1079 +c169.3,-717.3,254.7,-1077.7,256,-1081c4,-6.7,10,-10,18,-10H400000v40H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M1001 ${hLinePad}H400000v40H1014z`, + // size4 is from glyph U221A in the font KaTeX_Size4-Regular + sqrtSize4: `M473,${2713 + hLinePad}c339.3,-1799.3,509.3,-2700,510,-2702 +c3.3,-7.3,9.3,-11,18,-11H400000v40H1017.7s-90.5,478,-276.2,1466c-185.7,988, +-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32, +-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200c0,-1.3,-5.3,8.7,-16,30c-10.7, +21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26s76,-153,76,-153s77,-151, +77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,606z +M1001 ${hLinePad}H400000v40H1017z`, + // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main + doubleleftarrow: `M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`, + // doublerightarrow is from glyph U+21D2 in font KaTeX Main + doublerightarrow: `M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`, + // leftarrow is from glyph U+2190 in font KaTeX Main + leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`, + // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular + leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`, + leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`, + // overgroup is from the MnSymbol package (public domain) + leftgroup: `M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`, + leftgroupunder: `M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`, + // Harpoons are from glyph U+21BD in font KaTeX Main + leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`, + leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`, + leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`, + leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`, + // hook is from glyph U+21A9 in font KaTeX Main + lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`, + leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`, + leftmapsto: `M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`, + // tofrom is from glyph U+21C4 in font KaTeX AMS Regular + leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`, + longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`, + midbrace: `M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`, + midbraceunder: `M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`, + oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`, + oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`, + oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`, + oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`, + rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`, + rightbrace: `M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`, + rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`, + rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`, + rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`, + rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`, + rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`, + rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`, + rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`, + righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`, + rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`, + rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`, + // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular + twoheadleftarrow: `M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`, + twoheadrightarrow: `M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`, + // tilde1 is a modified version of a glyph from the MnSymbol package + tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`, + // ditto tilde2, tilde3, & tilde4 + tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`, + tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`, + tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`, + // vec is from glyph U+20D7 in font KaTeX Main + vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`, + // widehat1 is a modified version of a glyph from the MnSymbol package + widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`, + // ditto widehat2, widehat3, & widehat4 + widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + // widecheck paths are all inverted versions of widehat + widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`, + widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + // The next ten paths support reaction arrows from the mhchem package. + // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX + // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main + baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 241v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`, + // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main + rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`, + // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. + // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em + baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`, + rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`, + shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`, + shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z` +}; +var svgGeometry = { + path +}; + +/** + * This node represents a document fragment, which contains elements, but when + * placed into the DOM doesn't have any representation itself. It only contains + * children and doesn't have any DOM node properties. + */ +class DocumentFragment { + // HtmlDomNode + // Never used; needed for satisfying interface. + constructor(children) { + this.children = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + this.children = children; + this.classes = []; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = {}; + } + + hasClass(className) { + return utils.contains(this.classes, className); + } + /** Convert the fragment into a node. */ + + + toNode() { + const frag = document.createDocumentFragment(); + + for (let i = 0; i < this.children.length; i++) { + frag.appendChild(this.children[i].toNode()); + } + + return frag; + } + /** Convert the fragment into HTML markup. */ + + + toMarkup() { + let markup = ""; // Simply concatenate the markup for the children together. + + for (let i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + return markup; + } + /** + * Converts the math node into a string, similar to innerText. Applies to + * MathDomNode's only. + */ + + + toText() { + // To avoid this, we would subclass documentFragment separately for + // MathML, but polyfills for subclassing is expensive per PR 1469. + // $FlowFixMe: Only works for ChildType = MathDomNode. + const toText = child => child.toText(); + + return this.children.map(toText).join(""); + } + +} + +/** + * These objects store the data about the DOM nodes we create, as well as some + * extra data. They can then be transformed into real DOM nodes with the + * `toNode` function or HTML markup using `toMarkup`. They are useful for both + * storing extra properties on the nodes, as well as providing a way to easily + * work with the DOM. + * + * Similar functions for working with MathML nodes exist in mathMLTree.js. + * + * TODO: refactor `span` and `anchor` into common superclass when + * target environments support class inheritance + */ + +/** + * Create an HTML className based on a list of classes. In addition to joining + * with spaces, we also remove empty classes. + */ +const createClass = function createClass(classes) { + return classes.filter(cls => cls).join(" "); +}; + +const initNode = function initNode(classes, options, style) { + this.classes = classes || []; + this.attributes = {}; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = style || {}; + + if (options) { + if (options.style.isTight()) { + this.classes.push("mtight"); + } + + const color = options.getColor(); + + if (color) { + this.style.color = color; + } + } +}; +/** + * Convert into an HTML node + */ + + +const toNode = function toNode(tagName) { + const node = document.createElement(tagName); // Apply the class + + node.className = createClass(this.classes); // Apply inline styles + + for (const style in this.style) { + if (this.style.hasOwnProperty(style)) { + // $FlowFixMe Flow doesn't seem to understand span.style's type. + node.style[style] = this.style[style]; + } + } // Apply attributes + + + for (const attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } // Append the children, also as HTML nodes + + + for (let i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + + return node; +}; +/** + * Convert into an HTML markup string + */ + + +const toMarkup = function toMarkup(tagName) { + let markup = `<${tagName}`; // Add the class + + if (this.classes.length) { + markup += ` class="${utils.escape(createClass(this.classes))}"`; + } + + let styles = ""; // Add the styles, after hyphenation + + for (const style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += `${utils.hyphenate(style)}:${this.style[style]};`; + } + } + + if (styles) { + markup += ` style="${utils.escape(styles)}"`; + } // Add the attributes + + + for (const attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + markup += ` ${attr}="${utils.escape(this.attributes[attr])}"`; + } + } + + markup += ">"; // Add the markup of the children, also as markup + + for (let i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + markup += ``; + return markup; +}; // Making the type below exact with all optional fields doesn't work due to +// - https://github.com/facebook/flow/issues/4582 +// - https://github.com/facebook/flow/issues/5688 +// However, since *all* fields are optional, $Shape<> works as suggested in 5688 +// above. +// This type does not include all CSS properties. Additional properties should +// be added as needed. + + +/** + * This node represents a span node, with a className, a list of children, and + * an inline style. It also contains information about its height, depth, and + * maxFontSize. + * + * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan + * otherwise. This typesafety is important when HTML builders access a span's + * children. + */ +class Span { + constructor(classes, children, options, style) { + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.width = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes, options, style); + this.children = children || []; + } + /** + * Sets an arbitrary attribute on the span. Warning: use this wisely. Not + * all browsers support attributes the same, and having too many custom + * attributes is probably bad. + */ + + + setAttribute(attribute, value) { + this.attributes[attribute] = value; + } + + hasClass(className) { + return utils.contains(this.classes, className); + } + + toNode() { + return toNode.call(this, "span"); + } + + toMarkup() { + return toMarkup.call(this, "span"); + } + +} +/** + * This node represents an anchor () element with a hyperlink. See `span` + * for further details. + */ + +class Anchor { + constructor(href, classes, children, options) { + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes, options); + this.children = children || []; + this.setAttribute('href', href); + } + + setAttribute(attribute, value) { + this.attributes[attribute] = value; + } + + hasClass(className) { + return utils.contains(this.classes, className); + } + + toNode() { + return toNode.call(this, "a"); + } + + toMarkup() { + return toMarkup.call(this, "a"); + } + +} +const iCombinations = { + 'î': '\u0131\u0302', + 'ï': '\u0131\u0308', + 'í': '\u0131\u0301', + // 'ī': '\u0131\u0304', // enable when we add Extended Latin + 'ì': '\u0131\u0300' +}; +/** + * A symbol node contains information about a single symbol. It either renders + * to a single text node, or a span with a single text node in it, depending on + * whether it has CSS classes, styles, or needs italic correction. + */ + +class SymbolNode { + constructor(text, height, depth, italic, skew, width, classes, style) { + this.text = void 0; + this.height = void 0; + this.depth = void 0; + this.italic = void 0; + this.skew = void 0; + this.width = void 0; + this.maxFontSize = void 0; + this.classes = void 0; + this.style = void 0; + this.text = text; + this.height = height || 0; + this.depth = depth || 0; + this.italic = italic || 0; + this.skew = skew || 0; + this.width = width || 0; + this.classes = classes || []; + this.style = style || {}; + this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we + // can specify which fonts to use. This allows us to render these + // characters with a serif font in situations where the browser would + // either default to a sans serif or render a placeholder character. + // We use CSS class names like cjk_fallback, hangul_fallback and + // brahmic_fallback. See ./unicodeScripts.js for the set of possible + // script names + + const script = scriptFromCodepoint(this.text.charCodeAt(0)); + + if (script) { + this.classes.push(script + "_fallback"); + } + + if (/[îïíì]/.test(this.text)) { + // add ī when we add Extended Latin + this.text = iCombinations[this.text]; + } + } + + hasClass(className) { + return utils.contains(this.classes, className); + } + /** + * Creates a text node or span from a symbol node. Note that a span is only + * created if it is needed. + */ + + + toNode() { + const node = document.createTextNode(this.text); + let span = null; + + if (this.italic > 0) { + span = document.createElement("span"); + span.style.marginRight = this.italic + "em"; + } + + if (this.classes.length > 0) { + span = span || document.createElement("span"); + span.className = createClass(this.classes); + } + + for (const style in this.style) { + if (this.style.hasOwnProperty(style)) { + span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type. + + span.style[style] = this.style[style]; + } + } + + if (span) { + span.appendChild(node); + return span; + } else { + return node; + } + } + /** + * Creates markup for a symbol node. + */ + + + toMarkup() { + // TODO(alpert): More duplication than I'd like from + // span.prototype.toMarkup and symbolNode.prototype.toNode... + let needsSpan = false; + let markup = " 0) { + styles += "margin-right:" + this.italic + "em;"; + } + + for (const style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; + } + } + + if (styles) { + needsSpan = true; + markup += " style=\"" + utils.escape(styles) + "\""; + } + + const escaped = utils.escape(this.text); + + if (needsSpan) { + markup += ">"; + markup += escaped; + markup += ""; + return markup; + } else { + return escaped; + } + } + +} +/** + * SVG nodes are used to render stretchy wide elements. + */ + +class SvgNode { + constructor(children, attributes) { + this.children = void 0; + this.attributes = void 0; + this.children = children || []; + this.attributes = attributes || {}; + } + + toNode() { + const svgNS = "http://www.w3.org/2000/svg"; + const node = document.createElementNS(svgNS, "svg"); // Apply attributes + + for (const attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + for (let i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + + return node; + } + + toMarkup() { + let markup = "`; + } else { + return ``; + } + } + +} +class LineNode { + constructor(attributes) { + this.attributes = void 0; + this.attributes = attributes || {}; + } + + toNode() { + const svgNS = "http://www.w3.org/2000/svg"; + const node = document.createElementNS(svgNS, "line"); // Apply attributes + + for (const attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + return node; + } + + toMarkup() { + let markup = " but got ${String(group)}.`); + } +} + +// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY. +var metricMap = { + "AMS-Regular": { + "65": [0, 0.68889, 0, 0, 0.72222], + "66": [0, 0.68889, 0, 0, 0.66667], + "67": [0, 0.68889, 0, 0, 0.72222], + "68": [0, 0.68889, 0, 0, 0.72222], + "69": [0, 0.68889, 0, 0, 0.66667], + "70": [0, 0.68889, 0, 0, 0.61111], + "71": [0, 0.68889, 0, 0, 0.77778], + "72": [0, 0.68889, 0, 0, 0.77778], + "73": [0, 0.68889, 0, 0, 0.38889], + "74": [0.16667, 0.68889, 0, 0, 0.5], + "75": [0, 0.68889, 0, 0, 0.77778], + "76": [0, 0.68889, 0, 0, 0.66667], + "77": [0, 0.68889, 0, 0, 0.94445], + "78": [0, 0.68889, 0, 0, 0.72222], + "79": [0.16667, 0.68889, 0, 0, 0.77778], + "80": [0, 0.68889, 0, 0, 0.61111], + "81": [0.16667, 0.68889, 0, 0, 0.77778], + "82": [0, 0.68889, 0, 0, 0.72222], + "83": [0, 0.68889, 0, 0, 0.55556], + "84": [0, 0.68889, 0, 0, 0.66667], + "85": [0, 0.68889, 0, 0, 0.72222], + "86": [0, 0.68889, 0, 0, 0.72222], + "87": [0, 0.68889, 0, 0, 1.0], + "88": [0, 0.68889, 0, 0, 0.72222], + "89": [0, 0.68889, 0, 0, 0.72222], + "90": [0, 0.68889, 0, 0, 0.66667], + "107": [0, 0.68889, 0, 0, 0.55556], + "165": [0, 0.675, 0.025, 0, 0.75], + "174": [0.15559, 0.69224, 0, 0, 0.94666], + "240": [0, 0.68889, 0, 0, 0.55556], + "295": [0, 0.68889, 0, 0, 0.54028], + "710": [0, 0.825, 0, 0, 2.33334], + "732": [0, 0.9, 0, 0, 2.33334], + "770": [0, 0.825, 0, 0, 2.33334], + "771": [0, 0.9, 0, 0, 2.33334], + "989": [0.08167, 0.58167, 0, 0, 0.77778], + "1008": [0, 0.43056, 0.04028, 0, 0.66667], + "8245": [0, 0.54986, 0, 0, 0.275], + "8463": [0, 0.68889, 0, 0, 0.54028], + "8487": [0, 0.68889, 0, 0, 0.72222], + "8498": [0, 0.68889, 0, 0, 0.55556], + "8502": [0, 0.68889, 0, 0, 0.66667], + "8503": [0, 0.68889, 0, 0, 0.44445], + "8504": [0, 0.68889, 0, 0, 0.66667], + "8513": [0, 0.68889, 0, 0, 0.63889], + "8592": [-0.03598, 0.46402, 0, 0, 0.5], + "8594": [-0.03598, 0.46402, 0, 0, 0.5], + "8602": [-0.13313, 0.36687, 0, 0, 1.0], + "8603": [-0.13313, 0.36687, 0, 0, 1.0], + "8606": [0.01354, 0.52239, 0, 0, 1.0], + "8608": [0.01354, 0.52239, 0, 0, 1.0], + "8610": [0.01354, 0.52239, 0, 0, 1.11111], + "8611": [0.01354, 0.52239, 0, 0, 1.11111], + "8619": [0, 0.54986, 0, 0, 1.0], + "8620": [0, 0.54986, 0, 0, 1.0], + "8621": [-0.13313, 0.37788, 0, 0, 1.38889], + "8622": [-0.13313, 0.36687, 0, 0, 1.0], + "8624": [0, 0.69224, 0, 0, 0.5], + "8625": [0, 0.69224, 0, 0, 0.5], + "8630": [0, 0.43056, 0, 0, 1.0], + "8631": [0, 0.43056, 0, 0, 1.0], + "8634": [0.08198, 0.58198, 0, 0, 0.77778], + "8635": [0.08198, 0.58198, 0, 0, 0.77778], + "8638": [0.19444, 0.69224, 0, 0, 0.41667], + "8639": [0.19444, 0.69224, 0, 0, 0.41667], + "8642": [0.19444, 0.69224, 0, 0, 0.41667], + "8643": [0.19444, 0.69224, 0, 0, 0.41667], + "8644": [0.1808, 0.675, 0, 0, 1.0], + "8646": [0.1808, 0.675, 0, 0, 1.0], + "8647": [0.1808, 0.675, 0, 0, 1.0], + "8648": [0.19444, 0.69224, 0, 0, 0.83334], + "8649": [0.1808, 0.675, 0, 0, 1.0], + "8650": [0.19444, 0.69224, 0, 0, 0.83334], + "8651": [0.01354, 0.52239, 0, 0, 1.0], + "8652": [0.01354, 0.52239, 0, 0, 1.0], + "8653": [-0.13313, 0.36687, 0, 0, 1.0], + "8654": [-0.13313, 0.36687, 0, 0, 1.0], + "8655": [-0.13313, 0.36687, 0, 0, 1.0], + "8666": [0.13667, 0.63667, 0, 0, 1.0], + "8667": [0.13667, 0.63667, 0, 0, 1.0], + "8669": [-0.13313, 0.37788, 0, 0, 1.0], + "8672": [-0.064, 0.437, 0, 0, 1.334], + "8674": [-0.064, 0.437, 0, 0, 1.334], + "8705": [0, 0.825, 0, 0, 0.5], + "8708": [0, 0.68889, 0, 0, 0.55556], + "8709": [0.08167, 0.58167, 0, 0, 0.77778], + "8717": [0, 0.43056, 0, 0, 0.42917], + "8722": [-0.03598, 0.46402, 0, 0, 0.5], + "8724": [0.08198, 0.69224, 0, 0, 0.77778], + "8726": [0.08167, 0.58167, 0, 0, 0.77778], + "8733": [0, 0.69224, 0, 0, 0.77778], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8737": [0, 0.69224, 0, 0, 0.72222], + "8738": [0.03517, 0.52239, 0, 0, 0.72222], + "8739": [0.08167, 0.58167, 0, 0, 0.22222], + "8740": [0.25142, 0.74111, 0, 0, 0.27778], + "8741": [0.08167, 0.58167, 0, 0, 0.38889], + "8742": [0.25142, 0.74111, 0, 0, 0.5], + "8756": [0, 0.69224, 0, 0, 0.66667], + "8757": [0, 0.69224, 0, 0, 0.66667], + "8764": [-0.13313, 0.36687, 0, 0, 0.77778], + "8765": [-0.13313, 0.37788, 0, 0, 0.77778], + "8769": [-0.13313, 0.36687, 0, 0, 0.77778], + "8770": [-0.03625, 0.46375, 0, 0, 0.77778], + "8774": [0.30274, 0.79383, 0, 0, 0.77778], + "8776": [-0.01688, 0.48312, 0, 0, 0.77778], + "8778": [0.08167, 0.58167, 0, 0, 0.77778], + "8782": [0.06062, 0.54986, 0, 0, 0.77778], + "8783": [0.06062, 0.54986, 0, 0, 0.77778], + "8785": [0.08198, 0.58198, 0, 0, 0.77778], + "8786": [0.08198, 0.58198, 0, 0, 0.77778], + "8787": [0.08198, 0.58198, 0, 0, 0.77778], + "8790": [0, 0.69224, 0, 0, 0.77778], + "8791": [0.22958, 0.72958, 0, 0, 0.77778], + "8796": [0.08198, 0.91667, 0, 0, 0.77778], + "8806": [0.25583, 0.75583, 0, 0, 0.77778], + "8807": [0.25583, 0.75583, 0, 0, 0.77778], + "8808": [0.25142, 0.75726, 0, 0, 0.77778], + "8809": [0.25142, 0.75726, 0, 0, 0.77778], + "8812": [0.25583, 0.75583, 0, 0, 0.5], + "8814": [0.20576, 0.70576, 0, 0, 0.77778], + "8815": [0.20576, 0.70576, 0, 0, 0.77778], + "8816": [0.30274, 0.79383, 0, 0, 0.77778], + "8817": [0.30274, 0.79383, 0, 0, 0.77778], + "8818": [0.22958, 0.72958, 0, 0, 0.77778], + "8819": [0.22958, 0.72958, 0, 0, 0.77778], + "8822": [0.1808, 0.675, 0, 0, 0.77778], + "8823": [0.1808, 0.675, 0, 0, 0.77778], + "8828": [0.13667, 0.63667, 0, 0, 0.77778], + "8829": [0.13667, 0.63667, 0, 0, 0.77778], + "8830": [0.22958, 0.72958, 0, 0, 0.77778], + "8831": [0.22958, 0.72958, 0, 0, 0.77778], + "8832": [0.20576, 0.70576, 0, 0, 0.77778], + "8833": [0.20576, 0.70576, 0, 0, 0.77778], + "8840": [0.30274, 0.79383, 0, 0, 0.77778], + "8841": [0.30274, 0.79383, 0, 0, 0.77778], + "8842": [0.13597, 0.63597, 0, 0, 0.77778], + "8843": [0.13597, 0.63597, 0, 0, 0.77778], + "8847": [0.03517, 0.54986, 0, 0, 0.77778], + "8848": [0.03517, 0.54986, 0, 0, 0.77778], + "8858": [0.08198, 0.58198, 0, 0, 0.77778], + "8859": [0.08198, 0.58198, 0, 0, 0.77778], + "8861": [0.08198, 0.58198, 0, 0, 0.77778], + "8862": [0, 0.675, 0, 0, 0.77778], + "8863": [0, 0.675, 0, 0, 0.77778], + "8864": [0, 0.675, 0, 0, 0.77778], + "8865": [0, 0.675, 0, 0, 0.77778], + "8872": [0, 0.69224, 0, 0, 0.61111], + "8873": [0, 0.69224, 0, 0, 0.72222], + "8874": [0, 0.69224, 0, 0, 0.88889], + "8876": [0, 0.68889, 0, 0, 0.61111], + "8877": [0, 0.68889, 0, 0, 0.61111], + "8878": [0, 0.68889, 0, 0, 0.72222], + "8879": [0, 0.68889, 0, 0, 0.72222], + "8882": [0.03517, 0.54986, 0, 0, 0.77778], + "8883": [0.03517, 0.54986, 0, 0, 0.77778], + "8884": [0.13667, 0.63667, 0, 0, 0.77778], + "8885": [0.13667, 0.63667, 0, 0, 0.77778], + "8888": [0, 0.54986, 0, 0, 1.11111], + "8890": [0.19444, 0.43056, 0, 0, 0.55556], + "8891": [0.19444, 0.69224, 0, 0, 0.61111], + "8892": [0.19444, 0.69224, 0, 0, 0.61111], + "8901": [0, 0.54986, 0, 0, 0.27778], + "8903": [0.08167, 0.58167, 0, 0, 0.77778], + "8905": [0.08167, 0.58167, 0, 0, 0.77778], + "8906": [0.08167, 0.58167, 0, 0, 0.77778], + "8907": [0, 0.69224, 0, 0, 0.77778], + "8908": [0, 0.69224, 0, 0, 0.77778], + "8909": [-0.03598, 0.46402, 0, 0, 0.77778], + "8910": [0, 0.54986, 0, 0, 0.76042], + "8911": [0, 0.54986, 0, 0, 0.76042], + "8912": [0.03517, 0.54986, 0, 0, 0.77778], + "8913": [0.03517, 0.54986, 0, 0, 0.77778], + "8914": [0, 0.54986, 0, 0, 0.66667], + "8915": [0, 0.54986, 0, 0, 0.66667], + "8916": [0, 0.69224, 0, 0, 0.66667], + "8918": [0.0391, 0.5391, 0, 0, 0.77778], + "8919": [0.0391, 0.5391, 0, 0, 0.77778], + "8920": [0.03517, 0.54986, 0, 0, 1.33334], + "8921": [0.03517, 0.54986, 0, 0, 1.33334], + "8922": [0.38569, 0.88569, 0, 0, 0.77778], + "8923": [0.38569, 0.88569, 0, 0, 0.77778], + "8926": [0.13667, 0.63667, 0, 0, 0.77778], + "8927": [0.13667, 0.63667, 0, 0, 0.77778], + "8928": [0.30274, 0.79383, 0, 0, 0.77778], + "8929": [0.30274, 0.79383, 0, 0, 0.77778], + "8934": [0.23222, 0.74111, 0, 0, 0.77778], + "8935": [0.23222, 0.74111, 0, 0, 0.77778], + "8936": [0.23222, 0.74111, 0, 0, 0.77778], + "8937": [0.23222, 0.74111, 0, 0, 0.77778], + "8938": [0.20576, 0.70576, 0, 0, 0.77778], + "8939": [0.20576, 0.70576, 0, 0, 0.77778], + "8940": [0.30274, 0.79383, 0, 0, 0.77778], + "8941": [0.30274, 0.79383, 0, 0, 0.77778], + "8994": [0.19444, 0.69224, 0, 0, 0.77778], + "8995": [0.19444, 0.69224, 0, 0, 0.77778], + "9416": [0.15559, 0.69224, 0, 0, 0.90222], + "9484": [0, 0.69224, 0, 0, 0.5], + "9488": [0, 0.69224, 0, 0, 0.5], + "9492": [0, 0.37788, 0, 0, 0.5], + "9496": [0, 0.37788, 0, 0, 0.5], + "9585": [0.19444, 0.68889, 0, 0, 0.88889], + "9586": [0.19444, 0.74111, 0, 0, 0.88889], + "9632": [0, 0.675, 0, 0, 0.77778], + "9633": [0, 0.675, 0, 0, 0.77778], + "9650": [0, 0.54986, 0, 0, 0.72222], + "9651": [0, 0.54986, 0, 0, 0.72222], + "9654": [0.03517, 0.54986, 0, 0, 0.77778], + "9660": [0, 0.54986, 0, 0, 0.72222], + "9661": [0, 0.54986, 0, 0, 0.72222], + "9664": [0.03517, 0.54986, 0, 0, 0.77778], + "9674": [0.11111, 0.69224, 0, 0, 0.66667], + "9733": [0.19444, 0.69224, 0, 0, 0.94445], + "10003": [0, 0.69224, 0, 0, 0.83334], + "10016": [0, 0.69224, 0, 0, 0.83334], + "10731": [0.11111, 0.69224, 0, 0, 0.66667], + "10846": [0.19444, 0.75583, 0, 0, 0.61111], + "10877": [0.13667, 0.63667, 0, 0, 0.77778], + "10878": [0.13667, 0.63667, 0, 0, 0.77778], + "10885": [0.25583, 0.75583, 0, 0, 0.77778], + "10886": [0.25583, 0.75583, 0, 0, 0.77778], + "10887": [0.13597, 0.63597, 0, 0, 0.77778], + "10888": [0.13597, 0.63597, 0, 0, 0.77778], + "10889": [0.26167, 0.75726, 0, 0, 0.77778], + "10890": [0.26167, 0.75726, 0, 0, 0.77778], + "10891": [0.48256, 0.98256, 0, 0, 0.77778], + "10892": [0.48256, 0.98256, 0, 0, 0.77778], + "10901": [0.13667, 0.63667, 0, 0, 0.77778], + "10902": [0.13667, 0.63667, 0, 0, 0.77778], + "10933": [0.25142, 0.75726, 0, 0, 0.77778], + "10934": [0.25142, 0.75726, 0, 0, 0.77778], + "10935": [0.26167, 0.75726, 0, 0, 0.77778], + "10936": [0.26167, 0.75726, 0, 0, 0.77778], + "10937": [0.26167, 0.75726, 0, 0, 0.77778], + "10938": [0.26167, 0.75726, 0, 0, 0.77778], + "10949": [0.25583, 0.75583, 0, 0, 0.77778], + "10950": [0.25583, 0.75583, 0, 0, 0.77778], + "10955": [0.28481, 0.79383, 0, 0, 0.77778], + "10956": [0.28481, 0.79383, 0, 0, 0.77778], + "57350": [0.08167, 0.58167, 0, 0, 0.22222], + "57351": [0.08167, 0.58167, 0, 0, 0.38889], + "57352": [0.08167, 0.58167, 0, 0, 0.77778], + "57353": [0, 0.43056, 0.04028, 0, 0.66667], + "57356": [0.25142, 0.75726, 0, 0, 0.77778], + "57357": [0.25142, 0.75726, 0, 0, 0.77778], + "57358": [0.41951, 0.91951, 0, 0, 0.77778], + "57359": [0.30274, 0.79383, 0, 0, 0.77778], + "57360": [0.30274, 0.79383, 0, 0, 0.77778], + "57361": [0.41951, 0.91951, 0, 0, 0.77778], + "57366": [0.25142, 0.75726, 0, 0, 0.77778], + "57367": [0.25142, 0.75726, 0, 0, 0.77778], + "57368": [0.25142, 0.75726, 0, 0, 0.77778], + "57369": [0.25142, 0.75726, 0, 0, 0.77778], + "57370": [0.13597, 0.63597, 0, 0, 0.77778], + "57371": [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Caligraphic-Regular": { + "48": [0, 0.43056, 0, 0, 0.5], + "49": [0, 0.43056, 0, 0, 0.5], + "50": [0, 0.43056, 0, 0, 0.5], + "51": [0.19444, 0.43056, 0, 0, 0.5], + "52": [0.19444, 0.43056, 0, 0, 0.5], + "53": [0.19444, 0.43056, 0, 0, 0.5], + "54": [0, 0.64444, 0, 0, 0.5], + "55": [0.19444, 0.43056, 0, 0, 0.5], + "56": [0, 0.64444, 0, 0, 0.5], + "57": [0.19444, 0.43056, 0, 0, 0.5], + "65": [0, 0.68333, 0, 0.19445, 0.79847], + "66": [0, 0.68333, 0.03041, 0.13889, 0.65681], + "67": [0, 0.68333, 0.05834, 0.13889, 0.52653], + "68": [0, 0.68333, 0.02778, 0.08334, 0.77139], + "69": [0, 0.68333, 0.08944, 0.11111, 0.52778], + "70": [0, 0.68333, 0.09931, 0.11111, 0.71875], + "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], + "72": [0, 0.68333, 0.00965, 0.11111, 0.84452], + "73": [0, 0.68333, 0.07382, 0, 0.54452], + "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], + "75": [0, 0.68333, 0.01445, 0.05556, 0.76195], + "76": [0, 0.68333, 0, 0.13889, 0.68972], + "77": [0, 0.68333, 0, 0.13889, 1.2009], + "78": [0, 0.68333, 0.14736, 0.08334, 0.82049], + "79": [0, 0.68333, 0.02778, 0.11111, 0.79611], + "80": [0, 0.68333, 0.08222, 0.08334, 0.69556], + "81": [0.09722, 0.68333, 0, 0.11111, 0.81667], + "82": [0, 0.68333, 0, 0.08334, 0.8475], + "83": [0, 0.68333, 0.075, 0.13889, 0.60556], + "84": [0, 0.68333, 0.25417, 0, 0.54464], + "85": [0, 0.68333, 0.09931, 0.08334, 0.62583], + "86": [0, 0.68333, 0.08222, 0, 0.61278], + "87": [0, 0.68333, 0.08222, 0.08334, 0.98778], + "88": [0, 0.68333, 0.14643, 0.13889, 0.7133], + "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], + "90": [0, 0.68333, 0.07944, 0.13889, 0.72473] + }, + "Fraktur-Regular": { + "33": [0, 0.69141, 0, 0, 0.29574], + "34": [0, 0.69141, 0, 0, 0.21471], + "38": [0, 0.69141, 0, 0, 0.73786], + "39": [0, 0.69141, 0, 0, 0.21201], + "40": [0.24982, 0.74947, 0, 0, 0.38865], + "41": [0.24982, 0.74947, 0, 0, 0.38865], + "42": [0, 0.62119, 0, 0, 0.27764], + "43": [0.08319, 0.58283, 0, 0, 0.75623], + "44": [0, 0.10803, 0, 0, 0.27764], + "45": [0.08319, 0.58283, 0, 0, 0.75623], + "46": [0, 0.10803, 0, 0, 0.27764], + "47": [0.24982, 0.74947, 0, 0, 0.50181], + "48": [0, 0.47534, 0, 0, 0.50181], + "49": [0, 0.47534, 0, 0, 0.50181], + "50": [0, 0.47534, 0, 0, 0.50181], + "51": [0.18906, 0.47534, 0, 0, 0.50181], + "52": [0.18906, 0.47534, 0, 0, 0.50181], + "53": [0.18906, 0.47534, 0, 0, 0.50181], + "54": [0, 0.69141, 0, 0, 0.50181], + "55": [0.18906, 0.47534, 0, 0, 0.50181], + "56": [0, 0.69141, 0, 0, 0.50181], + "57": [0.18906, 0.47534, 0, 0, 0.50181], + "58": [0, 0.47534, 0, 0, 0.21606], + "59": [0.12604, 0.47534, 0, 0, 0.21606], + "61": [-0.13099, 0.36866, 0, 0, 0.75623], + "63": [0, 0.69141, 0, 0, 0.36245], + "65": [0, 0.69141, 0, 0, 0.7176], + "66": [0, 0.69141, 0, 0, 0.88397], + "67": [0, 0.69141, 0, 0, 0.61254], + "68": [0, 0.69141, 0, 0, 0.83158], + "69": [0, 0.69141, 0, 0, 0.66278], + "70": [0.12604, 0.69141, 0, 0, 0.61119], + "71": [0, 0.69141, 0, 0, 0.78539], + "72": [0.06302, 0.69141, 0, 0, 0.7203], + "73": [0, 0.69141, 0, 0, 0.55448], + "74": [0.12604, 0.69141, 0, 0, 0.55231], + "75": [0, 0.69141, 0, 0, 0.66845], + "76": [0, 0.69141, 0, 0, 0.66602], + "77": [0, 0.69141, 0, 0, 1.04953], + "78": [0, 0.69141, 0, 0, 0.83212], + "79": [0, 0.69141, 0, 0, 0.82699], + "80": [0.18906, 0.69141, 0, 0, 0.82753], + "81": [0.03781, 0.69141, 0, 0, 0.82699], + "82": [0, 0.69141, 0, 0, 0.82807], + "83": [0, 0.69141, 0, 0, 0.82861], + "84": [0, 0.69141, 0, 0, 0.66899], + "85": [0, 0.69141, 0, 0, 0.64576], + "86": [0, 0.69141, 0, 0, 0.83131], + "87": [0, 0.69141, 0, 0, 1.04602], + "88": [0, 0.69141, 0, 0, 0.71922], + "89": [0.18906, 0.69141, 0, 0, 0.83293], + "90": [0.12604, 0.69141, 0, 0, 0.60201], + "91": [0.24982, 0.74947, 0, 0, 0.27764], + "93": [0.24982, 0.74947, 0, 0, 0.27764], + "94": [0, 0.69141, 0, 0, 0.49965], + "97": [0, 0.47534, 0, 0, 0.50046], + "98": [0, 0.69141, 0, 0, 0.51315], + "99": [0, 0.47534, 0, 0, 0.38946], + "100": [0, 0.62119, 0, 0, 0.49857], + "101": [0, 0.47534, 0, 0, 0.40053], + "102": [0.18906, 0.69141, 0, 0, 0.32626], + "103": [0.18906, 0.47534, 0, 0, 0.5037], + "104": [0.18906, 0.69141, 0, 0, 0.52126], + "105": [0, 0.69141, 0, 0, 0.27899], + "106": [0, 0.69141, 0, 0, 0.28088], + "107": [0, 0.69141, 0, 0, 0.38946], + "108": [0, 0.69141, 0, 0, 0.27953], + "109": [0, 0.47534, 0, 0, 0.76676], + "110": [0, 0.47534, 0, 0, 0.52666], + "111": [0, 0.47534, 0, 0, 0.48885], + "112": [0.18906, 0.52396, 0, 0, 0.50046], + "113": [0.18906, 0.47534, 0, 0, 0.48912], + "114": [0, 0.47534, 0, 0, 0.38919], + "115": [0, 0.47534, 0, 0, 0.44266], + "116": [0, 0.62119, 0, 0, 0.33301], + "117": [0, 0.47534, 0, 0, 0.5172], + "118": [0, 0.52396, 0, 0, 0.5118], + "119": [0, 0.52396, 0, 0, 0.77351], + "120": [0.18906, 0.47534, 0, 0, 0.38865], + "121": [0.18906, 0.47534, 0, 0, 0.49884], + "122": [0.18906, 0.47534, 0, 0, 0.39054], + "8216": [0, 0.69141, 0, 0, 0.21471], + "8217": [0, 0.69141, 0, 0, 0.21471], + "58112": [0, 0.62119, 0, 0, 0.49749], + "58113": [0, 0.62119, 0, 0, 0.4983], + "58114": [0.18906, 0.69141, 0, 0, 0.33328], + "58115": [0.18906, 0.69141, 0, 0, 0.32923], + "58116": [0.18906, 0.47534, 0, 0, 0.50343], + "58117": [0, 0.69141, 0, 0, 0.33301], + "58118": [0, 0.62119, 0, 0, 0.33409], + "58119": [0, 0.47534, 0, 0, 0.50073] + }, + "Main-Bold": { + "33": [0, 0.69444, 0, 0, 0.35], + "34": [0, 0.69444, 0, 0, 0.60278], + "35": [0.19444, 0.69444, 0, 0, 0.95833], + "36": [0.05556, 0.75, 0, 0, 0.575], + "37": [0.05556, 0.75, 0, 0, 0.95833], + "38": [0, 0.69444, 0, 0, 0.89444], + "39": [0, 0.69444, 0, 0, 0.31944], + "40": [0.25, 0.75, 0, 0, 0.44722], + "41": [0.25, 0.75, 0, 0, 0.44722], + "42": [0, 0.75, 0, 0, 0.575], + "43": [0.13333, 0.63333, 0, 0, 0.89444], + "44": [0.19444, 0.15556, 0, 0, 0.31944], + "45": [0, 0.44444, 0, 0, 0.38333], + "46": [0, 0.15556, 0, 0, 0.31944], + "47": [0.25, 0.75, 0, 0, 0.575], + "48": [0, 0.64444, 0, 0, 0.575], + "49": [0, 0.64444, 0, 0, 0.575], + "50": [0, 0.64444, 0, 0, 0.575], + "51": [0, 0.64444, 0, 0, 0.575], + "52": [0, 0.64444, 0, 0, 0.575], + "53": [0, 0.64444, 0, 0, 0.575], + "54": [0, 0.64444, 0, 0, 0.575], + "55": [0, 0.64444, 0, 0, 0.575], + "56": [0, 0.64444, 0, 0, 0.575], + "57": [0, 0.64444, 0, 0, 0.575], + "58": [0, 0.44444, 0, 0, 0.31944], + "59": [0.19444, 0.44444, 0, 0, 0.31944], + "60": [0.08556, 0.58556, 0, 0, 0.89444], + "61": [-0.10889, 0.39111, 0, 0, 0.89444], + "62": [0.08556, 0.58556, 0, 0, 0.89444], + "63": [0, 0.69444, 0, 0, 0.54305], + "64": [0, 0.69444, 0, 0, 0.89444], + "65": [0, 0.68611, 0, 0, 0.86944], + "66": [0, 0.68611, 0, 0, 0.81805], + "67": [0, 0.68611, 0, 0, 0.83055], + "68": [0, 0.68611, 0, 0, 0.88194], + "69": [0, 0.68611, 0, 0, 0.75555], + "70": [0, 0.68611, 0, 0, 0.72361], + "71": [0, 0.68611, 0, 0, 0.90416], + "72": [0, 0.68611, 0, 0, 0.9], + "73": [0, 0.68611, 0, 0, 0.43611], + "74": [0, 0.68611, 0, 0, 0.59444], + "75": [0, 0.68611, 0, 0, 0.90138], + "76": [0, 0.68611, 0, 0, 0.69166], + "77": [0, 0.68611, 0, 0, 1.09166], + "78": [0, 0.68611, 0, 0, 0.9], + "79": [0, 0.68611, 0, 0, 0.86388], + "80": [0, 0.68611, 0, 0, 0.78611], + "81": [0.19444, 0.68611, 0, 0, 0.86388], + "82": [0, 0.68611, 0, 0, 0.8625], + "83": [0, 0.68611, 0, 0, 0.63889], + "84": [0, 0.68611, 0, 0, 0.8], + "85": [0, 0.68611, 0, 0, 0.88472], + "86": [0, 0.68611, 0.01597, 0, 0.86944], + "87": [0, 0.68611, 0.01597, 0, 1.18888], + "88": [0, 0.68611, 0, 0, 0.86944], + "89": [0, 0.68611, 0.02875, 0, 0.86944], + "90": [0, 0.68611, 0, 0, 0.70277], + "91": [0.25, 0.75, 0, 0, 0.31944], + "92": [0.25, 0.75, 0, 0, 0.575], + "93": [0.25, 0.75, 0, 0, 0.31944], + "94": [0, 0.69444, 0, 0, 0.575], + "95": [0.31, 0.13444, 0.03194, 0, 0.575], + "97": [0, 0.44444, 0, 0, 0.55902], + "98": [0, 0.69444, 0, 0, 0.63889], + "99": [0, 0.44444, 0, 0, 0.51111], + "100": [0, 0.69444, 0, 0, 0.63889], + "101": [0, 0.44444, 0, 0, 0.52708], + "102": [0, 0.69444, 0.10903, 0, 0.35139], + "103": [0.19444, 0.44444, 0.01597, 0, 0.575], + "104": [0, 0.69444, 0, 0, 0.63889], + "105": [0, 0.69444, 0, 0, 0.31944], + "106": [0.19444, 0.69444, 0, 0, 0.35139], + "107": [0, 0.69444, 0, 0, 0.60694], + "108": [0, 0.69444, 0, 0, 0.31944], + "109": [0, 0.44444, 0, 0, 0.95833], + "110": [0, 0.44444, 0, 0, 0.63889], + "111": [0, 0.44444, 0, 0, 0.575], + "112": [0.19444, 0.44444, 0, 0, 0.63889], + "113": [0.19444, 0.44444, 0, 0, 0.60694], + "114": [0, 0.44444, 0, 0, 0.47361], + "115": [0, 0.44444, 0, 0, 0.45361], + "116": [0, 0.63492, 0, 0, 0.44722], + "117": [0, 0.44444, 0, 0, 0.63889], + "118": [0, 0.44444, 0.01597, 0, 0.60694], + "119": [0, 0.44444, 0.01597, 0, 0.83055], + "120": [0, 0.44444, 0, 0, 0.60694], + "121": [0.19444, 0.44444, 0.01597, 0, 0.60694], + "122": [0, 0.44444, 0, 0, 0.51111], + "123": [0.25, 0.75, 0, 0, 0.575], + "124": [0.25, 0.75, 0, 0, 0.31944], + "125": [0.25, 0.75, 0, 0, 0.575], + "126": [0.35, 0.34444, 0, 0, 0.575], + "168": [0, 0.69444, 0, 0, 0.575], + "172": [0, 0.44444, 0, 0, 0.76666], + "176": [0, 0.69444, 0, 0, 0.86944], + "177": [0.13333, 0.63333, 0, 0, 0.89444], + "184": [0.17014, 0, 0, 0, 0.51111], + "198": [0, 0.68611, 0, 0, 1.04166], + "215": [0.13333, 0.63333, 0, 0, 0.89444], + "216": [0.04861, 0.73472, 0, 0, 0.89444], + "223": [0, 0.69444, 0, 0, 0.59722], + "230": [0, 0.44444, 0, 0, 0.83055], + "247": [0.13333, 0.63333, 0, 0, 0.89444], + "248": [0.09722, 0.54167, 0, 0, 0.575], + "305": [0, 0.44444, 0, 0, 0.31944], + "338": [0, 0.68611, 0, 0, 1.16944], + "339": [0, 0.44444, 0, 0, 0.89444], + "567": [0.19444, 0.44444, 0, 0, 0.35139], + "710": [0, 0.69444, 0, 0, 0.575], + "711": [0, 0.63194, 0, 0, 0.575], + "713": [0, 0.59611, 0, 0, 0.575], + "714": [0, 0.69444, 0, 0, 0.575], + "715": [0, 0.69444, 0, 0, 0.575], + "728": [0, 0.69444, 0, 0, 0.575], + "729": [0, 0.69444, 0, 0, 0.31944], + "730": [0, 0.69444, 0, 0, 0.86944], + "732": [0, 0.69444, 0, 0, 0.575], + "733": [0, 0.69444, 0, 0, 0.575], + "824": [0.19444, 0.69444, 0, 0, 0], + "915": [0, 0.68611, 0, 0, 0.69166], + "916": [0, 0.68611, 0, 0, 0.95833], + "920": [0, 0.68611, 0, 0, 0.89444], + "923": [0, 0.68611, 0, 0, 0.80555], + "926": [0, 0.68611, 0, 0, 0.76666], + "928": [0, 0.68611, 0, 0, 0.9], + "931": [0, 0.68611, 0, 0, 0.83055], + "933": [0, 0.68611, 0, 0, 0.89444], + "934": [0, 0.68611, 0, 0, 0.83055], + "936": [0, 0.68611, 0, 0, 0.89444], + "937": [0, 0.68611, 0, 0, 0.83055], + "8211": [0, 0.44444, 0.03194, 0, 0.575], + "8212": [0, 0.44444, 0.03194, 0, 1.14999], + "8216": [0, 0.69444, 0, 0, 0.31944], + "8217": [0, 0.69444, 0, 0, 0.31944], + "8220": [0, 0.69444, 0, 0, 0.60278], + "8221": [0, 0.69444, 0, 0, 0.60278], + "8224": [0.19444, 0.69444, 0, 0, 0.51111], + "8225": [0.19444, 0.69444, 0, 0, 0.51111], + "8242": [0, 0.55556, 0, 0, 0.34444], + "8407": [0, 0.72444, 0.15486, 0, 0.575], + "8463": [0, 0.69444, 0, 0, 0.66759], + "8465": [0, 0.69444, 0, 0, 0.83055], + "8467": [0, 0.69444, 0, 0, 0.47361], + "8472": [0.19444, 0.44444, 0, 0, 0.74027], + "8476": [0, 0.69444, 0, 0, 0.83055], + "8501": [0, 0.69444, 0, 0, 0.70277], + "8592": [-0.10889, 0.39111, 0, 0, 1.14999], + "8593": [0.19444, 0.69444, 0, 0, 0.575], + "8594": [-0.10889, 0.39111, 0, 0, 1.14999], + "8595": [0.19444, 0.69444, 0, 0, 0.575], + "8596": [-0.10889, 0.39111, 0, 0, 1.14999], + "8597": [0.25, 0.75, 0, 0, 0.575], + "8598": [0.19444, 0.69444, 0, 0, 1.14999], + "8599": [0.19444, 0.69444, 0, 0, 1.14999], + "8600": [0.19444, 0.69444, 0, 0, 1.14999], + "8601": [0.19444, 0.69444, 0, 0, 1.14999], + "8636": [-0.10889, 0.39111, 0, 0, 1.14999], + "8637": [-0.10889, 0.39111, 0, 0, 1.14999], + "8640": [-0.10889, 0.39111, 0, 0, 1.14999], + "8641": [-0.10889, 0.39111, 0, 0, 1.14999], + "8656": [-0.10889, 0.39111, 0, 0, 1.14999], + "8657": [0.19444, 0.69444, 0, 0, 0.70277], + "8658": [-0.10889, 0.39111, 0, 0, 1.14999], + "8659": [0.19444, 0.69444, 0, 0, 0.70277], + "8660": [-0.10889, 0.39111, 0, 0, 1.14999], + "8661": [0.25, 0.75, 0, 0, 0.70277], + "8704": [0, 0.69444, 0, 0, 0.63889], + "8706": [0, 0.69444, 0.06389, 0, 0.62847], + "8707": [0, 0.69444, 0, 0, 0.63889], + "8709": [0.05556, 0.75, 0, 0, 0.575], + "8711": [0, 0.68611, 0, 0, 0.95833], + "8712": [0.08556, 0.58556, 0, 0, 0.76666], + "8715": [0.08556, 0.58556, 0, 0, 0.76666], + "8722": [0.13333, 0.63333, 0, 0, 0.89444], + "8723": [0.13333, 0.63333, 0, 0, 0.89444], + "8725": [0.25, 0.75, 0, 0, 0.575], + "8726": [0.25, 0.75, 0, 0, 0.575], + "8727": [-0.02778, 0.47222, 0, 0, 0.575], + "8728": [-0.02639, 0.47361, 0, 0, 0.575], + "8729": [-0.02639, 0.47361, 0, 0, 0.575], + "8730": [0.18, 0.82, 0, 0, 0.95833], + "8733": [0, 0.44444, 0, 0, 0.89444], + "8734": [0, 0.44444, 0, 0, 1.14999], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8739": [0.25, 0.75, 0, 0, 0.31944], + "8741": [0.25, 0.75, 0, 0, 0.575], + "8743": [0, 0.55556, 0, 0, 0.76666], + "8744": [0, 0.55556, 0, 0, 0.76666], + "8745": [0, 0.55556, 0, 0, 0.76666], + "8746": [0, 0.55556, 0, 0, 0.76666], + "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875], + "8764": [-0.10889, 0.39111, 0, 0, 0.89444], + "8768": [0.19444, 0.69444, 0, 0, 0.31944], + "8771": [0.00222, 0.50222, 0, 0, 0.89444], + "8776": [0.02444, 0.52444, 0, 0, 0.89444], + "8781": [0.00222, 0.50222, 0, 0, 0.89444], + "8801": [0.00222, 0.50222, 0, 0, 0.89444], + "8804": [0.19667, 0.69667, 0, 0, 0.89444], + "8805": [0.19667, 0.69667, 0, 0, 0.89444], + "8810": [0.08556, 0.58556, 0, 0, 1.14999], + "8811": [0.08556, 0.58556, 0, 0, 1.14999], + "8826": [0.08556, 0.58556, 0, 0, 0.89444], + "8827": [0.08556, 0.58556, 0, 0, 0.89444], + "8834": [0.08556, 0.58556, 0, 0, 0.89444], + "8835": [0.08556, 0.58556, 0, 0, 0.89444], + "8838": [0.19667, 0.69667, 0, 0, 0.89444], + "8839": [0.19667, 0.69667, 0, 0, 0.89444], + "8846": [0, 0.55556, 0, 0, 0.76666], + "8849": [0.19667, 0.69667, 0, 0, 0.89444], + "8850": [0.19667, 0.69667, 0, 0, 0.89444], + "8851": [0, 0.55556, 0, 0, 0.76666], + "8852": [0, 0.55556, 0, 0, 0.76666], + "8853": [0.13333, 0.63333, 0, 0, 0.89444], + "8854": [0.13333, 0.63333, 0, 0, 0.89444], + "8855": [0.13333, 0.63333, 0, 0, 0.89444], + "8856": [0.13333, 0.63333, 0, 0, 0.89444], + "8857": [0.13333, 0.63333, 0, 0, 0.89444], + "8866": [0, 0.69444, 0, 0, 0.70277], + "8867": [0, 0.69444, 0, 0, 0.70277], + "8868": [0, 0.69444, 0, 0, 0.89444], + "8869": [0, 0.69444, 0, 0, 0.89444], + "8900": [-0.02639, 0.47361, 0, 0, 0.575], + "8901": [-0.02639, 0.47361, 0, 0, 0.31944], + "8902": [-0.02778, 0.47222, 0, 0, 0.575], + "8968": [0.25, 0.75, 0, 0, 0.51111], + "8969": [0.25, 0.75, 0, 0, 0.51111], + "8970": [0.25, 0.75, 0, 0, 0.51111], + "8971": [0.25, 0.75, 0, 0, 0.51111], + "8994": [-0.13889, 0.36111, 0, 0, 1.14999], + "8995": [-0.13889, 0.36111, 0, 0, 1.14999], + "9651": [0.19444, 0.69444, 0, 0, 1.02222], + "9657": [-0.02778, 0.47222, 0, 0, 0.575], + "9661": [0.19444, 0.69444, 0, 0, 1.02222], + "9667": [-0.02778, 0.47222, 0, 0, 0.575], + "9711": [0.19444, 0.69444, 0, 0, 1.14999], + "9824": [0.12963, 0.69444, 0, 0, 0.89444], + "9825": [0.12963, 0.69444, 0, 0, 0.89444], + "9826": [0.12963, 0.69444, 0, 0, 0.89444], + "9827": [0.12963, 0.69444, 0, 0, 0.89444], + "9837": [0, 0.75, 0, 0, 0.44722], + "9838": [0.19444, 0.69444, 0, 0, 0.44722], + "9839": [0.19444, 0.69444, 0, 0, 0.44722], + "10216": [0.25, 0.75, 0, 0, 0.44722], + "10217": [0.25, 0.75, 0, 0, 0.44722], + "10815": [0, 0.68611, 0, 0, 0.9], + "10927": [0.19667, 0.69667, 0, 0, 0.89444], + "10928": [0.19667, 0.69667, 0, 0, 0.89444] + }, + "Main-BoldItalic": { + "33": [0, 0.69444, 0.11417, 0, 0.38611], + "34": [0, 0.69444, 0.07939, 0, 0.62055], + "35": [0.19444, 0.69444, 0.06833, 0, 0.94444], + "37": [0.05556, 0.75, 0.12861, 0, 0.94444], + "38": [0, 0.69444, 0.08528, 0, 0.88555], + "39": [0, 0.69444, 0.12945, 0, 0.35555], + "40": [0.25, 0.75, 0.15806, 0, 0.47333], + "41": [0.25, 0.75, 0.03306, 0, 0.47333], + "42": [0, 0.75, 0.14333, 0, 0.59111], + "43": [0.10333, 0.60333, 0.03306, 0, 0.88555], + "44": [0.19444, 0.14722, 0, 0, 0.35555], + "45": [0, 0.44444, 0.02611, 0, 0.41444], + "46": [0, 0.14722, 0, 0, 0.35555], + "47": [0.25, 0.75, 0.15806, 0, 0.59111], + "48": [0, 0.64444, 0.13167, 0, 0.59111], + "49": [0, 0.64444, 0.13167, 0, 0.59111], + "50": [0, 0.64444, 0.13167, 0, 0.59111], + "51": [0, 0.64444, 0.13167, 0, 0.59111], + "52": [0.19444, 0.64444, 0.13167, 0, 0.59111], + "53": [0, 0.64444, 0.13167, 0, 0.59111], + "54": [0, 0.64444, 0.13167, 0, 0.59111], + "55": [0.19444, 0.64444, 0.13167, 0, 0.59111], + "56": [0, 0.64444, 0.13167, 0, 0.59111], + "57": [0, 0.64444, 0.13167, 0, 0.59111], + "58": [0, 0.44444, 0.06695, 0, 0.35555], + "59": [0.19444, 0.44444, 0.06695, 0, 0.35555], + "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555], + "63": [0, 0.69444, 0.11472, 0, 0.59111], + "64": [0, 0.69444, 0.09208, 0, 0.88555], + "65": [0, 0.68611, 0, 0, 0.86555], + "66": [0, 0.68611, 0.0992, 0, 0.81666], + "67": [0, 0.68611, 0.14208, 0, 0.82666], + "68": [0, 0.68611, 0.09062, 0, 0.87555], + "69": [0, 0.68611, 0.11431, 0, 0.75666], + "70": [0, 0.68611, 0.12903, 0, 0.72722], + "71": [0, 0.68611, 0.07347, 0, 0.89527], + "72": [0, 0.68611, 0.17208, 0, 0.8961], + "73": [0, 0.68611, 0.15681, 0, 0.47166], + "74": [0, 0.68611, 0.145, 0, 0.61055], + "75": [0, 0.68611, 0.14208, 0, 0.89499], + "76": [0, 0.68611, 0, 0, 0.69777], + "77": [0, 0.68611, 0.17208, 0, 1.07277], + "78": [0, 0.68611, 0.17208, 0, 0.8961], + "79": [0, 0.68611, 0.09062, 0, 0.85499], + "80": [0, 0.68611, 0.0992, 0, 0.78721], + "81": [0.19444, 0.68611, 0.09062, 0, 0.85499], + "82": [0, 0.68611, 0.02559, 0, 0.85944], + "83": [0, 0.68611, 0.11264, 0, 0.64999], + "84": [0, 0.68611, 0.12903, 0, 0.7961], + "85": [0, 0.68611, 0.17208, 0, 0.88083], + "86": [0, 0.68611, 0.18625, 0, 0.86555], + "87": [0, 0.68611, 0.18625, 0, 1.15999], + "88": [0, 0.68611, 0.15681, 0, 0.86555], + "89": [0, 0.68611, 0.19803, 0, 0.86555], + "90": [0, 0.68611, 0.14208, 0, 0.70888], + "91": [0.25, 0.75, 0.1875, 0, 0.35611], + "93": [0.25, 0.75, 0.09972, 0, 0.35611], + "94": [0, 0.69444, 0.06709, 0, 0.59111], + "95": [0.31, 0.13444, 0.09811, 0, 0.59111], + "97": [0, 0.44444, 0.09426, 0, 0.59111], + "98": [0, 0.69444, 0.07861, 0, 0.53222], + "99": [0, 0.44444, 0.05222, 0, 0.53222], + "100": [0, 0.69444, 0.10861, 0, 0.59111], + "101": [0, 0.44444, 0.085, 0, 0.53222], + "102": [0.19444, 0.69444, 0.21778, 0, 0.4], + "103": [0.19444, 0.44444, 0.105, 0, 0.53222], + "104": [0, 0.69444, 0.09426, 0, 0.59111], + "105": [0, 0.69326, 0.11387, 0, 0.35555], + "106": [0.19444, 0.69326, 0.1672, 0, 0.35555], + "107": [0, 0.69444, 0.11111, 0, 0.53222], + "108": [0, 0.69444, 0.10861, 0, 0.29666], + "109": [0, 0.44444, 0.09426, 0, 0.94444], + "110": [0, 0.44444, 0.09426, 0, 0.64999], + "111": [0, 0.44444, 0.07861, 0, 0.59111], + "112": [0.19444, 0.44444, 0.07861, 0, 0.59111], + "113": [0.19444, 0.44444, 0.105, 0, 0.53222], + "114": [0, 0.44444, 0.11111, 0, 0.50167], + "115": [0, 0.44444, 0.08167, 0, 0.48694], + "116": [0, 0.63492, 0.09639, 0, 0.385], + "117": [0, 0.44444, 0.09426, 0, 0.62055], + "118": [0, 0.44444, 0.11111, 0, 0.53222], + "119": [0, 0.44444, 0.11111, 0, 0.76777], + "120": [0, 0.44444, 0.12583, 0, 0.56055], + "121": [0.19444, 0.44444, 0.105, 0, 0.56166], + "122": [0, 0.44444, 0.13889, 0, 0.49055], + "126": [0.35, 0.34444, 0.11472, 0, 0.59111], + "163": [0, 0.69444, 0, 0, 0.86853], + "168": [0, 0.69444, 0.11473, 0, 0.59111], + "176": [0, 0.69444, 0, 0, 0.94888], + "184": [0.17014, 0, 0, 0, 0.53222], + "198": [0, 0.68611, 0.11431, 0, 1.02277], + "216": [0.04861, 0.73472, 0.09062, 0, 0.88555], + "223": [0.19444, 0.69444, 0.09736, 0, 0.665], + "230": [0, 0.44444, 0.085, 0, 0.82666], + "248": [0.09722, 0.54167, 0.09458, 0, 0.59111], + "305": [0, 0.44444, 0.09426, 0, 0.35555], + "338": [0, 0.68611, 0.11431, 0, 1.14054], + "339": [0, 0.44444, 0.085, 0, 0.82666], + "567": [0.19444, 0.44444, 0.04611, 0, 0.385], + "710": [0, 0.69444, 0.06709, 0, 0.59111], + "711": [0, 0.63194, 0.08271, 0, 0.59111], + "713": [0, 0.59444, 0.10444, 0, 0.59111], + "714": [0, 0.69444, 0.08528, 0, 0.59111], + "715": [0, 0.69444, 0, 0, 0.59111], + "728": [0, 0.69444, 0.10333, 0, 0.59111], + "729": [0, 0.69444, 0.12945, 0, 0.35555], + "730": [0, 0.69444, 0, 0, 0.94888], + "732": [0, 0.69444, 0.11472, 0, 0.59111], + "733": [0, 0.69444, 0.11472, 0, 0.59111], + "915": [0, 0.68611, 0.12903, 0, 0.69777], + "916": [0, 0.68611, 0, 0, 0.94444], + "920": [0, 0.68611, 0.09062, 0, 0.88555], + "923": [0, 0.68611, 0, 0, 0.80666], + "926": [0, 0.68611, 0.15092, 0, 0.76777], + "928": [0, 0.68611, 0.17208, 0, 0.8961], + "931": [0, 0.68611, 0.11431, 0, 0.82666], + "933": [0, 0.68611, 0.10778, 0, 0.88555], + "934": [0, 0.68611, 0.05632, 0, 0.82666], + "936": [0, 0.68611, 0.10778, 0, 0.88555], + "937": [0, 0.68611, 0.0992, 0, 0.82666], + "8211": [0, 0.44444, 0.09811, 0, 0.59111], + "8212": [0, 0.44444, 0.09811, 0, 1.18221], + "8216": [0, 0.69444, 0.12945, 0, 0.35555], + "8217": [0, 0.69444, 0.12945, 0, 0.35555], + "8220": [0, 0.69444, 0.16772, 0, 0.62055], + "8221": [0, 0.69444, 0.07939, 0, 0.62055] + }, + "Main-Italic": { + "33": [0, 0.69444, 0.12417, 0, 0.30667], + "34": [0, 0.69444, 0.06961, 0, 0.51444], + "35": [0.19444, 0.69444, 0.06616, 0, 0.81777], + "37": [0.05556, 0.75, 0.13639, 0, 0.81777], + "38": [0, 0.69444, 0.09694, 0, 0.76666], + "39": [0, 0.69444, 0.12417, 0, 0.30667], + "40": [0.25, 0.75, 0.16194, 0, 0.40889], + "41": [0.25, 0.75, 0.03694, 0, 0.40889], + "42": [0, 0.75, 0.14917, 0, 0.51111], + "43": [0.05667, 0.56167, 0.03694, 0, 0.76666], + "44": [0.19444, 0.10556, 0, 0, 0.30667], + "45": [0, 0.43056, 0.02826, 0, 0.35778], + "46": [0, 0.10556, 0, 0, 0.30667], + "47": [0.25, 0.75, 0.16194, 0, 0.51111], + "48": [0, 0.64444, 0.13556, 0, 0.51111], + "49": [0, 0.64444, 0.13556, 0, 0.51111], + "50": [0, 0.64444, 0.13556, 0, 0.51111], + "51": [0, 0.64444, 0.13556, 0, 0.51111], + "52": [0.19444, 0.64444, 0.13556, 0, 0.51111], + "53": [0, 0.64444, 0.13556, 0, 0.51111], + "54": [0, 0.64444, 0.13556, 0, 0.51111], + "55": [0.19444, 0.64444, 0.13556, 0, 0.51111], + "56": [0, 0.64444, 0.13556, 0, 0.51111], + "57": [0, 0.64444, 0.13556, 0, 0.51111], + "58": [0, 0.43056, 0.0582, 0, 0.30667], + "59": [0.19444, 0.43056, 0.0582, 0, 0.30667], + "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666], + "63": [0, 0.69444, 0.1225, 0, 0.51111], + "64": [0, 0.69444, 0.09597, 0, 0.76666], + "65": [0, 0.68333, 0, 0, 0.74333], + "66": [0, 0.68333, 0.10257, 0, 0.70389], + "67": [0, 0.68333, 0.14528, 0, 0.71555], + "68": [0, 0.68333, 0.09403, 0, 0.755], + "69": [0, 0.68333, 0.12028, 0, 0.67833], + "70": [0, 0.68333, 0.13305, 0, 0.65277], + "71": [0, 0.68333, 0.08722, 0, 0.77361], + "72": [0, 0.68333, 0.16389, 0, 0.74333], + "73": [0, 0.68333, 0.15806, 0, 0.38555], + "74": [0, 0.68333, 0.14028, 0, 0.525], + "75": [0, 0.68333, 0.14528, 0, 0.76888], + "76": [0, 0.68333, 0, 0, 0.62722], + "77": [0, 0.68333, 0.16389, 0, 0.89666], + "78": [0, 0.68333, 0.16389, 0, 0.74333], + "79": [0, 0.68333, 0.09403, 0, 0.76666], + "80": [0, 0.68333, 0.10257, 0, 0.67833], + "81": [0.19444, 0.68333, 0.09403, 0, 0.76666], + "82": [0, 0.68333, 0.03868, 0, 0.72944], + "83": [0, 0.68333, 0.11972, 0, 0.56222], + "84": [0, 0.68333, 0.13305, 0, 0.71555], + "85": [0, 0.68333, 0.16389, 0, 0.74333], + "86": [0, 0.68333, 0.18361, 0, 0.74333], + "87": [0, 0.68333, 0.18361, 0, 0.99888], + "88": [0, 0.68333, 0.15806, 0, 0.74333], + "89": [0, 0.68333, 0.19383, 0, 0.74333], + "90": [0, 0.68333, 0.14528, 0, 0.61333], + "91": [0.25, 0.75, 0.1875, 0, 0.30667], + "93": [0.25, 0.75, 0.10528, 0, 0.30667], + "94": [0, 0.69444, 0.06646, 0, 0.51111], + "95": [0.31, 0.12056, 0.09208, 0, 0.51111], + "97": [0, 0.43056, 0.07671, 0, 0.51111], + "98": [0, 0.69444, 0.06312, 0, 0.46], + "99": [0, 0.43056, 0.05653, 0, 0.46], + "100": [0, 0.69444, 0.10333, 0, 0.51111], + "101": [0, 0.43056, 0.07514, 0, 0.46], + "102": [0.19444, 0.69444, 0.21194, 0, 0.30667], + "103": [0.19444, 0.43056, 0.08847, 0, 0.46], + "104": [0, 0.69444, 0.07671, 0, 0.51111], + "105": [0, 0.65536, 0.1019, 0, 0.30667], + "106": [0.19444, 0.65536, 0.14467, 0, 0.30667], + "107": [0, 0.69444, 0.10764, 0, 0.46], + "108": [0, 0.69444, 0.10333, 0, 0.25555], + "109": [0, 0.43056, 0.07671, 0, 0.81777], + "110": [0, 0.43056, 0.07671, 0, 0.56222], + "111": [0, 0.43056, 0.06312, 0, 0.51111], + "112": [0.19444, 0.43056, 0.06312, 0, 0.51111], + "113": [0.19444, 0.43056, 0.08847, 0, 0.46], + "114": [0, 0.43056, 0.10764, 0, 0.42166], + "115": [0, 0.43056, 0.08208, 0, 0.40889], + "116": [0, 0.61508, 0.09486, 0, 0.33222], + "117": [0, 0.43056, 0.07671, 0, 0.53666], + "118": [0, 0.43056, 0.10764, 0, 0.46], + "119": [0, 0.43056, 0.10764, 0, 0.66444], + "120": [0, 0.43056, 0.12042, 0, 0.46389], + "121": [0.19444, 0.43056, 0.08847, 0, 0.48555], + "122": [0, 0.43056, 0.12292, 0, 0.40889], + "126": [0.35, 0.31786, 0.11585, 0, 0.51111], + "163": [0, 0.69444, 0, 0, 0.76909], + "168": [0, 0.66786, 0.10474, 0, 0.51111], + "176": [0, 0.69444, 0, 0, 0.83129], + "184": [0.17014, 0, 0, 0, 0.46], + "198": [0, 0.68333, 0.12028, 0, 0.88277], + "216": [0.04861, 0.73194, 0.09403, 0, 0.76666], + "223": [0.19444, 0.69444, 0.10514, 0, 0.53666], + "230": [0, 0.43056, 0.07514, 0, 0.71555], + "248": [0.09722, 0.52778, 0.09194, 0, 0.51111], + "305": [0, 0.43056, 0, 0.02778, 0.32246], + "338": [0, 0.68333, 0.12028, 0, 0.98499], + "339": [0, 0.43056, 0.07514, 0, 0.71555], + "567": [0.19444, 0.43056, 0, 0.08334, 0.38403], + "710": [0, 0.69444, 0.06646, 0, 0.51111], + "711": [0, 0.62847, 0.08295, 0, 0.51111], + "713": [0, 0.56167, 0.10333, 0, 0.51111], + "714": [0, 0.69444, 0.09694, 0, 0.51111], + "715": [0, 0.69444, 0, 0, 0.51111], + "728": [0, 0.69444, 0.10806, 0, 0.51111], + "729": [0, 0.66786, 0.11752, 0, 0.30667], + "730": [0, 0.69444, 0, 0, 0.83129], + "732": [0, 0.66786, 0.11585, 0, 0.51111], + "733": [0, 0.69444, 0.1225, 0, 0.51111], + "915": [0, 0.68333, 0.13305, 0, 0.62722], + "916": [0, 0.68333, 0, 0, 0.81777], + "920": [0, 0.68333, 0.09403, 0, 0.76666], + "923": [0, 0.68333, 0, 0, 0.69222], + "926": [0, 0.68333, 0.15294, 0, 0.66444], + "928": [0, 0.68333, 0.16389, 0, 0.74333], + "931": [0, 0.68333, 0.12028, 0, 0.71555], + "933": [0, 0.68333, 0.11111, 0, 0.76666], + "934": [0, 0.68333, 0.05986, 0, 0.71555], + "936": [0, 0.68333, 0.11111, 0, 0.76666], + "937": [0, 0.68333, 0.10257, 0, 0.71555], + "8211": [0, 0.43056, 0.09208, 0, 0.51111], + "8212": [0, 0.43056, 0.09208, 0, 1.02222], + "8216": [0, 0.69444, 0.12417, 0, 0.30667], + "8217": [0, 0.69444, 0.12417, 0, 0.30667], + "8220": [0, 0.69444, 0.1685, 0, 0.51444], + "8221": [0, 0.69444, 0.06961, 0, 0.51444], + "8463": [0, 0.68889, 0, 0, 0.54028] + }, + "Main-Regular": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0, 0, 0.27778], + "34": [0, 0.69444, 0, 0, 0.5], + "35": [0.19444, 0.69444, 0, 0, 0.83334], + "36": [0.05556, 0.75, 0, 0, 0.5], + "37": [0.05556, 0.75, 0, 0, 0.83334], + "38": [0, 0.69444, 0, 0, 0.77778], + "39": [0, 0.69444, 0, 0, 0.27778], + "40": [0.25, 0.75, 0, 0, 0.38889], + "41": [0.25, 0.75, 0, 0, 0.38889], + "42": [0, 0.75, 0, 0, 0.5], + "43": [0.08333, 0.58333, 0, 0, 0.77778], + "44": [0.19444, 0.10556, 0, 0, 0.27778], + "45": [0, 0.43056, 0, 0, 0.33333], + "46": [0, 0.10556, 0, 0, 0.27778], + "47": [0.25, 0.75, 0, 0, 0.5], + "48": [0, 0.64444, 0, 0, 0.5], + "49": [0, 0.64444, 0, 0, 0.5], + "50": [0, 0.64444, 0, 0, 0.5], + "51": [0, 0.64444, 0, 0, 0.5], + "52": [0, 0.64444, 0, 0, 0.5], + "53": [0, 0.64444, 0, 0, 0.5], + "54": [0, 0.64444, 0, 0, 0.5], + "55": [0, 0.64444, 0, 0, 0.5], + "56": [0, 0.64444, 0, 0, 0.5], + "57": [0, 0.64444, 0, 0, 0.5], + "58": [0, 0.43056, 0, 0, 0.27778], + "59": [0.19444, 0.43056, 0, 0, 0.27778], + "60": [0.0391, 0.5391, 0, 0, 0.77778], + "61": [-0.13313, 0.36687, 0, 0, 0.77778], + "62": [0.0391, 0.5391, 0, 0, 0.77778], + "63": [0, 0.69444, 0, 0, 0.47222], + "64": [0, 0.69444, 0, 0, 0.77778], + "65": [0, 0.68333, 0, 0, 0.75], + "66": [0, 0.68333, 0, 0, 0.70834], + "67": [0, 0.68333, 0, 0, 0.72222], + "68": [0, 0.68333, 0, 0, 0.76389], + "69": [0, 0.68333, 0, 0, 0.68056], + "70": [0, 0.68333, 0, 0, 0.65278], + "71": [0, 0.68333, 0, 0, 0.78472], + "72": [0, 0.68333, 0, 0, 0.75], + "73": [0, 0.68333, 0, 0, 0.36111], + "74": [0, 0.68333, 0, 0, 0.51389], + "75": [0, 0.68333, 0, 0, 0.77778], + "76": [0, 0.68333, 0, 0, 0.625], + "77": [0, 0.68333, 0, 0, 0.91667], + "78": [0, 0.68333, 0, 0, 0.75], + "79": [0, 0.68333, 0, 0, 0.77778], + "80": [0, 0.68333, 0, 0, 0.68056], + "81": [0.19444, 0.68333, 0, 0, 0.77778], + "82": [0, 0.68333, 0, 0, 0.73611], + "83": [0, 0.68333, 0, 0, 0.55556], + "84": [0, 0.68333, 0, 0, 0.72222], + "85": [0, 0.68333, 0, 0, 0.75], + "86": [0, 0.68333, 0.01389, 0, 0.75], + "87": [0, 0.68333, 0.01389, 0, 1.02778], + "88": [0, 0.68333, 0, 0, 0.75], + "89": [0, 0.68333, 0.025, 0, 0.75], + "90": [0, 0.68333, 0, 0, 0.61111], + "91": [0.25, 0.75, 0, 0, 0.27778], + "92": [0.25, 0.75, 0, 0, 0.5], + "93": [0.25, 0.75, 0, 0, 0.27778], + "94": [0, 0.69444, 0, 0, 0.5], + "95": [0.31, 0.12056, 0.02778, 0, 0.5], + "97": [0, 0.43056, 0, 0, 0.5], + "98": [0, 0.69444, 0, 0, 0.55556], + "99": [0, 0.43056, 0, 0, 0.44445], + "100": [0, 0.69444, 0, 0, 0.55556], + "101": [0, 0.43056, 0, 0, 0.44445], + "102": [0, 0.69444, 0.07778, 0, 0.30556], + "103": [0.19444, 0.43056, 0.01389, 0, 0.5], + "104": [0, 0.69444, 0, 0, 0.55556], + "105": [0, 0.66786, 0, 0, 0.27778], + "106": [0.19444, 0.66786, 0, 0, 0.30556], + "107": [0, 0.69444, 0, 0, 0.52778], + "108": [0, 0.69444, 0, 0, 0.27778], + "109": [0, 0.43056, 0, 0, 0.83334], + "110": [0, 0.43056, 0, 0, 0.55556], + "111": [0, 0.43056, 0, 0, 0.5], + "112": [0.19444, 0.43056, 0, 0, 0.55556], + "113": [0.19444, 0.43056, 0, 0, 0.52778], + "114": [0, 0.43056, 0, 0, 0.39167], + "115": [0, 0.43056, 0, 0, 0.39445], + "116": [0, 0.61508, 0, 0, 0.38889], + "117": [0, 0.43056, 0, 0, 0.55556], + "118": [0, 0.43056, 0.01389, 0, 0.52778], + "119": [0, 0.43056, 0.01389, 0, 0.72222], + "120": [0, 0.43056, 0, 0, 0.52778], + "121": [0.19444, 0.43056, 0.01389, 0, 0.52778], + "122": [0, 0.43056, 0, 0, 0.44445], + "123": [0.25, 0.75, 0, 0, 0.5], + "124": [0.25, 0.75, 0, 0, 0.27778], + "125": [0.25, 0.75, 0, 0, 0.5], + "126": [0.35, 0.31786, 0, 0, 0.5], + "160": [0, 0, 0, 0, 0.25], + "167": [0.19444, 0.69444, 0, 0, 0.44445], + "168": [0, 0.66786, 0, 0, 0.5], + "172": [0, 0.43056, 0, 0, 0.66667], + "176": [0, 0.69444, 0, 0, 0.75], + "177": [0.08333, 0.58333, 0, 0, 0.77778], + "182": [0.19444, 0.69444, 0, 0, 0.61111], + "184": [0.17014, 0, 0, 0, 0.44445], + "198": [0, 0.68333, 0, 0, 0.90278], + "215": [0.08333, 0.58333, 0, 0, 0.77778], + "216": [0.04861, 0.73194, 0, 0, 0.77778], + "223": [0, 0.69444, 0, 0, 0.5], + "230": [0, 0.43056, 0, 0, 0.72222], + "247": [0.08333, 0.58333, 0, 0, 0.77778], + "248": [0.09722, 0.52778, 0, 0, 0.5], + "305": [0, 0.43056, 0, 0, 0.27778], + "338": [0, 0.68333, 0, 0, 1.01389], + "339": [0, 0.43056, 0, 0, 0.77778], + "567": [0.19444, 0.43056, 0, 0, 0.30556], + "710": [0, 0.69444, 0, 0, 0.5], + "711": [0, 0.62847, 0, 0, 0.5], + "713": [0, 0.56778, 0, 0, 0.5], + "714": [0, 0.69444, 0, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0, 0, 0.5], + "729": [0, 0.66786, 0, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.75], + "732": [0, 0.66786, 0, 0, 0.5], + "733": [0, 0.69444, 0, 0, 0.5], + "824": [0.19444, 0.69444, 0, 0, 0], + "915": [0, 0.68333, 0, 0, 0.625], + "916": [0, 0.68333, 0, 0, 0.83334], + "920": [0, 0.68333, 0, 0, 0.77778], + "923": [0, 0.68333, 0, 0, 0.69445], + "926": [0, 0.68333, 0, 0, 0.66667], + "928": [0, 0.68333, 0, 0, 0.75], + "931": [0, 0.68333, 0, 0, 0.72222], + "933": [0, 0.68333, 0, 0, 0.77778], + "934": [0, 0.68333, 0, 0, 0.72222], + "936": [0, 0.68333, 0, 0, 0.77778], + "937": [0, 0.68333, 0, 0, 0.72222], + "8211": [0, 0.43056, 0.02778, 0, 0.5], + "8212": [0, 0.43056, 0.02778, 0, 1.0], + "8216": [0, 0.69444, 0, 0, 0.27778], + "8217": [0, 0.69444, 0, 0, 0.27778], + "8220": [0, 0.69444, 0, 0, 0.5], + "8221": [0, 0.69444, 0, 0, 0.5], + "8224": [0.19444, 0.69444, 0, 0, 0.44445], + "8225": [0.19444, 0.69444, 0, 0, 0.44445], + "8230": [0, 0.12, 0, 0, 1.172], + "8242": [0, 0.55556, 0, 0, 0.275], + "8407": [0, 0.71444, 0.15382, 0, 0.5], + "8463": [0, 0.68889, 0, 0, 0.54028], + "8465": [0, 0.69444, 0, 0, 0.72222], + "8467": [0, 0.69444, 0, 0.11111, 0.41667], + "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646], + "8476": [0, 0.69444, 0, 0, 0.72222], + "8501": [0, 0.69444, 0, 0, 0.61111], + "8592": [-0.13313, 0.36687, 0, 0, 1.0], + "8593": [0.19444, 0.69444, 0, 0, 0.5], + "8594": [-0.13313, 0.36687, 0, 0, 1.0], + "8595": [0.19444, 0.69444, 0, 0, 0.5], + "8596": [-0.13313, 0.36687, 0, 0, 1.0], + "8597": [0.25, 0.75, 0, 0, 0.5], + "8598": [0.19444, 0.69444, 0, 0, 1.0], + "8599": [0.19444, 0.69444, 0, 0, 1.0], + "8600": [0.19444, 0.69444, 0, 0, 1.0], + "8601": [0.19444, 0.69444, 0, 0, 1.0], + "8614": [0.011, 0.511, 0, 0, 1.0], + "8617": [0.011, 0.511, 0, 0, 1.126], + "8618": [0.011, 0.511, 0, 0, 1.126], + "8636": [-0.13313, 0.36687, 0, 0, 1.0], + "8637": [-0.13313, 0.36687, 0, 0, 1.0], + "8640": [-0.13313, 0.36687, 0, 0, 1.0], + "8641": [-0.13313, 0.36687, 0, 0, 1.0], + "8652": [0.011, 0.671, 0, 0, 1.0], + "8656": [-0.13313, 0.36687, 0, 0, 1.0], + "8657": [0.19444, 0.69444, 0, 0, 0.61111], + "8658": [-0.13313, 0.36687, 0, 0, 1.0], + "8659": [0.19444, 0.69444, 0, 0, 0.61111], + "8660": [-0.13313, 0.36687, 0, 0, 1.0], + "8661": [0.25, 0.75, 0, 0, 0.61111], + "8704": [0, 0.69444, 0, 0, 0.55556], + "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309], + "8707": [0, 0.69444, 0, 0, 0.55556], + "8709": [0.05556, 0.75, 0, 0, 0.5], + "8711": [0, 0.68333, 0, 0, 0.83334], + "8712": [0.0391, 0.5391, 0, 0, 0.66667], + "8715": [0.0391, 0.5391, 0, 0, 0.66667], + "8722": [0.08333, 0.58333, 0, 0, 0.77778], + "8723": [0.08333, 0.58333, 0, 0, 0.77778], + "8725": [0.25, 0.75, 0, 0, 0.5], + "8726": [0.25, 0.75, 0, 0, 0.5], + "8727": [-0.03472, 0.46528, 0, 0, 0.5], + "8728": [-0.05555, 0.44445, 0, 0, 0.5], + "8729": [-0.05555, 0.44445, 0, 0, 0.5], + "8730": [0.2, 0.8, 0, 0, 0.83334], + "8733": [0, 0.43056, 0, 0, 0.77778], + "8734": [0, 0.43056, 0, 0, 1.0], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8739": [0.25, 0.75, 0, 0, 0.27778], + "8741": [0.25, 0.75, 0, 0, 0.5], + "8743": [0, 0.55556, 0, 0, 0.66667], + "8744": [0, 0.55556, 0, 0, 0.66667], + "8745": [0, 0.55556, 0, 0, 0.66667], + "8746": [0, 0.55556, 0, 0, 0.66667], + "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667], + "8764": [-0.13313, 0.36687, 0, 0, 0.77778], + "8768": [0.19444, 0.69444, 0, 0, 0.27778], + "8771": [-0.03625, 0.46375, 0, 0, 0.77778], + "8773": [-0.022, 0.589, 0, 0, 1.0], + "8776": [-0.01688, 0.48312, 0, 0, 0.77778], + "8781": [-0.03625, 0.46375, 0, 0, 0.77778], + "8784": [-0.133, 0.67, 0, 0, 0.778], + "8800": [0.215, 0.716, 0, 0, 0.778], + "8801": [-0.03625, 0.46375, 0, 0, 0.77778], + "8804": [0.13597, 0.63597, 0, 0, 0.77778], + "8805": [0.13597, 0.63597, 0, 0, 0.77778], + "8810": [0.0391, 0.5391, 0, 0, 1.0], + "8811": [0.0391, 0.5391, 0, 0, 1.0], + "8826": [0.0391, 0.5391, 0, 0, 0.77778], + "8827": [0.0391, 0.5391, 0, 0, 0.77778], + "8834": [0.0391, 0.5391, 0, 0, 0.77778], + "8835": [0.0391, 0.5391, 0, 0, 0.77778], + "8838": [0.13597, 0.63597, 0, 0, 0.77778], + "8839": [0.13597, 0.63597, 0, 0, 0.77778], + "8846": [0, 0.55556, 0, 0, 0.66667], + "8849": [0.13597, 0.63597, 0, 0, 0.77778], + "8850": [0.13597, 0.63597, 0, 0, 0.77778], + "8851": [0, 0.55556, 0, 0, 0.66667], + "8852": [0, 0.55556, 0, 0, 0.66667], + "8853": [0.08333, 0.58333, 0, 0, 0.77778], + "8854": [0.08333, 0.58333, 0, 0, 0.77778], + "8855": [0.08333, 0.58333, 0, 0, 0.77778], + "8856": [0.08333, 0.58333, 0, 0, 0.77778], + "8857": [0.08333, 0.58333, 0, 0, 0.77778], + "8866": [0, 0.69444, 0, 0, 0.61111], + "8867": [0, 0.69444, 0, 0, 0.61111], + "8868": [0, 0.69444, 0, 0, 0.77778], + "8869": [0, 0.69444, 0, 0, 0.77778], + "8872": [0.249, 0.75, 0, 0, 0.867], + "8900": [-0.05555, 0.44445, 0, 0, 0.5], + "8901": [-0.05555, 0.44445, 0, 0, 0.27778], + "8902": [-0.03472, 0.46528, 0, 0, 0.5], + "8904": [0.005, 0.505, 0, 0, 0.9], + "8942": [0.03, 0.9, 0, 0, 0.278], + "8943": [-0.19, 0.31, 0, 0, 1.172], + "8945": [-0.1, 0.82, 0, 0, 1.282], + "8968": [0.25, 0.75, 0, 0, 0.44445], + "8969": [0.25, 0.75, 0, 0, 0.44445], + "8970": [0.25, 0.75, 0, 0, 0.44445], + "8971": [0.25, 0.75, 0, 0, 0.44445], + "8994": [-0.14236, 0.35764, 0, 0, 1.0], + "8995": [-0.14236, 0.35764, 0, 0, 1.0], + "9136": [0.244, 0.744, 0, 0, 0.412], + "9137": [0.244, 0.744, 0, 0, 0.412], + "9651": [0.19444, 0.69444, 0, 0, 0.88889], + "9657": [-0.03472, 0.46528, 0, 0, 0.5], + "9661": [0.19444, 0.69444, 0, 0, 0.88889], + "9667": [-0.03472, 0.46528, 0, 0, 0.5], + "9711": [0.19444, 0.69444, 0, 0, 1.0], + "9824": [0.12963, 0.69444, 0, 0, 0.77778], + "9825": [0.12963, 0.69444, 0, 0, 0.77778], + "9826": [0.12963, 0.69444, 0, 0, 0.77778], + "9827": [0.12963, 0.69444, 0, 0, 0.77778], + "9837": [0, 0.75, 0, 0, 0.38889], + "9838": [0.19444, 0.69444, 0, 0, 0.38889], + "9839": [0.19444, 0.69444, 0, 0, 0.38889], + "10216": [0.25, 0.75, 0, 0, 0.38889], + "10217": [0.25, 0.75, 0, 0, 0.38889], + "10222": [0.244, 0.744, 0, 0, 0.412], + "10223": [0.244, 0.744, 0, 0, 0.412], + "10229": [0.011, 0.511, 0, 0, 1.609], + "10230": [0.011, 0.511, 0, 0, 1.638], + "10231": [0.011, 0.511, 0, 0, 1.859], + "10232": [0.024, 0.525, 0, 0, 1.609], + "10233": [0.024, 0.525, 0, 0, 1.638], + "10234": [0.024, 0.525, 0, 0, 1.858], + "10236": [0.011, 0.511, 0, 0, 1.638], + "10815": [0, 0.68333, 0, 0, 0.75], + "10927": [0.13597, 0.63597, 0, 0, 0.77778], + "10928": [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Math-BoldItalic": { + "47": [0.19444, 0.69444, 0, 0, 0], + "65": [0, 0.68611, 0, 0, 0.86944], + "66": [0, 0.68611, 0.04835, 0, 0.8664], + "67": [0, 0.68611, 0.06979, 0, 0.81694], + "68": [0, 0.68611, 0.03194, 0, 0.93812], + "69": [0, 0.68611, 0.05451, 0, 0.81007], + "70": [0, 0.68611, 0.15972, 0, 0.68889], + "71": [0, 0.68611, 0, 0, 0.88673], + "72": [0, 0.68611, 0.08229, 0, 0.98229], + "73": [0, 0.68611, 0.07778, 0, 0.51111], + "74": [0, 0.68611, 0.10069, 0, 0.63125], + "75": [0, 0.68611, 0.06979, 0, 0.97118], + "76": [0, 0.68611, 0, 0, 0.75555], + "77": [0, 0.68611, 0.11424, 0, 1.14201], + "78": [0, 0.68611, 0.11424, 0, 0.95034], + "79": [0, 0.68611, 0.03194, 0, 0.83666], + "80": [0, 0.68611, 0.15972, 0, 0.72309], + "81": [0.19444, 0.68611, 0, 0, 0.86861], + "82": [0, 0.68611, 0.00421, 0, 0.87235], + "83": [0, 0.68611, 0.05382, 0, 0.69271], + "84": [0, 0.68611, 0.15972, 0, 0.63663], + "85": [0, 0.68611, 0.11424, 0, 0.80027], + "86": [0, 0.68611, 0.25555, 0, 0.67778], + "87": [0, 0.68611, 0.15972, 0, 1.09305], + "88": [0, 0.68611, 0.07778, 0, 0.94722], + "89": [0, 0.68611, 0.25555, 0, 0.67458], + "90": [0, 0.68611, 0.06979, 0, 0.77257], + "97": [0, 0.44444, 0, 0, 0.63287], + "98": [0, 0.69444, 0, 0, 0.52083], + "99": [0, 0.44444, 0, 0, 0.51342], + "100": [0, 0.69444, 0, 0, 0.60972], + "101": [0, 0.44444, 0, 0, 0.55361], + "102": [0.19444, 0.69444, 0.11042, 0, 0.56806], + "103": [0.19444, 0.44444, 0.03704, 0, 0.5449], + "104": [0, 0.69444, 0, 0, 0.66759], + "105": [0, 0.69326, 0, 0, 0.4048], + "106": [0.19444, 0.69326, 0.0622, 0, 0.47083], + "107": [0, 0.69444, 0.01852, 0, 0.6037], + "108": [0, 0.69444, 0.0088, 0, 0.34815], + "109": [0, 0.44444, 0, 0, 1.0324], + "110": [0, 0.44444, 0, 0, 0.71296], + "111": [0, 0.44444, 0, 0, 0.58472], + "112": [0.19444, 0.44444, 0, 0, 0.60092], + "113": [0.19444, 0.44444, 0.03704, 0, 0.54213], + "114": [0, 0.44444, 0.03194, 0, 0.5287], + "115": [0, 0.44444, 0, 0, 0.53125], + "116": [0, 0.63492, 0, 0, 0.41528], + "117": [0, 0.44444, 0, 0, 0.68102], + "118": [0, 0.44444, 0.03704, 0, 0.56666], + "119": [0, 0.44444, 0.02778, 0, 0.83148], + "120": [0, 0.44444, 0, 0, 0.65903], + "121": [0.19444, 0.44444, 0.03704, 0, 0.59028], + "122": [0, 0.44444, 0.04213, 0, 0.55509], + "915": [0, 0.68611, 0.15972, 0, 0.65694], + "916": [0, 0.68611, 0, 0, 0.95833], + "920": [0, 0.68611, 0.03194, 0, 0.86722], + "923": [0, 0.68611, 0, 0, 0.80555], + "926": [0, 0.68611, 0.07458, 0, 0.84125], + "928": [0, 0.68611, 0.08229, 0, 0.98229], + "931": [0, 0.68611, 0.05451, 0, 0.88507], + "933": [0, 0.68611, 0.15972, 0, 0.67083], + "934": [0, 0.68611, 0, 0, 0.76666], + "936": [0, 0.68611, 0.11653, 0, 0.71402], + "937": [0, 0.68611, 0.04835, 0, 0.8789], + "945": [0, 0.44444, 0, 0, 0.76064], + "946": [0.19444, 0.69444, 0.03403, 0, 0.65972], + "947": [0.19444, 0.44444, 0.06389, 0, 0.59003], + "948": [0, 0.69444, 0.03819, 0, 0.52222], + "949": [0, 0.44444, 0, 0, 0.52882], + "950": [0.19444, 0.69444, 0.06215, 0, 0.50833], + "951": [0.19444, 0.44444, 0.03704, 0, 0.6], + "952": [0, 0.69444, 0.03194, 0, 0.5618], + "953": [0, 0.44444, 0, 0, 0.41204], + "954": [0, 0.44444, 0, 0, 0.66759], + "955": [0, 0.69444, 0, 0, 0.67083], + "956": [0.19444, 0.44444, 0, 0, 0.70787], + "957": [0, 0.44444, 0.06898, 0, 0.57685], + "958": [0.19444, 0.69444, 0.03021, 0, 0.50833], + "959": [0, 0.44444, 0, 0, 0.58472], + "960": [0, 0.44444, 0.03704, 0, 0.68241], + "961": [0.19444, 0.44444, 0, 0, 0.6118], + "962": [0.09722, 0.44444, 0.07917, 0, 0.42361], + "963": [0, 0.44444, 0.03704, 0, 0.68588], + "964": [0, 0.44444, 0.13472, 0, 0.52083], + "965": [0, 0.44444, 0.03704, 0, 0.63055], + "966": [0.19444, 0.44444, 0, 0, 0.74722], + "967": [0.19444, 0.44444, 0, 0, 0.71805], + "968": [0.19444, 0.69444, 0.03704, 0, 0.75833], + "969": [0, 0.44444, 0.03704, 0, 0.71782], + "977": [0, 0.69444, 0, 0, 0.69155], + "981": [0.19444, 0.69444, 0, 0, 0.7125], + "982": [0, 0.44444, 0.03194, 0, 0.975], + "1009": [0.19444, 0.44444, 0, 0, 0.6118], + "1013": [0, 0.44444, 0, 0, 0.48333] + }, + "Math-Italic": { + "47": [0.19444, 0.69444, 0, 0, 0], + "65": [0, 0.68333, 0, 0.13889, 0.75], + "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], + "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], + "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], + "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], + "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], + "71": [0, 0.68333, 0, 0.08334, 0.78625], + "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], + "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], + "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], + "76": [0, 0.68333, 0, 0.02778, 0.68056], + "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], + "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], + "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], + "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], + "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], + "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], + "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], + "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], + "86": [0, 0.68333, 0.22222, 0, 0.58333], + "87": [0, 0.68333, 0.13889, 0, 0.94445], + "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], + "89": [0, 0.68333, 0.22222, 0, 0.58056], + "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], + "97": [0, 0.43056, 0, 0, 0.52859], + "98": [0, 0.69444, 0, 0, 0.42917], + "99": [0, 0.43056, 0, 0.05556, 0.43276], + "100": [0, 0.69444, 0, 0.16667, 0.52049], + "101": [0, 0.43056, 0, 0.05556, 0.46563], + "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + "104": [0, 0.69444, 0, 0, 0.57616], + "105": [0, 0.65952, 0, 0, 0.34451], + "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], + "107": [0, 0.69444, 0.03148, 0, 0.5206], + "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], + "109": [0, 0.43056, 0, 0, 0.87801], + "110": [0, 0.43056, 0, 0, 0.60023], + "111": [0, 0.43056, 0, 0.05556, 0.48472], + "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], + "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], + "115": [0, 0.43056, 0, 0.05556, 0.46875], + "116": [0, 0.61508, 0, 0.08334, 0.36111], + "117": [0, 0.43056, 0, 0.02778, 0.57246], + "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], + "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], + "120": [0, 0.43056, 0, 0.02778, 0.57153], + "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], + "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], + "916": [0, 0.68333, 0, 0.16667, 0.83334], + "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "923": [0, 0.68333, 0, 0.16667, 0.69445], + "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], + "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], + "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], + "934": [0, 0.68333, 0, 0.08334, 0.66667], + "936": [0, 0.68333, 0.11, 0.05556, 0.61222], + "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], + "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], + "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], + "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], + "949": [0, 0.43056, 0, 0.08334, 0.46632], + "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], + "953": [0, 0.43056, 0, 0.05556, 0.35394], + "954": [0, 0.43056, 0, 0, 0.57616], + "955": [0, 0.69444, 0, 0, 0.58334], + "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], + "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], + "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + "959": [0, 0.43056, 0, 0.05556, 0.48472], + "960": [0, 0.43056, 0.03588, 0, 0.57003], + "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + "963": [0, 0.43056, 0.03588, 0, 0.57141], + "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], + "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], + "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], + "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], + "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + "969": [0, 0.43056, 0.03588, 0, 0.62245], + "977": [0, 0.69444, 0, 0.08334, 0.59144], + "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], + "982": [0, 0.43056, 0.02778, 0, 0.82813], + "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "1013": [0, 0.43056, 0, 0.05556, 0.4059] + }, + "Math-Regular": { + "65": [0, 0.68333, 0, 0.13889, 0.75], + "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], + "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], + "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], + "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], + "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], + "71": [0, 0.68333, 0, 0.08334, 0.78625], + "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], + "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], + "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], + "76": [0, 0.68333, 0, 0.02778, 0.68056], + "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], + "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], + "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], + "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], + "82": [0, 0.68333, 0.00773, 0.08334, 0.75929], + "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], + "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], + "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], + "86": [0, 0.68333, 0.22222, 0, 0.58333], + "87": [0, 0.68333, 0.13889, 0, 0.94445], + "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], + "89": [0, 0.68333, 0.22222, 0, 0.58056], + "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], + "97": [0, 0.43056, 0, 0, 0.52859], + "98": [0, 0.69444, 0, 0, 0.42917], + "99": [0, 0.43056, 0, 0.05556, 0.43276], + "100": [0, 0.69444, 0, 0.16667, 0.52049], + "101": [0, 0.43056, 0, 0.05556, 0.46563], + "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + "104": [0, 0.69444, 0, 0, 0.57616], + "105": [0, 0.65952, 0, 0, 0.34451], + "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], + "107": [0, 0.69444, 0.03148, 0, 0.5206], + "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], + "109": [0, 0.43056, 0, 0, 0.87801], + "110": [0, 0.43056, 0, 0, 0.60023], + "111": [0, 0.43056, 0, 0.05556, 0.48472], + "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], + "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], + "115": [0, 0.43056, 0, 0.05556, 0.46875], + "116": [0, 0.61508, 0, 0.08334, 0.36111], + "117": [0, 0.43056, 0, 0.02778, 0.57246], + "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], + "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], + "120": [0, 0.43056, 0, 0.02778, 0.57153], + "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], + "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], + "916": [0, 0.68333, 0, 0.16667, 0.83334], + "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "923": [0, 0.68333, 0, 0.16667, 0.69445], + "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], + "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], + "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], + "934": [0, 0.68333, 0, 0.08334, 0.66667], + "936": [0, 0.68333, 0.11, 0.05556, 0.61222], + "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], + "945": [0, 0.43056, 0.0037, 0.02778, 0.6397], + "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], + "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], + "949": [0, 0.43056, 0, 0.08334, 0.46632], + "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], + "953": [0, 0.43056, 0, 0.05556, 0.35394], + "954": [0, 0.43056, 0, 0, 0.57616], + "955": [0, 0.69444, 0, 0, 0.58334], + "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], + "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], + "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + "959": [0, 0.43056, 0, 0.05556, 0.48472], + "960": [0, 0.43056, 0.03588, 0, 0.57003], + "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + "963": [0, 0.43056, 0.03588, 0, 0.57141], + "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], + "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], + "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], + "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], + "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + "969": [0, 0.43056, 0.03588, 0, 0.62245], + "977": [0, 0.69444, 0, 0.08334, 0.59144], + "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], + "982": [0, 0.43056, 0.02778, 0, 0.82813], + "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "1013": [0, 0.43056, 0, 0.05556, 0.4059] + }, + "SansSerif-Bold": { + "33": [0, 0.69444, 0, 0, 0.36667], + "34": [0, 0.69444, 0, 0, 0.55834], + "35": [0.19444, 0.69444, 0, 0, 0.91667], + "36": [0.05556, 0.75, 0, 0, 0.55], + "37": [0.05556, 0.75, 0, 0, 1.02912], + "38": [0, 0.69444, 0, 0, 0.83056], + "39": [0, 0.69444, 0, 0, 0.30556], + "40": [0.25, 0.75, 0, 0, 0.42778], + "41": [0.25, 0.75, 0, 0, 0.42778], + "42": [0, 0.75, 0, 0, 0.55], + "43": [0.11667, 0.61667, 0, 0, 0.85556], + "44": [0.10556, 0.13056, 0, 0, 0.30556], + "45": [0, 0.45833, 0, 0, 0.36667], + "46": [0, 0.13056, 0, 0, 0.30556], + "47": [0.25, 0.75, 0, 0, 0.55], + "48": [0, 0.69444, 0, 0, 0.55], + "49": [0, 0.69444, 0, 0, 0.55], + "50": [0, 0.69444, 0, 0, 0.55], + "51": [0, 0.69444, 0, 0, 0.55], + "52": [0, 0.69444, 0, 0, 0.55], + "53": [0, 0.69444, 0, 0, 0.55], + "54": [0, 0.69444, 0, 0, 0.55], + "55": [0, 0.69444, 0, 0, 0.55], + "56": [0, 0.69444, 0, 0, 0.55], + "57": [0, 0.69444, 0, 0, 0.55], + "58": [0, 0.45833, 0, 0, 0.30556], + "59": [0.10556, 0.45833, 0, 0, 0.30556], + "61": [-0.09375, 0.40625, 0, 0, 0.85556], + "63": [0, 0.69444, 0, 0, 0.51945], + "64": [0, 0.69444, 0, 0, 0.73334], + "65": [0, 0.69444, 0, 0, 0.73334], + "66": [0, 0.69444, 0, 0, 0.73334], + "67": [0, 0.69444, 0, 0, 0.70278], + "68": [0, 0.69444, 0, 0, 0.79445], + "69": [0, 0.69444, 0, 0, 0.64167], + "70": [0, 0.69444, 0, 0, 0.61111], + "71": [0, 0.69444, 0, 0, 0.73334], + "72": [0, 0.69444, 0, 0, 0.79445], + "73": [0, 0.69444, 0, 0, 0.33056], + "74": [0, 0.69444, 0, 0, 0.51945], + "75": [0, 0.69444, 0, 0, 0.76389], + "76": [0, 0.69444, 0, 0, 0.58056], + "77": [0, 0.69444, 0, 0, 0.97778], + "78": [0, 0.69444, 0, 0, 0.79445], + "79": [0, 0.69444, 0, 0, 0.79445], + "80": [0, 0.69444, 0, 0, 0.70278], + "81": [0.10556, 0.69444, 0, 0, 0.79445], + "82": [0, 0.69444, 0, 0, 0.70278], + "83": [0, 0.69444, 0, 0, 0.61111], + "84": [0, 0.69444, 0, 0, 0.73334], + "85": [0, 0.69444, 0, 0, 0.76389], + "86": [0, 0.69444, 0.01528, 0, 0.73334], + "87": [0, 0.69444, 0.01528, 0, 1.03889], + "88": [0, 0.69444, 0, 0, 0.73334], + "89": [0, 0.69444, 0.0275, 0, 0.73334], + "90": [0, 0.69444, 0, 0, 0.67223], + "91": [0.25, 0.75, 0, 0, 0.34306], + "93": [0.25, 0.75, 0, 0, 0.34306], + "94": [0, 0.69444, 0, 0, 0.55], + "95": [0.35, 0.10833, 0.03056, 0, 0.55], + "97": [0, 0.45833, 0, 0, 0.525], + "98": [0, 0.69444, 0, 0, 0.56111], + "99": [0, 0.45833, 0, 0, 0.48889], + "100": [0, 0.69444, 0, 0, 0.56111], + "101": [0, 0.45833, 0, 0, 0.51111], + "102": [0, 0.69444, 0.07639, 0, 0.33611], + "103": [0.19444, 0.45833, 0.01528, 0, 0.55], + "104": [0, 0.69444, 0, 0, 0.56111], + "105": [0, 0.69444, 0, 0, 0.25556], + "106": [0.19444, 0.69444, 0, 0, 0.28611], + "107": [0, 0.69444, 0, 0, 0.53056], + "108": [0, 0.69444, 0, 0, 0.25556], + "109": [0, 0.45833, 0, 0, 0.86667], + "110": [0, 0.45833, 0, 0, 0.56111], + "111": [0, 0.45833, 0, 0, 0.55], + "112": [0.19444, 0.45833, 0, 0, 0.56111], + "113": [0.19444, 0.45833, 0, 0, 0.56111], + "114": [0, 0.45833, 0.01528, 0, 0.37222], + "115": [0, 0.45833, 0, 0, 0.42167], + "116": [0, 0.58929, 0, 0, 0.40417], + "117": [0, 0.45833, 0, 0, 0.56111], + "118": [0, 0.45833, 0.01528, 0, 0.5], + "119": [0, 0.45833, 0.01528, 0, 0.74445], + "120": [0, 0.45833, 0, 0, 0.5], + "121": [0.19444, 0.45833, 0.01528, 0, 0.5], + "122": [0, 0.45833, 0, 0, 0.47639], + "126": [0.35, 0.34444, 0, 0, 0.55], + "168": [0, 0.69444, 0, 0, 0.55], + "176": [0, 0.69444, 0, 0, 0.73334], + "180": [0, 0.69444, 0, 0, 0.55], + "184": [0.17014, 0, 0, 0, 0.48889], + "305": [0, 0.45833, 0, 0, 0.25556], + "567": [0.19444, 0.45833, 0, 0, 0.28611], + "710": [0, 0.69444, 0, 0, 0.55], + "711": [0, 0.63542, 0, 0, 0.55], + "713": [0, 0.63778, 0, 0, 0.55], + "728": [0, 0.69444, 0, 0, 0.55], + "729": [0, 0.69444, 0, 0, 0.30556], + "730": [0, 0.69444, 0, 0, 0.73334], + "732": [0, 0.69444, 0, 0, 0.55], + "733": [0, 0.69444, 0, 0, 0.55], + "915": [0, 0.69444, 0, 0, 0.58056], + "916": [0, 0.69444, 0, 0, 0.91667], + "920": [0, 0.69444, 0, 0, 0.85556], + "923": [0, 0.69444, 0, 0, 0.67223], + "926": [0, 0.69444, 0, 0, 0.73334], + "928": [0, 0.69444, 0, 0, 0.79445], + "931": [0, 0.69444, 0, 0, 0.79445], + "933": [0, 0.69444, 0, 0, 0.85556], + "934": [0, 0.69444, 0, 0, 0.79445], + "936": [0, 0.69444, 0, 0, 0.85556], + "937": [0, 0.69444, 0, 0, 0.79445], + "8211": [0, 0.45833, 0.03056, 0, 0.55], + "8212": [0, 0.45833, 0.03056, 0, 1.10001], + "8216": [0, 0.69444, 0, 0, 0.30556], + "8217": [0, 0.69444, 0, 0, 0.30556], + "8220": [0, 0.69444, 0, 0, 0.55834], + "8221": [0, 0.69444, 0, 0, 0.55834] + }, + "SansSerif-Italic": { + "33": [0, 0.69444, 0.05733, 0, 0.31945], + "34": [0, 0.69444, 0.00316, 0, 0.5], + "35": [0.19444, 0.69444, 0.05087, 0, 0.83334], + "36": [0.05556, 0.75, 0.11156, 0, 0.5], + "37": [0.05556, 0.75, 0.03126, 0, 0.83334], + "38": [0, 0.69444, 0.03058, 0, 0.75834], + "39": [0, 0.69444, 0.07816, 0, 0.27778], + "40": [0.25, 0.75, 0.13164, 0, 0.38889], + "41": [0.25, 0.75, 0.02536, 0, 0.38889], + "42": [0, 0.75, 0.11775, 0, 0.5], + "43": [0.08333, 0.58333, 0.02536, 0, 0.77778], + "44": [0.125, 0.08333, 0, 0, 0.27778], + "45": [0, 0.44444, 0.01946, 0, 0.33333], + "46": [0, 0.08333, 0, 0, 0.27778], + "47": [0.25, 0.75, 0.13164, 0, 0.5], + "48": [0, 0.65556, 0.11156, 0, 0.5], + "49": [0, 0.65556, 0.11156, 0, 0.5], + "50": [0, 0.65556, 0.11156, 0, 0.5], + "51": [0, 0.65556, 0.11156, 0, 0.5], + "52": [0, 0.65556, 0.11156, 0, 0.5], + "53": [0, 0.65556, 0.11156, 0, 0.5], + "54": [0, 0.65556, 0.11156, 0, 0.5], + "55": [0, 0.65556, 0.11156, 0, 0.5], + "56": [0, 0.65556, 0.11156, 0, 0.5], + "57": [0, 0.65556, 0.11156, 0, 0.5], + "58": [0, 0.44444, 0.02502, 0, 0.27778], + "59": [0.125, 0.44444, 0.02502, 0, 0.27778], + "61": [-0.13, 0.37, 0.05087, 0, 0.77778], + "63": [0, 0.69444, 0.11809, 0, 0.47222], + "64": [0, 0.69444, 0.07555, 0, 0.66667], + "65": [0, 0.69444, 0, 0, 0.66667], + "66": [0, 0.69444, 0.08293, 0, 0.66667], + "67": [0, 0.69444, 0.11983, 0, 0.63889], + "68": [0, 0.69444, 0.07555, 0, 0.72223], + "69": [0, 0.69444, 0.11983, 0, 0.59722], + "70": [0, 0.69444, 0.13372, 0, 0.56945], + "71": [0, 0.69444, 0.11983, 0, 0.66667], + "72": [0, 0.69444, 0.08094, 0, 0.70834], + "73": [0, 0.69444, 0.13372, 0, 0.27778], + "74": [0, 0.69444, 0.08094, 0, 0.47222], + "75": [0, 0.69444, 0.11983, 0, 0.69445], + "76": [0, 0.69444, 0, 0, 0.54167], + "77": [0, 0.69444, 0.08094, 0, 0.875], + "78": [0, 0.69444, 0.08094, 0, 0.70834], + "79": [0, 0.69444, 0.07555, 0, 0.73611], + "80": [0, 0.69444, 0.08293, 0, 0.63889], + "81": [0.125, 0.69444, 0.07555, 0, 0.73611], + "82": [0, 0.69444, 0.08293, 0, 0.64584], + "83": [0, 0.69444, 0.09205, 0, 0.55556], + "84": [0, 0.69444, 0.13372, 0, 0.68056], + "85": [0, 0.69444, 0.08094, 0, 0.6875], + "86": [0, 0.69444, 0.1615, 0, 0.66667], + "87": [0, 0.69444, 0.1615, 0, 0.94445], + "88": [0, 0.69444, 0.13372, 0, 0.66667], + "89": [0, 0.69444, 0.17261, 0, 0.66667], + "90": [0, 0.69444, 0.11983, 0, 0.61111], + "91": [0.25, 0.75, 0.15942, 0, 0.28889], + "93": [0.25, 0.75, 0.08719, 0, 0.28889], + "94": [0, 0.69444, 0.0799, 0, 0.5], + "95": [0.35, 0.09444, 0.08616, 0, 0.5], + "97": [0, 0.44444, 0.00981, 0, 0.48056], + "98": [0, 0.69444, 0.03057, 0, 0.51667], + "99": [0, 0.44444, 0.08336, 0, 0.44445], + "100": [0, 0.69444, 0.09483, 0, 0.51667], + "101": [0, 0.44444, 0.06778, 0, 0.44445], + "102": [0, 0.69444, 0.21705, 0, 0.30556], + "103": [0.19444, 0.44444, 0.10836, 0, 0.5], + "104": [0, 0.69444, 0.01778, 0, 0.51667], + "105": [0, 0.67937, 0.09718, 0, 0.23889], + "106": [0.19444, 0.67937, 0.09162, 0, 0.26667], + "107": [0, 0.69444, 0.08336, 0, 0.48889], + "108": [0, 0.69444, 0.09483, 0, 0.23889], + "109": [0, 0.44444, 0.01778, 0, 0.79445], + "110": [0, 0.44444, 0.01778, 0, 0.51667], + "111": [0, 0.44444, 0.06613, 0, 0.5], + "112": [0.19444, 0.44444, 0.0389, 0, 0.51667], + "113": [0.19444, 0.44444, 0.04169, 0, 0.51667], + "114": [0, 0.44444, 0.10836, 0, 0.34167], + "115": [0, 0.44444, 0.0778, 0, 0.38333], + "116": [0, 0.57143, 0.07225, 0, 0.36111], + "117": [0, 0.44444, 0.04169, 0, 0.51667], + "118": [0, 0.44444, 0.10836, 0, 0.46111], + "119": [0, 0.44444, 0.10836, 0, 0.68334], + "120": [0, 0.44444, 0.09169, 0, 0.46111], + "121": [0.19444, 0.44444, 0.10836, 0, 0.46111], + "122": [0, 0.44444, 0.08752, 0, 0.43472], + "126": [0.35, 0.32659, 0.08826, 0, 0.5], + "168": [0, 0.67937, 0.06385, 0, 0.5], + "176": [0, 0.69444, 0, 0, 0.73752], + "184": [0.17014, 0, 0, 0, 0.44445], + "305": [0, 0.44444, 0.04169, 0, 0.23889], + "567": [0.19444, 0.44444, 0.04169, 0, 0.26667], + "710": [0, 0.69444, 0.0799, 0, 0.5], + "711": [0, 0.63194, 0.08432, 0, 0.5], + "713": [0, 0.60889, 0.08776, 0, 0.5], + "714": [0, 0.69444, 0.09205, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0.09483, 0, 0.5], + "729": [0, 0.67937, 0.07774, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.73752], + "732": [0, 0.67659, 0.08826, 0, 0.5], + "733": [0, 0.69444, 0.09205, 0, 0.5], + "915": [0, 0.69444, 0.13372, 0, 0.54167], + "916": [0, 0.69444, 0, 0, 0.83334], + "920": [0, 0.69444, 0.07555, 0, 0.77778], + "923": [0, 0.69444, 0, 0, 0.61111], + "926": [0, 0.69444, 0.12816, 0, 0.66667], + "928": [0, 0.69444, 0.08094, 0, 0.70834], + "931": [0, 0.69444, 0.11983, 0, 0.72222], + "933": [0, 0.69444, 0.09031, 0, 0.77778], + "934": [0, 0.69444, 0.04603, 0, 0.72222], + "936": [0, 0.69444, 0.09031, 0, 0.77778], + "937": [0, 0.69444, 0.08293, 0, 0.72222], + "8211": [0, 0.44444, 0.08616, 0, 0.5], + "8212": [0, 0.44444, 0.08616, 0, 1.0], + "8216": [0, 0.69444, 0.07816, 0, 0.27778], + "8217": [0, 0.69444, 0.07816, 0, 0.27778], + "8220": [0, 0.69444, 0.14205, 0, 0.5], + "8221": [0, 0.69444, 0.00316, 0, 0.5] + }, + "SansSerif-Regular": { + "33": [0, 0.69444, 0, 0, 0.31945], + "34": [0, 0.69444, 0, 0, 0.5], + "35": [0.19444, 0.69444, 0, 0, 0.83334], + "36": [0.05556, 0.75, 0, 0, 0.5], + "37": [0.05556, 0.75, 0, 0, 0.83334], + "38": [0, 0.69444, 0, 0, 0.75834], + "39": [0, 0.69444, 0, 0, 0.27778], + "40": [0.25, 0.75, 0, 0, 0.38889], + "41": [0.25, 0.75, 0, 0, 0.38889], + "42": [0, 0.75, 0, 0, 0.5], + "43": [0.08333, 0.58333, 0, 0, 0.77778], + "44": [0.125, 0.08333, 0, 0, 0.27778], + "45": [0, 0.44444, 0, 0, 0.33333], + "46": [0, 0.08333, 0, 0, 0.27778], + "47": [0.25, 0.75, 0, 0, 0.5], + "48": [0, 0.65556, 0, 0, 0.5], + "49": [0, 0.65556, 0, 0, 0.5], + "50": [0, 0.65556, 0, 0, 0.5], + "51": [0, 0.65556, 0, 0, 0.5], + "52": [0, 0.65556, 0, 0, 0.5], + "53": [0, 0.65556, 0, 0, 0.5], + "54": [0, 0.65556, 0, 0, 0.5], + "55": [0, 0.65556, 0, 0, 0.5], + "56": [0, 0.65556, 0, 0, 0.5], + "57": [0, 0.65556, 0, 0, 0.5], + "58": [0, 0.44444, 0, 0, 0.27778], + "59": [0.125, 0.44444, 0, 0, 0.27778], + "61": [-0.13, 0.37, 0, 0, 0.77778], + "63": [0, 0.69444, 0, 0, 0.47222], + "64": [0, 0.69444, 0, 0, 0.66667], + "65": [0, 0.69444, 0, 0, 0.66667], + "66": [0, 0.69444, 0, 0, 0.66667], + "67": [0, 0.69444, 0, 0, 0.63889], + "68": [0, 0.69444, 0, 0, 0.72223], + "69": [0, 0.69444, 0, 0, 0.59722], + "70": [0, 0.69444, 0, 0, 0.56945], + "71": [0, 0.69444, 0, 0, 0.66667], + "72": [0, 0.69444, 0, 0, 0.70834], + "73": [0, 0.69444, 0, 0, 0.27778], + "74": [0, 0.69444, 0, 0, 0.47222], + "75": [0, 0.69444, 0, 0, 0.69445], + "76": [0, 0.69444, 0, 0, 0.54167], + "77": [0, 0.69444, 0, 0, 0.875], + "78": [0, 0.69444, 0, 0, 0.70834], + "79": [0, 0.69444, 0, 0, 0.73611], + "80": [0, 0.69444, 0, 0, 0.63889], + "81": [0.125, 0.69444, 0, 0, 0.73611], + "82": [0, 0.69444, 0, 0, 0.64584], + "83": [0, 0.69444, 0, 0, 0.55556], + "84": [0, 0.69444, 0, 0, 0.68056], + "85": [0, 0.69444, 0, 0, 0.6875], + "86": [0, 0.69444, 0.01389, 0, 0.66667], + "87": [0, 0.69444, 0.01389, 0, 0.94445], + "88": [0, 0.69444, 0, 0, 0.66667], + "89": [0, 0.69444, 0.025, 0, 0.66667], + "90": [0, 0.69444, 0, 0, 0.61111], + "91": [0.25, 0.75, 0, 0, 0.28889], + "93": [0.25, 0.75, 0, 0, 0.28889], + "94": [0, 0.69444, 0, 0, 0.5], + "95": [0.35, 0.09444, 0.02778, 0, 0.5], + "97": [0, 0.44444, 0, 0, 0.48056], + "98": [0, 0.69444, 0, 0, 0.51667], + "99": [0, 0.44444, 0, 0, 0.44445], + "100": [0, 0.69444, 0, 0, 0.51667], + "101": [0, 0.44444, 0, 0, 0.44445], + "102": [0, 0.69444, 0.06944, 0, 0.30556], + "103": [0.19444, 0.44444, 0.01389, 0, 0.5], + "104": [0, 0.69444, 0, 0, 0.51667], + "105": [0, 0.67937, 0, 0, 0.23889], + "106": [0.19444, 0.67937, 0, 0, 0.26667], + "107": [0, 0.69444, 0, 0, 0.48889], + "108": [0, 0.69444, 0, 0, 0.23889], + "109": [0, 0.44444, 0, 0, 0.79445], + "110": [0, 0.44444, 0, 0, 0.51667], + "111": [0, 0.44444, 0, 0, 0.5], + "112": [0.19444, 0.44444, 0, 0, 0.51667], + "113": [0.19444, 0.44444, 0, 0, 0.51667], + "114": [0, 0.44444, 0.01389, 0, 0.34167], + "115": [0, 0.44444, 0, 0, 0.38333], + "116": [0, 0.57143, 0, 0, 0.36111], + "117": [0, 0.44444, 0, 0, 0.51667], + "118": [0, 0.44444, 0.01389, 0, 0.46111], + "119": [0, 0.44444, 0.01389, 0, 0.68334], + "120": [0, 0.44444, 0, 0, 0.46111], + "121": [0.19444, 0.44444, 0.01389, 0, 0.46111], + "122": [0, 0.44444, 0, 0, 0.43472], + "126": [0.35, 0.32659, 0, 0, 0.5], + "168": [0, 0.67937, 0, 0, 0.5], + "176": [0, 0.69444, 0, 0, 0.66667], + "184": [0.17014, 0, 0, 0, 0.44445], + "305": [0, 0.44444, 0, 0, 0.23889], + "567": [0.19444, 0.44444, 0, 0, 0.26667], + "710": [0, 0.69444, 0, 0, 0.5], + "711": [0, 0.63194, 0, 0, 0.5], + "713": [0, 0.60889, 0, 0, 0.5], + "714": [0, 0.69444, 0, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0, 0, 0.5], + "729": [0, 0.67937, 0, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.66667], + "732": [0, 0.67659, 0, 0, 0.5], + "733": [0, 0.69444, 0, 0, 0.5], + "915": [0, 0.69444, 0, 0, 0.54167], + "916": [0, 0.69444, 0, 0, 0.83334], + "920": [0, 0.69444, 0, 0, 0.77778], + "923": [0, 0.69444, 0, 0, 0.61111], + "926": [0, 0.69444, 0, 0, 0.66667], + "928": [0, 0.69444, 0, 0, 0.70834], + "931": [0, 0.69444, 0, 0, 0.72222], + "933": [0, 0.69444, 0, 0, 0.77778], + "934": [0, 0.69444, 0, 0, 0.72222], + "936": [0, 0.69444, 0, 0, 0.77778], + "937": [0, 0.69444, 0, 0, 0.72222], + "8211": [0, 0.44444, 0.02778, 0, 0.5], + "8212": [0, 0.44444, 0.02778, 0, 1.0], + "8216": [0, 0.69444, 0, 0, 0.27778], + "8217": [0, 0.69444, 0, 0, 0.27778], + "8220": [0, 0.69444, 0, 0, 0.5], + "8221": [0, 0.69444, 0, 0, 0.5] + }, + "Script-Regular": { + "65": [0, 0.7, 0.22925, 0, 0.80253], + "66": [0, 0.7, 0.04087, 0, 0.90757], + "67": [0, 0.7, 0.1689, 0, 0.66619], + "68": [0, 0.7, 0.09371, 0, 0.77443], + "69": [0, 0.7, 0.18583, 0, 0.56162], + "70": [0, 0.7, 0.13634, 0, 0.89544], + "71": [0, 0.7, 0.17322, 0, 0.60961], + "72": [0, 0.7, 0.29694, 0, 0.96919], + "73": [0, 0.7, 0.19189, 0, 0.80907], + "74": [0.27778, 0.7, 0.19189, 0, 1.05159], + "75": [0, 0.7, 0.31259, 0, 0.91364], + "76": [0, 0.7, 0.19189, 0, 0.87373], + "77": [0, 0.7, 0.15981, 0, 1.08031], + "78": [0, 0.7, 0.3525, 0, 0.9015], + "79": [0, 0.7, 0.08078, 0, 0.73787], + "80": [0, 0.7, 0.08078, 0, 1.01262], + "81": [0, 0.7, 0.03305, 0, 0.88282], + "82": [0, 0.7, 0.06259, 0, 0.85], + "83": [0, 0.7, 0.19189, 0, 0.86767], + "84": [0, 0.7, 0.29087, 0, 0.74697], + "85": [0, 0.7, 0.25815, 0, 0.79996], + "86": [0, 0.7, 0.27523, 0, 0.62204], + "87": [0, 0.7, 0.27523, 0, 0.80532], + "88": [0, 0.7, 0.26006, 0, 0.94445], + "89": [0, 0.7, 0.2939, 0, 0.70961], + "90": [0, 0.7, 0.24037, 0, 0.8212] + }, + "Size1-Regular": { + "40": [0.35001, 0.85, 0, 0, 0.45834], + "41": [0.35001, 0.85, 0, 0, 0.45834], + "47": [0.35001, 0.85, 0, 0, 0.57778], + "91": [0.35001, 0.85, 0, 0, 0.41667], + "92": [0.35001, 0.85, 0, 0, 0.57778], + "93": [0.35001, 0.85, 0, 0, 0.41667], + "123": [0.35001, 0.85, 0, 0, 0.58334], + "125": [0.35001, 0.85, 0, 0, 0.58334], + "710": [0, 0.72222, 0, 0, 0.55556], + "732": [0, 0.72222, 0, 0, 0.55556], + "770": [0, 0.72222, 0, 0, 0.55556], + "771": [0, 0.72222, 0, 0, 0.55556], + "8214": [-0.00099, 0.601, 0, 0, 0.77778], + "8593": [1e-05, 0.6, 0, 0, 0.66667], + "8595": [1e-05, 0.6, 0, 0, 0.66667], + "8657": [1e-05, 0.6, 0, 0, 0.77778], + "8659": [1e-05, 0.6, 0, 0, 0.77778], + "8719": [0.25001, 0.75, 0, 0, 0.94445], + "8720": [0.25001, 0.75, 0, 0, 0.94445], + "8721": [0.25001, 0.75, 0, 0, 1.05556], + "8730": [0.35001, 0.85, 0, 0, 1.0], + "8739": [-0.00599, 0.606, 0, 0, 0.33333], + "8741": [-0.00599, 0.606, 0, 0, 0.55556], + "8747": [0.30612, 0.805, 0.19445, 0, 0.47222], + "8748": [0.306, 0.805, 0.19445, 0, 0.47222], + "8749": [0.306, 0.805, 0.19445, 0, 0.47222], + "8750": [0.30612, 0.805, 0.19445, 0, 0.47222], + "8896": [0.25001, 0.75, 0, 0, 0.83334], + "8897": [0.25001, 0.75, 0, 0, 0.83334], + "8898": [0.25001, 0.75, 0, 0, 0.83334], + "8899": [0.25001, 0.75, 0, 0, 0.83334], + "8968": [0.35001, 0.85, 0, 0, 0.47222], + "8969": [0.35001, 0.85, 0, 0, 0.47222], + "8970": [0.35001, 0.85, 0, 0, 0.47222], + "8971": [0.35001, 0.85, 0, 0, 0.47222], + "9168": [-0.00099, 0.601, 0, 0, 0.66667], + "10216": [0.35001, 0.85, 0, 0, 0.47222], + "10217": [0.35001, 0.85, 0, 0, 0.47222], + "10752": [0.25001, 0.75, 0, 0, 1.11111], + "10753": [0.25001, 0.75, 0, 0, 1.11111], + "10754": [0.25001, 0.75, 0, 0, 1.11111], + "10756": [0.25001, 0.75, 0, 0, 0.83334], + "10758": [0.25001, 0.75, 0, 0, 0.83334] + }, + "Size2-Regular": { + "40": [0.65002, 1.15, 0, 0, 0.59722], + "41": [0.65002, 1.15, 0, 0, 0.59722], + "47": [0.65002, 1.15, 0, 0, 0.81111], + "91": [0.65002, 1.15, 0, 0, 0.47222], + "92": [0.65002, 1.15, 0, 0, 0.81111], + "93": [0.65002, 1.15, 0, 0, 0.47222], + "123": [0.65002, 1.15, 0, 0, 0.66667], + "125": [0.65002, 1.15, 0, 0, 0.66667], + "710": [0, 0.75, 0, 0, 1.0], + "732": [0, 0.75, 0, 0, 1.0], + "770": [0, 0.75, 0, 0, 1.0], + "771": [0, 0.75, 0, 0, 1.0], + "8719": [0.55001, 1.05, 0, 0, 1.27778], + "8720": [0.55001, 1.05, 0, 0, 1.27778], + "8721": [0.55001, 1.05, 0, 0, 1.44445], + "8730": [0.65002, 1.15, 0, 0, 1.0], + "8747": [0.86225, 1.36, 0.44445, 0, 0.55556], + "8748": [0.862, 1.36, 0.44445, 0, 0.55556], + "8749": [0.862, 1.36, 0.44445, 0, 0.55556], + "8750": [0.86225, 1.36, 0.44445, 0, 0.55556], + "8896": [0.55001, 1.05, 0, 0, 1.11111], + "8897": [0.55001, 1.05, 0, 0, 1.11111], + "8898": [0.55001, 1.05, 0, 0, 1.11111], + "8899": [0.55001, 1.05, 0, 0, 1.11111], + "8968": [0.65002, 1.15, 0, 0, 0.52778], + "8969": [0.65002, 1.15, 0, 0, 0.52778], + "8970": [0.65002, 1.15, 0, 0, 0.52778], + "8971": [0.65002, 1.15, 0, 0, 0.52778], + "10216": [0.65002, 1.15, 0, 0, 0.61111], + "10217": [0.65002, 1.15, 0, 0, 0.61111], + "10752": [0.55001, 1.05, 0, 0, 1.51112], + "10753": [0.55001, 1.05, 0, 0, 1.51112], + "10754": [0.55001, 1.05, 0, 0, 1.51112], + "10756": [0.55001, 1.05, 0, 0, 1.11111], + "10758": [0.55001, 1.05, 0, 0, 1.11111] + }, + "Size3-Regular": { + "40": [0.95003, 1.45, 0, 0, 0.73611], + "41": [0.95003, 1.45, 0, 0, 0.73611], + "47": [0.95003, 1.45, 0, 0, 1.04445], + "91": [0.95003, 1.45, 0, 0, 0.52778], + "92": [0.95003, 1.45, 0, 0, 1.04445], + "93": [0.95003, 1.45, 0, 0, 0.52778], + "123": [0.95003, 1.45, 0, 0, 0.75], + "125": [0.95003, 1.45, 0, 0, 0.75], + "710": [0, 0.75, 0, 0, 1.44445], + "732": [0, 0.75, 0, 0, 1.44445], + "770": [0, 0.75, 0, 0, 1.44445], + "771": [0, 0.75, 0, 0, 1.44445], + "8730": [0.95003, 1.45, 0, 0, 1.0], + "8968": [0.95003, 1.45, 0, 0, 0.58334], + "8969": [0.95003, 1.45, 0, 0, 0.58334], + "8970": [0.95003, 1.45, 0, 0, 0.58334], + "8971": [0.95003, 1.45, 0, 0, 0.58334], + "10216": [0.95003, 1.45, 0, 0, 0.75], + "10217": [0.95003, 1.45, 0, 0, 0.75] + }, + "Size4-Regular": { + "40": [1.25003, 1.75, 0, 0, 0.79167], + "41": [1.25003, 1.75, 0, 0, 0.79167], + "47": [1.25003, 1.75, 0, 0, 1.27778], + "91": [1.25003, 1.75, 0, 0, 0.58334], + "92": [1.25003, 1.75, 0, 0, 1.27778], + "93": [1.25003, 1.75, 0, 0, 0.58334], + "123": [1.25003, 1.75, 0, 0, 0.80556], + "125": [1.25003, 1.75, 0, 0, 0.80556], + "710": [0, 0.825, 0, 0, 1.8889], + "732": [0, 0.825, 0, 0, 1.8889], + "770": [0, 0.825, 0, 0, 1.8889], + "771": [0, 0.825, 0, 0, 1.8889], + "8730": [1.25003, 1.75, 0, 0, 1.0], + "8968": [1.25003, 1.75, 0, 0, 0.63889], + "8969": [1.25003, 1.75, 0, 0, 0.63889], + "8970": [1.25003, 1.75, 0, 0, 0.63889], + "8971": [1.25003, 1.75, 0, 0, 0.63889], + "9115": [0.64502, 1.155, 0, 0, 0.875], + "9116": [1e-05, 0.6, 0, 0, 0.875], + "9117": [0.64502, 1.155, 0, 0, 0.875], + "9118": [0.64502, 1.155, 0, 0, 0.875], + "9119": [1e-05, 0.6, 0, 0, 0.875], + "9120": [0.64502, 1.155, 0, 0, 0.875], + "9121": [0.64502, 1.155, 0, 0, 0.66667], + "9122": [-0.00099, 0.601, 0, 0, 0.66667], + "9123": [0.64502, 1.155, 0, 0, 0.66667], + "9124": [0.64502, 1.155, 0, 0, 0.66667], + "9125": [-0.00099, 0.601, 0, 0, 0.66667], + "9126": [0.64502, 1.155, 0, 0, 0.66667], + "9127": [1e-05, 0.9, 0, 0, 0.88889], + "9128": [0.65002, 1.15, 0, 0, 0.88889], + "9129": [0.90001, 0, 0, 0, 0.88889], + "9130": [0, 0.3, 0, 0, 0.88889], + "9131": [1e-05, 0.9, 0, 0, 0.88889], + "9132": [0.65002, 1.15, 0, 0, 0.88889], + "9133": [0.90001, 0, 0, 0, 0.88889], + "9143": [0.88502, 0.915, 0, 0, 1.05556], + "10216": [1.25003, 1.75, 0, 0, 0.80556], + "10217": [1.25003, 1.75, 0, 0, 0.80556], + "57344": [-0.00499, 0.605, 0, 0, 1.05556], + "57345": [-0.00499, 0.605, 0, 0, 1.05556], + "57680": [0, 0.12, 0, 0, 0.45], + "57681": [0, 0.12, 0, 0, 0.45], + "57682": [0, 0.12, 0, 0, 0.45], + "57683": [0, 0.12, 0, 0, 0.45] + }, + "Typewriter-Regular": { + "32": [0, 0, 0, 0, 0.525], + "33": [0, 0.61111, 0, 0, 0.525], + "34": [0, 0.61111, 0, 0, 0.525], + "35": [0, 0.61111, 0, 0, 0.525], + "36": [0.08333, 0.69444, 0, 0, 0.525], + "37": [0.08333, 0.69444, 0, 0, 0.525], + "38": [0, 0.61111, 0, 0, 0.525], + "39": [0, 0.61111, 0, 0, 0.525], + "40": [0.08333, 0.69444, 0, 0, 0.525], + "41": [0.08333, 0.69444, 0, 0, 0.525], + "42": [0, 0.52083, 0, 0, 0.525], + "43": [-0.08056, 0.53055, 0, 0, 0.525], + "44": [0.13889, 0.125, 0, 0, 0.525], + "45": [-0.08056, 0.53055, 0, 0, 0.525], + "46": [0, 0.125, 0, 0, 0.525], + "47": [0.08333, 0.69444, 0, 0, 0.525], + "48": [0, 0.61111, 0, 0, 0.525], + "49": [0, 0.61111, 0, 0, 0.525], + "50": [0, 0.61111, 0, 0, 0.525], + "51": [0, 0.61111, 0, 0, 0.525], + "52": [0, 0.61111, 0, 0, 0.525], + "53": [0, 0.61111, 0, 0, 0.525], + "54": [0, 0.61111, 0, 0, 0.525], + "55": [0, 0.61111, 0, 0, 0.525], + "56": [0, 0.61111, 0, 0, 0.525], + "57": [0, 0.61111, 0, 0, 0.525], + "58": [0, 0.43056, 0, 0, 0.525], + "59": [0.13889, 0.43056, 0, 0, 0.525], + "60": [-0.05556, 0.55556, 0, 0, 0.525], + "61": [-0.19549, 0.41562, 0, 0, 0.525], + "62": [-0.05556, 0.55556, 0, 0, 0.525], + "63": [0, 0.61111, 0, 0, 0.525], + "64": [0, 0.61111, 0, 0, 0.525], + "65": [0, 0.61111, 0, 0, 0.525], + "66": [0, 0.61111, 0, 0, 0.525], + "67": [0, 0.61111, 0, 0, 0.525], + "68": [0, 0.61111, 0, 0, 0.525], + "69": [0, 0.61111, 0, 0, 0.525], + "70": [0, 0.61111, 0, 0, 0.525], + "71": [0, 0.61111, 0, 0, 0.525], + "72": [0, 0.61111, 0, 0, 0.525], + "73": [0, 0.61111, 0, 0, 0.525], + "74": [0, 0.61111, 0, 0, 0.525], + "75": [0, 0.61111, 0, 0, 0.525], + "76": [0, 0.61111, 0, 0, 0.525], + "77": [0, 0.61111, 0, 0, 0.525], + "78": [0, 0.61111, 0, 0, 0.525], + "79": [0, 0.61111, 0, 0, 0.525], + "80": [0, 0.61111, 0, 0, 0.525], + "81": [0.13889, 0.61111, 0, 0, 0.525], + "82": [0, 0.61111, 0, 0, 0.525], + "83": [0, 0.61111, 0, 0, 0.525], + "84": [0, 0.61111, 0, 0, 0.525], + "85": [0, 0.61111, 0, 0, 0.525], + "86": [0, 0.61111, 0, 0, 0.525], + "87": [0, 0.61111, 0, 0, 0.525], + "88": [0, 0.61111, 0, 0, 0.525], + "89": [0, 0.61111, 0, 0, 0.525], + "90": [0, 0.61111, 0, 0, 0.525], + "91": [0.08333, 0.69444, 0, 0, 0.525], + "92": [0.08333, 0.69444, 0, 0, 0.525], + "93": [0.08333, 0.69444, 0, 0, 0.525], + "94": [0, 0.61111, 0, 0, 0.525], + "95": [0.09514, 0, 0, 0, 0.525], + "96": [0, 0.61111, 0, 0, 0.525], + "97": [0, 0.43056, 0, 0, 0.525], + "98": [0, 0.61111, 0, 0, 0.525], + "99": [0, 0.43056, 0, 0, 0.525], + "100": [0, 0.61111, 0, 0, 0.525], + "101": [0, 0.43056, 0, 0, 0.525], + "102": [0, 0.61111, 0, 0, 0.525], + "103": [0.22222, 0.43056, 0, 0, 0.525], + "104": [0, 0.61111, 0, 0, 0.525], + "105": [0, 0.61111, 0, 0, 0.525], + "106": [0.22222, 0.61111, 0, 0, 0.525], + "107": [0, 0.61111, 0, 0, 0.525], + "108": [0, 0.61111, 0, 0, 0.525], + "109": [0, 0.43056, 0, 0, 0.525], + "110": [0, 0.43056, 0, 0, 0.525], + "111": [0, 0.43056, 0, 0, 0.525], + "112": [0.22222, 0.43056, 0, 0, 0.525], + "113": [0.22222, 0.43056, 0, 0, 0.525], + "114": [0, 0.43056, 0, 0, 0.525], + "115": [0, 0.43056, 0, 0, 0.525], + "116": [0, 0.55358, 0, 0, 0.525], + "117": [0, 0.43056, 0, 0, 0.525], + "118": [0, 0.43056, 0, 0, 0.525], + "119": [0, 0.43056, 0, 0, 0.525], + "120": [0, 0.43056, 0, 0, 0.525], + "121": [0.22222, 0.43056, 0, 0, 0.525], + "122": [0, 0.43056, 0, 0, 0.525], + "123": [0.08333, 0.69444, 0, 0, 0.525], + "124": [0.08333, 0.69444, 0, 0, 0.525], + "125": [0.08333, 0.69444, 0, 0, 0.525], + "126": [0, 0.61111, 0, 0, 0.525], + "127": [0, 0.61111, 0, 0, 0.525], + "160": [0, 0, 0, 0, 0.525], + "176": [0, 0.61111, 0, 0, 0.525], + "184": [0.19445, 0, 0, 0, 0.525], + "305": [0, 0.43056, 0, 0, 0.525], + "567": [0.22222, 0.43056, 0, 0, 0.525], + "711": [0, 0.56597, 0, 0, 0.525], + "713": [0, 0.56555, 0, 0, 0.525], + "714": [0, 0.61111, 0, 0, 0.525], + "715": [0, 0.61111, 0, 0, 0.525], + "728": [0, 0.61111, 0, 0, 0.525], + "730": [0, 0.61111, 0, 0, 0.525], + "770": [0, 0.61111, 0, 0, 0.525], + "771": [0, 0.61111, 0, 0, 0.525], + "776": [0, 0.61111, 0, 0, 0.525], + "915": [0, 0.61111, 0, 0, 0.525], + "916": [0, 0.61111, 0, 0, 0.525], + "920": [0, 0.61111, 0, 0, 0.525], + "923": [0, 0.61111, 0, 0, 0.525], + "926": [0, 0.61111, 0, 0, 0.525], + "928": [0, 0.61111, 0, 0, 0.525], + "931": [0, 0.61111, 0, 0, 0.525], + "933": [0, 0.61111, 0, 0, 0.525], + "934": [0, 0.61111, 0, 0, 0.525], + "936": [0, 0.61111, 0, 0, 0.525], + "937": [0, 0.61111, 0, 0, 0.525], + "8216": [0, 0.61111, 0, 0, 0.525], + "8217": [0, 0.61111, 0, 0, 0.525], + "8242": [0, 0.61111, 0, 0, 0.525], + "9251": [0.11111, 0.21944, 0, 0, 0.525] + } +}; + +/** + * This file contains metrics regarding fonts and individual symbols. The sigma + * and xi variables, as well as the metricMap map contain data extracted from + * TeX, TeX font metrics, and the TTF files. These data are then exposed via the + * `metrics` variable and the getCharacterMetrics function. + */ +// In TeX, there are actually three sets of dimensions, one for each of +// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4: +// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are +// provided in the the arrays below, in that order. +// +// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively. +// This was determined by running the following script: +// +// latex -interaction=nonstopmode \ +// '\documentclass{article}\usepackage{amsmath}\begin{document}' \ +// '$a$ \expandafter\show\the\textfont2' \ +// '\expandafter\show\the\scriptfont2' \ +// '\expandafter\show\the\scriptscriptfont2' \ +// '\stop' +// +// The metrics themselves were retreived using the following commands: +// +// tftopl cmsy10 +// tftopl cmsy7 +// tftopl cmsy5 +// +// The output of each of these commands is quite lengthy. The only part we +// care about is the FONTDIMEN section. Each value is measured in EMs. +const sigmasAndXis = { + slant: [0.250, 0.250, 0.250], + // sigma1 + space: [0.000, 0.000, 0.000], + // sigma2 + stretch: [0.000, 0.000, 0.000], + // sigma3 + shrink: [0.000, 0.000, 0.000], + // sigma4 + xHeight: [0.431, 0.431, 0.431], + // sigma5 + quad: [1.000, 1.171, 1.472], + // sigma6 + extraSpace: [0.000, 0.000, 0.000], + // sigma7 + num1: [0.677, 0.732, 0.925], + // sigma8 + num2: [0.394, 0.384, 0.387], + // sigma9 + num3: [0.444, 0.471, 0.504], + // sigma10 + denom1: [0.686, 0.752, 1.025], + // sigma11 + denom2: [0.345, 0.344, 0.532], + // sigma12 + sup1: [0.413, 0.503, 0.504], + // sigma13 + sup2: [0.363, 0.431, 0.404], + // sigma14 + sup3: [0.289, 0.286, 0.294], + // sigma15 + sub1: [0.150, 0.143, 0.200], + // sigma16 + sub2: [0.247, 0.286, 0.400], + // sigma17 + supDrop: [0.386, 0.353, 0.494], + // sigma18 + subDrop: [0.050, 0.071, 0.100], + // sigma19 + delim1: [2.390, 1.700, 1.980], + // sigma20 + delim2: [1.010, 1.157, 1.420], + // sigma21 + axisHeight: [0.250, 0.250, 0.250], + // sigma22 + // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; + // they correspond to the font parameters of the extension fonts (family 3). + // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to + // match cmex7, we'd use cmex7.tfm values for script and scriptscript + // values. + defaultRuleThickness: [0.04, 0.049, 0.049], + // xi8; cmex7: 0.049 + bigOpSpacing1: [0.111, 0.111, 0.111], + // xi9 + bigOpSpacing2: [0.166, 0.166, 0.166], + // xi10 + bigOpSpacing3: [0.2, 0.2, 0.2], + // xi11 + bigOpSpacing4: [0.6, 0.611, 0.611], + // xi12; cmex7: 0.611 + bigOpSpacing5: [0.1, 0.143, 0.143], + // xi13; cmex7: 0.143 + // The \sqrt rule width is taken from the height of the surd character. + // Since we use the same font at all sizes, this thickness doesn't scale. + sqrtRuleThickness: [0.04, 0.04, 0.04], + // This value determines how large a pt is, for metrics which are defined + // in terms of pts. + // This value is also used in katex.less; if you change it make sure the + // values match. + ptPerEm: [10.0, 10.0, 10.0], + // The space between adjacent `|` columns in an array definition. From + // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. + doubleRuleSep: [0.2, 0.2, 0.2] +}; // This map contains a mapping from font name and character code to character +// should have Latin-1 and Cyrillic characters, but may not depending on the +// operating system. The metrics do not account for extra height from the +// accents. In the case of Cyrillic characters which have both ascenders and +// descenders we prefer approximations with ascenders, primarily to prevent +// the fraction bar or root line from intersecting the glyph. +// TODO(kevinb) allow union of multiple glyph metrics for better accuracy. + +const extraCharacterMap = { + // Latin-1 + 'Å': 'A', + 'Ç': 'C', + 'Ð': 'D', + 'Þ': 'o', + 'å': 'a', + 'ç': 'c', + 'ð': 'd', + 'þ': 'o', + // Cyrillic + 'А': 'A', + 'Б': 'B', + 'В': 'B', + 'Г': 'F', + 'Д': 'A', + 'Е': 'E', + 'Ж': 'K', + 'З': '3', + 'И': 'N', + 'Й': 'N', + 'К': 'K', + 'Л': 'N', + 'М': 'M', + 'Н': 'H', + 'О': 'O', + 'П': 'N', + 'Р': 'P', + 'С': 'C', + 'Т': 'T', + 'У': 'y', + 'Ф': 'O', + 'Х': 'X', + 'Ц': 'U', + 'Ч': 'h', + 'Ш': 'W', + 'Щ': 'W', + 'Ъ': 'B', + 'Ы': 'X', + 'Ь': 'B', + 'Э': '3', + 'Ю': 'X', + 'Я': 'R', + 'а': 'a', + 'б': 'b', + 'в': 'a', + 'г': 'r', + 'д': 'y', + 'е': 'e', + 'ж': 'm', + 'з': 'e', + 'и': 'n', + 'й': 'n', + 'к': 'n', + 'л': 'n', + 'м': 'm', + 'н': 'n', + 'о': 'o', + 'п': 'n', + 'р': 'p', + 'с': 'c', + 'т': 'o', + 'у': 'y', + 'ф': 'b', + 'х': 'x', + 'ц': 'n', + 'ч': 'n', + 'ш': 'w', + 'щ': 'w', + 'ъ': 'a', + 'ы': 'm', + 'ь': 'a', + 'э': 'e', + 'ю': 'm', + 'я': 'r' +}; + +/** + * This function adds new font metrics to default metricMap + * It can also override existing metrics + */ +function setFontMetrics(fontName, metrics) { + metricMap[fontName] = metrics; +} +/** + * This function is a convenience function for looking up information in the + * metricMap table. It takes a character as a string, and a font. + * + * Note: the `width` property may be undefined if fontMetricsData.js wasn't + * built using `Make extended_metrics`. + */ + +function getCharacterMetrics(character, font, mode) { + if (!metricMap[font]) { + throw new Error(`Font metrics not found for font: ${font}.`); + } + + let ch = character.charCodeAt(0); + + if (character[0] in extraCharacterMap) { + ch = extraCharacterMap[character[0]].charCodeAt(0); + } + + let metrics = metricMap[font][ch]; + + if (!metrics && mode === 'text') { + // We don't typically have font metrics for Asian scripts. + // But since we support them in text mode, we need to return + // some sort of metrics. + // So if the character is in a script we support but we + // don't have metrics for it, just use the metrics for + // the Latin capital letter M. This is close enough because + // we (currently) only care about the height of the glpyh + // not its width. + if (supportedCodepoint(ch)) { + metrics = metricMap[font][77]; // 77 is the charcode for 'M' + } + } + + if (metrics) { + return { + depth: metrics[0], + height: metrics[1], + italic: metrics[2], + skew: metrics[3], + width: metrics[4] + }; + } +} +const fontMetricsBySizeIndex = {}; +/** + * Get the font metrics for a given size. + */ + +function getGlobalMetrics(size) { + let sizeIndex; + + if (size >= 5) { + sizeIndex = 0; + } else if (size >= 3) { + sizeIndex = 1; + } else { + sizeIndex = 2; + } + + if (!fontMetricsBySizeIndex[sizeIndex]) { + const metrics = fontMetricsBySizeIndex[sizeIndex] = { + cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 + }; + + for (const key in sigmasAndXis) { + if (sigmasAndXis.hasOwnProperty(key)) { + metrics[key] = sigmasAndXis[key][sizeIndex]; + } + } + } + + return fontMetricsBySizeIndex[sizeIndex]; +} + +/** + * This file holds a list of all no-argument functions and single-character + * symbols (like 'a' or ';'). + * + * For each of the symbols, there are three properties they can have: + * - font (required): the font to be used for this symbol. Either "main" (the + normal font), or "ams" (the ams fonts). + * - group (required): the ParseNode group type the symbol should have (i.e. + "textord", "mathord", etc). + See https://github.com/Khan/KaTeX/wiki/Examining-TeX#group-types + * - replace: the character that this symbol or function should be + * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi + * character in the main font). + * + * The outermost map in the table indicates what mode the symbols should be + * accepted in (e.g. "math" or "text"). + */ +// Some of these have a "-token" suffix since these are also used as `ParseNode` +// types for raw text tokens, and we want to avoid conflicts with higher-level +// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by +// looking up the `symbols` map. +const ATOMS = { + "bin": 1, + "close": 1, + "inner": 1, + "open": 1, + "punct": 1, + "rel": 1 +}; +const NON_ATOMS = { + "accent-token": 1, + "mathord": 1, + "op-token": 1, + "spacing": 1, + "textord": 1 +}; +const symbols = { + "math": {}, + "text": {} +}; +/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */ + +function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { + symbols[mode][name] = { + font, + group, + replace + }; + + if (acceptUnicodeChar && replace) { + symbols[mode][replace] = symbols[mode][name]; + } +} // Some abbreviations for commonly used strings. +// This helps minify the code, and also spotting typos using jshint. +// modes: + +const math = "math"; +const text$1 = "text"; // fonts: + +const main = "main"; +const ams = "ams"; // groups: + +const accent = "accent-token"; +const bin = "bin"; +const close = "close"; +const inner = "inner"; +const mathord = "mathord"; +const op = "op-token"; +const open = "open"; +const punct = "punct"; +const rel = "rel"; +const spacing = "spacing"; +const textord = "textord"; // Now comes the symbol table +// Relation Symbols + +defineSymbol(math, main, rel, "\u2261", "\\equiv", true); +defineSymbol(math, main, rel, "\u227a", "\\prec", true); +defineSymbol(math, main, rel, "\u227b", "\\succ", true); +defineSymbol(math, main, rel, "\u223c", "\\sim", true); +defineSymbol(math, main, rel, "\u22a5", "\\perp"); +defineSymbol(math, main, rel, "\u2aaf", "\\preceq", true); +defineSymbol(math, main, rel, "\u2ab0", "\\succeq", true); +defineSymbol(math, main, rel, "\u2243", "\\simeq", true); +defineSymbol(math, main, rel, "\u2223", "\\mid", true); +defineSymbol(math, main, rel, "\u226a", "\\ll", true); +defineSymbol(math, main, rel, "\u226b", "\\gg", true); +defineSymbol(math, main, rel, "\u224d", "\\asymp", true); +defineSymbol(math, main, rel, "\u2225", "\\parallel"); +defineSymbol(math, main, rel, "\u22c8", "\\bowtie", true); +defineSymbol(math, main, rel, "\u2323", "\\smile", true); +defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); +defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); +defineSymbol(math, main, rel, "\u2250", "\\doteq", true); +defineSymbol(math, main, rel, "\u2322", "\\frown", true); +defineSymbol(math, main, rel, "\u220b", "\\ni", true); +defineSymbol(math, main, rel, "\u221d", "\\propto", true); +defineSymbol(math, main, rel, "\u22a2", "\\vdash", true); +defineSymbol(math, main, rel, "\u22a3", "\\dashv", true); +defineSymbol(math, main, rel, "\u220b", "\\owns"); // Punctuation + +defineSymbol(math, main, punct, "\u002e", "\\ldotp"); +defineSymbol(math, main, punct, "\u22c5", "\\cdotp"); // Misc Symbols + +defineSymbol(math, main, textord, "\u0023", "\\#"); +defineSymbol(text$1, main, textord, "\u0023", "\\#"); +defineSymbol(math, main, textord, "\u0026", "\\&"); +defineSymbol(text$1, main, textord, "\u0026", "\\&"); +defineSymbol(math, main, textord, "\u2135", "\\aleph", true); +defineSymbol(math, main, textord, "\u2200", "\\forall", true); +defineSymbol(math, main, textord, "\u210f", "\\hbar", true); +defineSymbol(math, main, textord, "\u2203", "\\exists", true); +defineSymbol(math, main, textord, "\u2207", "\\nabla", true); +defineSymbol(math, main, textord, "\u266d", "\\flat", true); +defineSymbol(math, main, textord, "\u2113", "\\ell", true); +defineSymbol(math, main, textord, "\u266e", "\\natural", true); +defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); +defineSymbol(math, main, textord, "\u2118", "\\wp", true); +defineSymbol(math, main, textord, "\u266f", "\\sharp", true); +defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); +defineSymbol(math, main, textord, "\u211c", "\\Re", true); +defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); +defineSymbol(math, main, textord, "\u2111", "\\Im", true); +defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); +defineSymbol(text$1, main, textord, "\u00a7", "\\S", true); +defineSymbol(text$1, main, textord, "\u00b6", "\\P", true); // Math and Text + +defineSymbol(math, main, textord, "\u2020", "\\dag"); +defineSymbol(text$1, main, textord, "\u2020", "\\dag"); +defineSymbol(text$1, main, textord, "\u2020", "\\textdagger"); +defineSymbol(math, main, textord, "\u2021", "\\ddag"); +defineSymbol(text$1, main, textord, "\u2021", "\\ddag"); +defineSymbol(text$1, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters + +defineSymbol(math, main, close, "\u23b1", "\\rmoustache", true); +defineSymbol(math, main, open, "\u23b0", "\\lmoustache", true); +defineSymbol(math, main, close, "\u27ef", "\\rgroup", true); +defineSymbol(math, main, open, "\u27ee", "\\lgroup", true); // Binary Operators + +defineSymbol(math, main, bin, "\u2213", "\\mp", true); +defineSymbol(math, main, bin, "\u2296", "\\ominus", true); +defineSymbol(math, main, bin, "\u228e", "\\uplus", true); +defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); +defineSymbol(math, main, bin, "\u2217", "\\ast"); +defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); +defineSymbol(math, main, bin, "\u25ef", "\\bigcirc"); +defineSymbol(math, main, bin, "\u2219", "\\bullet"); +defineSymbol(math, main, bin, "\u2021", "\\ddagger"); +defineSymbol(math, main, bin, "\u2240", "\\wr", true); +defineSymbol(math, main, bin, "\u2a3f", "\\amalg"); +defineSymbol(math, main, bin, "\u0026", "\\And"); // from amsmath +// Arrow Symbols + +defineSymbol(math, main, rel, "\u27f5", "\\longleftarrow", true); +defineSymbol(math, main, rel, "\u21d0", "\\Leftarrow", true); +defineSymbol(math, main, rel, "\u27f8", "\\Longleftarrow", true); +defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow", true); +defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow", true); +defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow", true); +defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); +defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow", true); +defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow", true); +defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow", true); +defineSymbol(math, main, rel, "\u21a6", "\\mapsto", true); +defineSymbol(math, main, rel, "\u27fc", "\\longmapsto", true); +defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); +defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow", true); +defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow", true); +defineSymbol(math, main, rel, "\u2198", "\\searrow", true); +defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup", true); +defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup", true); +defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); +defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown", true); +defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true); +defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); +defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true); // AMS Negated Binary Relations + +defineSymbol(math, ams, rel, "\u226e", "\\nless", true); +defineSymbol(math, ams, rel, "\ue010", "\\nleqslant"); +defineSymbol(math, ams, rel, "\ue011", "\\nleqq"); +defineSymbol(math, ams, rel, "\u2a87", "\\lneq", true); +defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); +defineSymbol(math, ams, rel, "\ue00c", "\\lvertneqq"); +defineSymbol(math, ams, rel, "\u22e6", "\\lnsim", true); +defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox", true); +defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym. + +defineSymbol(math, ams, rel, "\u22e0", "\\npreceq", true); +defineSymbol(math, ams, rel, "\u22e8", "\\precnsim", true); +defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox", true); +defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); +defineSymbol(math, ams, rel, "\ue006", "\\nshortmid"); +defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); +defineSymbol(math, ams, rel, "\u22ac", "\\nvdash", true); +defineSymbol(math, ams, rel, "\u22ad", "\\nvDash", true); +defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft"); +defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq", true); +defineSymbol(math, ams, rel, "\u228a", "\\subsetneq", true); +defineSymbol(math, ams, rel, "\ue01a", "\\varsubsetneq"); +defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq", true); +defineSymbol(math, ams, rel, "\ue017", "\\varsubsetneqq"); +defineSymbol(math, ams, rel, "\u226f", "\\ngtr", true); +defineSymbol(math, ams, rel, "\ue00f", "\\ngeqslant"); +defineSymbol(math, ams, rel, "\ue00e", "\\ngeqq"); +defineSymbol(math, ams, rel, "\u2a88", "\\gneq", true); +defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); +defineSymbol(math, ams, rel, "\ue00d", "\\gvertneqq"); +defineSymbol(math, ams, rel, "\u22e7", "\\gnsim", true); +defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox", true); +defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym. + +defineSymbol(math, ams, rel, "\u22e1", "\\nsucceq", true); +defineSymbol(math, ams, rel, "\u22e9", "\\succnsim", true); +defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym. + +defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); +defineSymbol(math, ams, rel, "\ue007", "\\nshortparallel"); +defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); +defineSymbol(math, ams, rel, "\u22af", "\\nVDash", true); +defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright"); +defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq", true); +defineSymbol(math, ams, rel, "\ue018", "\\nsupseteqq"); +defineSymbol(math, ams, rel, "\u228b", "\\supsetneq", true); +defineSymbol(math, ams, rel, "\ue01b", "\\varsupsetneq"); +defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq", true); +defineSymbol(math, ams, rel, "\ue019", "\\varsupsetneqq"); +defineSymbol(math, ams, rel, "\u22ae", "\\nVdash", true); +defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq", true); +defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq", true); +defineSymbol(math, ams, rel, "\ue016", "\\nsubseteqq"); +defineSymbol(math, ams, bin, "\u22b4", "\\unlhd"); +defineSymbol(math, ams, bin, "\u22b5", "\\unrhd"); // AMS Negated Arrows + +defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow", true); +defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow", true); +defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow", true); +defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow", true); +defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow", true); +defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow", true); // AMS Misc + +defineSymbol(math, ams, rel, "\u25b3", "\\vartriangle"); +defineSymbol(math, ams, textord, "\u210f", "\\hslash"); +defineSymbol(math, ams, textord, "\u25bd", "\\triangledown"); +defineSymbol(math, ams, textord, "\u25ca", "\\lozenge"); +defineSymbol(math, ams, textord, "\u24c8", "\\circledS"); +defineSymbol(math, ams, textord, "\u00ae", "\\circledR"); +defineSymbol(text$1, ams, textord, "\u00ae", "\\circledR"); +defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); +defineSymbol(math, ams, textord, "\u2204", "\\nexists"); +defineSymbol(math, ams, textord, "\u2127", "\\mho"); +defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); +defineSymbol(math, ams, textord, "\u2141", "\\Game", true); +defineSymbol(math, ams, textord, "\u006b", "\\Bbbk"); +defineSymbol(math, ams, textord, "\u2035", "\\backprime"); +defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle"); +defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown"); +defineSymbol(math, ams, textord, "\u25a0", "\\blacksquare"); +defineSymbol(math, ams, textord, "\u29eb", "\\blacklozenge"); +defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); +defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); +defineSymbol(math, ams, textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 (ð) to \matheth. We map to AMS function \eth + +defineSymbol(math, ams, textord, "\u00f0", "\\eth", true); +defineSymbol(math, ams, textord, "\u2571", "\\diagup"); +defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); +defineSymbol(math, ams, textord, "\u25a1", "\\square"); +defineSymbol(math, ams, textord, "\u25a1", "\\Box"); +defineSymbol(math, ams, textord, "\u25ca", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen + +defineSymbol(math, ams, textord, "\u00a5", "\\yen", true); +defineSymbol(text$1, ams, textord, "\u00a5", "\\yen", true); +defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); +defineSymbol(text$1, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew + +defineSymbol(math, ams, textord, "\u2136", "\\beth", true); +defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); +defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek + +defineSymbol(math, ams, textord, "\u03dd", "\\digamma"); +defineSymbol(math, ams, textord, "\u03f0", "\\varkappa"); // AMS Delimiters + +defineSymbol(math, ams, open, "\u250c", "\\ulcorner", true); +defineSymbol(math, ams, close, "\u2510", "\\urcorner", true); +defineSymbol(math, ams, open, "\u2514", "\\llcorner", true); +defineSymbol(math, ams, close, "\u2518", "\\lrcorner", true); // AMS Binary Relations + +defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); +defineSymbol(math, ams, rel, "\u2a7d", "\\leqslant", true); +defineSymbol(math, ams, rel, "\u2a95", "\\eqslantless", true); +defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true); +defineSymbol(math, ams, rel, "\u2a85", "\\lessapprox", true); +defineSymbol(math, ams, rel, "\u224a", "\\approxeq", true); +defineSymbol(math, ams, bin, "\u22d6", "\\lessdot"); +defineSymbol(math, ams, rel, "\u22d8", "\\lll", true); +defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true); +defineSymbol(math, ams, rel, "\u22da", "\\lesseqgtr", true); +defineSymbol(math, ams, rel, "\u2a8b", "\\lesseqqgtr", true); +defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); +defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); +defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); +defineSymbol(math, ams, rel, "\u223d", "\\backsim", true); +defineSymbol(math, ams, rel, "\u22cd", "\\backsimeq", true); +defineSymbol(math, ams, rel, "\u2ac5", "\\subseteqq", true); +defineSymbol(math, ams, rel, "\u22d0", "\\Subset", true); +defineSymbol(math, ams, rel, "\u228f", "\\sqsubset", true); +defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq", true); +defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec", true); +defineSymbol(math, ams, rel, "\u227e", "\\precsim", true); +defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox", true); +defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft"); +defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq"); +defineSymbol(math, ams, rel, "\u22a8", "\\vDash", true); +defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash", true); +defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); +defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); +defineSymbol(math, ams, rel, "\u224f", "\\bumpeq", true); +defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq", true); +defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); +defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant", true); +defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr", true); +defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); +defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox", true); +defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot"); +defineSymbol(math, ams, rel, "\u22d9", "\\ggg", true); +defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); +defineSymbol(math, ams, rel, "\u22db", "\\gtreqless", true); +defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless", true); +defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); +defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); +defineSymbol(math, ams, rel, "\u225c", "\\triangleq", true); +defineSymbol(math, ams, rel, "\u223c", "\\thicksim"); +defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); +defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq", true); +defineSymbol(math, ams, rel, "\u22d1", "\\Supset", true); +defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); +defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq", true); +defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc", true); +defineSymbol(math, ams, rel, "\u227f", "\\succsim", true); +defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox", true); +defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright"); +defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq"); +defineSymbol(math, ams, rel, "\u22a9", "\\Vdash", true); +defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); +defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); +defineSymbol(math, ams, rel, "\u226c", "\\between", true); +defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork", true); +defineSymbol(math, ams, rel, "\u221d", "\\varpropto"); +defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom. +// We kept the amssymb atom type, which is rel. + +defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); +defineSymbol(math, ams, rel, "\u220d", "\\backepsilon"); +defineSymbol(math, ams, rel, "\u25b6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom. +// We kept the amssymb atom type, which is rel. + +defineSymbol(math, ams, rel, "\u2235", "\\because", true); +defineSymbol(math, ams, rel, "\u22d8", "\\llless"); +defineSymbol(math, ams, rel, "\u22d9", "\\gggtr"); +defineSymbol(math, ams, bin, "\u22b2", "\\lhd"); +defineSymbol(math, ams, bin, "\u22b3", "\\rhd"); +defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); +defineSymbol(math, main, rel, "\u22c8", "\\Join"); +defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators + +defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); +defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); +defineSymbol(math, ams, bin, "\u22d2", "\\Cap", true); +defineSymbol(math, ams, bin, "\u22d3", "\\Cup", true); +defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge", true); +defineSymbol(math, ams, bin, "\u229f", "\\boxminus", true); +defineSymbol(math, ams, bin, "\u229e", "\\boxplus", true); +defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes", true); +defineSymbol(math, ams, bin, "\u22c9", "\\ltimes", true); +defineSymbol(math, ams, bin, "\u22ca", "\\rtimes", true); +defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes", true); +defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes", true); +defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge", true); +defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee", true); +defineSymbol(math, ams, bin, "\u229d", "\\circleddash", true); +defineSymbol(math, ams, bin, "\u229b", "\\circledast", true); +defineSymbol(math, ams, bin, "\u22c5", "\\centerdot"); +defineSymbol(math, ams, bin, "\u22ba", "\\intercal", true); +defineSymbol(math, ams, bin, "\u22d2", "\\doublecap"); +defineSymbol(math, ams, bin, "\u22d3", "\\doublecup"); +defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes", true); // AMS Arrows +// Note: unicode-math maps \u21e2 to their own function \rightdasharrow. +// We'll map it to AMS function \dashrightarrow. It produces the same atom. + +defineSymbol(math, ams, rel, "\u21e2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym. + +defineSymbol(math, ams, rel, "\u21e0", "\\dashleftarrow", true); +defineSymbol(math, ams, rel, "\u21c7", "\\leftleftarrows", true); +defineSymbol(math, ams, rel, "\u21c6", "\\leftrightarrows", true); +defineSymbol(math, ams, rel, "\u21da", "\\Lleftarrow", true); +defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow", true); +defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail", true); +defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft", true); +defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons", true); +defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym. + +defineSymbol(math, ams, rel, "\u21ba", "\\circlearrowleft", true); +defineSymbol(math, ams, rel, "\u21b0", "\\Lsh", true); +defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows", true); +defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft", true); +defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft", true); +defineSymbol(math, ams, rel, "\u22b8", "\\multimap", true); +defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow", true); +defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows", true); +defineSymbol(math, ams, rel, "\u21c4", "\\rightleftarrows", true); +defineSymbol(math, ams, rel, "\u21a0", "\\twoheadrightarrow", true); +defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail", true); +defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright", true); +defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym. + +defineSymbol(math, ams, rel, "\u21bb", "\\circlearrowright", true); +defineSymbol(math, ams, rel, "\u21b1", "\\Rsh", true); +defineSymbol(math, ams, rel, "\u21ca", "\\downdownarrows", true); +defineSymbol(math, ams, rel, "\u21be", "\\upharpoonright", true); +defineSymbol(math, ams, rel, "\u21c2", "\\downharpoonright", true); +defineSymbol(math, ams, rel, "\u21dd", "\\rightsquigarrow", true); +defineSymbol(math, ams, rel, "\u21dd", "\\leadsto"); +defineSymbol(math, ams, rel, "\u21db", "\\Rrightarrow", true); +defineSymbol(math, ams, rel, "\u21be", "\\restriction"); +defineSymbol(math, main, textord, "\u2018", "`"); +defineSymbol(math, main, textord, "$", "\\$"); +defineSymbol(text$1, main, textord, "$", "\\$"); +defineSymbol(text$1, main, textord, "$", "\\textdollar"); +defineSymbol(math, main, textord, "%", "\\%"); +defineSymbol(text$1, main, textord, "%", "\\%"); +defineSymbol(math, main, textord, "_", "\\_"); +defineSymbol(text$1, main, textord, "_", "\\_"); +defineSymbol(text$1, main, textord, "_", "\\textunderscore"); +defineSymbol(math, main, textord, "\u2220", "\\angle", true); +defineSymbol(math, main, textord, "\u221e", "\\infty", true); +defineSymbol(math, main, textord, "\u2032", "\\prime"); +defineSymbol(math, main, textord, "\u25b3", "\\triangle"); +defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); +defineSymbol(math, main, textord, "\u0394", "\\Delta", true); +defineSymbol(math, main, textord, "\u0398", "\\Theta", true); +defineSymbol(math, main, textord, "\u039b", "\\Lambda", true); +defineSymbol(math, main, textord, "\u039e", "\\Xi", true); +defineSymbol(math, main, textord, "\u03a0", "\\Pi", true); +defineSymbol(math, main, textord, "\u03a3", "\\Sigma", true); +defineSymbol(math, main, textord, "\u03a5", "\\Upsilon", true); +defineSymbol(math, main, textord, "\u03a6", "\\Phi", true); +defineSymbol(math, main, textord, "\u03a8", "\\Psi", true); +defineSymbol(math, main, textord, "\u03a9", "\\Omega", true); +defineSymbol(math, main, textord, "A", "\u0391"); +defineSymbol(math, main, textord, "B", "\u0392"); +defineSymbol(math, main, textord, "E", "\u0395"); +defineSymbol(math, main, textord, "Z", "\u0396"); +defineSymbol(math, main, textord, "H", "\u0397"); +defineSymbol(math, main, textord, "I", "\u0399"); +defineSymbol(math, main, textord, "K", "\u039A"); +defineSymbol(math, main, textord, "M", "\u039C"); +defineSymbol(math, main, textord, "N", "\u039D"); +defineSymbol(math, main, textord, "O", "\u039F"); +defineSymbol(math, main, textord, "P", "\u03A1"); +defineSymbol(math, main, textord, "T", "\u03A4"); +defineSymbol(math, main, textord, "X", "\u03A7"); +defineSymbol(math, main, textord, "\u00ac", "\\neg", true); +defineSymbol(math, main, textord, "\u00ac", "\\lnot"); +defineSymbol(math, main, textord, "\u22a4", "\\top"); +defineSymbol(math, main, textord, "\u22a5", "\\bot"); +defineSymbol(math, main, textord, "\u2205", "\\emptyset"); +defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); +defineSymbol(math, main, mathord, "\u03b1", "\\alpha", true); +defineSymbol(math, main, mathord, "\u03b2", "\\beta", true); +defineSymbol(math, main, mathord, "\u03b3", "\\gamma", true); +defineSymbol(math, main, mathord, "\u03b4", "\\delta", true); +defineSymbol(math, main, mathord, "\u03f5", "\\epsilon", true); +defineSymbol(math, main, mathord, "\u03b6", "\\zeta", true); +defineSymbol(math, main, mathord, "\u03b7", "\\eta", true); +defineSymbol(math, main, mathord, "\u03b8", "\\theta", true); +defineSymbol(math, main, mathord, "\u03b9", "\\iota", true); +defineSymbol(math, main, mathord, "\u03ba", "\\kappa", true); +defineSymbol(math, main, mathord, "\u03bb", "\\lambda", true); +defineSymbol(math, main, mathord, "\u03bc", "\\mu", true); +defineSymbol(math, main, mathord, "\u03bd", "\\nu", true); +defineSymbol(math, main, mathord, "\u03be", "\\xi", true); +defineSymbol(math, main, mathord, "\u03bf", "\\omicron", true); +defineSymbol(math, main, mathord, "\u03c0", "\\pi", true); +defineSymbol(math, main, mathord, "\u03c1", "\\rho", true); +defineSymbol(math, main, mathord, "\u03c3", "\\sigma", true); +defineSymbol(math, main, mathord, "\u03c4", "\\tau", true); +defineSymbol(math, main, mathord, "\u03c5", "\\upsilon", true); +defineSymbol(math, main, mathord, "\u03d5", "\\phi", true); +defineSymbol(math, main, mathord, "\u03c7", "\\chi", true); +defineSymbol(math, main, mathord, "\u03c8", "\\psi", true); +defineSymbol(math, main, mathord, "\u03c9", "\\omega", true); +defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon", true); +defineSymbol(math, main, mathord, "\u03d1", "\\vartheta", true); +defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true); +defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true); +defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true); +defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true); +defineSymbol(math, main, bin, "\u2217", "*"); +defineSymbol(math, main, bin, "+", "+"); +defineSymbol(math, main, bin, "\u2212", "-"); +defineSymbol(math, main, bin, "\u22c5", "\\cdot", true); +defineSymbol(math, main, bin, "\u2218", "\\circ"); +defineSymbol(math, main, bin, "\u00f7", "\\div", true); +defineSymbol(math, main, bin, "\u00b1", "\\pm", true); +defineSymbol(math, main, bin, "\u00d7", "\\times", true); +defineSymbol(math, main, bin, "\u2229", "\\cap", true); +defineSymbol(math, main, bin, "\u222a", "\\cup", true); +defineSymbol(math, main, bin, "\u2216", "\\setminus"); +defineSymbol(math, main, bin, "\u2227", "\\land"); +defineSymbol(math, main, bin, "\u2228", "\\lor"); +defineSymbol(math, main, bin, "\u2227", "\\wedge", true); +defineSymbol(math, main, bin, "\u2228", "\\vee", true); +defineSymbol(math, main, textord, "\u221a", "\\surd"); +defineSymbol(math, main, open, "(", "("); +defineSymbol(math, main, open, "[", "["); +defineSymbol(math, main, open, "\u27e8", "\\langle", true); +defineSymbol(math, main, open, "\u2223", "\\lvert"); +defineSymbol(math, main, open, "\u2225", "\\lVert"); +defineSymbol(math, main, close, ")", ")"); +defineSymbol(math, main, close, "]", "]"); +defineSymbol(math, main, close, "?", "?"); +defineSymbol(math, main, close, "!", "!"); +defineSymbol(math, main, close, "\u27e9", "\\rangle", true); +defineSymbol(math, main, close, "\u2223", "\\rvert"); +defineSymbol(math, main, close, "\u2225", "\\rVert"); +defineSymbol(math, main, rel, "=", "="); +defineSymbol(math, main, rel, "<", "<"); +defineSymbol(math, main, rel, ">", ">"); +defineSymbol(math, main, rel, ":", ":"); +defineSymbol(math, main, rel, "\u2248", "\\approx", true); +defineSymbol(math, main, rel, "\u2245", "\\cong", true); +defineSymbol(math, main, rel, "\u2265", "\\ge"); +defineSymbol(math, main, rel, "\u2265", "\\geq", true); +defineSymbol(math, main, rel, "\u2190", "\\gets"); +defineSymbol(math, main, rel, ">", "\\gt"); +defineSymbol(math, main, rel, "\u2208", "\\in", true); +defineSymbol(math, main, rel, "\u0338", "\\@not"); +defineSymbol(math, main, rel, "\u2282", "\\subset", true); +defineSymbol(math, main, rel, "\u2283", "\\supset", true); +defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); +defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); +defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); +defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); +defineSymbol(math, main, rel, "\u22a8", "\\models"); +defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); +defineSymbol(math, main, rel, "\u2264", "\\le"); +defineSymbol(math, main, rel, "\u2264", "\\leq", true); +defineSymbol(math, main, rel, "<", "\\lt"); +defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); +defineSymbol(math, main, rel, "\u2192", "\\to"); +defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); +defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); +defineSymbol(math, main, spacing, "\u00a0", "\\ "); +defineSymbol(math, main, spacing, "\u00a0", "~"); +defineSymbol(math, main, spacing, "\u00a0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% + +defineSymbol(math, main, spacing, "\u00a0", "\\nobreakspace"); +defineSymbol(text$1, main, spacing, "\u00a0", "\\ "); +defineSymbol(text$1, main, spacing, "\u00a0", "~"); +defineSymbol(text$1, main, spacing, "\u00a0", "\\space"); +defineSymbol(text$1, main, spacing, "\u00a0", "\\nobreakspace"); +defineSymbol(math, main, spacing, null, "\\nobreak"); +defineSymbol(math, main, spacing, null, "\\allowbreak"); +defineSymbol(math, main, punct, ",", ","); +defineSymbol(math, main, punct, ";", ";"); +defineSymbol(math, ams, bin, "\u22bc", "\\barwedge", true); +defineSymbol(math, ams, bin, "\u22bb", "\\veebar", true); +defineSymbol(math, main, bin, "\u2299", "\\odot", true); +defineSymbol(math, main, bin, "\u2295", "\\oplus", true); +defineSymbol(math, main, bin, "\u2297", "\\otimes", true); +defineSymbol(math, main, textord, "\u2202", "\\partial", true); +defineSymbol(math, main, bin, "\u2298", "\\oslash", true); +defineSymbol(math, ams, bin, "\u229a", "\\circledcirc", true); +defineSymbol(math, ams, bin, "\u22a1", "\\boxdot", true); +defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup"); +defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown"); +defineSymbol(math, main, bin, "\u2020", "\\dagger"); +defineSymbol(math, main, bin, "\u22c4", "\\diamond"); +defineSymbol(math, main, bin, "\u22c6", "\\star"); +defineSymbol(math, main, bin, "\u25c3", "\\triangleleft"); +defineSymbol(math, main, bin, "\u25b9", "\\triangleright"); +defineSymbol(math, main, open, "{", "\\{"); +defineSymbol(text$1, main, textord, "{", "\\{"); +defineSymbol(text$1, main, textord, "{", "\\textbraceleft"); +defineSymbol(math, main, close, "}", "\\}"); +defineSymbol(text$1, main, textord, "}", "\\}"); +defineSymbol(text$1, main, textord, "}", "\\textbraceright"); +defineSymbol(math, main, open, "{", "\\lbrace"); +defineSymbol(math, main, close, "}", "\\rbrace"); +defineSymbol(math, main, open, "[", "\\lbrack"); +defineSymbol(text$1, main, textord, "[", "\\lbrack"); +defineSymbol(math, main, close, "]", "\\rbrack"); +defineSymbol(text$1, main, textord, "]", "\\rbrack"); +defineSymbol(math, main, open, "(", "\\lparen"); +defineSymbol(math, main, close, ")", "\\rparen"); +defineSymbol(text$1, main, textord, "<", "\\textless"); // in T1 fontenc + +defineSymbol(text$1, main, textord, ">", "\\textgreater"); // in T1 fontenc + +defineSymbol(math, main, open, "\u230a", "\\lfloor", true); +defineSymbol(math, main, close, "\u230b", "\\rfloor", true); +defineSymbol(math, main, open, "\u2308", "\\lceil", true); +defineSymbol(math, main, close, "\u2309", "\\rceil", true); +defineSymbol(math, main, textord, "\\", "\\backslash"); +defineSymbol(math, main, textord, "\u2223", "|"); +defineSymbol(math, main, textord, "\u2223", "\\vert"); +defineSymbol(text$1, main, textord, "|", "\\textbar"); // in T1 fontenc + +defineSymbol(math, main, textord, "\u2225", "\\|"); +defineSymbol(math, main, textord, "\u2225", "\\Vert"); +defineSymbol(text$1, main, textord, "\u2225", "\\textbardbl"); +defineSymbol(text$1, main, textord, "~", "\\textasciitilde"); +defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); +defineSymbol(math, main, rel, "\u21d1", "\\Uparrow", true); +defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); +defineSymbol(math, main, rel, "\u21d3", "\\Downarrow", true); +defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); +defineSymbol(math, main, rel, "\u21d5", "\\Updownarrow", true); +defineSymbol(math, main, op, "\u2210", "\\coprod"); +defineSymbol(math, main, op, "\u22c1", "\\bigvee"); +defineSymbol(math, main, op, "\u22c0", "\\bigwedge"); +defineSymbol(math, main, op, "\u2a04", "\\biguplus"); +defineSymbol(math, main, op, "\u22c2", "\\bigcap"); +defineSymbol(math, main, op, "\u22c3", "\\bigcup"); +defineSymbol(math, main, op, "\u222b", "\\int"); +defineSymbol(math, main, op, "\u222b", "\\intop"); +defineSymbol(math, main, op, "\u222c", "\\iint"); +defineSymbol(math, main, op, "\u222d", "\\iiint"); +defineSymbol(math, main, op, "\u220f", "\\prod"); +defineSymbol(math, main, op, "\u2211", "\\sum"); +defineSymbol(math, main, op, "\u2a02", "\\bigotimes"); +defineSymbol(math, main, op, "\u2a01", "\\bigoplus"); +defineSymbol(math, main, op, "\u2a00", "\\bigodot"); +defineSymbol(math, main, op, "\u222e", "\\oint"); +defineSymbol(math, main, op, "\u222f", "\\oiint"); +defineSymbol(math, main, op, "\u2230", "\\oiiint"); +defineSymbol(math, main, op, "\u2a06", "\\bigsqcup"); +defineSymbol(math, main, op, "\u222b", "\\smallint"); +defineSymbol(text$1, main, inner, "\u2026", "\\textellipsis"); +defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); +defineSymbol(text$1, main, inner, "\u2026", "\\ldots", true); +defineSymbol(math, main, inner, "\u2026", "\\ldots", true); +defineSymbol(math, main, inner, "\u22ef", "\\@cdots", true); +defineSymbol(math, main, inner, "\u22f1", "\\ddots", true); +defineSymbol(math, main, textord, "\u22ee", "\\varvdots"); // \vdots is a macro + +defineSymbol(math, main, accent, "\u02ca", "\\acute"); +defineSymbol(math, main, accent, "\u02cb", "\\grave"); +defineSymbol(math, main, accent, "\u00a8", "\\ddot"); +defineSymbol(math, main, accent, "\u007e", "\\tilde"); +defineSymbol(math, main, accent, "\u02c9", "\\bar"); +defineSymbol(math, main, accent, "\u02d8", "\\breve"); +defineSymbol(math, main, accent, "\u02c7", "\\check"); +defineSymbol(math, main, accent, "\u005e", "\\hat"); +defineSymbol(math, main, accent, "\u20d7", "\\vec"); +defineSymbol(math, main, accent, "\u02d9", "\\dot"); +defineSymbol(math, main, accent, "\u02da", "\\mathring"); +defineSymbol(math, main, mathord, "\u0131", "\\imath", true); +defineSymbol(math, main, mathord, "\u0237", "\\jmath", true); +defineSymbol(text$1, main, textord, "\u0131", "\\i", true); +defineSymbol(text$1, main, textord, "\u0237", "\\j", true); +defineSymbol(text$1, main, textord, "\u00df", "\\ss", true); +defineSymbol(text$1, main, textord, "\u00e6", "\\ae", true); +defineSymbol(text$1, main, textord, "\u00e6", "\\ae", true); +defineSymbol(text$1, main, textord, "\u0153", "\\oe", true); +defineSymbol(text$1, main, textord, "\u00f8", "\\o", true); +defineSymbol(text$1, main, textord, "\u00c6", "\\AE", true); +defineSymbol(text$1, main, textord, "\u0152", "\\OE", true); +defineSymbol(text$1, main, textord, "\u00d8", "\\O", true); +defineSymbol(text$1, main, accent, "\u02ca", "\\'"); // acute + +defineSymbol(text$1, main, accent, "\u02cb", "\\`"); // grave + +defineSymbol(text$1, main, accent, "\u02c6", "\\^"); // circumflex + +defineSymbol(text$1, main, accent, "\u02dc", "\\~"); // tilde + +defineSymbol(text$1, main, accent, "\u02c9", "\\="); // macron + +defineSymbol(text$1, main, accent, "\u02d8", "\\u"); // breve + +defineSymbol(text$1, main, accent, "\u02d9", "\\."); // dot above + +defineSymbol(text$1, main, accent, "\u02da", "\\r"); // ring above + +defineSymbol(text$1, main, accent, "\u02c7", "\\v"); // caron + +defineSymbol(text$1, main, accent, "\u00a8", '\\"'); // diaresis + +defineSymbol(text$1, main, accent, "\u02dd", "\\H"); // double acute + +defineSymbol(text$1, main, accent, "\u25ef", "\\textcircled"); // \bigcirc glyph +// These ligatures are detected and created in Parser.js's `formLigatures`. + +const ligatures = { + "--": true, + "---": true, + "``": true, + "''": true +}; +defineSymbol(text$1, main, textord, "\u2013", "--"); +defineSymbol(text$1, main, textord, "\u2013", "\\textendash"); +defineSymbol(text$1, main, textord, "\u2014", "---"); +defineSymbol(text$1, main, textord, "\u2014", "\\textemdash"); +defineSymbol(text$1, main, textord, "\u2018", "`"); +defineSymbol(text$1, main, textord, "\u2018", "\\textquoteleft"); +defineSymbol(text$1, main, textord, "\u2019", "'"); +defineSymbol(text$1, main, textord, "\u2019", "\\textquoteright"); +defineSymbol(text$1, main, textord, "\u201c", "``"); +defineSymbol(text$1, main, textord, "\u201c", "\\textquotedblleft"); +defineSymbol(text$1, main, textord, "\u201d", "''"); +defineSymbol(text$1, main, textord, "\u201d", "\\textquotedblright"); // \degree from gensymb package + +defineSymbol(math, main, textord, "\u00b0", "\\degree", true); +defineSymbol(text$1, main, textord, "\u00b0", "\\degree"); // \textdegree from inputenc package + +defineSymbol(text$1, main, textord, "\u00b0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math +// mode, but among our fonts, only Main-Italic defines this character "163". + +defineSymbol(math, main, mathord, "\u00a3", "\\pounds"); +defineSymbol(math, main, mathord, "\u00a3", "\\mathsterling", true); +defineSymbol(text$1, main, mathord, "\u00a3", "\\pounds"); +defineSymbol(text$1, main, mathord, "\u00a3", "\\textsterling", true); +defineSymbol(math, ams, textord, "\u2720", "\\maltese"); +defineSymbol(text$1, ams, textord, "\u2720", "\\maltese"); +defineSymbol(text$1, main, spacing, "\u00a0", "\\ "); +defineSymbol(text$1, main, spacing, "\u00a0", " "); +defineSymbol(text$1, main, spacing, "\u00a0", "~"); // There are lots of symbols which are the same, so we add them in afterwards. +// All of these are textords in math mode + +const mathTextSymbols = "0123456789/@.\""; + +for (let i = 0; i < mathTextSymbols.length; i++) { + const ch = mathTextSymbols.charAt(i); + defineSymbol(math, main, textord, ch, ch); +} // All of these are textords in text mode + + +const textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,"; + +for (let i = 0; i < textSymbols.length; i++) { + const ch = textSymbols.charAt(i); + defineSymbol(text$1, main, textord, ch, ch); +} // All of these are textords in text mode, and mathords in math mode + + +const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +for (let i = 0; i < letters.length; i++) { + const ch = letters.charAt(i); + defineSymbol(math, main, mathord, ch, ch); + defineSymbol(text$1, main, textord, ch, ch); +} // The next loop loads wide (surrogate pair) characters. +// We support some letters in the Unicode range U+1D400 to U+1D7FF, +// Mathematical Alphanumeric Symbols. +// Some editors do not deal well with wide characters. So don't write the +// string into this file. Instead, create the string from the surrogate pair. + + +let wideChar = ""; + +for (let i = 0; i < letters.length; i++) { + const ch = letters.charAt(i); // The hex numbers in the next line are a surrogate pair. + // 0xD835 is the high surrogate for all letters in the range we support. + // 0xDC00 is the low surrogate for bold A. + + wideChar = String.fromCharCode(0xD835, 0xDC00 + i); // A-Z a-z bold + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC34 + i); // A-Z a-z italic + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC68 + i); // A-Z a-z bold italic + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDD04 + i); // A-Z a-z Fractur + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDDA0 + i); // A-Z a-z sans-serif + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDDD4 + i); // A-Z a-z sans bold + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDE08 + i); // A-Z a-z sans italic + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDE70 + i); // A-Z a-z monospace + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + + if (i < 26) { + // KaTeX fonts have only capital letters for blackboard bold and script. + // See exception for k below. + wideChar = String.fromCharCode(0xD835, 0xDD38 + i); // A-Z double struck + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDC9C + i); // A-Z script + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + } // TODO: Add bold script when it is supported by a KaTeX font. + +} // "k" is the only double struck lower case letter in the KaTeX fonts. + + +wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck + +defineSymbol(math, main, mathord, "k", wideChar); +defineSymbol(text$1, main, textord, "k", wideChar); // Next, some wide character numerals + +for (let i = 0; i < 10; i++) { + const ch = i.toString(); + wideChar = String.fromCharCode(0xD835, 0xDFCE + i); // 0-9 bold + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFE2 + i); // 0-9 sans serif + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFEC + i); // 0-9 bold sans + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); + wideChar = String.fromCharCode(0xD835, 0xDFF6 + i); // 0-9 monospace + + defineSymbol(math, main, mathord, ch, wideChar); + defineSymbol(text$1, main, textord, ch, wideChar); +} // We add these Latin-1 letters as symbols for backwards-compatibility, +// but they are not actually in the font, nor are they supported by the +// Unicode accent mechanism, so they fall back to Times font and look ugly. +// TODO(edemaine): Fix this. + + +const extraLatin = "ÇÐÞçþ"; + +for (let i = 0; i < extraLatin.length; i++) { + const ch = extraLatin.charAt(i); + defineSymbol(math, main, mathord, ch, ch); + defineSymbol(text$1, main, textord, ch, ch); +} + +defineSymbol(text$1, main, textord, "ð", "ð"); // Unicode versions of existing characters + +defineSymbol(text$1, main, textord, "\u2013", "–"); +defineSymbol(text$1, main, textord, "\u2014", "—"); +defineSymbol(text$1, main, textord, "\u2018", "‘"); +defineSymbol(text$1, main, textord, "\u2019", "’"); +defineSymbol(text$1, main, textord, "\u201c", "“"); +defineSymbol(text$1, main, textord, "\u201d", "”"); + +/** + * This file provides support for Unicode range U+1D400 to U+1D7FF, + * Mathematical Alphanumeric Symbols. + * + * Function wideCharacterFont takes a wide character as input and returns + * the font information necessary to render it properly. + */ +/** + * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf + * That document sorts characters into groups by font type, say bold or italic. + * + * In the arrays below, each subarray consists three elements: + * * The CSS class of that group when in math mode. + * * The CSS class of that group when in text mode. + * * The font name, so that KaTeX can get font metrics. + */ + +const wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright +["mathbf", "textbf", "Main-Bold"], // a-z bold upright +["mathdefault", "textit", "Math-Italic"], // A-Z italic +["mathdefault", "textit", "Math-Italic"], // a-z italic +["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic +["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic +// Map fancy A-Z letters to script, not calligraphic. +// This aligns with unicode-math and math fonts (except Cambria Math). +["mathscr", "textscr", "Script-Regular"], // A-Z script +["", "", ""], // a-z script. No font +["", "", ""], // A-Z bold script. No font +["", "", ""], // a-z bold script. No font +["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur +["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur +["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck +["mathbb", "textbb", "AMS-Regular"], // k double-struck +["", "", ""], // A-Z bold Fraktur No font metrics +["", "", ""], // a-z bold Fraktur. No font. +["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif +["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif +["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif +["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif +["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif +["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif +["", "", ""], // A-Z bold italic sans. No font +["", "", ""], // a-z bold italic sans. No font +["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace +["mathtt", "texttt", "Typewriter-Regular"]]; +const wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold +["", "", ""], // 0-9 double-struck. No KaTeX font. +["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif +["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif +["mathtt", "texttt", "Typewriter-Regular"]]; +const wideCharacterFont = function wideCharacterFont(wideChar, mode) { + // IE doesn't support codePointAt(). So work with the surrogate pair. + const H = wideChar.charCodeAt(0); // high surrogate + + const L = wideChar.charCodeAt(1); // low surrogate + + const codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000; + const j = mode === "math" ? 0 : 1; // column index for CSS class. + + if (0x1D400 <= codePoint && codePoint < 0x1D6A4) { + // wideLatinLetterData contains exactly 26 chars on each row. + // So we can calculate the relevant row. No traverse necessary. + const i = Math.floor((codePoint - 0x1D400) / 26); + return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; + } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) { + // Numerals, ten per row. + const i = Math.floor((codePoint - 0x1D7CE) / 10); + return [wideNumeralData[i][2], wideNumeralData[i][j]]; + } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) { + // dotless i or j + return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; + } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) { + // Greek letters. Not supported, yet. + return ["", ""]; + } else { + // We don't support any wide characters outside 1D400–1D7FF. + throw new ParseError("Unsupported character: " + wideChar); + } +}; + +/** + * This file contains information about the options that the Parser carries + * around with it while parsing. Data is held in an `Options` object, and when + * recursing, a new `Options` object can be created with the `.with*` and + * `.reset` functions. + */ +const sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize]. +// The size mappings are taken from TeX with \normalsize=10pt. +[1, 1, 1], // size1: [5, 5, 5] \tiny +[2, 1, 1], // size2: [6, 5, 5] +[3, 1, 1], // size3: [7, 5, 5] \scriptsize +[4, 2, 1], // size4: [8, 6, 5] \footnotesize +[5, 2, 1], // size5: [9, 6, 5] \small +[6, 3, 1], // size6: [10, 7, 5] \normalsize +[7, 4, 2], // size7: [12, 8, 6] \large +[8, 6, 3], // size8: [14.4, 10, 7] \Large +[9, 7, 6], // size9: [17.28, 12, 10] \LARGE +[10, 8, 7], // size10: [20.74, 14.4, 12] \huge +[11, 10, 9]]; +const sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if +// you change size indexes, change that function. +0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488]; + +const sizeAtStyle = function sizeAtStyle(size, style) { + return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; +}; + +/** + * This is the main options class. It contains the current style, size, color, + * and font. + * + * Options objects should not be modified. To create a new Options with + * different properties, call a `.having*` method. + */ +class Options { + // A font family applies to a group of fonts (i.e. SansSerif), while a font + // represents a specific font (i.e. SansSerif Bold). + // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm + + /** + * The base size index. + */ + constructor(data) { + this.style = void 0; + this.color = void 0; + this.size = void 0; + this.textSize = void 0; + this.phantom = void 0; + this.font = void 0; + this.fontFamily = void 0; + this.fontWeight = void 0; + this.fontShape = void 0; + this.sizeMultiplier = void 0; + this.maxSize = void 0; + this._fontMetrics = void 0; + this.style = data.style; + this.color = data.color; + this.size = data.size || Options.BASESIZE; + this.textSize = data.textSize || this.size; + this.phantom = !!data.phantom; + this.font = data.font || ""; + this.fontFamily = data.fontFamily || ""; + this.fontWeight = data.fontWeight || ''; + this.fontShape = data.fontShape || ''; + this.sizeMultiplier = sizeMultipliers[this.size - 1]; + this.maxSize = data.maxSize; + this._fontMetrics = undefined; + } + /** + * Returns a new options object with the same properties as "this". Properties + * from "extension" will be copied to the new options object. + */ + + + extend(extension) { + const data = { + style: this.style, + size: this.size, + textSize: this.textSize, + color: this.color, + phantom: this.phantom, + font: this.font, + fontFamily: this.fontFamily, + fontWeight: this.fontWeight, + fontShape: this.fontShape, + maxSize: this.maxSize + }; + + for (const key in extension) { + if (extension.hasOwnProperty(key)) { + data[key] = extension[key]; + } + } + + return new Options(data); + } + /** + * Return an options object with the given style. If `this.style === style`, + * returns `this`. + */ + + + havingStyle(style) { + if (this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: sizeAtStyle(this.textSize, style) + }); + } + } + /** + * Return an options object with a cramped version of the current style. If + * the current style is cramped, returns `this`. + */ + + + havingCrampedStyle() { + return this.havingStyle(this.style.cramp()); + } + /** + * Return an options object with the given size and in at least `\textstyle`. + * Returns `this` if appropriate. + */ + + + havingSize(size) { + if (this.size === size && this.textSize === size) { + return this; + } else { + return this.extend({ + style: this.style.text(), + size: size, + textSize: size, + sizeMultiplier: sizeMultipliers[size - 1] + }); + } + } + /** + * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, + * changes to at least `\textstyle`. + */ + + + havingBaseStyle(style) { + style = style || this.style.text(); + const wantSize = sizeAtStyle(Options.BASESIZE, style); + + if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: wantSize + }); + } + } + /** + * Remove the effect of sizing changes such as \Huge. + * Keep the effect of the current style, such as \scriptstyle. + */ + + + havingBaseSizing() { + let size; + + switch (this.style.id) { + case 4: + case 5: + size = 3; // normalsize in scriptstyle + + break; + + case 6: + case 7: + size = 1; // normalsize in scriptscriptstyle + + break; + + default: + size = 6; + // normalsize in textstyle or displaystyle + } + + return this.extend({ + style: this.style.text(), + size: size + }); + } + /** + * Create a new options object with the given color. + */ + + + withColor(color) { + return this.extend({ + color: color + }); + } + /** + * Create a new options object with "phantom" set to true. + */ + + + withPhantom() { + return this.extend({ + phantom: true + }); + } + /** + * Creates a new options object with the given math font or old text font. + * @type {[type]} + */ + + + withFont(font) { + return this.extend({ + font + }); + } + /** + * Create a new options objects with the given fontFamily. + */ + + + withTextFontFamily(fontFamily) { + return this.extend({ + fontFamily, + font: "" + }); + } + /** + * Creates a new options object with the given font weight + */ + + + withTextFontWeight(fontWeight) { + return this.extend({ + fontWeight, + font: "" + }); + } + /** + * Creates a new options object with the given font weight + */ + + + withTextFontShape(fontShape) { + return this.extend({ + fontShape, + font: "" + }); + } + /** + * Return the CSS sizing classes required to switch from enclosing options + * `oldOptions` to `this`. Returns an array of classes. + */ + + + sizingClasses(oldOptions) { + if (oldOptions.size !== this.size) { + return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; + } else { + return []; + } + } + /** + * Return the CSS sizing classes required to switch to the base size. Like + * `this.havingSize(BASESIZE).sizingClasses(this)`. + */ + + + baseSizingClasses() { + if (this.size !== Options.BASESIZE) { + return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE]; + } else { + return []; + } + } + /** + * Return the font metrics for this size. + */ + + + fontMetrics() { + if (!this._fontMetrics) { + this._fontMetrics = getGlobalMetrics(this.size); + } + + return this._fontMetrics; + } + /** + * A map of color names to CSS colors. + * TODO(emily): Remove this when we have real macros + */ + + + /** + * Gets the CSS color of the current options object, accounting for the + * `colorMap`. + */ + getColor() { + if (this.phantom) { + return "transparent"; + } else if (this.color != null && Options.colorMap.hasOwnProperty(this.color)) { + return Options.colorMap[this.color]; + } else { + return this.color; + } + } + +} + +Options.BASESIZE = 6; +Options.colorMap = { + "katex-blue": "#6495ed", + "katex-orange": "#ffa500", + "katex-pink": "#ff00af", + "katex-red": "#df0030", + "katex-green": "#28ae7b", + "katex-gray": "gray", + "katex-purple": "#9d38bd", + "katex-blueA": "#ccfaff", + "katex-blueB": "#80f6ff", + "katex-blueC": "#63d9ea", + "katex-blueD": "#11accd", + "katex-blueE": "#0c7f99", + "katex-tealA": "#94fff5", + "katex-tealB": "#26edd5", + "katex-tealC": "#01d1c1", + "katex-tealD": "#01a995", + "katex-tealE": "#208170", + "katex-greenA": "#b6ffb0", + "katex-greenB": "#8af281", + "katex-greenC": "#74cf70", + "katex-greenD": "#1fab54", + "katex-greenE": "#0d923f", + "katex-goldA": "#ffd0a9", + "katex-goldB": "#ffbb71", + "katex-goldC": "#ff9c39", + "katex-goldD": "#e07d10", + "katex-goldE": "#a75a05", + "katex-redA": "#fca9a9", + "katex-redB": "#ff8482", + "katex-redC": "#f9685d", + "katex-redD": "#e84d39", + "katex-redE": "#bc2612", + "katex-maroonA": "#ffbde0", + "katex-maroonB": "#ff92c6", + "katex-maroonC": "#ed5fa6", + "katex-maroonD": "#ca337c", + "katex-maroonE": "#9e034e", + "katex-purpleA": "#ddd7ff", + "katex-purpleB": "#c6b9fc", + "katex-purpleC": "#aa87ff", + "katex-purpleD": "#7854ab", + "katex-purpleE": "#543b78", + "katex-mintA": "#f5f9e8", + "katex-mintB": "#edf2df", + "katex-mintC": "#e0e5cc", + "katex-grayA": "#f6f7f7", + "katex-grayB": "#f0f1f2", + "katex-grayC": "#e3e5e6", + "katex-grayD": "#d6d8da", + "katex-grayE": "#babec2", + "katex-grayF": "#888d93", + "katex-grayG": "#626569", + "katex-grayH": "#3b3e40", + "katex-grayI": "#21242c", + "katex-kaBlue": "#314453", + "katex-kaGreen": "#71B307" +}; + +/** + * This file does conversion between units. In particular, it provides + * calculateSize to convert other units into ems. + */ +// Thus, multiplying a length by this number converts the length from units +// into pts. Dividing the result by ptPerEm gives the number of ems +// *assuming* a font size of ptPerEm (normal size, normal style). + +const ptPerUnit = { + // https://en.wikibooks.org/wiki/LaTeX/Lengths and + // https://tex.stackexchange.com/a/8263 + "pt": 1, + // TeX point + "mm": 7227 / 2540, + // millimeter + "cm": 7227 / 254, + // centimeter + "in": 72.27, + // inch + "bp": 803 / 800, + // big (PostScript) points + "pc": 12, + // pica + "dd": 1238 / 1157, + // didot + "cc": 14856 / 1157, + // cicero (12 didot) + "nd": 685 / 642, + // new didot + "nc": 1370 / 107, + // new cicero (12 new didot) + "sp": 1 / 65536, + // scaled point (TeX's internal smallest unit) + // https://tex.stackexchange.com/a/41371 + "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX + +}; // Dictionary of relative units, for fast validity testing. + +const relativeUnit = { + "ex": true, + "em": true, + "mu": true +}; + +/** + * Determine whether the specified unit (either a string defining the unit + * or a "size" parse node containing a unit field) is valid. + */ +const validUnit = function validUnit(unit) { + if (typeof unit !== "string") { + unit = unit.unit; + } + + return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; +}; +/* + * Convert a "size" parse node (with numeric "number" and string "unit" fields, + * as parsed by functions.js argType "size") into a CSS em value for the + * current style/scale. `options` gives the current options. + */ + +const calculateSize = function calculateSize(sizeValue, options) { + let scale; + + if (sizeValue.unit in ptPerUnit) { + // Absolute units + scale = ptPerUnit[sizeValue.unit] // Convert unit to pt + / options.fontMetrics().ptPerEm // Convert pt to CSS em + / options.sizeMultiplier; // Unscale to make absolute units + } else if (sizeValue.unit === "mu") { + // `mu` units scale with scriptstyle/scriptscriptstyle. + scale = options.fontMetrics().cssEmPerMu; + } else { + // Other relative units always refer to the *textstyle* font + // in the current size. + let unitOptions; + + if (options.style.isTight()) { + // isTight() means current style is script/scriptscript. + unitOptions = options.havingStyle(options.style.text()); + } else { + unitOptions = options; + } // TODO: In TeX these units are relative to the quad of the current + // *text* font, e.g. cmr10. KaTeX instead uses values from the + // comparably-sized *Computer Modern symbol* font. At 10pt, these + // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641; + // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$. + // TeX \showlists shows a kern of 1.13889 * fontsize; + // KaTeX shows a kern of 1.171 * fontsize. + + + if (sizeValue.unit === "ex") { + scale = unitOptions.fontMetrics().xHeight; + } else if (sizeValue.unit === "em") { + scale = unitOptions.fontMetrics().quad; + } else { + throw new ParseError("Invalid unit: '" + sizeValue.unit + "'"); + } + + if (unitOptions !== options) { + scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; + } + } + + return Math.min(sizeValue.number * scale, options.maxSize); +}; + +/* eslint no-console:0 */ +// The following have to be loaded from Main-Italic font, using class mathit +const mathitLetters = ["\\imath", "ı", // dotless i +"\\jmath", "ȷ", // dotless j +"\\pounds", "\\mathsterling", "\\textsterling", "£"]; +/** + * Looks up the given symbol in fontMetrics, after applying any symbol + * replacements defined in symbol.js + */ + +const lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this. +fontName, mode) { + // Replace the value with its replaced value from symbol.js + if (symbols[mode][value] && symbols[mode][value].replace) { + value = symbols[mode][value].replace; + } + + return { + value: value, + metrics: getCharacterMetrics(value, fontName, mode) + }; +}; +/** + * Makes a symbolNode after translation via the list of symbols in symbols.js. + * Correctly pulls out metrics for the character, and optionally takes a list of + * classes to be attached to the node. + * + * TODO: make argument order closer to makeSpan + * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which + * should if present come first in `classes`. + * TODO(#953): Make `options` mandatory and always pass it in. + */ + + +const makeSymbol = function makeSymbol(value, fontName, mode, options, classes) { + const lookup = lookupSymbol(value, fontName, mode); + const metrics = lookup.metrics; + value = lookup.value; + let symbolNode; + + if (metrics) { + let italic = metrics.italic; + + if (mode === "text" || options && options.font === "mathit") { + italic = 0; + } + + symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes); + } else { + // TODO(emily): Figure out a good way to only print this in development + typeof console !== "undefined" && console.warn("No character metrics for '" + value + "' in style '" + fontName + "'"); + symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes); + } + + if (options) { + symbolNode.maxFontSize = options.sizeMultiplier; + + if (options.style.isTight()) { + symbolNode.classes.push("mtight"); + } + + const color = options.getColor(); + + if (color) { + symbolNode.style.color = color; + } + } + + return symbolNode; +}; +/** + * Makes a symbol in Main-Regular or AMS-Regular. + * Used for rel, bin, open, close, inner, and punct. + * + * TODO(#953): Make `options` mandatory and always pass it in. + */ + + +const mathsym = function mathsym(value, mode, options, classes = []) { + // Decide what font to render the symbol in by its entry in the symbols + // table. + // Have a special case for when the value = \ because the \ is used as a + // textord in unsupported command errors but cannot be parsed as a regular + // text ordinal and is therefore not present as a symbol in the symbols + // table for text, as well as a special case for boldsymbol because it + // can be used for bold + and - + if (options && options.font && options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) { + return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"])); + } else if (value === "\\" || symbols[mode][value].font === "main") { + return makeSymbol(value, "Main-Regular", mode, options, classes); + } else { + return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"])); + } +}; +/** + * Determines which of the two font names (Main-Italic and Math-Italic) and + * corresponding style tags (maindefault or mathit) to use for default math font, + * depending on the symbol. + */ + + +const mathdefault = function mathdefault(value, mode, options, classes) { + if (/[0-9]/.test(value.charAt(0)) || // glyphs for \imath and \jmath do not exist in Math-Italic so we + // need to use Main-Italic instead + utils.contains(mathitLetters, value)) { + return { + fontName: "Main-Italic", + fontClass: "mathit" + }; + } else { + return { + fontName: "Math-Italic", + fontClass: "mathdefault" + }; + } +}; +/** + * Determines which of the font names (Main-Italic, Math-Italic, and Caligraphic) + * and corresponding style tags (mathit, mathdefault, or mathcal) to use for font + * "mathnormal", depending on the symbol. Use this function instead of fontMap for + * font "mathnormal". + */ + + +const mathnormal = function mathnormal(value, mode, options, classes) { + if (utils.contains(mathitLetters, value)) { + return { + fontName: "Main-Italic", + fontClass: "mathit" + }; + } else if (/[0-9]/.test(value.charAt(0))) { + return { + fontName: "Caligraphic-Regular", + fontClass: "mathcal" + }; + } else { + return { + fontName: "Math-Italic", + fontClass: "mathdefault" + }; + } +}; +/** + * Determines which of the two font names (Main-Bold and Math-BoldItalic) and + * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol", + * depending on the symbol. Use this function instead of fontMap for font + * "boldsymbol". + */ + + +const boldsymbol = function boldsymbol(value, mode, options, classes) { + if (lookupSymbol(value, "Math-BoldItalic", mode).metrics) { + return { + fontName: "Math-BoldItalic", + fontClass: "boldsymbol" + }; + } else { + // Some glyphs do not exist in Math-BoldItalic so we need to use + // Main-Bold instead. + return { + fontName: "Main-Bold", + fontClass: "mathbf" + }; + } +}; +/** + * Makes either a mathord or textord in the correct font and color. + */ + + +const makeOrd = function makeOrd(group, options, type) { + const mode = group.mode; + const text = group.text; + const classes = ["mord"]; // Math mode or Old font (i.e. \rm) + + const isFont = mode === "math" || mode === "text" && options.font; + const fontOrFamily = isFont ? options.font : options.fontFamily; + + if (text.charCodeAt(0) === 0xD835) { + // surrogate pairs get special treatment + const _wideCharacterFont = wideCharacterFont(text, mode), + wideFontName = _wideCharacterFont[0], + wideFontClass = _wideCharacterFont[1]; + + return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass)); + } else if (fontOrFamily) { + let fontName; + let fontClasses; + + if (fontOrFamily === "boldsymbol" || fontOrFamily === "mathnormal") { + const fontData = fontOrFamily === "boldsymbol" ? boldsymbol(text, mode, options, classes) : mathnormal(text, mode, options, classes); + fontName = fontData.fontName; + fontClasses = [fontData.fontClass]; + } else if (utils.contains(mathitLetters, text)) { + fontName = "Main-Italic"; + fontClasses = ["mathit"]; + } else if (isFont) { + fontName = fontMap[fontOrFamily].fontName; + fontClasses = [fontOrFamily]; + } else { + fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape); + fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; + } + + if (lookupSymbol(text, fontName, mode).metrics) { + return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses)); + } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") { + // Deconstruct ligatures in monospace fonts (\texttt, \tt). + const parts = []; + + for (let i = 0; i < text.length; i++) { + parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses))); + } + + return makeFragment(parts); + } + } // Makes a symbol in the default font for mathords and textords. + + + if (type === "mathord") { + const fontLookup = mathdefault(text, mode, options, classes); + return makeSymbol(text, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass])); + } else if (type === "textord") { + const font = symbols[mode][text] && symbols[mode][text].font; + + if (font === "ams") { + const fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape); + return makeSymbol(text, fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape)); + } else if (font === "main" || !font) { + const fontName = retrieveTextFontName("textrm", options.fontWeight, options.fontShape); + return makeSymbol(text, fontName, mode, options, classes.concat(options.fontWeight, options.fontShape)); + } else { + // fonts added by plugins + const fontName = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class + + return makeSymbol(text, fontName, mode, options, classes.concat(fontName, options.fontWeight, options.fontShape)); + } + } else { + throw new Error("unexpected type: " + type + " in makeOrd"); + } +}; +/** + * Returns true if subsequent symbolNodes have the same classes, skew, maxFont, + * and styles. + */ + + +const canCombine = (prev, next) => { + if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) { + return false; + } + + for (const style in prev.style) { + if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { + return false; + } + } + + for (const style in next.style) { + if (next.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) { + return false; + } + } + + return true; +}; +/** + * Combine consequetive domTree.symbolNodes into a single symbolNode. + * Note: this function mutates the argument. + */ + + +const tryCombineChars = chars => { + for (let i = 0; i < chars.length - 1; i++) { + const prev = chars[i]; + const next = chars[i + 1]; + + if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) { + prev.text += next.text; + prev.height = Math.max(prev.height, next.height); + prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use + // it to add padding to the right of the span created from + // the combined characters. + + prev.italic = next.italic; + chars.splice(i + 1, 1); + i--; + } + } + + return chars; +}; +/** + * Calculate the height, depth, and maxFontSize of an element based on its + * children. + */ + + +const sizeElementFromChildren = function sizeElementFromChildren(elem) { + let height = 0; + let depth = 0; + let maxFontSize = 0; + + for (let i = 0; i < elem.children.length; i++) { + const child = elem.children[i]; + + if (child.height > height) { + height = child.height; + } + + if (child.depth > depth) { + depth = child.depth; + } + + if (child.maxFontSize > maxFontSize) { + maxFontSize = child.maxFontSize; + } + } + + elem.height = height; + elem.depth = depth; + elem.maxFontSize = maxFontSize; +}; +/** + * Makes a span with the given list of classes, list of children, and options. + * + * TODO(#953): Ensure that `options` is always provided (currently some call + * sites don't pass it) and make the type below mandatory. + * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which + * should if present come first in `classes`. + */ + + +const makeSpan = function makeSpan(classes, children, options, style) { + const span = new Span(classes, children, options, style); + sizeElementFromChildren(span); + return span; +}; // SVG one is simpler -- doesn't require height, depth, max-font setting. +// This is also a separate method for typesafety. + + +const makeSvgSpan = (classes, children, options, style) => new Span(classes, children, options, style); + +const makeLineSpan = function makeLineSpan(className, options, thickness) { + const line = makeSpan([className], [], options); + line.height = thickness || options.fontMetrics().defaultRuleThickness; + line.style.borderBottomWidth = line.height + "em"; + line.maxFontSize = 1.0; + return line; +}; +/** + * Makes an anchor with the given href, list of classes, list of children, + * and options. + */ + + +const makeAnchor = function makeAnchor(href, classes, children, options) { + const anchor = new Anchor(href, classes, children, options); + sizeElementFromChildren(anchor); + return anchor; +}; +/** + * Makes a document fragment with the given list of children. + */ + + +const makeFragment = function makeFragment(children) { + const fragment = new DocumentFragment(children); + sizeElementFromChildren(fragment); + return fragment; +}; +/** + * Wraps group in a span if it's a document fragment, allowing to apply classes + * and styles + */ + + +const wrapFragment = function wrapFragment(group, options) { + if (group instanceof DocumentFragment) { + return makeSpan([], [group], options); + } + + return group; +}; // These are exact object types to catch typos in the names of the optional fields. + + +// Computes the updated `children` list and the overall depth. +// +// This helper function for makeVList makes it easier to enforce type safety by +// allowing early exits (returns) in the logic. +const getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { + if (params.positionType === "individualShift") { + const oldChildren = params.children; + const children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be + // shifted to the correct specified shift + + const depth = -oldChildren[0].shift - oldChildren[0].elem.depth; + let currPos = depth; + + for (let i = 1; i < oldChildren.length; i++) { + const diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; + const size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); + currPos = currPos + diff; + children.push({ + type: "kern", + size + }); + children.push(oldChildren[i]); + } + + return { + children, + depth + }; + } + + let depth; + + if (params.positionType === "top") { + // We always start at the bottom, so calculate the bottom by adding up + // all the sizes + let bottom = params.positionData; + + for (let i = 0; i < params.children.length; i++) { + const child = params.children[i]; + bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; + } + + depth = bottom; + } else if (params.positionType === "bottom") { + depth = -params.positionData; + } else { + const firstChild = params.children[0]; + + if (firstChild.type !== "elem") { + throw new Error('First child must have type "elem".'); + } + + if (params.positionType === "shift") { + depth = -firstChild.elem.depth - params.positionData; + } else if (params.positionType === "firstBaseline") { + depth = -firstChild.elem.depth; + } else { + throw new Error(`Invalid positionType ${params.positionType}.`); + } + } + + return { + children: params.children, + depth + }; +}; +/** + * Makes a vertical list by stacking elements and kerns on top of each other. + * Allows for many different ways of specifying the positioning method. + * + * See VListParam documentation above. + */ + + +const makeVList = function makeVList(params, options) { + const _getVListChildrenAndD = getVListChildrenAndDepth(params), + children = _getVListChildrenAndD.children, + depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to + // each item, where it will determine the item's baseline. Since it has + // `overflow:hidden`, the strut's top edge will sit on the item's line box's + // top edge and the strut's bottom edge will sit on the item's baseline, + // with no additional line-height spacing. This allows the item baseline to + // be positioned precisely without worrying about font ascent and + // line-height. + + + let pstrutSize = 0; + + for (let i = 0; i < children.length; i++) { + const child = children[i]; + + if (child.type === "elem") { + const elem = child.elem; + pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); + } + } + + pstrutSize += 2; + const pstrut = makeSpan(["pstrut"], []); + pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets + + const realChildren = []; + let minPos = depth; + let maxPos = depth; + let currPos = depth; + + for (let i = 0; i < children.length; i++) { + const child = children[i]; + + if (child.type === "kern") { + currPos += child.size; + } else { + const elem = child.elem; + const classes = child.wrapperClasses || []; + const style = child.wrapperStyle || {}; + const childWrap = makeSpan(classes, [pstrut, elem], undefined, style); + childWrap.style.top = -pstrutSize - currPos - elem.depth + "em"; + + if (child.marginLeft) { + childWrap.style.marginLeft = child.marginLeft; + } + + if (child.marginRight) { + childWrap.style.marginRight = child.marginRight; + } + + realChildren.push(childWrap); + currPos += elem.height + elem.depth; + } + + minPos = Math.min(minPos, currPos); + maxPos = Math.max(maxPos, currPos); + } // The vlist contents go in a table-cell with `vertical-align:bottom`. + // This cell's bottom edge will determine the containing table's baseline + // without overly expanding the containing line-box. + + + const vlist = makeSpan(["vlist"], realChildren); + vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth. + + let rows; + + if (minPos < 0) { + // We will define depth in an empty span with display: table-cell. + // It should render with the height that we define. But Chrome, in + // contenteditable mode only, treats that span as if it contains some + // text content. And that min-height over-rides our desired height. + // So we put another empty span inside the depth strut span. + const emptySpan = makeSpan([], []); + const depthStrut = makeSpan(["vlist"], [emptySpan]); + depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it + // puts the bottom of the *second* row on the baseline. + + const topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200b")]); + rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])]; + } else { + rows = [makeSpan(["vlist-r"], [vlist])]; + } + + const vtable = makeSpan(["vlist-t"], rows); + + if (rows.length === 2) { + vtable.classes.push("vlist-t2"); + } + + vtable.height = maxPos; + vtable.depth = -minPos; + return vtable; +}; // Glue is a concept from TeX which is a flexible space between elements in +// either a vertical or horizontal list. In KaTeX, at least for now, it's +// static space between elements in a horizontal layout. + + +const makeGlue = (measurement, options) => { + // Make an empty span for the space + const rule = makeSpan(["mspace"], [], options); + const size = calculateSize(measurement, options); + rule.style.marginRight = `${size}em`; + return rule; +}; // Takes font options, and returns the appropriate fontLookup name + + +const retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) { + let baseFontName = ""; + + switch (fontFamily) { + case "amsrm": + baseFontName = "AMS"; + break; + + case "textrm": + baseFontName = "Main"; + break; + + case "textsf": + baseFontName = "SansSerif"; + break; + + case "texttt": + baseFontName = "Typewriter"; + break; + + default: + baseFontName = fontFamily; + // use fonts added by a plugin + } + + let fontStylesName; + + if (fontWeight === "textbf" && fontShape === "textit") { + fontStylesName = "BoldItalic"; + } else if (fontWeight === "textbf") { + fontStylesName = "Bold"; + } else if (fontWeight === "textit") { + fontStylesName = "Italic"; + } else { + fontStylesName = "Regular"; + } + + return `${baseFontName}-${fontStylesName}`; +}; +/** + * Maps TeX font commands to objects containing: + * - variant: string used for "mathvariant" attribute in buildMathML.js + * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics + */ +// A map between tex font commands an MathML mathvariant attribute values + + +const fontMap = { + // styles + "mathbf": { + variant: "bold", + fontName: "Main-Bold" + }, + "mathrm": { + variant: "normal", + fontName: "Main-Regular" + }, + "textit": { + variant: "italic", + fontName: "Main-Italic" + }, + "mathit": { + variant: "italic", + fontName: "Main-Italic" + }, + // Default math font, "mathnormal" and "boldsymbol" are missing because they + // require the use of several fonts: Main-Italic and Math-Italic for default + // math font, Main-Italic, Math-Italic, Caligraphic for "mathnormal", and + // Math-BoldItalic and Main-Bold for "boldsymbol". This is handled by a + // special case in makeOrd which ends up calling mathdefault, mathnormal, + // and boldsymbol. + // families + "mathbb": { + variant: "double-struck", + fontName: "AMS-Regular" + }, + "mathcal": { + variant: "script", + fontName: "Caligraphic-Regular" + }, + "mathfrak": { + variant: "fraktur", + fontName: "Fraktur-Regular" + }, + "mathscr": { + variant: "script", + fontName: "Script-Regular" + }, + "mathsf": { + variant: "sans-serif", + fontName: "SansSerif-Regular" + }, + "mathtt": { + variant: "monospace", + fontName: "Typewriter-Regular" + } +}; +const svgData = { + // path, width, height + vec: ["vec", 0.471, 0.714], + // values from the font glyph + oiintSize1: ["oiintSize1", 0.957, 0.499], + // oval to overlay the integrand + oiintSize2: ["oiintSize2", 1.472, 0.659], + oiiintSize1: ["oiiintSize1", 1.304, 0.499], + oiiintSize2: ["oiiintSize2", 1.98, 0.659] +}; + +const staticSvg = function staticSvg(value, options) { + // Create a span with inline SVG for the element. + const _svgData$value = svgData[value], + pathName = _svgData$value[0], + width = _svgData$value[1], + height = _svgData$value[2]; + const path = new PathNode(pathName); + const svgNode = new SvgNode([path], { + "width": width + "em", + "height": height + "em", + // Override CSS rule `.katex svg { width: 100% }` + "style": "width:" + width + "em", + "viewBox": "0 0 " + 1000 * width + " " + 1000 * height, + "preserveAspectRatio": "xMinYMin" + }); + const span = makeSvgSpan(["overlay"], [svgNode], options); + span.height = height; + span.style.height = height + "em"; + span.style.width = width + "em"; + return span; +}; + +var buildCommon = { + fontMap, + makeSymbol, + mathsym, + makeSpan, + makeSvgSpan, + makeLineSpan, + makeAnchor, + makeFragment, + wrapFragment, + makeVList, + makeOrd, + makeGlue, + staticSvg, + svgData, + tryCombineChars +}; + +/** + * Asserts that the node is of the given type and returns it with stricter + * typing. Throws if the node's type does not match. + */ +function assertNodeType(node, type) { + const typedNode = checkNodeType(node, type); + + if (!typedNode) { + throw new Error(`Expected node of type ${type}, but got ` + (node ? `node of type ${node.type}` : String(node))); + } // $FlowFixMe: Unsure why. + + + return typedNode; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function checkNodeType(node, type) { + if (node && node.type === type) { + // The definition of ParseNode doesn't communicate to flow that + // `type: TYPE` (as that's not explicitly mentioned anywhere), though that + // happens to be true for all our value types. + // $FlowFixMe + return node; + } + + return null; +} +/** + * Asserts that the node is of the given type and returns it with stricter + * typing. Throws if the node's type does not match. + */ + +function assertAtomFamily(node, family) { + const typedNode = checkAtomFamily(node, family); + + if (!typedNode) { + throw new Error(`Expected node of type "atom" and family "${family}", but got ` + (node ? node.type === "atom" ? `atom of family ${node.family}` : `node of type ${node.type}` : String(node))); + } + + return typedNode; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function checkAtomFamily(node, family) { + return node && node.type === "atom" && node.family === family ? node : null; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function assertSymbolNodeType(node) { + const typedNode = checkSymbolNodeType(node); + + if (!typedNode) { + throw new Error(`Expected node of symbol group type, but got ` + (node ? `node of type ${node.type}` : String(node))); + } + + return typedNode; +} +/** + * Returns the node more strictly typed iff it is of the given type. Otherwise, + * returns null. + */ + +function checkSymbolNodeType(node) { + if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { + // $FlowFixMe + return node; + } + + return null; +} + +/** + * Describes spaces between different classes of atoms. + */ +const thinspace = { + number: 3, + unit: "mu" +}; +const mediumspace = { + number: 4, + unit: "mu" +}; +const thickspace = { + number: 5, + unit: "mu" +}; // Making the type below exact with all optional fields doesn't work due to +// - https://github.com/facebook/flow/issues/4582 +// - https://github.com/facebook/flow/issues/5688 +// However, since *all* fields are optional, $Shape<> works as suggested in 5688 +// above. + +// Spacing relationships for display and text styles +const spacings = { + mord: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + minner: thinspace + }, + mbin: { + mord: mediumspace, + mop: mediumspace, + mopen: mediumspace, + minner: mediumspace + }, + mrel: { + mord: thickspace, + mop: thickspace, + mopen: thickspace, + minner: thickspace + }, + mopen: {}, + mclose: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mpunct: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + mopen: thinspace, + mclose: thinspace, + mpunct: thinspace, + minner: thinspace + }, + minner: { + mord: thinspace, + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + mopen: thinspace, + mpunct: thinspace, + minner: thinspace + } +}; // Spacing relationships for script and scriptscript styles + +const tightSpacings = { + mord: { + mop: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace + }, + mbin: {}, + mrel: {}, + mopen: {}, + mclose: { + mop: thinspace + }, + mpunct: {}, + minner: { + mop: thinspace + } +}; + +/** + * All registered functions. + * `functions.js` just exports this same dictionary again and makes it public. + * `Parser.js` requires this dictionary. + */ +const _functions = {}; +/** + * All HTML builders. Should be only used in the `define*` and the `build*ML` + * functions. + */ + +const _htmlGroupBuilders = {}; +/** + * All MathML builders. Should be only used in the `define*` and the `build*ML` + * functions. + */ + +const _mathmlGroupBuilders = {}; +function defineFunction({ + type, + nodeType, + names, + props, + handler, + htmlBuilder, + mathmlBuilder +}) { + // Set default values of functions + const data = { + type, + numArgs: props.numArgs, + argTypes: props.argTypes, + greediness: props.greediness === undefined ? 1 : props.greediness, + allowedInText: !!props.allowedInText, + allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath, + numOptionalArgs: props.numOptionalArgs || 0, + infix: !!props.infix, + consumeMode: props.consumeMode, + handler: handler + }; + + for (let i = 0; i < names.length; ++i) { + // TODO: The value type of _functions should be a type union of all + // possible `FunctionSpec<>` possibilities instead of `FunctionSpec<*>`, + // which is an existential type. + // $FlowFixMe + _functions[names[i]] = data; + } + + if (type) { + if (htmlBuilder) { + _htmlGroupBuilders[type] = htmlBuilder; + } + + if (mathmlBuilder) { + _mathmlGroupBuilders[type] = mathmlBuilder; + } + } +} +/** + * Use this to register only the HTML and MathML builders for a function (e.g. + * if the function's ParseNode is generated in Parser.js rather than via a + * stand-alone handler provided to `defineFunction`). + */ + +function defineFunctionBuilders({ + type, + htmlBuilder, + mathmlBuilder +}) { + defineFunction({ + type, + names: [], + props: { + numArgs: 0 + }, + + handler() { + throw new Error('Should never be called.'); + }, + + htmlBuilder, + mathmlBuilder + }); +} // Since the corresponding buildHTML/buildMathML function expects a +// list of elements, we normalize for different kinds of arguments + +const ordargument = function ordargument(arg) { + const node = checkNodeType(arg, "ordgroup"); + return node ? node.body : [arg]; +}; + +/** + * This file does the main work of building a domTree structure from a parse + * tree. The entry point is the `buildHTML` function, which takes a parse tree. + * Then, the buildExpression, buildGroup, and various groupBuilders functions + * are called, to produce a final HTML tree. + */ +const makeSpan$1 = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`) +// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6, +// and the text before Rule 19. + +const isBinLeftCanceller = function isBinLeftCanceller(node, isRealGroup) { + // TODO: This code assumes that a node's math class is the first element + // of its `classes` array. A later cleanup should ensure this, for + // instance by changing the signature of `makeSpan`. + if (node) { + return utils.contains(["mbin", "mopen", "mrel", "mop", "mpunct"], getTypeOfDomTree(node, "right")); + } else { + return isRealGroup; + } +}; + +const isBinRightCanceller = function isBinRightCanceller(node, isRealGroup) { + if (node) { + return utils.contains(["mrel", "mclose", "mpunct"], getTypeOfDomTree(node, "left")); + } else { + return isRealGroup; + } +}; + +const styleMap = { + "display": Style$1.DISPLAY, + "text": Style$1.TEXT, + "script": Style$1.SCRIPT, + "scriptscript": Style$1.SCRIPTSCRIPT +}; +const DomEnum = { + mord: "mord", + mop: "mop", + mbin: "mbin", + mrel: "mrel", + mopen: "mopen", + mclose: "mclose", + mpunct: "mpunct", + minner: "minner" +}; + +/** + * Take a list of nodes, build them in order, and return a list of the built + * nodes. documentFragments are flattened into their contents, so the + * returned list contains no fragments. `isRealGroup` is true if `expression` + * is a real group (no atoms will be added on either side), as opposed to + * a partial group (e.g. one created by \color). `surrounding` is an array + * consisting type of nodes that will be added to the left and right. + */ +const buildExpression = function buildExpression(expression, options, isRealGroup, surrounding = [null, null]) { + // Parse expressions into `groups`. + const rawGroups = []; + + for (let i = 0; i < expression.length; i++) { + const output = buildGroup(expression[i], options); + + if (output instanceof DocumentFragment) { + const children = output.children; + rawGroups.push(...children); + } else { + rawGroups.push(output); + } + } // At this point `rawGroups` consists entirely of `symbolNode`s and `span`s. + // Ignore explicit spaces (e.g., \;, \,) when determining what implicit + // spacing should go between atoms of different classes, and add dummy + // spans for determining spacings between surrounding atoms. + + + const nonSpaces = [surrounding[0] ? makeSpan$1([surrounding[0]], [], options) : null, ...rawGroups.filter(group => group && group.classes[0] !== "mspace"), surrounding[1] ? makeSpan$1([surrounding[1]], [], options) : null]; // Before determining what spaces to insert, perform bin cancellation. + // Binary operators change to ordinary symbols in some contexts. + + for (let i = 1; i < nonSpaces.length - 1; i++) { + const nonSpacesI = assert(nonSpaces[i]); + const left = getOutermostNode(nonSpacesI, "left"); + + if (left.classes[0] === "mbin" && isBinLeftCanceller(nonSpaces[i - 1], isRealGroup)) { + left.classes[0] = "mord"; + } + + const right = getOutermostNode(nonSpacesI, "right"); + + if (right.classes[0] === "mbin" && isBinRightCanceller(nonSpaces[i + 1], isRealGroup)) { + right.classes[0] = "mord"; + } + } + + const groups = []; + let j = 0; + + for (let i = 0; i < rawGroups.length; i++) { + groups.push(rawGroups[i]); // For any group that is not a space, get the next non-space. Then + // lookup what implicit space should be placed between those atoms and + // add it to groups. + + if (rawGroups[i].classes[0] !== "mspace" && j < nonSpaces.length - 1) { + // if current non-space node is left dummy span, add a glue before + // first real non-space node + if (j === 0) { + groups.pop(); + i--; + } // Get the type of the current non-space node. If it's a document + // fragment, get the type of the rightmost node in the fragment. + + + const left = getTypeOfDomTree(nonSpaces[j], "right"); // Get the type of the next non-space node. If it's a document + // fragment, get the type of the leftmost node in the fragment. + + const right = getTypeOfDomTree(nonSpaces[j + 1], "left"); // We use buildExpression inside of sizingGroup, but it returns a + // document fragment of elements. sizingGroup sets `isRealGroup` + // to false to avoid processing spans multiple times. + + if (left && right && isRealGroup) { + const nonSpacesJp1 = assert(nonSpaces[j + 1]); + const space = isLeftTight(nonSpacesJp1) ? tightSpacings[left][right] : spacings[left][right]; + + if (space) { + let glueOptions = options; + + if (expression.length === 1) { + const node = checkNodeType(expression[0], "sizing") || checkNodeType(expression[0], "styling"); + + if (!node) ; else if (node.type === "sizing") { + glueOptions = options.havingSize(node.size); + } else if (node.type === "styling") { + glueOptions = options.havingStyle(styleMap[node.style]); + } + } + + groups.push(buildCommon.makeGlue(space, glueOptions)); + } + } + + j++; + } + } + + return groups; +}; // Return the outermost node of a domTree. + +const getOutermostNode = function getOutermostNode(node, side) { + if (node instanceof DocumentFragment || node instanceof Anchor) { + const children = node.children; + + if (children.length) { + if (side === "right") { + return getOutermostNode(children[children.length - 1], "right"); + } else if (side === "left") { + return getOutermostNode(children[0], "right"); + } + } + } + + return node; +}; // Return math atom class (mclass) of a domTree. + + +const getTypeOfDomTree = function getTypeOfDomTree(node, side) { + if (!node) { + return null; + } + + node = getOutermostNode(node, side); // This makes a lot of assumptions as to where the type of atom + // appears. We should do a better job of enforcing this. + + return DomEnum[node.classes[0]] || null; +}; // If `node` is an atom return whether it's been assigned the mtight class. +// If `node` is a document fragment, return the value of isLeftTight() for the +// leftmost node in the fragment. +// 'mtight' indicates that the node is script or scriptscript style. + +const isLeftTight = function isLeftTight(node) { + node = getOutermostNode(node, "left"); + return node.hasClass("mtight"); +}; +const makeNullDelimiter = function makeNullDelimiter(options, classes) { + const moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); + return makeSpan$1(classes.concat(moreClasses)); +}; +/** + * buildGroup is the function that takes a group and calls the correct groupType + * function for it. It also handles the interaction of size and style changes + * between parents and children. + */ + +const buildGroup = function buildGroup(group, options, baseOptions) { + if (!group) { + return makeSpan$1(); + } + + if (_htmlGroupBuilders[group.type]) { + // Call the groupBuilders function + let groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account + // for that size difference. + + if (baseOptions && options.size !== baseOptions.size) { + groupNode = makeSpan$1(options.sizingClasses(baseOptions), [groupNode], options); + const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; + groupNode.height *= multiplier; + groupNode.depth *= multiplier; + } + + return groupNode; + } else { + throw new ParseError("Got group of unknown type: '" + group.type + "'"); + } +}; +/** + * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`) + * into an unbreakable HTML node of class .base, with proper struts to + * guarantee correct vertical extent. `buildHTML` calls this repeatedly to + * make up the entire expression as a sequence of unbreakable units. + */ + +function buildHTMLUnbreakable(children, options) { + // Compute height and depth of this chunk. + const body = makeSpan$1(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at + // the height of the expression, and the bottom of the HTML element + // falls at the depth of the expression. + // We used to have separate top and bottom struts, where the bottom strut + // would like to use `vertical-align: top`, but in IE 9 this lowers the + // baseline of the box to the bottom of this strut (instead of staying in + // the normal place) so we use an absolute value for vertical-align instead. + + const strut = makeSpan$1(["strut"]); + strut.style.height = body.height + body.depth + "em"; + strut.style.verticalAlign = -body.depth + "em"; + body.children.unshift(strut); + return body; +} +/** + * Take an entire parse tree, and build it into an appropriate set of HTML + * nodes. + */ + + +function buildHTML(tree, options) { + // Strip off outer tag wrapper for processing below. + let tag = null; + + if (tree.length === 1 && tree[0].type === "tag") { + tag = tree[0].tag; + tree = tree[0].body; + } // Build the expression contained in the tree + + + const expression = buildExpression(tree, options, true); + const children = []; // Create one base node for each chunk between potential line breaks. + // The TeXBook [p.173] says "A formula will be broken only after a + // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary + // operation symbol like $+$ or $-$ or $\times$, where the relation or + // binary operation is on the ``outer level'' of the formula (i.e., not + // enclosed in {...} and not part of an \over construction)." + + let parts = []; + + for (let i = 0; i < expression.length; i++) { + parts.push(expression[i]); + + if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) { + // Put any post-operator glue on same line as operator. + // Watch for \nobreak along the way. + let nobreak = false; + + while (i < expression.length - 1 && expression[i + 1].hasClass("mspace")) { + i++; + parts.push(expression[i]); + + if (expression[i].hasClass("nobreak")) { + nobreak = true; + } + } // Don't allow break if \nobreak among the post-operator glue. + + + if (!nobreak) { + children.push(buildHTMLUnbreakable(parts, options)); + parts = []; + } + } else if (expression[i].hasClass("newline")) { + // Write the line except the newline + parts.pop(); + + if (parts.length > 0) { + children.push(buildHTMLUnbreakable(parts, options)); + parts = []; + } // Put the newline at the top level + + + children.push(expression[i]); + } + } + + if (parts.length > 0) { + children.push(buildHTMLUnbreakable(parts, options)); + } // Now, if there was a tag, build it too and append it as a final child. + + + let tagChild; + + if (tag) { + tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true)); + tagChild.classes = ["tag"]; + children.push(tagChild); + } + + const htmlNode = makeSpan$1(["katex-html"], children); + htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children + // (the height of the enclosing htmlNode) for proper vertical alignment. + + if (tagChild) { + const strut = tagChild.children[0]; + strut.style.height = htmlNode.height + htmlNode.depth + "em"; + strut.style.verticalAlign = -htmlNode.depth + "em"; + } + + return htmlNode; +} + +/** + * These objects store data about MathML nodes. This is the MathML equivalent + * of the types in domTree.js. Since MathML handles its own rendering, and + * since we're mainly using MathML to improve accessibility, we don't manage + * any of the styling state that the plain DOM nodes do. + * + * The `toNode` and `toMarkup` functions work simlarly to how they do in + * domTree.js, creating namespaced DOM nodes and HTML text markup respectively. + */ +function newDocumentFragment(children) { + return new DocumentFragment(children); +} +/** + * This node represents a general purpose MathML node of any type. The + * constructor requires the type of node to create (for example, `"mo"` or + * `"mspace"`, corresponding to `` and `` tags). + */ + +class MathNode { + constructor(type, children) { + this.type = void 0; + this.attributes = void 0; + this.children = void 0; + this.type = type; + this.attributes = {}; + this.children = children || []; + } + /** + * Sets an attribute on a MathML node. MathML depends on attributes to convey a + * semantic content, so this is used heavily. + */ + + + setAttribute(name, value) { + this.attributes[name] = value; + } + /** + * Gets an attribute on a MathML node. + */ + + + getAttribute(name) { + return this.attributes[name]; + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + + + toNode() { + const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + + for (const attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + + for (let i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + + return node; + } + /** + * Converts the math node into an HTML markup string. + */ + + + toMarkup() { + let markup = "<" + this.type; // Add the attributes + + for (const attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + markup += " " + attr + "=\""; + markup += utils.escape(this.attributes[attr]); + markup += "\""; + } + } + + markup += ">"; + + for (let i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + + markup += ""; + return markup; + } + /** + * Converts the math node into a string, similar to innerText, but escaped. + */ + + + toText() { + return this.children.map(child => child.toText()).join(""); + } + +} +/** + * This node represents a piece of text. + */ + +class TextNode { + constructor(text, needsEscape = true) { + this.text = void 0; + this.needsEscape = void 0; + this.text = text; + this.needsEscape = needsEscape; + } + /** + * Converts the text node into a DOM text node. + */ + + + toNode() { + return document.createTextNode(this.toText()); + } + /** + * Converts the text node into escaped HTML markup + * (representing the text itself). + */ + + + toMarkup() { + return this.toText(); + } + /** + * Converts the text node into an escaped string + * (representing the text iteself). + */ + + + toText() { + return this.needsEscape ? utils.escape(this.text) : this.text; + } + +} +/** + * This node represents a space, but may render as or as text, + * depending on the width. + */ + +class SpaceNode { + /** + * Create a Space node with width given in CSS ems. + */ + constructor(width) { + this.width = void 0; + this.character = void 0; + this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html + // for a table of space-like characters. We consistently use the + // &LongNames; because Unicode does not have single characters for + //    (\u2005\u200a) and all negative spaces. + + if (width >= 0.05555 && width <= 0.05556) { + this.character = " "; // \u200a + } else if (width >= 0.1666 && width <= 0.1667) { + this.character = " "; // \u2009 + } else if (width >= 0.2222 && width <= 0.2223) { + this.character = " "; // \u2005 + } else if (width >= 0.2777 && width <= 0.2778) { + this.character = "  "; // \u2005\u200a + } else if (width >= -0.05556 && width <= -0.05555) { + this.character = "​"; + } else if (width >= -0.1667 && width <= -0.1666) { + this.character = "​"; + } else if (width >= -0.2223 && width <= -0.2222) { + this.character = "​"; + } else if (width >= -0.2778 && width <= -0.2777) { + this.character = "​"; + } else { + this.character = null; + } + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + + + toNode() { + if (this.character) { + return document.createTextNode(this.character); + } else { + const node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); + node.setAttribute("width", this.width + "em"); + return node; + } + } + /** + * Converts the math node into an HTML markup string. + */ + + + toMarkup() { + if (this.character) { + return `${this.character}`; + } else { + return ``; + } + } + /** + * Converts the math node into a string, similar to innerText. + */ + + + toText() { + if (this.character) { + return this.character; + } else { + return " "; + } + } + +} + +var mathMLTree = { + MathNode, + TextNode, + SpaceNode, + newDocumentFragment +}; + +/** + * This file converts a parse tree into a cooresponding MathML tree. The main + * entry point is the `buildMathML` function, which takes a parse tree from the + * parser. + */ + +/** + * Takes a symbol and converts it into a MathML text node after performing + * optional replacement from symbols.js. + */ +const makeText = function makeText(text, mode, options) { + if (symbols[mode][text] && symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) { + text = symbols[mode][text].replace; + } + + return new mathMLTree.TextNode(text); +}; +/** + * Wrap the given array of nodes in an node if needed, i.e., + * unless the array has length 1. Always returns a single node. + */ + +const makeRow = function makeRow(body) { + if (body.length === 1) { + return body[0]; + } else { + return new mathMLTree.MathNode("mrow", body); + } +}; +/** + * Returns the math variant as a string or null if none is required. + */ + +const getVariant = function getVariant(group, options) { + // Handle \text... font specifiers as best we can. + // MathML has a limited list of allowable mathvariant specifiers; see + // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt + if (options.fontFamily === "texttt") { + return "monospace"; + } else if (options.fontFamily === "textsf") { + if (options.fontShape === "textit" && options.fontWeight === "textbf") { + return "sans-serif-bold-italic"; + } else if (options.fontShape === "textit") { + return "sans-serif-italic"; + } else if (options.fontWeight === "textbf") { + return "bold-sans-serif"; + } else { + return "sans-serif"; + } + } else if (options.fontShape === "textit" && options.fontWeight === "textbf") { + return "bold-italic"; + } else if (options.fontShape === "textit") { + return "italic"; + } else if (options.fontWeight === "textbf") { + return "bold"; + } + + const font = options.font; + + if (!font || font === "mathnormal") { + return null; + } + + const mode = group.mode; + + if (font === "mathit") { + return "italic"; + } else if (font === "boldsymbol") { + return "bold-italic"; + } + + let text = group.text; + + if (utils.contains(["\\imath", "\\jmath"], text)) { + return null; + } + + if (symbols[mode][text] && symbols[mode][text].replace) { + text = symbols[mode][text].replace; + } + + const fontName = buildCommon.fontMap[font].fontName; + + if (getCharacterMetrics(text, fontName, mode)) { + return buildCommon.fontMap[font].variant; + } + + return null; +}; +/** + * Takes a list of nodes, builds them, and returns a list of the generated + * MathML nodes. Also combine consecutive outputs into a single + * tag. + */ + +const buildExpression$1 = function buildExpression(expression, options) { + const groups = []; + let lastGroup; + + for (let i = 0; i < expression.length; i++) { + const group = buildGroup$1(expression[i], options); + + if (group instanceof MathNode && lastGroup instanceof MathNode) { + // Concatenate adjacent s + if (group.type === 'mtext' && lastGroup.type === 'mtext' && group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) { + lastGroup.children.push(...group.children); + continue; // Concatenate adjacent s + } else if (group.type === 'mn' && lastGroup.type === 'mn') { + lastGroup.children.push(...group.children); + continue; // Concatenate ... followed by . + } else if (group.type === 'mi' && group.children.length === 1 && lastGroup.type === 'mn') { + const child = group.children[0]; + + if (child instanceof TextNode && child.text === '.') { + lastGroup.children.push(...group.children); + continue; + } + } + } + + groups.push(group); + lastGroup = group; + } // TODO(kevinb): combine \\not with mrels and mords + + + return groups; +}; +/** + * Equivalent to buildExpression, but wraps the elements in an + * if there's more than one. Returns a single node instead of an array. + */ + +const buildExpressionRow = function buildExpressionRow(expression, options) { + return makeRow(buildExpression$1(expression, options)); +}; +/** + * Takes a group from the parser and calls the appropriate groupBuilders function + * on it to produce a MathML node. + */ + +const buildGroup$1 = function buildGroup(group, options) { + if (!group) { + return new mathMLTree.MathNode("mrow"); + } + + if (_mathmlGroupBuilders[group.type]) { + // Call the groupBuilders function + const result = _mathmlGroupBuilders[group.type](group, options); + return result; + } else { + throw new ParseError("Got group of unknown type: '" + group.type + "'"); + } +}; +/** + * Takes a full parse tree and settings and builds a MathML representation of + * it. In particular, we put the elements from building the parse tree into a + * tag so we can also include that TeX source as an annotation. + * + * Note that we actually return a domTree element with a `` inside it so + * we can do appropriate styling. + */ + +function buildMathML(tree, texExpression, options) { + const expression = buildExpression$1(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics + // tag correctly, unless it's a single or . + + let wrapper; + + if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) { + wrapper = expression[0]; + } else { + wrapper = new mathMLTree.MathNode("mrow", expression); + } // Build a TeX annotation of the source + + + const annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); + annotation.setAttribute("encoding", "application/x-tex"); + const semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); + const math = new mathMLTree.MathNode("math", [semantics]); // You can't style nodes, so we wrap the node in a span. + // NOTE: The span class is not typed to have nodes as children, and + // we don't want to make the children type more generic since the children + // of span are expected to have more fields in `buildHtml` contexts. + // $FlowFixMe + + return buildCommon.makeSpan(["katex-mathml"], [math]); +} + +const optionsFromSettings = function optionsFromSettings(settings) { + return new Options({ + style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT, + maxSize: settings.maxSize + }); +}; + +const buildTree = function buildTree(tree, expression, settings) { + const options = optionsFromSettings(settings); + const mathMLNode = buildMathML(tree, expression, options); + const htmlNode = buildHTML(tree, options); + const katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, htmlNode]); + + if (settings.displayMode) { + return buildCommon.makeSpan(["katex-display"], [katexNode]); + } else { + return katexNode; + } +}; +const buildHTMLTree = function buildHTMLTree(tree, expression, settings) { + const options = optionsFromSettings(settings); + const htmlNode = buildHTML(tree, options); + const katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); + + if (settings.displayMode) { + return buildCommon.makeSpan(["katex-display"], [katexNode]); + } else { + return katexNode; + } +}; + +/** + * This file provides support to buildMathML.js and buildHTML.js + * for stretchy wide elements rendered from SVG files + * and other CSS trickery. + */ +const stretchyCodePoint = { + widehat: "^", + widecheck: "ˇ", + widetilde: "~", + utilde: "~", + overleftarrow: "\u2190", + underleftarrow: "\u2190", + xleftarrow: "\u2190", + overrightarrow: "\u2192", + underrightarrow: "\u2192", + xrightarrow: "\u2192", + underbrace: "\u23b5", + overbrace: "\u23de", + overleftrightarrow: "\u2194", + underleftrightarrow: "\u2194", + xleftrightarrow: "\u2194", + Overrightarrow: "\u21d2", + xRightarrow: "\u21d2", + overleftharpoon: "\u21bc", + xleftharpoonup: "\u21bc", + overrightharpoon: "\u21c0", + xrightharpoonup: "\u21c0", + xLeftarrow: "\u21d0", + xLeftrightarrow: "\u21d4", + xhookleftarrow: "\u21a9", + xhookrightarrow: "\u21aa", + xmapsto: "\u21a6", + xrightharpoondown: "\u21c1", + xleftharpoondown: "\u21bd", + xrightleftharpoons: "\u21cc", + xleftrightharpoons: "\u21cb", + xtwoheadleftarrow: "\u219e", + xtwoheadrightarrow: "\u21a0", + xlongequal: "=", + xtofrom: "\u21c4", + xrightleftarrows: "\u21c4", + xrightequilibrium: "\u21cc", + // Not a perfect match. + xleftequilibrium: "\u21cb" // None better available. + +}; + +const mathMLnode = function mathMLnode(label) { + const node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]); + node.setAttribute("stretchy", "true"); + return node; +}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts. +// Copyright (c) 2009-2010, Design Science, Inc. () +// Copyright (c) 2014-2017 Khan Academy () +// Licensed under the SIL Open Font License, Version 1.1. +// See \nhttp://scripts.sil.org/OFL +// Very Long SVGs +// Many of the KaTeX stretchy wide elements use a long SVG image and an +// overflow: hidden tactic to achieve a stretchy image while avoiding +// distortion of arrowheads or brace corners. +// The SVG typically contains a very long (400 em) arrow. +// The SVG is in a container span that has overflow: hidden, so the span +// acts like a window that exposes only part of the SVG. +// The SVG always has a longer, thinner aspect ratio than the container span. +// After the SVG fills 100% of the height of the container span, +// there is a long arrow shaft left over. That left-over shaft is not shown. +// Instead, it is sliced off because the span's CSS has overflow: hidden. +// Thus, the reader sees an arrow that matches the subject matter width +// without distortion. +// Some functions, such as \cancel, need to vary their aspect ratio. These +// functions do not get the overflow SVG treatment. +// Second Brush Stroke +// Low resolution monitors struggle to display images in fine detail. +// So browsers apply anti-aliasing. A long straight arrow shaft therefore +// will sometimes appear as if it has a blurred edge. +// To mitigate this, these SVG files contain a second "brush-stroke" on the +// arrow shafts. That is, a second long thin rectangular SVG path has been +// written directly on top of each arrow shaft. This reinforcement causes +// some of the screen pixels to display as black instead of the anti-aliased +// gray pixel that a single path would generate. So we get arrow shafts +// whose edges appear to be sharper. +// In the katexImagesData object just below, the dimensions all +// correspond to path geometry inside the relevant SVG. +// For example, \overrightarrow uses the same arrowhead as glyph U+2192 +// from the KaTeX Main font. The scaling factor is 1000. +// That is, inside the font, that arrowhead is 522 units tall, which +// corresponds to 0.522 em inside the document. + + +const katexImagesData = { + // path(s), minWidth, height, align + overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], + xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], + xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], + overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], + overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], + xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], + xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], + overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], + underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], + underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], + xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], + xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], + xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], + overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + overgroup: [["leftgroup", "rightgroup"], 0.888, 342], + undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], + xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], + xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], + // The next three arrows are from the mhchem package. + // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the + // document as \xrightarrow or \xrightleftharpoons. Those have + // min-length = 1.75em, so we set min-length on these next three to match. + xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], + xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], + xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] +}; + +const groupLength = function groupLength(arg) { + if (arg.type === "ordgroup") { + return arg.body.length; + } else { + return 1; + } +}; + +const svgSpan = function svgSpan(group, options) { + // Create a span with inline SVG for the element. + function buildSvgSpan_() { + let viewBoxWidth = 400000; // default + + const label = group.label.substr(1); + + if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) { + // Each type in the `if` statement corresponds to one of the ParseNode + // types below. This narrowing is required to access `grp.base`. + const grp = group; // There are four SVG images available for each function. + // Choose a taller image when there are more characters. + + const numChars = groupLength(grp.base); + let viewBoxHeight; + let pathName; + let height; + + if (numChars > 5) { + if (label === "widehat" || label === "widecheck") { + viewBoxHeight = 420; + viewBoxWidth = 2364; + height = 0.42; + pathName = label + "4"; + } else { + viewBoxHeight = 312; + viewBoxWidth = 2340; + height = 0.34; + pathName = "tilde4"; + } + } else { + const imgIndex = [1, 1, 2, 2, 3, 3][numChars]; + + if (label === "widehat" || label === "widecheck") { + viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; + viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; + height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; + pathName = label + imgIndex; + } else { + viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; + viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; + height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; + pathName = "tilde" + imgIndex; + } + } + + const path = new PathNode(pathName); + const svgNode = new SvgNode([path], { + "width": "100%", + "height": height + "em", + "viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`, + "preserveAspectRatio": "none" + }); + return { + span: buildCommon.makeSvgSpan([], [svgNode], options), + minWidth: 0, + height + }; + } else { + const spans = []; + const data = katexImagesData[label]; + const paths = data[0], + minWidth = data[1], + viewBoxHeight = data[2]; + const height = viewBoxHeight / 1000; + const numSvgChildren = paths.length; + let widthClasses; + let aligns; + + if (numSvgChildren === 1) { + // $FlowFixMe: All these cases must be of the 4-tuple type. + const align1 = data[3]; + widthClasses = ["hide-tail"]; + aligns = [align1]; + } else if (numSvgChildren === 2) { + widthClasses = ["halfarrow-left", "halfarrow-right"]; + aligns = ["xMinYMin", "xMaxYMin"]; + } else if (numSvgChildren === 3) { + widthClasses = ["brace-left", "brace-center", "brace-right"]; + aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + } else { + throw new Error(`Correct katexImagesData or update code here to support + ${numSvgChildren} children.`); + } + + for (let i = 0; i < numSvgChildren; i++) { + const path = new PathNode(paths[i]); + const svgNode = new SvgNode([path], { + "width": "400em", + "height": height + "em", + "viewBox": `0 0 ${viewBoxWidth} ${viewBoxHeight}`, + "preserveAspectRatio": aligns[i] + " slice" + }); + const span = buildCommon.makeSvgSpan([widthClasses[i]], [svgNode], options); + + if (numSvgChildren === 1) { + return { + span, + minWidth, + height + }; + } else { + span.style.height = height + "em"; + spans.push(span); + } + } + + return { + span: buildCommon.makeSpan(["stretchy"], spans, options), + minWidth, + height + }; + } + } // buildSvgSpan_() + + + const _buildSvgSpan_ = buildSvgSpan_(), + span = _buildSvgSpan_.span, + minWidth = _buildSvgSpan_.minWidth, + height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0. + // Any adjustments relative to the baseline must be done in buildHTML. + + + span.height = height; + span.style.height = height + "em"; + + if (minWidth > 0) { + span.style.minWidth = minWidth + "em"; + } + + return span; +}; + +const encloseSpan = function encloseSpan(inner, label, pad, options) { + // Return an image span for \cancel, \bcancel, \xcancel, or \fbox + let img; + const totalHeight = inner.height + inner.depth + 2 * pad; + + if (/fbox|color/.test(label)) { + img = buildCommon.makeSpan(["stretchy", label], [], options); + + if (label === "fbox") { + const color = options.color && options.getColor(); + + if (color) { + img.style.borderColor = color; + } + } + } else { + // \cancel, \bcancel, or \xcancel + // Since \cancel's SVG is inline and it omits the viewBox attribute, + // its stroke-width will not vary with span area. + const lines = []; + + if (/^[bx]cancel$/.test(label)) { + lines.push(new LineNode({ + "x1": "0", + "y1": "0", + "x2": "100%", + "y2": "100%", + "stroke-width": "0.046em" + })); + } + + if (/^x?cancel$/.test(label)) { + lines.push(new LineNode({ + "x1": "0", + "y1": "100%", + "x2": "100%", + "y2": "0", + "stroke-width": "0.046em" + })); + } + + const svgNode = new SvgNode(lines, { + "width": "100%", + "height": totalHeight + "em" + }); + img = buildCommon.makeSvgSpan([], [svgNode], options); + } + + img.height = totalHeight; + img.style.height = totalHeight + "em"; + return img; +}; + +var stretchy = { + encloseSpan, + mathMLnode, + svgSpan +}; + +// NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but +const htmlBuilder = (grp, options) => { + // Accents are handled in the TeXbook pg. 443, rule 12. + let base; + let group; + const supSub = checkNodeType(grp, "supsub"); + let supSubGroup; + + if (supSub) { + // If our base is a character box, and we have superscripts and + // subscripts, the supsub will defer to us. In particular, we want + // to attach the superscripts and subscripts to the inner body (so + // that the position of the superscripts and subscripts won't be + // affected by the height of the accent). We accomplish this by + // sticking the base of the accent into the base of the supsub, and + // rendering that, while keeping track of where the accent is. + // The real accent group is the base of the supsub group + group = assertNodeType(supSub.base, "accent"); // The character box is the base of the accent group + + base = group.base; // Stick the character box into the base of the supsub group + + supSub.base = base; // Rerender the supsub group with its new base, and store that + // result. + + supSubGroup = assertSpan(buildGroup(supSub, options)); // reset original base + + supSub.base = group; + } else { + group = assertNodeType(grp, "accent"); + base = group.base; + } // Build the base group + + + const body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character? + + const mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the + // nucleus is not a single character, let s = 0; otherwise set s to the + // kern amount for the nucleus followed by the \skewchar of its font." + // Note that our skew metrics are just the kern between each character + // and the skewchar. + + let skew = 0; + + if (mustShift) { + // If the base is a character box, then we want the skew of the + // innermost character. To do that, we find the innermost character: + const baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it + + const baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol. + + skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we + // removed with getBaseElem might contain things like \color which + // we can't get rid of. + // TODO(emily): Find a better way to get the skew + } // calculate the amount of space between the body and the accent + + + let clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent + + let accentBody; + + if (!group.isStretchy) { + let accent; + let width; + + if (group.label === "\\vec") { + // Before version 0.9, \vec used the combining font glyph U+20D7. + // But browsers, especially Safari, are not consistent in how they + // render combining characters when not preceded by a character. + // So now we use an SVG. + // If Safari reforms, we should consider reverting to the glyph. + accent = buildCommon.staticSvg("vec", options); + width = buildCommon.svgData.vec[1]; + } else { + accent = buildCommon.makeSymbol(group.label, "Main-Regular", group.mode, options); // Remove the italic correction of the accent, because it only serves to + // shift the accent over to a place we don't want. + + accent.italic = 0; + width = accent.width; + } + + accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be + // at least the width of the accent, and overlap directly onto the + // character without any vertical offset. + + const accentFull = group.label === "\\textcircled"; + + if (accentFull) { + accentBody.classes.push('accent-full'); + clearance = body.height; + } // Shift the accent over by the skew. + + + let left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }` + // so that the accent doesn't contribute to the bounding box. + // We need to shift the character by its width (effectively half + // its width) to compensate. + + if (!accentFull) { + left -= width / 2; + } + + accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some + // vertical adjustment to match LaTeX. + + if (group.label === "\\textcircled") { + accentBody.style.top = ".2em"; + } + + accentBody = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "kern", + size: -clearance + }, { + type: "elem", + elem: accentBody + }] + }, options); + } else { + accentBody = stretchy.svgSpan(group, options); + accentBody = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"], + wrapperStyle: skew > 0 ? { + width: `calc(100% - ${2 * skew}em)`, + marginLeft: `${2 * skew}em` + } : undefined + }] + }, options); + } + + const accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options); + + if (supSubGroup) { + // Here, we replace the "base" child of the supsub with our newly + // generated accent. + supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the + // accent, we manually recalculate height. + + supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not. + + supSubGroup.classes[0] = "mord"; + return supSubGroup; + } else { + return accentWrap; + } +}; + +const mathmlBuilder = (group, options) => { + const accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); + const node = new mathMLTree.MathNode("mover", [buildGroup$1(group.base, options), accentNode]); + node.setAttribute("accent", "true"); + return node; +}; + +const NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(accent => `\\${accent}`).join("|")); // Accents + +defineFunction({ + type: "accent", + names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], + props: { + numArgs: 1 + }, + handler: (context, args) => { + const base = args[0]; + const isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); + const isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; + return { + type: "accent", + mode: context.parser.mode, + label: context.funcName, + isStretchy: isStretchy, + isShifty: isShifty, + base: base + }; + }, + htmlBuilder, + mathmlBuilder +}); // Text-mode accents + +defineFunction({ + type: "accent", + names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"], + props: { + numArgs: 1, + allowedInText: true, + allowedInMath: false + }, + handler: (context, args) => { + const base = args[0]; + return { + type: "accent", + mode: context.parser.mode, + label: context.funcName, + isStretchy: false, + isShifty: true, + base: base + }; + }, + htmlBuilder, + mathmlBuilder +}); + +// Horizontal overlap functions +defineFunction({ + type: "accentUnder", + names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], + props: { + numArgs: 1 + }, + handler: ({ + parser, + funcName + }, args) => { + const base = args[0]; + return { + type: "accentUnder", + mode: parser.mode, + label: funcName, + base: base + }; + }, + htmlBuilder: (group, options) => { + // Treat under accents much like underlines. + const innerGroup = buildGroup(group.base, options); + const accentBody = stretchy.svgSpan(group, options); + const kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns + + const vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: accentBody.height + kern, + children: [{ + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: kern + }, { + type: "elem", + elem: innerGroup + }] + }, options); + return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); + }, + mathmlBuilder: (group, options) => { + const accentNode = stretchy.mathMLnode(group.label); + const node = new mathMLTree.MathNode("munder", [buildGroup$1(group.base, options), accentNode]); + node.setAttribute("accentunder", "true"); + return node; + } +}); + +// Stretchy arrows with an optional argument +defineFunction({ + type: "xArrow", + names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension. + // Direct use of these functions is discouraged and may break someday. + "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + + handler({ + parser, + funcName + }, args, optArgs) { + return { + type: "xArrow", + mode: parser.mode, + label: funcName, + body: args[0], + below: optArgs[0] + }; + }, + + // Flow is unable to correctly infer the type of `group`, even though it's + // unamibiguously determined from the passed-in `type` above. + htmlBuilder(group, options) { + const style = options.style; // Build the argument groups in the appropriate style. + // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% + // Some groups can return document fragments. Handle those by wrapping + // them in a span. + + let newOptions = options.havingStyle(style.sup()); + const upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options); + upperGroup.classes.push("x-arrow-pad"); + let lowerGroup; + + if (group.below) { + // Build the lower group + newOptions = options.havingStyle(style.sub()); + lowerGroup = buildCommon.wrapFragment(buildGroup(group.below, newOptions, options), options); + lowerGroup.classes.push("x-arrow-pad"); + } + + const arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0. + // The point we want on the math axis is at 0.5 * arrowBody.height. + + const arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi + + let upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu + + if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { + upperShift -= upperGroup.depth; // shift up if depth encroaches + } // Generate the vlist + + + let vlist; + + if (lowerGroup) { + const lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: upperGroup, + shift: upperShift + }, { + type: "elem", + elem: arrowBody, + shift: arrowShift + }, { + type: "elem", + elem: lowerGroup, + shift: lowerShift + }] + }, options); + } else { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: upperGroup, + shift: upperShift + }, { + type: "elem", + elem: arrowBody, + shift: arrowShift + }] + }, options); + } // $FlowFixMe: Replace this with passing "svg-align" into makeVList. + + + vlist.children[0].children[0].children[1].classes.push("svg-align"); + return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); + }, + + mathmlBuilder(group, options) { + const arrowNode = stretchy.mathMLnode(group.label); + let node; + let lowerNode; + + if (group.body) { + const upperNode = buildGroup$1(group.body, options); + + if (group.below) { + lowerNode = buildGroup$1(group.below, options); + node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); + } else { + node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); + } + } else if (group.below) { + lowerNode = buildGroup$1(group.below, options); + node = new mathMLTree.MathNode("munder", [arrowNode, lowerNode]); + } else { + node = new mathMLTree.MathNode("mover", [arrowNode]); + } + + return node; + } + +}); + +// {123} and converts into symbol with code 123. It is used by the *macro* +// \char defined in macros.js. + +defineFunction({ + type: "textord", + names: ["\\@char"], + props: { + numArgs: 1, + allowedInText: true + }, + + handler({ + parser + }, args) { + const arg = assertNodeType(args[0], "ordgroup"); + const group = arg.body; + let number = ""; + + for (let i = 0; i < group.length; i++) { + const node = assertNodeType(group[i], "textord"); + number += node.text; + } + + const code = parseInt(number); + + if (isNaN(code)) { + throw new ParseError(`\\@char has non-numeric argument ${number}`); + } + + return { + type: "textord", + mode: parser.mode, + text: String.fromCharCode(code) + }; + } + +}); + +const htmlBuilder$1 = (group, options) => { + const elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains. + // To accomplish this, we wrap the results in a fragment, so the inner + // elements will be able to directly interact with their neighbors. For + // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3` + + return buildCommon.makeFragment(elements); +}; + +const mathmlBuilder$1 = (group, options) => { + const inner = buildExpression$1(group.body, options); + const node = new mathMLTree.MathNode("mstyle", inner); + node.setAttribute("mathcolor", group.color); + return node; +}; + +defineFunction({ + type: "color", + names: ["\\textcolor"], + props: { + numArgs: 2, + allowedInText: true, + greediness: 3, + argTypes: ["color", "original"] + }, + + handler({ + parser + }, args) { + const color = assertNodeType(args[0], "color-token").color; + const body = args[1]; + return { + type: "color", + mode: parser.mode, + color, + body: ordargument(body) + }; + }, + + htmlBuilder: htmlBuilder$1, + mathmlBuilder: mathmlBuilder$1 +}); // TODO(kevinb): define these using macros + +defineFunction({ + type: "color", + names: ["\\blue", "\\orange", "\\pink", "\\red", "\\green", "\\gray", "\\purple", "\\blueA", "\\blueB", "\\blueC", "\\blueD", "\\blueE", "\\tealA", "\\tealB", "\\tealC", "\\tealD", "\\tealE", "\\greenA", "\\greenB", "\\greenC", "\\greenD", "\\greenE", "\\goldA", "\\goldB", "\\goldC", "\\goldD", "\\goldE", "\\redA", "\\redB", "\\redC", "\\redD", "\\redE", "\\maroonA", "\\maroonB", "\\maroonC", "\\maroonD", "\\maroonE", "\\purpleA", "\\purpleB", "\\purpleC", "\\purpleD", "\\purpleE", "\\mintA", "\\mintB", "\\mintC", "\\grayA", "\\grayB", "\\grayC", "\\grayD", "\\grayE", "\\grayF", "\\grayG", "\\grayH", "\\grayI", "\\kaBlue", "\\kaGreen"], + props: { + numArgs: 1, + allowedInText: true, + greediness: 3 + }, + + handler({ + parser, + funcName + }, args) { + const body = args[0]; + return { + type: "color", + mode: parser.mode, + color: "katex-" + funcName.slice(1), + body: ordargument(body) + }; + }, + + htmlBuilder: htmlBuilder$1, + mathmlBuilder: mathmlBuilder$1 +}); +defineFunction({ + type: "color", + names: ["\\color"], + props: { + numArgs: 1, + allowedInText: true, + greediness: 3, + argTypes: ["color"] + }, + + handler({ + parser, + breakOnTokenText + }, args) { + const color = assertNodeType(args[0], "color-token").color; // If we see a styling function, parse out the implicit body + + const body = parser.parseExpression(true, breakOnTokenText); + return { + type: "color", + mode: parser.mode, + color, + body + }; + }, + + htmlBuilder: htmlBuilder$1, + mathmlBuilder: mathmlBuilder$1 +}); + +// Row breaks within tabular environments, and line breaks at top level +// same signature, we implement them as one megafunction, with newRow +// indicating whether we're in the \cr case, and newLine indicating whether +// to break the line in the \newline case. + +defineFunction({ + type: "cr", + names: ["\\cr", "\\newline"], + props: { + numArgs: 0, + numOptionalArgs: 1, + argTypes: ["size"], + allowedInText: true + }, + + handler({ + parser, + funcName + }, args, optArgs) { + const size = optArgs[0]; + const newRow = funcName === "\\cr"; + let newLine = false; + + if (!newRow) { + if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) { + newLine = false; + } else { + newLine = true; + } + } + + return { + type: "cr", + mode: parser.mode, + newLine, + newRow, + size: size && assertNodeType(size, "size").value + }; + }, + + // The following builders are called only at the top level, + // not within tabular/array environments. + htmlBuilder(group, options) { + if (group.newRow) { + throw new ParseError("\\cr valid only within a tabular/array environment"); + } + + const span = buildCommon.makeSpan(["mspace"], [], options); + + if (group.newLine) { + span.classes.push("newline"); + + if (group.size) { + span.style.marginTop = calculateSize(group.size, options) + "em"; + } + } + + return span; + }, + + mathmlBuilder(group, options) { + const node = new mathMLTree.MathNode("mspace"); + + if (group.newLine) { + node.setAttribute("linebreak", "newline"); + + if (group.size) { + node.setAttribute("height", calculateSize(group.size, options) + "em"); + } + } + + return node; + } + +}); + +/** + * This file deals with creating delimiters of various sizes. The TeXbook + * discusses these routines on page 441-442, in the "Another subroutine sets box + * x to a specified variable delimiter" paragraph. + * + * There are three main routines here. `makeSmallDelim` makes a delimiter in the + * normal font, but in either text, script, or scriptscript style. + * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1, + * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of + * smaller pieces that are stacked on top of one another. + * + * The functions take a parameter `center`, which determines if the delimiter + * should be centered around the axis. + * + * Then, there are three exposed functions. `sizedDelim` makes a delimiter in + * one of the given sizes. This is used for things like `\bigl`. + * `customSizedDelim` makes a delimiter with a given total height+depth. It is + * called in places like `\sqrt`. `leftRightDelim` makes an appropriate + * delimiter which surrounds an expression of a given height an depth. It is + * used in `\left` and `\right`. + */ + +/** + * Get the metrics for a given symbol and font, after transformation (i.e. + * after following replacement from symbols.js) + */ +const getMetrics = function getMetrics(symbol, font, mode) { + const replace = symbols.math[symbol] && symbols.math[symbol].replace; + const metrics = getCharacterMetrics(replace || symbol, font, mode); + + if (!metrics) { + throw new Error(`Unsupported symbol ${symbol} and font size ${font}.`); + } + + return metrics; +}; +/** + * Puts a delimiter span in a given style, and adds appropriate height, depth, + * and maxFontSizes. + */ + + +const styleWrap = function styleWrap(delim, toStyle, options, classes) { + const newOptions = options.havingBaseStyle(toStyle); + const span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options); + const delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier; + span.height *= delimSizeMultiplier; + span.depth *= delimSizeMultiplier; + span.maxFontSize = newOptions.sizeMultiplier; + return span; +}; + +const centerSpan = function centerSpan(span, options, style) { + const newOptions = options.havingBaseStyle(style); + const shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight; + span.classes.push("delimcenter"); + span.style.top = shift + "em"; + span.height -= shift; + span.depth += shift; +}; +/** + * Makes a small delimiter. This is a delimiter that comes in the Main-Regular + * font, but is restyled to either be in textstyle, scriptstyle, or + * scriptscriptstyle. + */ + + +const makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) { + const text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); + const span = styleWrap(text, style, options, classes); + + if (center) { + centerSpan(span, options, style); + } + + return span; +}; +/** + * Builds a symbol in the given font size (note size is an integer) + */ + + +const mathrmSize = function mathrmSize(value, size, mode, options) { + return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options); +}; +/** + * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, + * Size3, or Size4 fonts. It is always rendered in textstyle. + */ + + +const makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) { + const inner = mathrmSize(delim, size, mode, options); + const span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), Style$1.TEXT, options, classes); + + if (center) { + centerSpan(span, options, Style$1.TEXT); + } + + return span; +}; +/** + * Make an inner span with the given offset and in the given font. This is used + * in `makeStackedDelim` to make the stacking pieces for the delimiter. + */ + + +const makeInner = function makeInner(symbol, font, mode) { + let sizeClass; // Apply the correct CSS class to choose the right font. + + if (font === "Size1-Regular") { + sizeClass = "delim-size1"; + } else + /* if (font === "Size4-Regular") */ + { + sizeClass = "delim-size4"; + } + + const inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element + // in the appropriate tag that VList uses. + + return { + type: "elem", + elem: inner + }; +}; +/** + * Make a stacked delimiter out of a given delimiter, with the total height at + * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook. + */ + + +const makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) { + // There are four parts, the top, an optional middle, a repeated part, and a + // bottom. + let top; + let middle; + let repeat; + let bottom; + top = repeat = bottom = delim; + middle = null; // Also keep track of what font the delimiters are in + + let font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use + // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the + // repeats of the arrows + + if (delim === "\\uparrow") { + repeat = bottom = "\u23d0"; + } else if (delim === "\\Uparrow") { + repeat = bottom = "\u2016"; + } else if (delim === "\\downarrow") { + top = repeat = "\u23d0"; + } else if (delim === "\\Downarrow") { + top = repeat = "\u2016"; + } else if (delim === "\\updownarrow") { + top = "\\uparrow"; + repeat = "\u23d0"; + bottom = "\\downarrow"; + } else if (delim === "\\Updownarrow") { + top = "\\Uparrow"; + repeat = "\u2016"; + bottom = "\\Downarrow"; + } else if (delim === "[" || delim === "\\lbrack") { + top = "\u23a1"; + repeat = "\u23a2"; + bottom = "\u23a3"; + font = "Size4-Regular"; + } else if (delim === "]" || delim === "\\rbrack") { + top = "\u23a4"; + repeat = "\u23a5"; + bottom = "\u23a6"; + font = "Size4-Regular"; + } else if (delim === "\\lfloor" || delim === "\u230a") { + repeat = top = "\u23a2"; + bottom = "\u23a3"; + font = "Size4-Regular"; + } else if (delim === "\\lceil" || delim === "\u2308") { + top = "\u23a1"; + repeat = bottom = "\u23a2"; + font = "Size4-Regular"; + } else if (delim === "\\rfloor" || delim === "\u230b") { + repeat = top = "\u23a5"; + bottom = "\u23a6"; + font = "Size4-Regular"; + } else if (delim === "\\rceil" || delim === "\u2309") { + top = "\u23a4"; + repeat = bottom = "\u23a5"; + font = "Size4-Regular"; + } else if (delim === "(" || delim === "\\lparen") { + top = "\u239b"; + repeat = "\u239c"; + bottom = "\u239d"; + font = "Size4-Regular"; + } else if (delim === ")" || delim === "\\rparen") { + top = "\u239e"; + repeat = "\u239f"; + bottom = "\u23a0"; + font = "Size4-Regular"; + } else if (delim === "\\{" || delim === "\\lbrace") { + top = "\u23a7"; + middle = "\u23a8"; + bottom = "\u23a9"; + repeat = "\u23aa"; + font = "Size4-Regular"; + } else if (delim === "\\}" || delim === "\\rbrace") { + top = "\u23ab"; + middle = "\u23ac"; + bottom = "\u23ad"; + repeat = "\u23aa"; + font = "Size4-Regular"; + } else if (delim === "\\lgroup" || delim === "\u27ee") { + top = "\u23a7"; + bottom = "\u23a9"; + repeat = "\u23aa"; + font = "Size4-Regular"; + } else if (delim === "\\rgroup" || delim === "\u27ef") { + top = "\u23ab"; + bottom = "\u23ad"; + repeat = "\u23aa"; + font = "Size4-Regular"; + } else if (delim === "\\lmoustache" || delim === "\u23b0") { + top = "\u23a7"; + bottom = "\u23ad"; + repeat = "\u23aa"; + font = "Size4-Regular"; + } else if (delim === "\\rmoustache" || delim === "\u23b1") { + top = "\u23ab"; + bottom = "\u23a9"; + repeat = "\u23aa"; + font = "Size4-Regular"; + } // Get the metrics of the four sections + + + const topMetrics = getMetrics(top, font, mode); + const topHeightTotal = topMetrics.height + topMetrics.depth; + const repeatMetrics = getMetrics(repeat, font, mode); + const repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; + const bottomMetrics = getMetrics(bottom, font, mode); + const bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; + let middleHeightTotal = 0; + let middleFactor = 1; + + if (middle !== null) { + const middleMetrics = getMetrics(middle, font, mode); + middleHeightTotal = middleMetrics.height + middleMetrics.depth; + middleFactor = 2; // repeat symmetrically above and below middle + } // Calcuate the minimal height that the delimiter can have. + // It is at least the size of the top, bottom, and optional middle combined. + + + const minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need + + const repeatCount = Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)); // Compute the total height of the delimiter including all the symbols + + const realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note + // that in this context, "center" means that the delimiter should be + // centered around the axis in the current style, while normally it is + // centered around the axis in textstyle. + + let axisHeight = options.fontMetrics().axisHeight; + + if (center) { + axisHeight *= options.sizeMultiplier; + } // Calculate the depth + + + const depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist + // Keep a list of the inner pieces + + const inners = []; // Add the bottom symbol + + inners.push(makeInner(bottom, font, mode)); + + if (middle === null) { + // Add that many symbols + for (let i = 0; i < repeatCount; i++) { + inners.push(makeInner(repeat, font, mode)); + } + } else { + // When there is a middle bit, we need the middle part and two repeated + // sections + for (let i = 0; i < repeatCount; i++) { + inners.push(makeInner(repeat, font, mode)); + } + + inners.push(makeInner(middle, font, mode)); + + for (let i = 0; i < repeatCount; i++) { + inners.push(makeInner(repeat, font, mode)); + } + } // Add the top symbol + + + inners.push(makeInner(top, font, mode)); // Finally, build the vlist + + const newOptions = options.havingBaseStyle(Style$1.TEXT); + const inner = buildCommon.makeVList({ + positionType: "bottom", + positionData: depth, + children: inners + }, newOptions); + return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), Style$1.TEXT, options, classes); +}; // All surds have 0.08em padding above the viniculum inside the SVG. +// That keeps browser span height rounding error from pinching the line. + + +const vbPad = 80; // padding above the surd, measured inside the viewBox. + +const emPad = 0.08; // padding, in ems, measured in the document. + +const sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, options) { + let alternate; + + if (sqrtName === "sqrtTall") { + // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular + // One path edge has a variable length. It runs from the viniculumn + // to a point near (14 units) the bottom of the surd. The viniculum + // is 40 units thick. So the length of the line in question is: + const vertSegment = viewBoxHeight - 54 - vbPad; + alternate = `M702 ${vbPad}H400000v40H742v${vertSegment}l-4 4-4 4c-.667.7 +-2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1h-12l-28-84c-16.667-52-96.667 +-294.333-240-727l-212 -643 -85 170c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 + 77-156c66 199.333 139 419.667 219 661 l218 661zM702 ${vbPad}H400000v40H742z`; + } + + const pathNode = new PathNode(sqrtName, alternate); + const svg = new SvgNode([pathNode], { + // Note: 1000:1 ratio of viewBox to document em width. + "width": "400em", + "height": height + "em", + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); + return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); +}; +/** + * Make a sqrt image of the given height, + */ + + +const makeSqrtImage = function makeSqrtImage(height, options) { + // Define a newOptions that removes the effect of size changes such as \Huge. + // We don't pick different a height surd for \Huge. For it, we scale up. + const newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds. + + const delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); + let sizeMultiplier = newOptions.sizeMultiplier; // default + // Create a span containing an SVG image of a sqrt symbol. + + let span; + let spanHeight = 0; + let texHeight = 0; + let viewBoxHeight = 0; + let advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd. + // Then browser rounding error on the parent span height will not + // encroach on the ink of the viniculum. But that padding is not + // included in the TeX-like `height` used for calculation of + // vertical alignment. So texHeight = span.height < span.style.height. + + if (delim.type === "small") { + // Get an SVG that is derived from glyph U+221A in font KaTeX-Main. + viewBoxHeight = 1000 + vbPad; // 1000 unit glyph height. + + if (height < 1.0) { + sizeMultiplier = 1.0; // mimic a \textfont radical + } else if (height < 1.4) { + sizeMultiplier = 0.7; // mimic a \scriptfont radical + } + + spanHeight = (1.0 + emPad) / sizeMultiplier; + texHeight = 1.00 / sizeMultiplier; + span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, options); + span.style.minWidth = "0.853em"; + advanceWidth = 0.833 / sizeMultiplier; // from the font. + } else if (delim.type === "large") { + // These SVGs come from fonts: KaTeX_Size1, _Size2, etc. + viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; + texHeight = sizeToMaxHeight[delim.size] / sizeMultiplier; + spanHeight = (sizeToMaxHeight[delim.size] + emPad) / sizeMultiplier; + span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, options); + span.style.minWidth = "1.02em"; + advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font. + } else { + // Tall sqrt. In TeX, this would be stacked using multiple glyphs. + // We'll use a single SVG to accomplish the same thing. + spanHeight = height + emPad; + texHeight = height; + viewBoxHeight = Math.floor(1000 * height) + vbPad; + span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, options); + span.style.minWidth = "0.742em"; + advanceWidth = 1.056; + } + + span.height = texHeight; + span.style.height = spanHeight + "em"; + return { + span, + advanceWidth, + // Calculate the actual line width. + // This actually should depend on the chosen font -- e.g. \boldmath + // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and + // have thicker rules. + ruleWidth: options.fontMetrics().sqrtRuleThickness * sizeMultiplier + }; +}; // There are three kinds of delimiters, delimiters that stack when they become +// too large + + +const stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack + +const stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1"]; // and delimiters that never stack + +const stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of +// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$ +// Used to create stacked delimiters of appropriate sizes in makeSizedDelim. + +const sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0]; +/** + * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4. + */ + +const makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) { + // < and > turn into \langle and \rangle in delimiters + if (delim === "<" || delim === "\\lt" || delim === "\u27e8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27e9") { + delim = "\\rangle"; + } // Sized delimiters are never centered. + + + if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) { + return makeLargeDelim(delim, size, false, options, mode, classes); + } else if (utils.contains(stackAlwaysDelimiters, delim)) { + return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes); + } else { + throw new ParseError("Illegal delimiter: '" + delim + "'"); + } +}; +/** + * There are three different sequences of delimiter sizes that the delimiters + * follow depending on the kind of delimiter. This is used when creating custom + * sized delimiters to decide whether to create a small, large, or stacked + * delimiter. + * + * In real TeX, these sequences aren't explicitly defined, but are instead + * defined inside the font metrics. Since there are only three sequences that + * are possible for the delimiters that TeX defines, it is easier to just encode + * them explicitly here. + */ + + +// Delimiters that never stack try small delimiters and large delimiters only +const stackNeverDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT +}, { + type: "small", + style: Style$1.SCRIPT +}, { + type: "small", + style: Style$1.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}]; // Delimiters that always stack try the small delimiters first, then stack + +const stackAlwaysDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT +}, { + type: "small", + style: Style$1.SCRIPT +}, { + type: "small", + style: Style$1.TEXT +}, { + type: "stack" +}]; // Delimiters that stack when large try the small and then large delimiters, and +// stack afterwards + +const stackLargeDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT +}, { + type: "small", + style: Style$1.SCRIPT +}, { + type: "small", + style: Style$1.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}, { + type: "stack" +}]; +/** + * Get the font used in a delimiter based on what kind of delimiter it is. + * TODO(#963) Use more specific font family return type once that is introduced. + */ + +const delimTypeToFont = function delimTypeToFont(type) { + if (type.type === "small") { + return "Main-Regular"; + } else if (type.type === "large") { + return "Size" + type.size + "-Regular"; + } else if (type.type === "stack") { + return "Size4-Regular"; + } else { + throw new Error(`Add support for delim type '${type.type}' here.`); + } +}; +/** + * Traverse a sequence of types of delimiters to decide what kind of delimiter + * should be used to create a delimiter of the given height+depth. + */ + + +const traverseSequence = function traverseSequence(delim, height, sequence, options) { + // Here, we choose the index we should start at in the sequences. In smaller + // sizes (which correspond to larger numbers in style.size) we start earlier + // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts + // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2 + const start = Math.min(2, 3 - options.style.size); + + for (let i = start; i < sequence.length; i++) { + if (sequence[i].type === "stack") { + // This is always the last delimiter, so we just break the loop now. + break; + } + + const metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); + let heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we + // account for the style change size. + + if (sequence[i].type === "small") { + const newOptions = options.havingBaseStyle(sequence[i].style); + heightDepth *= newOptions.sizeMultiplier; + } // Check if the delimiter at this size works for the given height. + + + if (heightDepth > height) { + return sequence[i]; + } + } // If we reached the end of the sequence, return the last sequence element. + + + return sequence[sequence.length - 1]; +}; +/** + * Make a delimiter of a given height+depth, with optional centering. Here, we + * traverse the sequences, and create a delimiter that the sequence tells us to. + */ + + +const makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) { + if (delim === "<" || delim === "\\lt" || delim === "\u27e8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27e9") { + delim = "\\rangle"; + } // Decide what sequence to use + + + let sequence; + + if (utils.contains(stackNeverDelimiters, delim)) { + sequence = stackNeverDelimiterSequence; + } else if (utils.contains(stackLargeDelimiters, delim)) { + sequence = stackLargeDelimiterSequence; + } else { + sequence = stackAlwaysDelimiterSequence; + } // Look through the sequence + + + const delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs. + // Depending on the sequence element we decided on, call the + // appropriate function. + + if (delimType.type === "small") { + return makeSmallDelim(delim, delimType.style, center, options, mode, classes); + } else if (delimType.type === "large") { + return makeLargeDelim(delim, delimType.size, center, options, mode, classes); + } else + /* if (delimType.type === "stack") */ + { + return makeStackedDelim(delim, height, center, options, mode, classes); + } +}; +/** + * Make a delimiter for use with `\left` and `\right`, given a height and depth + * of an expression that the delimiters surround. + */ + + +const makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) { + // We always center \left/\right delimiters, so the axis is always shifted + const axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right + + const delimiterFactor = 901; + const delimiterExtend = 5.0 / options.fontMetrics().ptPerEm; + const maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); + const totalHeight = Math.max( // In real TeX, calculations are done using integral values which are + // 65536 per pt, or 655360 per em. So, the division here truncates in + // TeX but doesn't here, producing different results. If we wanted to + // exactly match TeX's calculation, we could do + // Math.floor(655360 * maxDistFromAxis / 500) * + // delimiterFactor / 655360 + // (To see the difference, compare + // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} + // in TeX and KaTeX) + maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total + // height + + return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes); +}; + +var delimiter = { + sqrtImage: makeSqrtImage, + sizedDelim: makeSizedDelim, + customSizedDelim: makeCustomSizedDelim, + leftRightDelim: makeLeftRightDelim +}; + +// Extra data needed for the delimiter handler down below +const delimiterSizes = { + "\\bigl": { + mclass: "mopen", + size: 1 + }, + "\\Bigl": { + mclass: "mopen", + size: 2 + }, + "\\biggl": { + mclass: "mopen", + size: 3 + }, + "\\Biggl": { + mclass: "mopen", + size: 4 + }, + "\\bigr": { + mclass: "mclose", + size: 1 + }, + "\\Bigr": { + mclass: "mclose", + size: 2 + }, + "\\biggr": { + mclass: "mclose", + size: 3 + }, + "\\Biggr": { + mclass: "mclose", + size: 4 + }, + "\\bigm": { + mclass: "mrel", + size: 1 + }, + "\\Bigm": { + mclass: "mrel", + size: 2 + }, + "\\biggm": { + mclass: "mrel", + size: 3 + }, + "\\Biggm": { + mclass: "mrel", + size: 4 + }, + "\\big": { + mclass: "mord", + size: 1 + }, + "\\Big": { + mclass: "mord", + size: 2 + }, + "\\bigg": { + mclass: "mord", + size: 3 + }, + "\\Bigg": { + mclass: "mord", + size: 4 + } +}; +const delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230a", "\u230b", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27e8", "\\rangle", "\u27e9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27ee", "\u27ef", "\\lmoustache", "\\rmoustache", "\u23b0", "\u23b1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; + +// Delimiter functions +function checkDelimiter(delim, context) { + const symDelim = checkSymbolNodeType(delim); + + if (symDelim && utils.contains(delimiters, symDelim.text)) { + return symDelim; + } else { + throw new ParseError("Invalid delimiter: '" + (symDelim ? symDelim.text : JSON.stringify(delim)) + "' after '" + context.funcName + "'", delim); + } +} + +defineFunction({ + type: "delimsizing", + names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], + props: { + numArgs: 1 + }, + handler: (context, args) => { + const delim = checkDelimiter(args[0], context); + return { + type: "delimsizing", + mode: context.parser.mode, + size: delimiterSizes[context.funcName].size, + mclass: delimiterSizes[context.funcName].mclass, + delim: delim.text + }; + }, + htmlBuilder: (group, options) => { + if (group.delim === ".") { + // Empty delimiters still count as elements, even though they don't + // show anything. + return buildCommon.makeSpan([group.mclass]); + } // Use delimiter.sizedDelim to generate the delimiter. + + + return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]); + }, + mathmlBuilder: group => { + const children = []; + + if (group.delim !== ".") { + children.push(makeText(group.delim, group.mode)); + } + + const node = new mathMLTree.MathNode("mo", children); + + if (group.mclass === "mopen" || group.mclass === "mclose") { + // Only some of the delimsizing functions act as fences, and they + // return "mopen" or "mclose" mclass. + node.setAttribute("fence", "true"); + } else { + // Explicitly disable fencing if it's not a fence, to override the + // defaults. + node.setAttribute("fence", "false"); + } + + return node; + } +}); + +function assertParsed(group) { + if (!group.body) { + throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); + } +} + +defineFunction({ + type: "leftright-right", + names: ["\\right"], + props: { + numArgs: 1 + }, + handler: (context, args) => { + // \left case below triggers parsing of \right in + // `const right = parser.parseFunction();` + // uses this return value. + return { + type: "leftright-right", + mode: context.parser.mode, + delim: checkDelimiter(args[0], context).text + }; + } +}); +defineFunction({ + type: "leftright", + names: ["\\left"], + props: { + numArgs: 1 + }, + handler: (context, args) => { + const delim = checkDelimiter(args[0], context); + const parser = context.parser; // Parse out the implicit body + + ++parser.leftrightDepth; // parseExpression stops before '\\right' + + const body = parser.parseExpression(false); + --parser.leftrightDepth; // Check the next token + + parser.expect("\\right", false); + const right = assertNodeType(parser.parseFunction(), "leftright-right"); + return { + type: "leftright", + mode: parser.mode, + body, + left: delim.text, + right: right.delim + }; + }, + htmlBuilder: (group, options) => { + assertParsed(group); // Build the inner expression + + const inner = buildExpression(group.body, options, true, [null, "mclose"]); + let innerHeight = 0; + let innerDepth = 0; + let hadMiddle = false; // Calculate its height and depth + + for (let i = 0; i < inner.length; i++) { + // Property `isMiddle` not defined on `span`. See comment in + // "middle"'s htmlBuilder. + // $FlowFixMe + if (inner[i].isMiddle) { + hadMiddle = true; + } else { + innerHeight = Math.max(inner[i].height, innerHeight); + innerDepth = Math.max(inner[i].depth, innerDepth); + } + } // The size of delimiters is the same, regardless of what style we are + // in. Thus, to correctly calculate the size of delimiter we need around + // a group, we scale down the inner size based on the size. + + + innerHeight *= options.sizeMultiplier; + innerDepth *= options.sizeMultiplier; + let leftDelim; + + if (group.left === ".") { + // Empty delimiters in \left and \right make null delimiter spaces. + leftDelim = makeNullDelimiter(options, ["mopen"]); + } else { + // Otherwise, use leftRightDelim to generate the correct sized + // delimiter. + leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]); + } // Add it to the beginning of the expression + + + inner.unshift(leftDelim); // Handle middle delimiters + + if (hadMiddle) { + for (let i = 1; i < inner.length; i++) { + const middleDelim = inner[i]; // Property `isMiddle` not defined on `span`. See comment in + // "middle"'s htmlBuilder. + // $FlowFixMe + + const isMiddle = middleDelim.isMiddle; + + if (isMiddle) { + // Apply the options that were active when \middle was called + inner[i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []); + } + } + } + + let rightDelim; // Same for the right delimiter + + if (group.right === ".") { + rightDelim = makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, options, group.mode, ["mclose"]); + } // Add it to the end of the expression. + + + inner.push(rightDelim); + return buildCommon.makeSpan(["minner"], inner, options); + }, + mathmlBuilder: (group, options) => { + assertParsed(group); + const inner = buildExpression$1(group.body, options); + + if (group.left !== ".") { + const leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]); + leftNode.setAttribute("fence", "true"); + inner.unshift(leftNode); + } + + if (group.right !== ".") { + const rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]); + rightNode.setAttribute("fence", "true"); + inner.push(rightNode); + } + + return makeRow(inner); + } +}); +defineFunction({ + type: "middle", + names: ["\\middle"], + props: { + numArgs: 1 + }, + handler: (context, args) => { + const delim = checkDelimiter(args[0], context); + + if (!context.parser.leftrightDepth) { + throw new ParseError("\\middle without preceding \\left", delim); + } + + return { + type: "middle", + mode: context.parser.mode, + delim: delim.text + }; + }, + htmlBuilder: (group, options) => { + let middleDelim; + + if (group.delim === ".") { + middleDelim = makeNullDelimiter(options, []); + } else { + middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []); + const isMiddle = { + delim: group.delim, + options + }; // Property `isMiddle` not defined on `span`. It is only used in + // this file above. + // TODO: Fix this violation of the `span` type and possibly rename + // things since `isMiddle` sounds like a boolean, but is a struct. + // $FlowFixMe + + middleDelim.isMiddle = isMiddle; + } + + return middleDelim; + }, + mathmlBuilder: (group, options) => { + const middleNode = new mathMLTree.MathNode("mo", [makeText(group.delim, group.mode)]); + middleNode.setAttribute("fence", "true"); + return middleNode; + } +}); + +const htmlBuilder$2 = (group, options) => { + // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox + // Some groups can return document fragments. Handle those by wrapping + // them in a span. + const inner = buildCommon.wrapFragment(buildGroup(group.body, options), options); + const label = group.label.substr(1); + const scale = options.sizeMultiplier; + let img; + let imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different + // depending on whether the subject is wider than it is tall, or vice versa. + // We don't know the width of a group, so as a proxy, we test if + // the subject is a single character. This captures most of the + // subjects that should get the "tall" treatment. + + const isSingleChar = utils.isCharacterBox(group.body); + + if (label === "sout") { + img = buildCommon.makeSpan(["stretchy", "sout"]); + img.height = options.fontMetrics().defaultRuleThickness / scale; + imgShift = -0.5 * options.fontMetrics().xHeight; + } else { + // Add horizontal padding + if (/cancel/.test(label)) { + if (!isSingleChar) { + inner.classes.push("cancel-pad"); + } + } else { + inner.classes.push("boxpad"); + } // Add vertical padding + + + let vertPad = 0; // ref: LaTeX source2e: \fboxsep = 3pt; \fboxrule = .4pt + // ref: cancel package: \advance\totalheight2\p@ % "+2" + + if (/box/.test(label)) { + vertPad = label === "colorbox" ? 0.3 : 0.34; + } else { + vertPad = isSingleChar ? 0.2 : 0; + } + + img = stretchy.encloseSpan(inner, label, vertPad, options); + imgShift = inner.depth + vertPad; + + if (group.backgroundColor) { + img.style.backgroundColor = group.backgroundColor; + + if (group.borderColor) { + img.style.borderColor = group.borderColor; + } + } + } + + let vlist; + + if (group.backgroundColor) { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [// Put the color background behind inner; + { + type: "elem", + elem: img, + shift: imgShift + }, { + type: "elem", + elem: inner, + shift: 0 + }] + }, options); + } else { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [// Write the \cancel stroke on top of inner. + { + type: "elem", + elem: inner, + shift: 0 + }, { + type: "elem", + elem: img, + shift: imgShift, + wrapperClasses: /cancel/.test(label) ? ["svg-align"] : [] + }] + }, options); + } + + if (/cancel/.test(label)) { + // The cancel package documentation says that cancel lines add their height + // to the expression, but tests show that isn't how it actually works. + vlist.height = inner.height; + vlist.depth = inner.depth; + } + + if (/cancel/.test(label) && !isSingleChar) { + // cancel does not create horiz space for its line extension. + return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); + } else { + return buildCommon.makeSpan(["mord"], [vlist], options); + } +}; + +const mathmlBuilder$2 = (group, options) => { + const node = new mathMLTree.MathNode("menclose", [buildGroup$1(group.body, options)]); + + switch (group.label) { + case "\\cancel": + node.setAttribute("notation", "updiagonalstrike"); + break; + + case "\\bcancel": + node.setAttribute("notation", "downdiagonalstrike"); + break; + + case "\\sout": + node.setAttribute("notation", "horizontalstrike"); + break; + + case "\\fbox": + node.setAttribute("notation", "box"); + break; + + case "\\fcolorbox": + // TODO(ron): I don't know any way to set the border color. + node.setAttribute("notation", "box"); + break; + + case "\\xcancel": + node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + break; + } + + if (group.backgroundColor) { + node.setAttribute("mathbackground", group.backgroundColor); + } + + return node; +}; + +defineFunction({ + type: "enclose", + names: ["\\colorbox"], + props: { + numArgs: 2, + allowedInText: true, + greediness: 3, + argTypes: ["color", "text"] + }, + + handler({ + parser, + funcName + }, args, optArgs) { + const color = assertNodeType(args[0], "color-token").color; + const body = args[1]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + backgroundColor: color, + body + }; + }, + + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$2 +}); +defineFunction({ + type: "enclose", + names: ["\\fcolorbox"], + props: { + numArgs: 3, + allowedInText: true, + greediness: 3, + argTypes: ["color", "color", "text"] + }, + + handler({ + parser, + funcName + }, args, optArgs) { + const borderColor = assertNodeType(args[0], "color-token").color; + const backgroundColor = assertNodeType(args[1], "color-token").color; + const body = args[2]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + backgroundColor, + borderColor, + body + }; + }, + + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$2 +}); +defineFunction({ + type: "enclose", + names: ["\\fbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: true + }, + + handler({ + parser + }, args) { + return { + type: "enclose", + mode: parser.mode, + label: "\\fbox", + body: args[0] + }; + } + +}); +defineFunction({ + type: "enclose", + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"], + props: { + numArgs: 1 + }, + + handler({ + parser, + funcName + }, args, optArgs) { + const body = args[0]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + body + }; + }, + + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$2 +}); + +/** + * All registered environments. + * `environments.js` exports this same dictionary again and makes it public. + * `Parser.js` requires this dictionary via `environments.js`. + */ +const _environments = {}; +function defineEnvironment({ + type, + names, + props, + handler, + htmlBuilder, + mathmlBuilder +}) { + // Set default values of environments. + const data = { + type, + numArgs: props.numArgs || 0, + greediness: 1, + allowedInText: false, + numOptionalArgs: 0, + handler + }; + + for (let i = 0; i < names.length; ++i) { + // TODO: The value type of _environments should be a type union of all + // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is + // an existential type. + // $FlowFixMe + _environments[names[i]] = data; + } + + if (htmlBuilder) { + _htmlGroupBuilders[type] = htmlBuilder; + } + + if (mathmlBuilder) { + _mathmlGroupBuilders[type] = mathmlBuilder; + } +} + +function getHLines(parser) { + // Return an array. The array length = number of hlines. + // Each element in the array tells if the line is dashed. + const hlineInfo = []; + parser.consumeSpaces(); + let nxt = parser.nextToken.text; + + while (nxt === "\\hline" || nxt === "\\hdashline") { + parser.consume(); + hlineInfo.push(nxt === "\\hdashline"); + parser.consumeSpaces(); + nxt = parser.nextToken.text; + } + + return hlineInfo; +} +/** + * Parse the body of the environment, with rows delimited by \\ and + * columns delimited by &, and create a nested list in row-major order + * with one group per cell. If given an optional argument style + * ("text", "display", etc.), then each cell is cast into that style. + */ + + +function parseArray(parser, { + hskipBeforeAndAfter, + addJot, + cols, + arraystretch +}, style) { + // Parse body of array with \\ temporarily mapped to \cr + parser.gullet.beginGroup(); + parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment + + if (!arraystretch) { + const stretch = parser.gullet.expandMacroAsText("\\arraystretch"); + + if (stretch == null) { + // Default \arraystretch from lttab.dtx + arraystretch = 1; + } else { + arraystretch = parseFloat(stretch); + + if (!arraystretch || arraystretch < 0) { + throw new ParseError(`Invalid \\arraystretch: ${stretch}`); + } + } + } + + let row = []; + const body = [row]; + const rowGaps = []; + const hLinesBeforeRow = []; // Test for \hline at the top of the array. + + hLinesBeforeRow.push(getHLines(parser)); + + while (true) { + // eslint-disable-line no-constant-condition + let cell = parser.parseExpression(false, "\\cr"); + cell = { + type: "ordgroup", + mode: parser.mode, + body: cell + }; + + if (style) { + cell = { + type: "styling", + mode: parser.mode, + style, + body: [cell] + }; + } + + row.push(cell); + const next = parser.nextToken.text; + + if (next === "&") { + parser.consume(); + } else if (next === "\\end") { + // Arrays terminate newlines with `\crcr` which consumes a `\cr` if + // the last line is empty. + // NOTE: Currently, `cell` is the last item added into `row`. + if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) { + body.pop(); + } + + if (hLinesBeforeRow.length < body.length + 1) { + hLinesBeforeRow.push([]); + } + + break; + } else if (next === "\\cr") { + const cr = assertNodeType(parser.parseFunction(), "cr"); + rowGaps.push(cr.size); // check for \hline(s) following the row separator + + hLinesBeforeRow.push(getHLines(parser)); + row = []; + body.push(row); + } else { + throw new ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken); + } + } + + parser.gullet.endGroup(); + return { + type: "array", + mode: parser.mode, + addJot, + arraystretch, + body, + cols, + rowGaps, + hskipBeforeAndAfter, + hLinesBeforeRow + }; +} // Decides on a style for cells in an array according to whether the given +// environment name starts with the letter 'd'. + + +function dCellStyle(envName) { + if (envName.substr(0, 1) === "d") { + return "display"; + } else { + return "text"; + } +} + +const htmlBuilder$3 = function htmlBuilder(group, options) { + let r; + let c; + const nr = group.body.length; + const hLinesBeforeRow = group.hLinesBeforeRow; + let nc = 0; + let body = new Array(nr); + const hlines = []; // Horizontal spacing + + const pt = 1 / options.fontMetrics().ptPerEm; + const arraycolsep = 5 * pt; // \arraycolsep in article.cls + // Vertical spacing + + const baselineskip = 12 * pt; // see size10.clo + // Default \jot from ltmath.dtx + // TODO(edemaine): allow overriding \jot via \setlength (#687) + + const jot = 3 * pt; + const arrayskip = group.arraystretch * baselineskip; + const arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and + + const arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx + + let totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any. + + function setHLinePos(hlinesInGap) { + for (let i = 0; i < hlinesInGap.length; ++i) { + if (i > 0) { + totalHeight += 0.25; + } + + hlines.push({ + pos: totalHeight, + isDashed: hlinesInGap[i] + }); + } + } + + setHLinePos(hLinesBeforeRow[0]); + + for (r = 0; r < group.body.length; ++r) { + const inrow = group.body[r]; + let height = arstrutHeight; // \@array adds an \@arstrut + + let depth = arstrutDepth; // to each tow (via the template) + + if (nc < inrow.length) { + nc = inrow.length; + } + + const outrow = new Array(inrow.length); + + for (c = 0; c < inrow.length; ++c) { + const elt = buildGroup(inrow[c], options); + + if (depth < elt.depth) { + depth = elt.depth; + } + + if (height < elt.height) { + height = elt.height; + } + + outrow[c] = elt; + } + + const rowGap = group.rowGaps[r]; + let gap = 0; + + if (rowGap) { + gap = calculateSize(rowGap, options); + + if (gap > 0) { + // \@argarraycr + gap += arstrutDepth; + + if (depth < gap) { + depth = gap; // \@xargarraycr + } + + gap = 0; + } + } // In AMS multiline environments such as aligned and gathered, rows + // correspond to lines that have additional \jot added to the + // \baselineskip via \openup. + + + if (group.addJot) { + depth += jot; + } + + outrow.height = height; + outrow.depth = depth; + totalHeight += height; + outrow.pos = totalHeight; + totalHeight += depth + gap; // \@yargarraycr + + body[r] = outrow; // Set a position for \hline(s), if any. + + setHLinePos(hLinesBeforeRow[r + 1]); + } + + const offset = totalHeight / 2 + options.fontMetrics().axisHeight; + const colDescriptions = group.cols || []; + const cols = []; + let colSep; + let colDescrNum; + + for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column + // descriptions, so trailing separators don't get lost. + c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) { + let colDescr = colDescriptions[colDescrNum] || {}; + let firstSeparator = true; + + while (colDescr.type === "separator") { + // If there is more than one separator in a row, add a space + // between them. + if (!firstSeparator) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = options.fontMetrics().doubleRuleSep + "em"; + cols.push(colSep); + } + + if (colDescr.separator === "|") { + const separator = buildCommon.makeSpan(["vertical-separator"], [], options); + separator.style.height = totalHeight + "em"; + separator.style.verticalAlign = -(totalHeight - offset) + "em"; + cols.push(separator); + } else if (colDescr.separator === ":") { + const separator = buildCommon.makeSpan(["vertical-separator", "vs-dashed"], [], options); + separator.style.height = totalHeight + "em"; + separator.style.verticalAlign = -(totalHeight - offset) + "em"; + cols.push(separator); + } else { + throw new ParseError("Invalid separator type: " + colDescr.separator); + } + + colDescrNum++; + colDescr = colDescriptions[colDescrNum] || {}; + firstSeparator = false; + } + + if (c >= nc) { + continue; + } + + let sepwidth; + + if (c > 0 || group.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.pregap, arraycolsep); + + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = sepwidth + "em"; + cols.push(colSep); + } + } + + let col = []; + + for (r = 0; r < nr; ++r) { + const row = body[r]; + const elem = row[c]; + + if (!elem) { + continue; + } + + const shift = row.pos - offset; + elem.depth = row.depth; + elem.height = row.height; + col.push({ + type: "elem", + elem: elem, + shift: shift + }); + } + + col = buildCommon.makeVList({ + positionType: "individualShift", + children: col + }, options); + col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); + cols.push(col); + + if (c < nc - 1 || group.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.postgap, arraycolsep); + + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = sepwidth + "em"; + cols.push(colSep); + } + } + } + + body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any. + + if (hlines.length > 0) { + const line = buildCommon.makeLineSpan("hline", options, 0.05); + const dashes = buildCommon.makeLineSpan("hdashline", options, 0.05); + const vListElems = [{ + type: "elem", + elem: body, + shift: 0 + }]; + + while (hlines.length > 0) { + const hline = hlines.pop(); + const lineShift = hline.pos - offset; + + if (hline.isDashed) { + vListElems.push({ + type: "elem", + elem: dashes, + shift: lineShift + }); + } else { + vListElems.push({ + type: "elem", + elem: line, + shift: lineShift + }); + } + } + + body = buildCommon.makeVList({ + positionType: "individualShift", + children: vListElems + }, options); + } + + return buildCommon.makeSpan(["mord"], [body], options); +}; + +const mathmlBuilder$3 = function mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mtable", group.body.map(function (row) { + return new mathMLTree.MathNode("mtr", row.map(function (cell) { + return new mathMLTree.MathNode("mtd", [buildGroup$1(cell, options)]); + })); + })); +}; // Convenience function for aligned and alignedat environments. + + +const alignedHandler = function alignedHandler(context, args) { + const cols = []; + const res = parseArray(context.parser, { + cols, + addJot: true + }, "display"); // Determining number of columns. + // 1. If the first argument is given, we use it as a number of columns, + // and makes sure that each row doesn't exceed that number. + // 2. Otherwise, just count number of columns = maximum number + // of cells in each row ("aligned" mode -- isAligned will be true). + // + // At the same time, prepend empty group {} at beginning of every second + // cell in each row (starting with second cell) so that operators become + // binary. This behavior is implemented in amsmath's \start@aligned. + + let numMaths; + let numCols = 0; + const emptyGroup = { + type: "ordgroup", + mode: context.mode, + body: [] + }; + const ordgroup = checkNodeType(args[0], "ordgroup"); + + if (ordgroup) { + let arg0 = ""; + + for (let i = 0; i < ordgroup.body.length; i++) { + const textord = assertNodeType(ordgroup.body[i], "textord"); + arg0 += textord.text; + } + + numMaths = Number(arg0); + numCols = numMaths * 2; + } + + const isAligned = !numCols; + res.body.forEach(function (row) { + for (let i = 1; i < row.length; i += 2) { + // Modify ordgroup node within styling node + const styling = assertNodeType(row[i], "styling"); + const ordgroup = assertNodeType(styling.body[0], "ordgroup"); + ordgroup.body.unshift(emptyGroup); + } + + if (!isAligned) { + // Case 1 + const curMaths = row.length / 2; + + if (numMaths < curMaths) { + throw new ParseError("Too many math in a row: " + `expected ${numMaths}, but got ${curMaths}`, row[0]); + } + } else if (numCols < row.length) { + // Case 2 + numCols = row.length; + } + }); // Adjusting alignment. + // In aligned mode, we add one \qquad between columns; + // otherwise we add nothing. + + for (let i = 0; i < numCols; ++i) { + let align = "r"; + let pregap = 0; + + if (i % 2 === 1) { + align = "l"; + } else if (i > 0 && isAligned) { + // "aligned" mode. + pregap = 1; // add one \quad + } + + cols[i] = { + type: "align", + align: align, + pregap: pregap, + postgap: 0 + }; + } + + return res; +}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation +// is part of the source2e.pdf file of LaTeX2e source documentation. +// {darray} is an {array} environment where cells are set in \displaystyle, +// as defined in nccmath.sty. + + +defineEnvironment({ + type: "array", + names: ["array", "darray"], + props: { + numArgs: 1 + }, + + handler(context, args) { + // Since no types are specified above, the two possibilities are + // - The argument is wrapped in {} or [], in which case Parser's + // parseGroup() returns an "ordgroup" wrapping some symbol node. + // - The argument is a bare symbol node. + const symNode = checkSymbolNodeType(args[0]); + const colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; + const cols = colalign.map(function (nde) { + const node = assertSymbolNodeType(nde); + const ca = node.text; + + if ("lcr".indexOf(ca) !== -1) { + return { + type: "align", + align: ca + }; + } else if (ca === "|") { + return { + type: "separator", + separator: "|" + }; + } else if (ca === ":") { + return { + type: "separator", + separator: ":" + }; + } + + throw new ParseError("Unknown column alignment: " + ca, nde); + }); + const res = { + cols, + hskipBeforeAndAfter: true // \@preamble in lttab.dtx + + }; + return parseArray(context.parser, res, dCellStyle(context.envName)); + }, + + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); // The matrix environments of amsmath builds on the array environment +// of LaTeX, which is discussed above. + +defineEnvironment({ + type: "array", + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"], + props: { + numArgs: 0 + }, + + handler(context) { + const delimiters = { + "matrix": null, + "pmatrix": ["(", ")"], + "bmatrix": ["[", "]"], + "Bmatrix": ["\\{", "\\}"], + "vmatrix": ["|", "|"], + "Vmatrix": ["\\Vert", "\\Vert"] + }[context.envName]; // \hskip -\arraycolsep in amsmath + + const payload = { + hskipBeforeAndAfter: false + }; + const res = parseArray(context.parser, payload, dCellStyle(context.envName)); + return delimiters ? { + type: "leftright", + mode: context.mode, + body: [res], + left: delimiters[0], + right: delimiters[1] + } : res; + }, + + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); // A cases environment (in amsmath.sty) is almost equivalent to +// \def\arraystretch{1.2}% +// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right. +// {dcases} is a {cases} environment where cells are set in \displaystyle, +// as defined in mathtools.sty. + +defineEnvironment({ + type: "array", + names: ["cases", "dcases"], + props: { + numArgs: 0 + }, + + handler(context) { + const payload = { + arraystretch: 1.2, + cols: [{ + type: "align", + align: "l", + pregap: 0, + // TODO(kevinb) get the current style. + // For now we use the metrics for TEXT style which is what we were + // doing before. Before attempting to get the current style we + // should look at TeX's behavior especially for \over and matrices. + postgap: 1.0 + /* 1em quad */ + + }, { + type: "align", + align: "l", + pregap: 0, + postgap: 0 + }] + }; + const res = parseArray(context.parser, payload, dCellStyle(context.envName)); + return { + type: "leftright", + mode: context.mode, + body: [res], + left: "\\{", + right: "." + }; + }, + + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); // An aligned environment is like the align* environment +// except it operates within math mode. +// Note that we assume \nomallineskiplimit to be zero, +// so that \strut@ is the same as \strut. + +defineEnvironment({ + type: "array", + names: ["aligned"], + props: { + numArgs: 0 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); // A gathered environment is like an array environment with one centered +// column, but where rows are considered lines so get \jot line spacing +// and contents are set in \displaystyle. + +defineEnvironment({ + type: "array", + names: ["gathered"], + props: { + numArgs: 0 + }, + + handler(context) { + const res = { + cols: [{ + type: "align", + align: "c" + }], + addJot: true + }; + return parseArray(context.parser, res, "display"); + }, + + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); // alignat environment is like an align environment, but one must explicitly +// specify maximum number of columns in each row, and can adjust spacing between +// each columns. + +defineEnvironment({ + type: "array", + names: ["alignedat"], + // One for numbered and for unnumbered; + // but, KaTeX doesn't supports math numbering yet, + // they make no difference for now. + props: { + numArgs: 1 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$3 +}); // Catch \hline outside array environment + +defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\hline", "\\hdashline"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: true + }, + + handler(context, args) { + throw new ParseError(`${context.funcName} valid only within array environment`); + } + +}); + +const environments = _environments; + +// defineEnvironment definitions. +// $FlowFixMe, "environment" handler returns an environment ParseNode + +defineFunction({ + type: "environment", + names: ["\\begin", "\\end"], + props: { + numArgs: 1, + argTypes: ["text"] + }, + + handler({ + parser, + funcName + }, args) { + const nameGroup = args[0]; + + if (nameGroup.type !== "ordgroup") { + throw new ParseError("Invalid environment name", nameGroup); + } + + let envName = ""; + + for (let i = 0; i < nameGroup.body.length; ++i) { + envName += assertNodeType(nameGroup.body[i], "textord").text; + } + + if (funcName === "\\begin") { + // begin...end is similar to left...right + if (!environments.hasOwnProperty(envName)) { + throw new ParseError("No such environment: " + envName, nameGroup); + } // Build the environment object. Arguments and other information will + // be made available to the begin and end methods using properties. + + + const env = environments[envName]; + + const _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env), + args = _parser$parseArgument.args, + optArgs = _parser$parseArgument.optArgs; + + const context = { + mode: parser.mode, + envName, + parser + }; + const result = env.handler(context, args, optArgs); + parser.expect("\\end", false); + const endNameToken = parser.nextToken; + const end = assertNodeType(parser.parseFunction(), "environment"); + + if (end.name !== envName) { + throw new ParseError(`Mismatch: \\begin{${envName}} matched by \\end{${end.name}}`, endNameToken); + } + + return result; + } + + return { + type: "environment", + mode: parser.mode, + name: envName, + nameGroup + }; + } + +}); + +const makeSpan$2 = buildCommon.makeSpan; + +function htmlBuilder$4(group, options) { + const elements = buildExpression(group.body, options, true); + return makeSpan$2([group.mclass], elements, options); +} + +function mathmlBuilder$4(group, options) { + const inner = buildExpression$1(group.body, options); + return mathMLTree.newDocumentFragment(inner); +} // Math class commands except \mathop + + +defineFunction({ + type: "mclass", + names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], + props: { + numArgs: 1 + }, + + handler({ + parser, + funcName + }, args) { + const body = args[0]; + return { + type: "mclass", + mode: parser.mode, + mclass: "m" + funcName.substr(5), + body: ordargument(body) + }; + }, + + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$4 +}); +const binrelClass = arg => { + // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument. + // (by rendering separately and with {}s before and after, and measuring + // the change in spacing). We'll do roughly the same by detecting the + // atom type directly. + const atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; + + if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) { + return "m" + atom.family; + } else { + return "mord"; + } +}; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord. +// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX. + +defineFunction({ + type: "mclass", + names: ["\\@binrel"], + props: { + numArgs: 2 + }, + + handler({ + parser + }, args) { + return { + type: "mclass", + mode: parser.mode, + mclass: binrelClass(args[0]), + body: [args[1]] + }; + } + +}); // Build a relation or stacked op by placing one symbol on top of another + +defineFunction({ + type: "mclass", + names: ["\\stackrel", "\\overset", "\\underset"], + props: { + numArgs: 2 + }, + + handler({ + parser, + funcName + }, args) { + const baseArg = args[1]; + const shiftedArg = args[0]; + let mclass; + + if (funcName !== "\\stackrel") { + // LaTeX applies \binrel spacing to \overset and \underset. + mclass = binrelClass(baseArg); + } else { + mclass = "mrel"; // for \stackrel + } + + const baseOp = { + type: "op", + mode: baseArg.mode, + limits: true, + alwaysHandleSupSub: true, + symbol: false, + suppressBaseShift: funcName !== "\\stackrel", + body: ordargument(baseArg) + }; + const supsub = { + type: "supsub", + mode: shiftedArg.mode, + base: baseOp, + sup: funcName === "\\underset" ? null : shiftedArg, + sub: funcName === "\\underset" ? shiftedArg : null + }; + return { + type: "mclass", + mode: parser.mode, + mclass, + body: [supsub] + }; + }, + + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$4 +}); + +// TODO(kevinb): implement \\sl and \\sc + +const htmlBuilder$5 = (group, options) => { + const font = group.font; + const newOptions = options.withFont(font); + return buildGroup(group.body, newOptions); +}; + +const mathmlBuilder$5 = (group, options) => { + const font = group.font; + const newOptions = options.withFont(font); + return buildGroup$1(group.body, newOptions); +}; + +const fontAliases = { + "\\Bbb": "\\mathbb", + "\\bold": "\\mathbf", + "\\frak": "\\mathfrak", + "\\bm": "\\boldsymbol" +}; +defineFunction({ + type: "font", + names: [// styles, except \boldsymbol defined below + "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families + "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below + "\\Bbb", "\\bold", "\\frak"], + props: { + numArgs: 1, + greediness: 2 + }, + handler: ({ + parser, + funcName + }, args) => { + const body = args[0]; + let func = funcName; + + if (func in fontAliases) { + func = fontAliases[func]; + } + + return { + type: "font", + mode: parser.mode, + font: func.slice(1), + body + }; + }, + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$5 +}); +defineFunction({ + type: "mclass", + names: ["\\boldsymbol", "\\bm"], + props: { + numArgs: 1, + greediness: 2 + }, + handler: ({ + parser + }, args) => { + const body = args[0]; // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the + // argument's bin|rel|ord status + + return { + type: "mclass", + mode: parser.mode, + mclass: binrelClass(body), + body: [{ + type: "font", + mode: parser.mode, + font: "boldsymbol", + body + }] + }; + } +}); // Old font changing functions + +defineFunction({ + type: "font", + names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it"], + props: { + numArgs: 0, + allowedInText: true + }, + handler: ({ + parser, + funcName, + breakOnTokenText + }, args) => { + const mode = parser.mode; + parser.consumeSpaces(); + const body = parser.parseExpression(true, breakOnTokenText); + const style = `math${funcName.slice(1)}`; + return { + type: "font", + mode: mode, + font: style, + body: { + type: "ordgroup", + mode: parser.mode, + body + } + }; + }, + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$5 +}); + +const htmlBuilder$6 = (group, options) => { + // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e). + // Figure out what style this fraction should be in based on the + // function used + let style = options.style; + + if (group.size === "display") { + style = Style$1.DISPLAY; + } else if (group.size === "text" && style.size === Style$1.DISPLAY.size) { + // We're in a \tfrac but incoming style is displaystyle, so: + style = Style$1.TEXT; + } else if (group.size === "script") { + style = Style$1.SCRIPT; + } else if (group.size === "scriptscript") { + style = Style$1.SCRIPTSCRIPT; + } + + const nstyle = style.fracNum(); + const dstyle = style.fracDen(); + let newOptions; + newOptions = options.havingStyle(nstyle); + const numerm = buildGroup(group.numer, newOptions, options); + + if (group.continued) { + // \cfrac inserts a \strut into the numerator. + // Get \strut dimensions from TeXbook page 353. + const hStrut = 8.5 / options.fontMetrics().ptPerEm; + const dStrut = 3.5 / options.fontMetrics().ptPerEm; + numerm.height = numerm.height < hStrut ? hStrut : numerm.height; + numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; + } + + newOptions = options.havingStyle(dstyle); + const denomm = buildGroup(group.denom, newOptions, options); + let rule; + let ruleWidth; + let ruleSpacing; + + if (group.hasBarLine) { + if (group.barSize) { + ruleWidth = calculateSize(group.barSize, options); + rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); + } else { + rule = buildCommon.makeLineSpan("frac-line", options); + } + + ruleWidth = rule.height; + ruleSpacing = rule.height; + } else { + rule = null; + ruleWidth = 0; + ruleSpacing = options.fontMetrics().defaultRuleThickness; + } // Rule 15b + + + let numShift; + let clearance; + let denomShift; + + if (style.size === Style$1.DISPLAY.size) { + numShift = options.fontMetrics().num1; + + if (ruleWidth > 0) { + clearance = 3 * ruleSpacing; + } else { + clearance = 7 * ruleSpacing; + } + + denomShift = options.fontMetrics().denom1; + } else { + if (ruleWidth > 0) { + numShift = options.fontMetrics().num2; + clearance = ruleSpacing; + } else { + numShift = options.fontMetrics().num3; + clearance = 3 * ruleSpacing; + } + + denomShift = options.fontMetrics().denom2; + } + + let frac; + + if (!rule) { + // Rule 15c + const candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); + + if (candidateClearance < clearance) { + numShift += 0.5 * (clearance - candidateClearance); + denomShift += 0.5 * (clearance - candidateClearance); + } + + frac = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: denomm, + shift: denomShift + }, { + type: "elem", + elem: numerm, + shift: -numShift + }] + }, options); + } else { + // Rule 15d + const axisHeight = options.fontMetrics().axisHeight; + + if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { + numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); + } + + if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { + denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); + } + + const midShift = -(axisHeight - 0.5 * ruleWidth); + frac = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: denomm, + shift: denomShift + }, { + type: "elem", + elem: rule, + shift: midShift + }, { + type: "elem", + elem: numerm, + shift: -numShift + }] + }, options); + } // Since we manually change the style sometimes (with \dfrac or \tfrac), + // account for the possible size change here. + + + newOptions = options.havingStyle(style); + frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; + frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e + + let delimSize; + + if (style.size === Style$1.DISPLAY.size) { + delimSize = options.fontMetrics().delim1; + } else { + delimSize = options.fontMetrics().delim2; + } + + let leftDelim; + let rightDelim; + + if (group.leftDelim == null) { + leftDelim = makeNullDelimiter(options, ["mopen"]); + } else { + leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]); + } + + if (group.continued) { + rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac + } else if (group.rightDelim == null) { + rightDelim = makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]); + } + + return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options); +}; + +const mathmlBuilder$6 = (group, options) => { + const node = new mathMLTree.MathNode("mfrac", [buildGroup$1(group.numer, options), buildGroup$1(group.denom, options)]); + + if (!group.hasBarLine) { + node.setAttribute("linethickness", "0px"); + } else if (group.barSize) { + const ruleWidth = calculateSize(group.barSize, options); + node.setAttribute("linethickness", ruleWidth + "em"); + } + + if (group.leftDelim != null || group.rightDelim != null) { + const withDelims = []; + + if (group.leftDelim != null) { + const leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim)]); + leftOp.setAttribute("fence", "true"); + withDelims.push(leftOp); + } + + withDelims.push(node); + + if (group.rightDelim != null) { + const rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim)]); + rightOp.setAttribute("fence", "true"); + withDelims.push(rightOp); + } + + return makeRow(withDelims); + } + + return node; +}; + +defineFunction({ + type: "genfrac", + names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly + "\\\\bracefrac", "\\\\brackfrac"], + props: { + numArgs: 2, + greediness: 2 + }, + handler: ({ + parser, + funcName + }, args) => { + const numer = args[0]; + const denom = args[1]; + let hasBarLine; + let leftDelim = null; + let rightDelim = null; + let size = "auto"; + + switch (funcName) { + case "\\cfrac": + case "\\dfrac": + case "\\frac": + case "\\tfrac": + hasBarLine = true; + break; + + case "\\\\atopfrac": + hasBarLine = false; + break; + + case "\\dbinom": + case "\\binom": + case "\\tbinom": + hasBarLine = false; + leftDelim = "("; + rightDelim = ")"; + break; + + case "\\\\bracefrac": + hasBarLine = false; + leftDelim = "\\{"; + rightDelim = "\\}"; + break; + + case "\\\\brackfrac": + hasBarLine = false; + leftDelim = "["; + rightDelim = "]"; + break; + + default: + throw new Error("Unrecognized genfrac command"); + } + + switch (funcName) { + case "\\cfrac": + case "\\dfrac": + case "\\dbinom": + size = "display"; + break; + + case "\\tfrac": + case "\\tbinom": + size = "text"; + break; + } + + return { + type: "genfrac", + mode: parser.mode, + continued: funcName === "\\cfrac", + numer, + denom, + hasBarLine, + leftDelim, + rightDelim, + size, + barSize: null + }; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$6 +}); // Infix generalized fractions -- these are not rendered directly, but replaced +// immediately by one of the variants above. + +defineFunction({ + type: "infix", + names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], + props: { + numArgs: 0, + infix: true + }, + + handler({ + parser, + funcName, + token + }) { + let replaceWith; + + switch (funcName) { + case "\\over": + replaceWith = "\\frac"; + break; + + case "\\choose": + replaceWith = "\\binom"; + break; + + case "\\atop": + replaceWith = "\\\\atopfrac"; + break; + + case "\\brace": + replaceWith = "\\\\bracefrac"; + break; + + case "\\brack": + replaceWith = "\\\\brackfrac"; + break; + + default: + throw new Error("Unrecognized infix genfrac command"); + } + + return { + type: "infix", + mode: parser.mode, + replaceWith, + token + }; + } + +}); +const stylArray = ["display", "text", "script", "scriptscript"]; + +const delimFromValue = function delimFromValue(delimString) { + let delim = null; + + if (delimString.length > 0) { + delim = delimString; + delim = delim === "." ? null : delim; + } + + return delim; +}; + +defineFunction({ + type: "genfrac", + names: ["\\genfrac"], + props: { + numArgs: 6, + greediness: 6, + argTypes: ["math", "math", "size", "text", "math", "math"] + }, + + handler({ + parser + }, args) { + const numer = args[4]; + const denom = args[5]; // Look into the parse nodes to get the desired delimiters. + + let leftNode = checkNodeType(args[0], "ordgroup"); + + if (leftNode) { + leftNode = assertAtomFamily(leftNode.body[0], "open"); + } else { + leftNode = assertAtomFamily(args[0], "open"); + } + + const leftDelim = delimFromValue(leftNode.text); + let rightNode = checkNodeType(args[1], "ordgroup"); + + if (rightNode) { + rightNode = assertAtomFamily(rightNode.body[0], "close"); + } else { + rightNode = assertAtomFamily(args[1], "close"); + } + + const rightDelim = delimFromValue(rightNode.text); + const barNode = assertNodeType(args[2], "size"); + let hasBarLine; + let barSize = null; + + if (barNode.isBlank) { + // \genfrac acts differently than \above. + // \genfrac treats an empty size group as a signal to use a + // standard bar size. \above would see size = 0 and omit the bar. + hasBarLine = true; + } else { + barSize = barNode.value; + hasBarLine = barSize.number > 0; + } // Find out if we want displaystyle, textstyle, etc. + + + let size = "auto"; + let styl = checkNodeType(args[3], "ordgroup"); + + if (styl) { + if (styl.body.length > 0) { + const textOrd = assertNodeType(styl.body[0], "textord"); + size = stylArray[Number(textOrd.text)]; + } + } else { + styl = assertNodeType(args[3], "textord"); + size = stylArray[Number(styl.text)]; + } + + return { + type: "genfrac", + mode: parser.mode, + numer, + denom, + continued: false, + hasBarLine, + barSize, + leftDelim, + rightDelim, + size + }; + }, + + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$6 +}); // \above is an infix fraction that also defines a fraction bar size. + +defineFunction({ + type: "infix", + names: ["\\above"], + props: { + numArgs: 1, + argTypes: ["size"], + infix: true + }, + + handler({ + parser, + funcName, + token + }, args) { + return { + type: "infix", + mode: parser.mode, + replaceWith: "\\\\abovefrac", + size: assertNodeType(args[0], "size").value, + token + }; + } + +}); +defineFunction({ + type: "genfrac", + names: ["\\\\abovefrac"], + props: { + numArgs: 3, + argTypes: ["math", "size", "math"] + }, + handler: ({ + parser, + funcName + }, args) => { + const numer = args[0]; + const barSize = assert(assertNodeType(args[1], "infix").size); + const denom = args[2]; + const hasBarLine = barSize.number > 0; + return { + type: "genfrac", + mode: parser.mode, + numer, + denom, + continued: false, + hasBarLine, + barSize, + leftDelim: null, + rightDelim: null, + size: "auto" + }; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$6 +}); + +// NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but +const htmlBuilder$7 = (grp, options) => { + const style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node. + + let supSubGroup; + let group; + const supSub = checkNodeType(grp, "supsub"); + + if (supSub) { + // Ref: LaTeX source2e: }}}}\limits} + // i.e. LaTeX treats the brace similar to an op and passes it + // with \limits, so we need to assign supsub style. + supSubGroup = supSub.sup ? buildGroup(supSub.sup, options.havingStyle(style.sup()), options) : buildGroup(supSub.sub, options.havingStyle(style.sub()), options); + group = assertNodeType(supSub.base, "horizBrace"); + } else { + group = assertNodeType(grp, "horizBrace"); + } // Build the base group + + + const body = buildGroup(group.base, options.havingBaseStyle(Style$1.DISPLAY)); // Create the stretchy element + + const braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns ┏━━━━━━━━┓ + // This first vlist contains the content and the brace: equation + + let vlist; + + if (group.isOver) { + vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: braceBody + }] + }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. + + vlist.children[0].children[0].children[1].classes.push("svg-align"); + } else { + vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: body.depth + 0.1 + braceBody.height, + children: [{ + type: "elem", + elem: braceBody + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: body + }] + }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList. + + vlist.children[0].children[0].children[0].classes.push("svg-align"); + } + + if (supSubGroup) { + // To write the supsub, wrap the first vlist in another vlist: + // They can't all go in the same vlist, because the note might be + // wider than the equation. We want the equation to control the + // brace width. + // note long note long note + // ┏━━━━━━━━┓ or ┏━━━┓ not ┏━━━━━━━━━┓ + // equation eqn eqn + const vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); + + if (group.isOver) { + vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: vSpan + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: supSubGroup + }] + }, options); + } else { + vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, + children: [{ + type: "elem", + elem: supSubGroup + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: vSpan + }] + }, options); + } + } + + return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options); +}; + +const mathmlBuilder$7 = (group, options) => { + const accentNode = stretchy.mathMLnode(group.label); + return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildGroup$1(group.base, options), accentNode]); +}; // Horizontal stretchy braces + + +defineFunction({ + type: "horizBrace", + names: ["\\overbrace", "\\underbrace"], + props: { + numArgs: 1 + }, + + handler({ + parser, + funcName + }, args) { + return { + type: "horizBrace", + mode: parser.mode, + label: funcName, + isOver: /^\\over/.test(funcName), + base: args[0] + }; + }, + + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$7 +}); + +defineFunction({ + type: "href", + names: ["\\href"], + props: { + numArgs: 2, + argTypes: ["url", "original"], + allowedInText: true + }, + handler: ({ + parser + }, args) => { + const body = args[1]; + const href = assertNodeType(args[0], "url").url; + return { + type: "href", + mode: parser.mode, + href, + body: ordargument(body) + }; + }, + htmlBuilder: (group, options) => { + const elements = buildExpression(group.body, options, false); + return buildCommon.makeAnchor(group.href, [], elements, options); + }, + mathmlBuilder: (group, options) => { + let math = buildExpressionRow(group.body, options); + + if (!(math instanceof MathNode)) { + math = new MathNode("mrow", [math]); + } + + math.setAttribute("href", group.href); + return math; + } +}); +defineFunction({ + type: "href", + names: ["\\url"], + props: { + numArgs: 1, + argTypes: ["url"], + allowedInText: true + }, + handler: ({ + parser + }, args) => { + const href = assertNodeType(args[0], "url").url; + const chars = []; + + for (let i = 0; i < href.length; i++) { + let c = href[i]; + + if (c === "~") { + c = "\\textasciitilde"; + } + + chars.push({ + type: "textord", + mode: "text", + text: c + }); + } + + const body = { + type: "text", + mode: parser.mode, + font: "\\texttt", + body: chars + }; + return { + type: "href", + mode: parser.mode, + href, + body: ordargument(body) + }; + } +}); + +defineFunction({ + type: "htmlmathml", + names: ["\\html@mathml"], + props: { + numArgs: 2, + allowedInText: true + }, + handler: ({ + parser + }, args) => { + return { + type: "htmlmathml", + mode: parser.mode, + html: ordargument(args[0]), + mathml: ordargument(args[1]) + }; + }, + htmlBuilder: (group, options) => { + const elements = buildExpression(group.html, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: (group, options) => { + return buildExpressionRow(group.mathml, options); + } +}); + +// Horizontal spacing commands + +defineFunction({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + allowedInText: true + }, + + handler({ + parser, + funcName + }, args) { + const size = assertNodeType(args[0], "size"); + + if (parser.settings.strict) { + const mathFunction = funcName[1] === 'm'; // \mkern, \mskip + + const muUnit = size.value.unit === 'mu'; + + if (mathFunction) { + if (!muUnit) { + parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} supports only mu units, ` + `not ${size.value.unit} units`); + } + + if (parser.mode !== "math") { + parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} works only in math mode`); + } + } else { + // !mathFunction + if (muUnit) { + parser.settings.reportNonstrict("mathVsTextUnits", `LaTeX's ${funcName} doesn't support mu units`); + } + } + } + + return { + type: "kern", + mode: parser.mode, + dimension: size.value + }; + }, + + htmlBuilder(group, options) { + return buildCommon.makeGlue(group.dimension, options); + }, + + mathmlBuilder(group, options) { + const dimension = calculateSize(group.dimension, options); + return new mathMLTree.SpaceNode(dimension); + } + +}); + +// Horizontal overlap functions +defineFunction({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: ({ + parser, + funcName + }, args) => { + const body = args[0]; + return { + type: "lap", + mode: parser.mode, + alignment: funcName.slice(5), + body + }; + }, + htmlBuilder: (group, options) => { + // mathllap, mathrlap, mathclap + let inner; + + if (group.alignment === "clap") { + // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/ + inner = buildCommon.makeSpan([], [buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span + + inner = buildCommon.makeSpan(["inner"], [inner], options); + } else { + inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options)]); + } + + const fix = buildCommon.makeSpan(["fix"], []); + let node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the + // two items involved in the lap. + // Next, use a strut to set the height of the HTML bounding box. + // Otherwise, a tall argument may be misplaced. + + const strut = buildCommon.makeSpan(["strut"]); + strut.style.height = node.height + node.depth + "em"; + strut.style.verticalAlign = -node.depth + "em"; + node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall. + + node = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node + }] + }, options); // Get the horizontal spacing correct relative to adjacent items. + + return buildCommon.makeSpan(["mord"], [node], options); + }, + mathmlBuilder: (group, options) => { + // mathllap, mathrlap, mathclap + const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); + + if (group.alignment !== "rlap") { + const offset = group.alignment === "llap" ? "-1" : "-0.5"; + node.setAttribute("lspace", offset + "width"); + } + + node.setAttribute("width", "0px"); + return node; + } +}); + +defineFunction({ + type: "styling", + names: ["\\(", "$"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: false, + consumeMode: "math" + }, + + handler({ + funcName, + parser + }, args) { + const outerMode = parser.mode; + parser.switchMode("math"); + const close = funcName === "\\(" ? "\\)" : "$"; + const body = parser.parseExpression(false, close); // We can't expand the next symbol after the closing $ until after + // switching modes back. So don't consume within expect. + + parser.expect(close, false); + parser.switchMode(outerMode); + parser.consume(); + return { + type: "styling", + mode: parser.mode, + style: "text", + body + }; + } + +}); // Check for extra closing math delimiters + +defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\)", "\\]"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: false + }, + + handler(context, args) { + throw new ParseError(`Mismatched ${context.funcName}`); + } + +}); + +const chooseMathStyle = (group, options) => { + switch (options.style.size) { + case Style$1.DISPLAY.size: + return group.display; + + case Style$1.TEXT.size: + return group.text; + + case Style$1.SCRIPT.size: + return group.script; + + case Style$1.SCRIPTSCRIPT.size: + return group.scriptscript; + + default: + return group.text; + } +}; + +defineFunction({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { + numArgs: 4 + }, + handler: ({ + parser + }, args) => { + return { + type: "mathchoice", + mode: parser.mode, + display: ordargument(args[0]), + text: ordargument(args[1]), + script: ordargument(args[2]), + scriptscript: ordargument(args[3]) + }; + }, + htmlBuilder: (group, options) => { + const body = chooseMathStyle(group, options); + const elements = buildExpression(body, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: (group, options) => { + const body = chooseMathStyle(group, options); + return buildExpressionRow(body, options); + } +}); + +// Limits, symbols +// NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also +const htmlBuilder$8 = (grp, options) => { + // Operators are handled in the TeXbook pg. 443-444, rule 13(a). + let supGroup; + let subGroup; + let hasLimits = false; + let group; + const supSub = checkNodeType(grp, "supsub"); + + if (supSub) { + // If we have limits, supsub will pass us its group to handle. Pull + // out the superscript and subscript and set the group to the op in + // its base. + supGroup = supSub.sup; + subGroup = supSub.sub; + group = assertNodeType(supSub.base, "op"); + hasLimits = true; + } else { + group = assertNodeType(grp, "op"); + } + + const style = options.style; // Most operators have a large successor symbol, but these don't. + + const noSuccessor = ["\\smallint"]; + let large = false; + + if (style.size === Style$1.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) { + // Most symbol operators get larger in displaystyle (rule 13) + large = true; + } + + let base; + + if (group.symbol) { + // If this is a symbol, create the symbol. + const fontName = large ? "Size2-Regular" : "Size1-Regular"; + let stash = ""; + + if (group.name === "\\oiint" || group.name === "\\oiiint") { + // No font glyphs yet, so use a glyph w/o the oval. + // TODO: When font glyphs are available, delete this code. + stash = group.name.substr(1); // $FlowFixMe + + group.name = stash === "oiint" ? "\\iint" : "\\iiint"; + } + + base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]); + + if (stash.length > 0) { + // We're in \oiint or \oiiint. Overlay the oval. + // TODO: When font glyphs are available, delete this code. + const italic = base.italic; + const oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options); + base = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: base, + shift: 0 + }, { + type: "elem", + elem: oval, + shift: large ? 0.08 : 0 + }] + }, options); // $FlowFixMe + + group.name = "\\" + stash; + base.classes.unshift("mop"); // $FlowFixMe + + base.italic = italic; + } + } else if (group.body) { + // If this is a list, compose that list. + const inner = buildExpression(group.body, options, true); + + if (inner.length === 1 && inner[0] instanceof SymbolNode) { + base = inner[0]; + base.classes[0] = "mop"; // replace old mclass + } else { + base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options); + } + } else { + // Otherwise, this is a text operator. Build the text from the + // operator's name. + // TODO(emily): Add a space in the middle of some of these + // operators, like \limsup + const output = []; + + for (let i = 1; i < group.name.length; i++) { + output.push(buildCommon.mathsym(group.name[i], group.mode)); + } + + base = buildCommon.makeSpan(["mop"], output, options); + } // If content of op is a single symbol, shift it vertically. + + + let baseShift = 0; + let slant = 0; + + if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) { + // We suppress the shift of the base of \overset and \underset. Otherwise, + // shift the symbol so its center lies on the axis (rule 13). It + // appears that our fonts have the centers of the symbols already + // almost on the axis, so these numbers are very small. Note we + // don't actually apply this here, but instead it is used either in + // the vlist creation or separately when there are no limits. + baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction. + // $FlowFixMe + + slant = base.italic; + } + + if (hasLimits) { + // IE 8 clips \int if it is in a display: inline-block. We wrap it + // in a new span so it is an inline, and works. + base = buildCommon.makeSpan([], [base]); + let sub; + let sup; // We manually have to handle the superscripts and subscripts. This, + // aside from the kern calculations, is copied from supsub. + + if (supGroup) { + const elem = buildGroup(supGroup, options.havingStyle(style.sup()), options); + sup = { + elem, + kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth) + }; + } + + if (subGroup) { + const elem = buildGroup(subGroup, options.havingStyle(style.sub()), options); + sub = { + elem, + kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - elem.height) + }; + } // Build the final group as a vlist of the possible subscript, base, + // and possible superscript. + + + let finalGroup; + + if (sup && sub) { + const bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift; + finalGroup = buildCommon.makeVList({ + positionType: "bottom", + positionData: bottom, + children: [{ + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: sub.elem, + marginLeft: -slant + "em" + }, { + type: "kern", + size: sub.kern + }, { + type: "elem", + elem: base + }, { + type: "kern", + size: sup.kern + }, { + type: "elem", + elem: sup.elem, + marginLeft: slant + "em" + }, { + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }] + }, options); + } else if (sub) { + const top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note + // that we are supposed to shift the limits by 1/2 of the slant, + // but since we are centering the limits adding a full slant of + // margin will shift by 1/2 that. + + finalGroup = buildCommon.makeVList({ + positionType: "top", + positionData: top, + children: [{ + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: sub.elem, + marginLeft: -slant + "em" + }, { + type: "kern", + size: sub.kern + }, { + type: "elem", + elem: base + }] + }, options); + } else if (sup) { + const bottom = base.depth + baseShift; + finalGroup = buildCommon.makeVList({ + positionType: "bottom", + positionData: bottom, + children: [{ + type: "elem", + elem: base + }, { + type: "kern", + size: sup.kern + }, { + type: "elem", + elem: sup.elem, + marginLeft: slant + "em" + }, { + type: "kern", + size: options.fontMetrics().bigOpSpacing5 + }] + }, options); + } else { + // This case probably shouldn't occur (this would mean the + // supsub was sending us a group with no superscript or + // subscript) but be safe. + return base; + } + + return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options); + } else { + if (baseShift) { + base.style.position = "relative"; + base.style.top = baseShift + "em"; + } + + return base; + } +}; + +const mathmlBuilder$8 = (group, options) => { + let node; // TODO(emily): handle big operators using the `largeop` attribute + + if (group.symbol) { + // This is a symbol. Just add the symbol. + node = new MathNode("mo", [makeText(group.name, group.mode)]); + } else if (group.body) { + // This is an operator with children. Add them. + node = new MathNode("mo", buildExpression$1(group.body, options)); + } else { + // This is a text operator. Add all of the characters from the + // operator's name. + // TODO(emily): Add a space in the middle of some of these + // operators, like \limsup. + node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an . + // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4 + + const operator = new MathNode("mo", [makeText("\u2061", "text")]); + return newDocumentFragment([node, operator]); + } + + return node; +}; + +const singleCharBigOps = { + "\u220F": "\\prod", + "\u2210": "\\coprod", + "\u2211": "\\sum", + "\u22c0": "\\bigwedge", + "\u22c1": "\\bigvee", + "\u22c2": "\\bigcap", + "\u22c3": "\\bigcap", + "\u2a00": "\\bigodot", + "\u2a01": "\\bigoplus", + "\u2a02": "\\bigotimes", + "\u2a04": "\\biguplus", + "\u2a06": "\\bigsqcup" +}; +defineFunction({ + type: "op", + names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22c0", "\u22c1", "\u22c2", "\u22c3", "\u2a00", "\u2a01", "\u2a02", "\u2a04", "\u2a06"], + props: { + numArgs: 0 + }, + handler: ({ + parser, + funcName + }, args) => { + let fName = funcName; + + if (fName.length === 1) { + fName = singleCharBigOps[fName]; + } + + return { + type: "op", + mode: parser.mode, + limits: true, + symbol: true, + name: fName + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$8 +}); // Note: calling defineFunction with a type that's already been defined only +// works because the same htmlBuilder and mathmlBuilder are being used. + +defineFunction({ + type: "op", + names: ["\\mathop"], + props: { + numArgs: 1 + }, + handler: ({ + parser + }, args) => { + const body = args[0]; + return { + type: "op", + mode: parser.mode, + limits: false, + symbol: false, + body: ordargument(body) + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$8 +}); // There are 2 flags for operators; whether they produce limits in +// displaystyle, and whether they are symbols and should grow in +// displaystyle. These four groups cover the four possible choices. + +const singleCharIntegrals = { + "\u222b": "\\int", + "\u222c": "\\iint", + "\u222d": "\\iiint", + "\u222e": "\\oint", + "\u222f": "\\oiint", + "\u2230": "\\oiiint" +}; // No limits, not symbols + +defineFunction({ + type: "op", + names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], + props: { + numArgs: 0 + }, + + handler({ + parser, + funcName + }) { + return { + type: "op", + mode: parser.mode, + limits: false, + symbol: false, + name: funcName + }; + }, + + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$8 +}); // Limits, not symbols + +defineFunction({ + type: "op", + names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], + props: { + numArgs: 0 + }, + + handler({ + parser, + funcName + }) { + return { + type: "op", + mode: parser.mode, + limits: true, + symbol: false, + name: funcName + }; + }, + + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$8 +}); // No limits, symbols + +defineFunction({ + type: "op", + names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222b", "\u222c", "\u222d", "\u222e", "\u222f", "\u2230"], + props: { + numArgs: 0 + }, + + handler({ + parser, + funcName + }) { + let fName = funcName; + + if (fName.length === 1) { + fName = singleCharIntegrals[fName]; + } + + return { + type: "op", + mode: parser.mode, + limits: false, + symbol: true, + name: fName + }; + }, + + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$8 +}); + +// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@ + +defineFunction({ + type: "operatorname", + names: ["\\operatorname"], + props: { + numArgs: 1 + }, + handler: ({ + parser + }, args) => { + const body = args[0]; + return { + type: "operatorname", + mode: parser.mode, + body: ordargument(body) + }; + }, + htmlBuilder: (group, options) => { + if (group.body.length > 0) { + const body = group.body.map(child => { + // $FlowFixMe: Check if the node has a string `text` property. + const childText = child.text; + + if (typeof childText === "string") { + return { + type: "textord", + mode: child.mode, + text: childText + }; + } else { + return child; + } + }); // Consolidate function names into symbol characters. + + const expression = buildExpression(body, options.withFont("mathrm"), true); + + for (let i = 0; i < expression.length; i++) { + const child = expression[i]; + + if (child instanceof SymbolNode) { + // Per amsopn package, + // change minus to hyphen and \ast to asterisk + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } + } + + return buildCommon.makeSpan(["mop"], expression, options); + } else { + return buildCommon.makeSpan(["mop"], [], options); + } + }, + mathmlBuilder: (group, options) => { + // The steps taken here are similar to the html version. + let expression = buildExpression$1(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction? + + let isAllString = true; // default + + for (let i = 0; i < expression.length; i++) { + const node = expression[i]; + + if (node instanceof mathMLTree.SpaceNode) ; else if (node instanceof mathMLTree.MathNode) { + switch (node.type) { + case "mi": + case "mn": + case "ms": + case "mspace": + case "mtext": + break; + // Do nothing yet. + + case "mo": + { + const child = node.children[0]; + + if (node.children.length === 1 && child instanceof mathMLTree.TextNode) { + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } else { + isAllString = false; + } + + break; + } + + default: + isAllString = false; + } + } else { + isAllString = false; + } + } + + if (isAllString) { + // Write a single TextNode instead of multiple nested tags. + const word = expression.map(node => node.toText()).join(""); // word has already been escaped by `node.toText()` + + expression = [new mathMLTree.TextNode(word, false)]; + } + + const identifier = new mathMLTree.MathNode("mi", expression); + identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as ⁡ + // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp + + const operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); + return mathMLTree.newDocumentFragment([identifier, operator]); + } +}); + +defineFunctionBuilders({ + type: "ordgroup", + + htmlBuilder(group, options) { + return buildCommon.makeSpan(["mord"], buildExpression(group.body, options, true), options); + }, + + mathmlBuilder(group, options) { + return buildExpressionRow(group.body, options); + } + +}); + +defineFunction({ + type: "overline", + names: ["\\overline"], + props: { + numArgs: 1 + }, + + handler({ + parser + }, args) { + const body = args[0]; + return { + type: "overline", + mode: parser.mode, + body + }; + }, + + htmlBuilder(group, options) { + // Overlines are handled in the TeXbook pg 443, Rule 9. + // Build the inner group in the cramped style. + const innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body + + const line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns + + const vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: innerGroup + }, { + type: "kern", + size: 3 * line.height + }, { + type: "elem", + elem: line + }, { + type: "kern", + size: line.height + }] + }, options); + return buildCommon.makeSpan(["mord", "overline"], [vlist], options); + }, + + mathmlBuilder(group, options) { + const operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); + operator.setAttribute("stretchy", "true"); + const node = new mathMLTree.MathNode("mover", [buildGroup$1(group.body, options), operator]); + node.setAttribute("accent", "true"); + return node; + } + +}); + +defineFunction({ + type: "phantom", + names: ["\\phantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: ({ + parser + }, args) => { + const body = args[0]; + return { + type: "phantom", + mode: parser.mode, + body: ordargument(body) + }; + }, + htmlBuilder: (group, options) => { + const elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains. + // See "color" for more details. + + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: (group, options) => { + const inner = buildExpression$1(group.body, options); + return new mathMLTree.MathNode("mphantom", inner); + } +}); +defineFunction({ + type: "hphantom", + names: ["\\hphantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: ({ + parser + }, args) => { + const body = args[0]; + return { + type: "hphantom", + mode: parser.mode, + body + }; + }, + htmlBuilder: (group, options) => { + let node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]); + node.height = 0; + node.depth = 0; + + if (node.children) { + for (let i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + node.children[i].depth = 0; + } + } // See smash for comment re: use of makeVList + + + node = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node + }] + }, options); + return node; + }, + mathmlBuilder: (group, options) => { + const inner = buildExpression$1(ordargument(group.body), options); + const node = new mathMLTree.MathNode("mphantom", inner); + node.setAttribute("height", "0px"); + return node; + } +}); +defineFunction({ + type: "vphantom", + names: ["\\vphantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: ({ + parser + }, args) => { + const body = args[0]; + return { + type: "vphantom", + mode: parser.mode, + body + }; + }, + htmlBuilder: (group, options) => { + const inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]); + const fix = buildCommon.makeSpan(["fix"], []); + return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); + }, + mathmlBuilder: (group, options) => { + const inner = buildExpression$1(ordargument(group.body), options); + const node = new mathMLTree.MathNode("mphantom", inner); + node.setAttribute("width", "0px"); + return node; + } +}); + +function sizingGroup(value, options, baseOptions) { + const inner = buildExpression(value, options, false); + const multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize + // manually. Handle nested size changes. + + for (let i = 0; i < inner.length; i++) { + const pos = inner[i].classes.indexOf("sizing"); + + if (pos < 0) { + Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions)); + } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { + // This is a nested size change: e.g., inner[i] is the "b" in + // `\Huge a \small b`. Override the old size (the `reset-` class) + // but not the new size. + inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; + } + + inner[i].height *= multiplier; + inner[i].depth *= multiplier; + } + + return buildCommon.makeFragment(inner); +} +const sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; +const htmlBuilder$9 = (group, options) => { + // Handle sizing operators like \Huge. Real TeX doesn't actually allow + // these functions inside of math expressions, so we do some special + // handling. + const newOptions = options.havingSize(group.size); + return sizingGroup(group.body, newOptions, options); +}; +defineFunction({ + type: "sizing", + names: sizeFuncs, + props: { + numArgs: 0, + allowedInText: true + }, + handler: ({ + breakOnTokenText, + funcName, + parser + }, args) => { + parser.consumeSpaces(); + const body = parser.parseExpression(false, breakOnTokenText); + return { + type: "sizing", + mode: parser.mode, + // Figure out what size to use based on the list of functions above + size: sizeFuncs.indexOf(funcName) + 1, + body + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: (group, options) => { + const newOptions = options.havingSize(group.size); + const inner = buildExpression$1(group.body, newOptions); + const node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size + // changes, because we don't keep state of what style we're currently + // in, so we can't reset the size to normal before changing it. Now + // that we're passing an options parameter we should be able to fix + // this. + + node.setAttribute("mathsize", newOptions.sizeMultiplier + "em"); + return node; + } +}); + +defineFunction({ + type: "raisebox", + names: ["\\raisebox"], + props: { + numArgs: 2, + argTypes: ["size", "text"], + allowedInText: true + }, + + handler({ + parser + }, args) { + const amount = assertNodeType(args[0], "size").value; + const body = args[1]; + return { + type: "raisebox", + mode: parser.mode, + dy: amount, + body + }; + }, + + htmlBuilder(group, options) { + const text = { + type: "text", + mode: group.mode, + body: ordargument(group.body), + font: "mathrm" // simulate \textrm + + }; + const sizedText = { + type: "sizing", + mode: group.mode, + body: [text], + size: 6 // simulate \normalsize + + }; + const body = htmlBuilder$9(sizedText, options); + const dy = calculateSize(group.dy, options); + return buildCommon.makeVList({ + positionType: "shift", + positionData: -dy, + children: [{ + type: "elem", + elem: body + }] + }, options); + }, + + mathmlBuilder(group, options) { + const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); + const dy = group.dy.number + group.dy.unit; + node.setAttribute("voffset", dy); + return node; + } + +}); + +defineFunction({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + argTypes: ["size", "size", "size"] + }, + + handler({ + parser + }, args, optArgs) { + const shift = optArgs[0]; + const width = assertNodeType(args[0], "size"); + const height = assertNodeType(args[1], "size"); + return { + type: "rule", + mode: parser.mode, + shift: shift && assertNodeType(shift, "size").value, + width: width.value, + height: height.value + }; + }, + + htmlBuilder(group, options) { + // Make an empty span for the rule + const rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units + + let shift = 0; + + if (group.shift) { + shift = calculateSize(group.shift, options); + } + + const width = calculateSize(group.width, options); + const height = calculateSize(group.height, options); // Style the rule to the right size + + rule.style.borderRightWidth = width + "em"; + rule.style.borderTopWidth = height + "em"; + rule.style.bottom = shift + "em"; // Record the height and width + + rule.width = width; + rule.height = height + shift; + rule.depth = -shift; // Font size is the number large enough that the browser will + // reserve at least `absHeight` space above the baseline. + // The 1.125 factor was empirically determined + + rule.maxFontSize = height * 1.125 * options.sizeMultiplier; + return rule; + }, + + mathmlBuilder(group, options) { + // TODO(emily): Figure out if there's an actual way to draw black boxes + // in MathML. + const node = new mathMLTree.MathNode("mrow"); + return node; + } + +}); + +// smash, with optional [tb], as in AMS +defineFunction({ + type: "smash", + names: ["\\smash"], + props: { + numArgs: 1, + numOptionalArgs: 1, + allowedInText: true + }, + handler: ({ + parser + }, args, optArgs) => { + let smashHeight = false; + let smashDepth = false; + const tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); + + if (tbArg) { + // Optional [tb] argument is engaged. + // ref: amsmath: \renewcommand{\smash}[1][tb]{% + // def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + let letter = ""; + + for (let i = 0; i < tbArg.body.length; ++i) { + const node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property. + + letter = node.text; + + if (letter === "t") { + smashHeight = true; + } else if (letter === "b") { + smashDepth = true; + } else { + smashHeight = false; + smashDepth = false; + break; + } + } + } else { + smashHeight = true; + smashDepth = true; + } + + const body = args[0]; + return { + type: "smash", + mode: parser.mode, + body, + smashHeight, + smashDepth + }; + }, + htmlBuilder: (group, options) => { + const node = buildCommon.makeSpan(["mord"], [buildGroup(group.body, options)]); + + if (!group.smashHeight && !group.smashDepth) { + return node; + } + + if (group.smashHeight) { + node.height = 0; // In order to influence makeVList, we have to reset the children. + + if (node.children) { + for (let i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + } + } + } + + if (group.smashDepth) { + node.depth = 0; + + if (node.children) { + for (let i = 0; i < node.children.length; i++) { + node.children[i].depth = 0; + } + } + } // At this point, we've reset the TeX-like height and depth values. + // But the span still has an HTML line height. + // makeVList applies "display: table-cell", which prevents the browser + // from acting on that line height. So we'll call makeVList now. + + + return buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node + }] + }, options); + }, + mathmlBuilder: (group, options) => { + const node = new mathMLTree.MathNode("mpadded", [buildGroup$1(group.body, options)]); + + if (group.smashHeight) { + node.setAttribute("height", "0px"); + } + + if (group.smashDepth) { + node.setAttribute("depth", "0px"); + } + + return node; + } +}); + +defineFunction({ + type: "sqrt", + names: ["\\sqrt"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + + handler({ + parser + }, args, optArgs) { + const index = optArgs[0]; + const body = args[0]; + return { + type: "sqrt", + mode: parser.mode, + body, + index + }; + }, + + htmlBuilder(group, options) { + // Square roots are handled in the TeXbook pg. 443, Rule 11. + // First, we do the same steps as in overline to build the inner group + // and line + let inner = buildGroup(group.body, options.havingCrampedStyle()); + + if (inner.height === 0) { + // Render a small surd. + inner.height = options.fontMetrics().xHeight; + } // Some groups can return document fragments. Handle those by wrapping + // them in a span. + + + inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter + + const metrics = options.fontMetrics(); + const theta = metrics.defaultRuleThickness; + let phi = theta; + + if (options.style.id < Style$1.TEXT.id) { + phi = options.fontMetrics().xHeight; + } // Calculate the clearance between the body and line + + + let lineClearance = theta + phi / 4; + const minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size + + const _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options), + img = _delimiter$sqrtImage.span, + ruleWidth = _delimiter$sqrtImage.ruleWidth, + advanceWidth = _delimiter$sqrtImage.advanceWidth; + + const delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size + + if (delimDepth > inner.height + inner.depth + lineClearance) { + lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2; + } // Shift the sqrt image + + + const imgShift = img.height - inner.height - lineClearance - ruleWidth; + inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument. + + const body = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: inner, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: -(inner.height + imgShift) + }, { + type: "elem", + elem: img + }, { + type: "kern", + size: ruleWidth + }] + }, options); + + if (!group.index) { + return buildCommon.makeSpan(["mord", "sqrt"], [body], options); + } else { + // Handle the optional root index + // The index is always in scriptscript style + const newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT); + const rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX + // source, in the definition of `\r@@t`. + + const toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly + + const rootVList = buildCommon.makeVList({ + positionType: "shift", + positionData: -toShift, + children: [{ + type: "elem", + elem: rootm + }] + }, options); // Add a class surrounding it so we can add on the appropriate + // kerning + + const rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); + return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options); + } + }, + + mathmlBuilder(group, options) { + const body = group.body, + index = group.index; + return index ? new mathMLTree.MathNode("mroot", [buildGroup$1(body, options), buildGroup$1(index, options)]) : new mathMLTree.MathNode("msqrt", [buildGroup$1(body, options)]); + } + +}); + +const styleMap$1 = { + "display": Style$1.DISPLAY, + "text": Style$1.TEXT, + "script": Style$1.SCRIPT, + "scriptscript": Style$1.SCRIPTSCRIPT +}; +defineFunction({ + type: "styling", + names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], + props: { + numArgs: 0, + allowedInText: true + }, + + handler({ + breakOnTokenText, + funcName, + parser + }, args) { + // parse out the implicit body + parser.consumeSpaces(); + const body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g. + // here and in buildHTML and de-dupe the enumeration of all the styles). + // $FlowFixMe: The names above exactly match the styles. + + const style = funcName.slice(1, funcName.length - 5); + return { + type: "styling", + mode: parser.mode, + // Figure out what style to use by pulling out the style from + // the function name + style, + body + }; + }, + + htmlBuilder(group, options) { + // Style changes are handled in the TeXbook on pg. 442, Rule 3. + const newStyle = styleMap$1[group.style]; + const newOptions = options.havingStyle(newStyle).withFont(''); + return sizingGroup(group.body, newOptions, options); + }, + + mathmlBuilder(group, options) { + // Figure out what style we're changing to. + // TODO(kevinb): dedupe this with buildHTML.js + // This will be easier of handling of styling nodes is in the same file. + const styleMap = { + "display": Style$1.DISPLAY, + "text": Style$1.TEXT, + "script": Style$1.SCRIPT, + "scriptscript": Style$1.SCRIPTSCRIPT + }; + const newStyle = styleMap[group.style]; + const newOptions = options.havingStyle(newStyle); + const inner = buildExpression$1(group.body, newOptions); + const node = new mathMLTree.MathNode("mstyle", inner); + const styleAttributes = { + "display": ["0", "true"], + "text": ["0", "false"], + "script": ["1", "false"], + "scriptscript": ["2", "false"] + }; + const attr = styleAttributes[group.style]; + node.setAttribute("scriptlevel", attr[0]); + node.setAttribute("displaystyle", attr[1]); + return node; + } + +}); + +/** + * Sometimes, groups perform special rules when they have superscripts or + * subscripts attached to them. This function lets the `supsub` group know that + * Sometimes, groups perform special rules when they have superscripts or + * its inner element should handle the superscripts and subscripts instead of + * handling them itself. + */ +const htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { + const base = group.base; + + if (!base) { + return null; + } else if (base.type === "op") { + // Operators handle supsubs differently when they have limits + // (e.g. `\displaystyle\sum_2^3`) + const delegate = base.limits && (options.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub); + return delegate ? htmlBuilder$8 : null; + } else if (base.type === "accent") { + return utils.isCharacterBox(base.base) ? htmlBuilder : null; + } else if (base.type === "horizBrace") { + const isSup = !group.sub; + return isSup === base.isOver ? htmlBuilder$7 : null; + } else { + return null; + } +}; // Super scripts and subscripts, whose precise placement can depend on other +// functions that precede them. + + +defineFunctionBuilders({ + type: "supsub", + + htmlBuilder(group, options) { + // Superscript and subscripts are handled in the TeXbook on page + // 445-446, rules 18(a-f). + // Here is where we defer to the inner group if it should handle + // superscripts and subscripts itself. + const builderDelegate = htmlBuilderDelegate(group, options); + + if (builderDelegate) { + return builderDelegate(group, options); + } + + const valueBase = group.base, + valueSup = group.sup, + valueSub = group.sub; + const base = buildGroup(valueBase, options); + let supm; + let subm; + const metrics = options.fontMetrics(); // Rule 18a + + let supShift = 0; + let subShift = 0; + const isCharacterBox = valueBase && utils.isCharacterBox(valueBase); + + if (valueSup) { + const newOptions = options.havingStyle(options.style.sup()); + supm = buildGroup(valueSup, newOptions, options); + + if (!isCharacterBox) { + supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier; + } + } + + if (valueSub) { + const newOptions = options.havingStyle(options.style.sub()); + subm = buildGroup(valueSub, newOptions, options); + + if (!isCharacterBox) { + subShift = base.depth + newOptions.fontMetrics().subDrop * newOptions.sizeMultiplier / options.sizeMultiplier; + } + } // Rule 18c + + + let minSupShift; + + if (options.style === Style$1.DISPLAY) { + minSupShift = metrics.sup1; + } else if (options.style.cramped) { + minSupShift = metrics.sup3; + } else { + minSupShift = metrics.sup2; + } // scriptspace is a font-size-independent size, so scale it + // appropriately for use as the marginRight. + + + const multiplier = options.sizeMultiplier; + const marginRight = 0.5 / metrics.ptPerEm / multiplier + "em"; + let marginLeft = null; + + if (subm) { + // Subscripts shouldn't be shifted by the base's italic correction. + // Account for that by shifting the subscript back the appropriate + // amount. Note we only do this when the base is a single symbol. + const isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); + + if (base instanceof SymbolNode || isOiint) { + // $FlowFixMe + marginLeft = -base.italic + "em"; + } + } + + let supsub; + + if (supm && subm) { + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + subShift = Math.max(subShift, metrics.sub2); + const ruleWidth = metrics.defaultRuleThickness; // Rule 18e + + const maxWidth = 4 * ruleWidth; + + if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { + subShift = maxWidth - (supShift - supm.depth) + subm.height; + const psi = 0.8 * metrics.xHeight - (supShift - supm.depth); + + if (psi > 0) { + supShift += psi; + subShift -= psi; + } + } + + const vlistElem = [{ + type: "elem", + elem: subm, + shift: subShift, + marginRight, + marginLeft + }, { + type: "elem", + elem: supm, + shift: -supShift, + marginRight + }]; + supsub = buildCommon.makeVList({ + positionType: "individualShift", + children: vlistElem + }, options); + } else if (subm) { + // Rule 18b + subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); + const vlistElem = [{ + type: "elem", + elem: subm, + marginLeft, + marginRight + }]; + supsub = buildCommon.makeVList({ + positionType: "shift", + positionData: subShift, + children: vlistElem + }, options); + } else if (supm) { + // Rule 18c, d + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + supsub = buildCommon.makeVList({ + positionType: "shift", + positionData: -supShift, + children: [{ + type: "elem", + elem: supm, + marginRight + }] + }, options); + } else { + throw new Error("supsub must have either sup or sub."); + } // Wrap the supsub vlist in a span.msupsub to reset text-align. + + + const mclass = getTypeOfDomTree(base, "right") || "mord"; + return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options); + }, + + mathmlBuilder(group, options) { + // Is the inner group a relevant horizonal brace? + let isBrace = false; + let isOver; + let isSup; + const horizBrace = checkNodeType(group.base, "horizBrace"); + + if (horizBrace) { + isSup = !!group.sup; + + if (isSup === horizBrace.isOver) { + isBrace = true; + isOver = horizBrace.isOver; + } + } + + const children = [buildGroup$1(group.base, options)]; + + if (group.sub) { + children.push(buildGroup$1(group.sub, options)); + } + + if (group.sup) { + children.push(buildGroup$1(group.sup, options)); + } + + let nodeType; + + if (isBrace) { + nodeType = isOver ? "mover" : "munder"; + } else if (!group.sub) { + const base = group.base; + + if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) { + nodeType = "mover"; + } else { + nodeType = "msup"; + } + } else if (!group.sup) { + const base = group.base; + + if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) { + nodeType = "munder"; + } else { + nodeType = "msub"; + } + } else { + const base = group.base; + + if (base && base.type === "op" && base.limits && options.style === Style$1.DISPLAY) { + nodeType = "munderover"; + } else { + nodeType = "msubsup"; + } + } + + const node = new mathMLTree.MathNode(nodeType, children); + return node; + } + +}); + +defineFunctionBuilders({ + type: "atom", + + htmlBuilder(group, options) { + return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]); + }, + + mathmlBuilder(group, options) { + const node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]); + + if (group.family === "bin") { + const variant = getVariant(group, options); + + if (variant === "bold-italic") { + node.setAttribute("mathvariant", variant); + } + } else if (group.family === "punct") { + node.setAttribute("separator", "true"); + } + + return node; + } + +}); + +// "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in +const defaultVariant = { + "mi": "italic", + "mn": "normal", + "mtext": "normal" +}; +defineFunctionBuilders({ + type: "mathord", + + htmlBuilder(group, options) { + return buildCommon.makeOrd(group, options, "mathord"); + }, + + mathmlBuilder(group, options) { + const node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]); + const variant = getVariant(group, options) || "italic"; + + if (variant !== defaultVariant[node.type]) { + node.setAttribute("mathvariant", variant); + } + + return node; + } + +}); +defineFunctionBuilders({ + type: "textord", + + htmlBuilder(group, options) { + return buildCommon.makeOrd(group, options, "textord"); + }, + + mathmlBuilder(group, options) { + const text = makeText(group.text, group.mode, options); + const variant = getVariant(group, options) || "normal"; + let node; + + if (group.mode === 'text') { + node = new mathMLTree.MathNode("mtext", [text]); + } else if (/[0-9]/.test(group.text)) { + // TODO(kevinb) merge adjacent nodes + // do it as a post processing step + node = new mathMLTree.MathNode("mn", [text]); + } else if (group.text === "\\prime") { + node = new mathMLTree.MathNode("mo", [text]); + } else { + node = new mathMLTree.MathNode("mi", [text]); + } + + if (variant !== defaultVariant[node.type]) { + node.setAttribute("mathvariant", variant); + } + + return node; + } + +}); + +const cssSpace = { + "\\nobreak": "nobreak", + "\\allowbreak": "allowbreak" +}; // A lookup table to determine whether a spacing function/symbol should be +// treated like a regular space character. If a symbol or command is a key +// in this table, then it should be a regular space character. Furthermore, +// the associated value may have a `className` specifying an extra CSS class +// to add to the created `span`. + +const regularSpace = { + " ": {}, + "\\ ": {}, + "~": { + className: "nobreak" + }, + "\\space": {}, + "\\nobreakspace": { + className: "nobreak" + } +}; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in +// src/symbols.js. + +defineFunctionBuilders({ + type: "spacing", + + htmlBuilder(group, options) { + if (regularSpace.hasOwnProperty(group.text)) { + const className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these + // things has an entry in the symbols table, so these will be turned + // into appropriate outputs. + + if (group.mode === "text") { + const ord = buildCommon.makeOrd(group, options, "textord"); + ord.classes.push(className); + return ord; + } else { + return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options); + } + } else if (cssSpace.hasOwnProperty(group.text)) { + // Spaces based on just a CSS class. + return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options); + } else { + throw new ParseError(`Unknown type of space "${group.text}"`); + } + }, + + mathmlBuilder(group, options) { + let node; + + if (regularSpace.hasOwnProperty(group.text)) { + node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\u00a0")]); + } else if (cssSpace.hasOwnProperty(group.text)) { + // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored + return new mathMLTree.MathNode("mspace"); + } else { + throw new ParseError(`Unknown type of space "${group.text}"`); + } + + return node; + } + +}); + +defineFunctionBuilders({ + type: "tag", + + mathmlBuilder(group, options) { + const table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mlabeledtr", [new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)]), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)])])]); + table.setAttribute("side", "right"); + return table; + } + +}); + +const textFontFamilies = { + "\\text": undefined, + "\\textrm": "textrm", + "\\textsf": "textsf", + "\\texttt": "texttt", + "\\textnormal": "textrm" +}; +const textFontWeights = { + "\\textbf": "textbf" +}; +const textFontShapes = { + "\\textit": "textit" +}; + +const optionsWithFont = (group, options) => { + const font = group.font; // Checks if the argument is a font family or a font style. + + if (!font) { + return options; + } else if (textFontFamilies[font]) { + return options.withTextFontFamily(textFontFamilies[font]); + } else if (textFontWeights[font]) { + return options.withTextFontWeight(textFontWeights[font]); + } else { + return options.withTextFontShape(textFontShapes[font]); + } +}; + +defineFunction({ + type: "text", + names: [// Font families + "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights + "\\textbf", // Font Shapes + "\\textit"], + props: { + numArgs: 1, + argTypes: ["text"], + greediness: 2, + allowedInText: true, + consumeMode: "text" + }, + + handler({ + parser, + funcName + }, args) { + const body = args[0]; + return { + type: "text", + mode: parser.mode, + body: ordargument(body), + font: funcName + }; + }, + + htmlBuilder(group, options) { + const newOptions = optionsWithFont(group, options); + const inner = buildExpression(group.body, newOptions, true); + return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions); + }, + + mathmlBuilder(group, options) { + const newOptions = optionsWithFont(group, options); + return buildExpressionRow(group.body, newOptions); + } + +}); + +defineFunction({ + type: "underline", + names: ["\\underline"], + props: { + numArgs: 1, + allowedInText: true + }, + + handler({ + parser + }, args) { + return { + type: "underline", + mode: parser.mode, + body: args[0] + }; + }, + + htmlBuilder(group, options) { + // Underlines are handled in the TeXbook pg 443, Rule 10. + // Build the inner group. + const innerGroup = buildGroup(group.body, options); // Create the line to go below the body + + const line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns + + const vlist = buildCommon.makeVList({ + positionType: "top", + positionData: innerGroup.height, + children: [{ + type: "kern", + size: line.height + }, { + type: "elem", + elem: line + }, { + type: "kern", + size: 3 * line.height + }, { + type: "elem", + elem: innerGroup + }] + }, options); + return buildCommon.makeSpan(["mord", "underline"], [vlist], options); + }, + + mathmlBuilder(group, options) { + const operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203e")]); + operator.setAttribute("stretchy", "true"); + const node = new mathMLTree.MathNode("munder", [buildGroup$1(group.body, options), operator]); + node.setAttribute("accentunder", "true"); + return node; + } + +}); + +defineFunction({ + type: "verb", + names: ["\\verb"], + props: { + numArgs: 0, + allowedInText: true + }, + + handler(context, args, optArgs) { + // \verb and \verb* are dealt with directly in Parser.js. + // If we end up here, it's because of a failure to match the two delimiters + // in the regex in Lexer.js. LaTeX raises the following error when \verb is + // terminated by end of line (or file). + throw new ParseError("\\verb ended by end of line instead of matching delimiter"); + }, + + htmlBuilder(group, options) { + const text = makeVerb(group); + const body = []; // \verb enters text mode and therefore is sized like \textstyle + + const newOptions = options.havingStyle(options.style.text()); + + for (let i = 0; i < text.length; i++) { + let c = text[i]; + + if (c === '~') { + c = '\\textasciitilde'; + } + + body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"])); + } + + return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions); + }, + + mathmlBuilder(group, options) { + const text = new mathMLTree.TextNode(makeVerb(group)); + const node = new mathMLTree.MathNode("mtext", [text]); + node.setAttribute("mathvariant", "monospace"); + return node; + } + +}); +/** + * Converts verb group into body string. + * + * \verb* replaces each space with an open box \u2423 + * \verb replaces each space with a no-break space \xA0 + */ + +const makeVerb = group => group.body.replace(/ /g, group.star ? '\u2423' : '\xA0'); + +/** Include this to ensure that all functions are defined. */ +const functions = _functions; + +/** + * The Lexer class handles tokenizing the input in various ways. Since our + * parser expects us to be able to backtrack, the lexer allows lexing from any + * given starting point. + * + * Its main exposed function is the `lex` function, which takes a position to + * lex from and a type of token to lex. It defers to the appropriate `_innerLex` + * function. + * + * The various `_innerLex` functions perform the actual lexing of different + * kinds. + */ + +/* The following tokenRegex + * - matches typical whitespace (but not NBSP etc.) using its first group + * - does not match any control character \x00-\x1f except whitespace + * - does not match a bare backslash + * - matches any ASCII character except those just mentioned + * - does not match the BMP private use area \uE000-\uF8FF + * - does not match bare surrogate code units + * - matches any BMP character except for those just described + * - matches any valid Unicode surrogate pair + * - matches a backslash followed by one or more letters + * - matches a backslash followed by any BMP character, including newline + * Just because the Lexer matches something doesn't mean it's valid input: + * If there is no matching function or symbol definition, the Parser will + * still reject the input. + */ +const spaceRegexString = "[ \r\n\t]"; +const controlWordRegexString = "\\\\[a-zA-Z@]+"; +const controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; +const controlWordWhitespaceRegexString = `${controlWordRegexString}${spaceRegexString}*`; +const controlWordWhitespaceRegex = new RegExp(`^(${controlWordRegexString})${spaceRegexString}*$`); +const combiningDiacriticalMarkString = "[\u0300-\u036f]"; +const combiningDiacriticalMarksEndRegex = new RegExp(`${combiningDiacriticalMarkString}+$`); +const tokenRegexString = `(${spaceRegexString}+)|` + // whitespace +"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint +`${combiningDiacriticalMarkString}*` + // ...plus accents +"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair +`${combiningDiacriticalMarkString}*` + // ...plus accents +"|\\\\verb\\*([^]).*?\\3" + // \verb* +"|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred +`|${controlWordWhitespaceRegexString}` + // \macroName + spaces +`|${controlSymbolRegexString})`; // \\, \', etc. +/** Main Lexer class */ + +class Lexer { + constructor(input) { + this.input = void 0; + this.tokenRegex = void 0; + // Separate accents from characters + this.input = input; + this.tokenRegex = new RegExp(tokenRegexString, 'g'); + } + /** + * This function lexes a single token. + */ + + + lex() { + const input = this.input; + const pos = this.tokenRegex.lastIndex; + + if (pos === input.length) { + return new Token("EOF", new SourceLocation(this, pos, pos)); + } + + const match = this.tokenRegex.exec(input); + + if (match === null || match.index !== pos) { + throw new ParseError(`Unexpected character: '${input[pos]}'`, new Token(input[pos], new SourceLocation(this, pos, pos + 1))); + } + + let text = match[2] || " "; // Trim any trailing whitespace from control word match + + const controlMatch = text.match(controlWordWhitespaceRegex); + + if (controlMatch) { + text = controlMatch[1]; + } + + return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); + } + +} + +/** + * A `Namespace` refers to a space of nameable things like macros or lengths, + * which can be `set` either globally or local to a nested group, using an + * undo stack similar to how TeX implements this functionality. + * Performance-wise, `get` and local `set` take constant time, while global + * `set` takes time proportional to the depth of group nesting. + */ +class Namespace { + /** + * Both arguments are optional. The first argument is an object of + * built-in mappings which never change. The second argument is an object + * of initial (global-level) mappings, which will constantly change + * according to any global/top-level `set`s done. + */ + constructor(builtins = {}, globalMacros = {}) { + this.current = void 0; + this.builtins = void 0; + this.undefStack = void 0; + this.current = globalMacros; + this.builtins = builtins; + this.undefStack = []; + } + /** + * Start a new nested group, affecting future local `set`s. + */ + + + beginGroup() { + this.undefStack.push({}); + } + /** + * End current nested group, restoring values before the group began. + */ + + + endGroup() { + if (this.undefStack.length === 0) { + throw new ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug"); + } + + const undefs = this.undefStack.pop(); + + for (const undef in undefs) { + if (undefs.hasOwnProperty(undef)) { + if (undefs[undef] === undefined) { + delete this.current[undef]; + } else { + this.current[undef] = undefs[undef]; + } + } + } + } + /** + * Detect whether `name` has a definition. Equivalent to + * `get(name) != null`. + */ + + + has(name) { + return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name); + } + /** + * Get the current value of a name, or `undefined` if there is no value. + * + * Note: Do not use `if (namespace.get(...))` to detect whether a macro + * is defined, as the definition may be the empty string which evaluates + * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or + * `if (namespace.has(...))`. + */ + + + get(name) { + if (this.current.hasOwnProperty(name)) { + return this.current[name]; + } else { + return this.builtins[name]; + } + } + /** + * Set the current value of a name, and optionally set it globally too. + * Local set() sets the current value and (when appropriate) adds an undo + * operation to the undo stack. Global set() may change the undo + * operation at every level, so takes time linear in their number. + */ + + + set(name, value, global = false) { + if (global) { + // Global set is equivalent to setting in all groups. Simulate this + // by destroying any undos currently scheduled for this name, + // and adding an undo with the *new* value (in case it later gets + // locally reset within this environment). + for (let i = 0; i < this.undefStack.length; i++) { + delete this.undefStack[i][name]; + } + + if (this.undefStack.length > 0) { + this.undefStack[this.undefStack.length - 1][name] = value; + } + } else { + // Undo this set at end of this group (possibly to `undefined`), + // unless an undo is already in place, in which case that older + // value is the correct one. + const top = this.undefStack[this.undefStack.length - 1]; + + if (top && !top.hasOwnProperty(name)) { + top[name] = this.current[name]; + } + } + + this.current[name] = value; + } + +} + +/** + * Predefined macros for KaTeX. + * This can be used to define some commands in terms of others. + */ +const builtinMacros = {}; + +function defineMacro(name, body) { + builtinMacros[name] = body; +} ////////////////////////////////////////////////////////////////////// +// macro tools +// LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2 +// TeX source: \long\def\@firstoftwo#1#2{#1} + +defineMacro("\\@firstoftwo", function (context) { + const args = context.consumeArgs(2); + return { + tokens: args[0], + numArgs: 0 + }; +}); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1 +// TeX source: \long\def\@secondoftwo#1#2{#2} + +defineMacro("\\@secondoftwo", function (context) { + const args = context.consumeArgs(2); + return { + tokens: args[1], + numArgs: 0 + }; +}); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded) +// symbol. If it matches #1, then the macro expands to #2; otherwise, #3. +// Note, however, that it does not consume the next symbol in either case. + +defineMacro("\\@ifnextchar", function (context) { + const args = context.consumeArgs(3); // symbol, if, else + + const nextToken = context.future(); + + if (args[0].length === 1 && args[0][0].text === nextToken.text) { + return { + tokens: args[1], + numArgs: 0 + }; + } else { + return { + tokens: args[2], + numArgs: 0 + }; + } +}); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol. +// If it is `*`, then it consumes the symbol, and the macro expands to #1; +// otherwise, the macro expands to #2 (without consuming the symbol). +// TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}} + +defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode + +defineMacro("\\TextOrMath", function (context) { + const args = context.consumeArgs(2); + + if (context.mode === 'text') { + return { + tokens: args[0], + numArgs: 0 + }; + } else { + return { + tokens: args[1], + numArgs: 0 + }; + } +}); // Lookup table for parsing numbers in base 8 through 16 + +const digitToNumber = { + "0": 0, + "1": 1, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7, + "8": 8, + "9": 9, + "a": 10, + "A": 10, + "b": 11, + "B": 11, + "c": 12, + "C": 12, + "d": 13, + "D": 13, + "e": 14, + "E": 14, + "f": 15, + "F": 15 +}; // TeX \char makes a literal character (catcode 12) using the following forms: +// (see The TeXBook, p. 43) +// \char123 -- decimal +// \char'123 -- octal +// \char"123 -- hex +// \char`x -- character that can be written (i.e. isn't active) +// \char`\x -- character that cannot be written (e.g. %) +// These all refer to characters from the font, so we turn them into special +// calls to a function \@char dealt with in the Parser. + +defineMacro("\\char", function (context) { + let token = context.popToken(); + let base; + let number = ''; + + if (token.text === "'") { + base = 8; + token = context.popToken(); + } else if (token.text === '"') { + base = 16; + token = context.popToken(); + } else if (token.text === "`") { + token = context.popToken(); + + if (token.text[0] === "\\") { + number = token.text.charCodeAt(1); + } else if (token.text === "EOF") { + throw new ParseError("\\char` missing argument"); + } else { + number = token.text.charCodeAt(0); + } + } else { + base = 10; + } + + if (base) { + // Parse a number in the given base, starting with first `token`. + number = digitToNumber[token.text]; + + if (number == null || number >= base) { + throw new ParseError(`Invalid base-${base} digit ${token.text}`); + } + + let digit; + + while ((digit = digitToNumber[context.future().text]) != null && digit < base) { + number *= base; + number += digit; + context.popToken(); + } + } + + return `\\@char{${number}}`; +}); // Basic support for macro definitions: +// \def\macro{expansion} +// \def\macro#1{expansion} +// \def\macro#1#2{expansion} +// \def\macro#1#2#3#4#5#6#7#8#9{expansion} +// Also the \gdef and \global\def equivalents + +const def = (context, global) => { + let arg = context.consumeArgs(1)[0]; + + if (arg.length !== 1) { + throw new ParseError("\\gdef's first argument must be a macro name"); + } + + const name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ... + + let numArgs = 0; + arg = context.consumeArgs(1)[0]; + + while (arg.length === 1 && arg[0].text === "#") { + arg = context.consumeArgs(1)[0]; + + if (arg.length !== 1) { + throw new ParseError(`Invalid argument number length "${arg.length}"`); + } + + if (!/^[1-9]$/.test(arg[0].text)) { + throw new ParseError(`Invalid argument number "${arg[0].text}"`); + } + + numArgs++; + + if (parseInt(arg[0].text) !== numArgs) { + throw new ParseError(`Argument number "${arg[0].text}" out of order`); + } + + arg = context.consumeArgs(1)[0]; + } // Final arg is the expansion of the macro + + + context.macros.set(name, { + tokens: arg, + numArgs + }, global); + return ''; +}; + +defineMacro("\\gdef", context => def(context, true)); +defineMacro("\\def", context => def(context, false)); +defineMacro("\\global", context => { + const next = context.consumeArgs(1)[0]; + + if (next.length !== 1) { + throw new ParseError("Invalid command after \\global"); + } + + const command = next[0].text; // TODO: Should expand command + + if (command === "\\def") { + // \global\def is equivalent to \gdef + return def(context, true); + } else { + throw new ParseError(`Invalid command '${command}' after \\global`); + } +}); // \newcommand{\macro}[args]{definition} +// \renewcommand{\macro}[args]{definition} +// TODO: Optional arguments: \newcommand{\macro}[args][default]{definition} + +const newcommand = (context, existsOK, nonexistsOK) => { + let arg = context.consumeArgs(1)[0]; + + if (arg.length !== 1) { + throw new ParseError("\\newcommand's first argument must be a macro name"); + } + + const name = arg[0].text; + const exists = context.isDefined(name); + + if (exists && !existsOK) { + throw new ParseError(`\\newcommand{${name}} attempting to redefine ` + `${name}; use \\renewcommand`); + } + + if (!exists && !nonexistsOK) { + throw new ParseError(`\\renewcommand{${name}} when command ${name} ` + `does not yet exist; use \\newcommand`); + } + + let numArgs = 0; + arg = context.consumeArgs(1)[0]; + + if (arg.length === 1 && arg[0].text === "[") { + let argText = ''; + let token = context.expandNextToken(); + + while (token.text !== "]" && token.text !== "EOF") { + // TODO: Should properly expand arg, e.g., ignore {}s + argText += token.text; + token = context.expandNextToken(); + } + + if (!argText.match(/^\s*[0-9]+\s*$/)) { + throw new ParseError(`Invalid number of arguments: ${argText}`); + } + + numArgs = parseInt(argText); + arg = context.consumeArgs(1)[0]; + } // Final arg is the expansion of the macro + + + context.macros.set(name, { + tokens: arg, + numArgs + }); + return ''; +}; + +defineMacro("\\newcommand", context => newcommand(context, false, true)); +defineMacro("\\renewcommand", context => newcommand(context, true, false)); +defineMacro("\\providecommand", context => newcommand(context, true, true)); ////////////////////////////////////////////////////////////////////// +// Grouping +// \let\bgroup={ \let\egroup=} + +defineMacro("\\bgroup", "{"); +defineMacro("\\egroup", "}"); +defineMacro("\\begingroup", "{"); +defineMacro("\\endgroup", "}"); // Symbols from latex.ltx: +// \def\lq{`} +// \def\rq{'} +// \def \aa {\r a} +// \def \AA {\r A} + +defineMacro("\\lq", "`"); +defineMacro("\\rq", "'"); +defineMacro("\\aa", "\\r a"); +defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML. +// \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}} +// \DeclareTextCommandDefault{\textregistered}{\textcircled{% +// \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}} +// \DeclareRobustCommand{\copyright}{% +// \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi} + +defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); +defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); +defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Unicode double-struck letters + +defineMacro("\u2102", "\\mathbb{C}"); +defineMacro("\u210D", "\\mathbb{H}"); +defineMacro("\u2115", "\\mathbb{N}"); +defineMacro("\u2119", "\\mathbb{P}"); +defineMacro("\u211A", "\\mathbb{Q}"); +defineMacro("\u211D", "\\mathbb{R}"); +defineMacro("\u2124", "\\mathbb{Z}"); +defineMacro("\u210E", "\\mathit{h}"); // Planck constant +// Characters omitted from Unicode range 1D400–1D7FF + +defineMacro("\u212C", "\\mathscr{B}"); // script + +defineMacro("\u2130", "\\mathscr{E}"); +defineMacro("\u2131", "\\mathscr{F}"); +defineMacro("\u210B", "\\mathscr{H}"); +defineMacro("\u2110", "\\mathscr{I}"); +defineMacro("\u2112", "\\mathscr{L}"); +defineMacro("\u2133", "\\mathscr{M}"); +defineMacro("\u211B", "\\mathscr{R}"); +defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur + +defineMacro("\u210C", "\\mathfrak{H}"); +defineMacro("\u2128", "\\mathfrak{Z}"); // Unicode middle dot +// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays +// the dot at U+22C5 and gives it punct spacing. + +defineMacro("\u00b7", "\\cdotp"); // \llap and \rlap render their contents in text mode + +defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); +defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); +defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via +// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36} +// It's thus treated like a \mathrel, but defined by a symbol that has zero +// width but extends to the right. We use \rlap to get that spacing. + +defineMacro("\\not", '\\mathrel{\\mathrlap\\@not}'); // Negated symbols from base/fontmath.ltx: +// \def\neq{\not=} \let\ne=\neq +// \DeclareRobustCommand +// \notin{\mathrel{\m@th\mathpalette\c@ncel\in}} +// \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}} + +defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); +defineMacro("\\ne", "\\neq"); +defineMacro("\u2260", "\\neq"); +defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}"); +defineMacro("\u2209", "\\notin"); // Unicode stacked relations + +defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}"); +defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}"); +defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}"); +defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}"); +defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}"); +defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}"); +defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode + +defineMacro("\u27C2", "\\perp"); +defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); +defineMacro("\u220C", "\\notni"); +defineMacro("\u231C", "\\ulcorner"); +defineMacro("\u231D", "\\urcorner"); +defineMacro("\u231E", "\\llcorner"); +defineMacro("\u231F", "\\lrcorner"); +defineMacro("\u00A9", "\\copyright"); +defineMacro("\u00AE", "\\textregistered"); +defineMacro("\uFE0F", "\\textregistered"); ////////////////////////////////////////////////////////////////////// +// LaTeX_2ε +// \vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@ +// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}} +// We'll call \varvdots, which gets a glyph from symbols.js. +// The zero-width rule gets us an equivalent to the vertical 6pt kern. + +defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); +defineMacro("\u22ee", "\\vdots"); ////////////////////////////////////////////////////////////////////// +// amsmath.sty +// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf +// Italic Greek capital letters. AMS defines these with \DeclareMathSymbol, +// but they are equivalent to \mathit{\Letter}. + +defineMacro("\\varGamma", "\\mathit{\\Gamma}"); +defineMacro("\\varDelta", "\\mathit{\\Delta}"); +defineMacro("\\varTheta", "\\mathit{\\Theta}"); +defineMacro("\\varLambda", "\\mathit{\\Lambda}"); +defineMacro("\\varXi", "\\mathit{\\Xi}"); +defineMacro("\\varPi", "\\mathit{\\Pi}"); +defineMacro("\\varSigma", "\\mathit{\\Sigma}"); +defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); +defineMacro("\\varPhi", "\\mathit{\\Phi}"); +defineMacro("\\varPsi", "\\mathit{\\Psi}"); +defineMacro("\\varOmega", "\\mathit{\\Omega}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript +// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} + +defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} + +defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;} +// \def\implies{\DOTSB\;\Longrightarrow\;} +// \def\impliedby{\DOTSB\;\Longleftarrow\;} + +defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); +defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); +defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro. + +const dotsByToken = { + ',': '\\dotsc', + '\\not': '\\dotsb', + // \keybin@ checks for the following: + '+': '\\dotsb', + '=': '\\dotsb', + '<': '\\dotsb', + '>': '\\dotsb', + '-': '\\dotsb', + '*': '\\dotsb', + ':': '\\dotsb', + // Symbols whose definition starts with \DOTSB: + '\\DOTSB': '\\dotsb', + '\\coprod': '\\dotsb', + '\\bigvee': '\\dotsb', + '\\bigwedge': '\\dotsb', + '\\biguplus': '\\dotsb', + '\\bigcap': '\\dotsb', + '\\bigcup': '\\dotsb', + '\\prod': '\\dotsb', + '\\sum': '\\dotsb', + '\\bigotimes': '\\dotsb', + '\\bigoplus': '\\dotsb', + '\\bigodot': '\\dotsb', + '\\bigsqcup': '\\dotsb', + '\\And': '\\dotsb', + '\\longrightarrow': '\\dotsb', + '\\Longrightarrow': '\\dotsb', + '\\longleftarrow': '\\dotsb', + '\\Longleftarrow': '\\dotsb', + '\\longleftrightarrow': '\\dotsb', + '\\Longleftrightarrow': '\\dotsb', + '\\mapsto': '\\dotsb', + '\\longmapsto': '\\dotsb', + '\\hookrightarrow': '\\dotsb', + '\\doteq': '\\dotsb', + // Symbols whose definition starts with \mathbin: + '\\mathbin': '\\dotsb', + // Symbols whose definition starts with \mathrel: + '\\mathrel': '\\dotsb', + '\\relbar': '\\dotsb', + '\\Relbar': '\\dotsb', + '\\xrightarrow': '\\dotsb', + '\\xleftarrow': '\\dotsb', + // Symbols whose definition starts with \DOTSI: + '\\DOTSI': '\\dotsi', + '\\int': '\\dotsi', + '\\oint': '\\dotsi', + '\\iint': '\\dotsi', + '\\iiint': '\\dotsi', + '\\iiiint': '\\dotsi', + '\\idotsint': '\\dotsi', + // Symbols whose definition starts with \DOTSX: + '\\DOTSX': '\\dotsx' +}; +defineMacro("\\dots", function (context) { + // TODO: If used in text mode, should expand to \textellipsis. + // However, in KaTeX, \textellipsis and \ldots behave the same + // (in text mode), and it's unlikely we'd see any of the math commands + // that affect the behavior of \dots when in text mode. So fine for now + // (until we support \ifmmode ... \else ... \fi). + let thedots = '\\dotso'; + const next = context.expandAfterFuture().text; + + if (next in dotsByToken) { + thedots = dotsByToken[next]; + } else if (next.substr(0, 4) === '\\not') { + thedots = '\\dotsb'; + } else if (next in symbols.math) { + if (utils.contains(['bin', 'rel'], symbols.math[next].group)) { + thedots = '\\dotsb'; + } + } + + return thedots; +}); +const spaceAfterDots = { + // \rightdelim@ checks for the following: + ')': true, + ']': true, + '\\rbrack': true, + '\\}': true, + '\\rbrace': true, + '\\rangle': true, + '\\rceil': true, + '\\rfloor': true, + '\\rgroup': true, + '\\rmoustache': true, + '\\right': true, + '\\bigr': true, + '\\biggr': true, + '\\Bigr': true, + '\\Biggr': true, + // \extra@ also tests for the following: + '$': true, + // \extrap@ checks for the following: + ';': true, + '.': true, + ',': true +}; +defineMacro("\\dotso", function (context) { + const next = context.future().text; + + if (next in spaceAfterDots) { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } +}); +defineMacro("\\dotsc", function (context) { + const next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for + // ';' and '.', but doesn't check for ','. + + if (next in spaceAfterDots && next !== ',') { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } +}); +defineMacro("\\cdots", function (context) { + const next = context.future().text; + + if (next in spaceAfterDots) { + return "\\@cdots\\,"; + } else { + return "\\@cdots"; + } +}); +defineMacro("\\dotsb", "\\cdots"); +defineMacro("\\dotsm", "\\cdots"); +defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro +// starting with \DOTSX implies \dotso, and then \extra@ detects this case +// and forces the added `\,`. + +defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax +// \let\DOTSB\relax +// \let\DOTSX\relax + +defineMacro("\\DOTSI", "\\relax"); +defineMacro("\\DOTSB", "\\relax"); +defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults +// \DeclareRobustCommand{\tmspace}[3]{% +// \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} + +defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}} +// TODO: math mode should use \thinmuskip + +defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\, + +defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip} +// \renewcommand{\:}{\tmspace+\medmuskip{.2222em}} +// TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu + +defineMacro("\\>", "\\mskip{4mu}"); +defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\: + +defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}} +// TODO: math mode should use \thickmuskip = 5mu plus 5mu + +defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\; + +defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}} +// TODO: math mode should use \thinmuskip + +defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\! + +defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}} +// TODO: math mode should use \medmuskip + +defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}} +// TODO: math mode should use \thickmuskip + +defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em } + +defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax} + +defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax} + +defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax} + +defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag + +defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); +defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); +defineMacro("\\tag@literal", context => { + if (context.macros.get("\\df@tag")) { + throw new ParseError("Multiple \\tag"); + } + + return "\\gdef\\df@tag{\\text{#1}}"; +}); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin +// {\operator@font mod}\penalty900 +// \mkern5mu\nonscript\mskip-\medmuskip} +// \newcommand{\pod}[1]{\allowbreak +// \if@display\mkern18mu\else\mkern8mu\fi(#1)} +// \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} +// \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu +// \else\mkern12mu\fi{\operator@font mod}\,\,#1} +// TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu + +defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); +defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); +defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); +defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb -- A simulation of bold. +// It works by typesetting three copies of the argument with small offsets. +// Ref: a rather lengthy macro in ambsy.sty + +defineMacro("\\pmb", "\\html@mathml{\\@binrel{#1}{" + "\\mathrlap{#1}" + "\\mathrlap{\\mkern0.4mu\\raisebox{0.4mu}{$#1$}}" + "{\\mkern0.8mu#1}" + "}}{\\mathbf{#1}}"); ////////////////////////////////////////////////////////////////////// +// LaTeX source2e +// \\ defaults to \newline, but changes to \cr within array environment + +defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@} +// TODO: Doesn't normally work in math mode because \@ fails. KaTeX doesn't +// support \@ yet, so that's omitted, and we add \text so that the result +// doesn't look funny in math mode. + +defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em% +// {\sbox\z@ T% +// \vbox to\ht\z@{\hbox{\check@mathfonts +// \fontsize\sf@size\z@ +// \math@fontsfalse\selectfont +// A}% +// \vss}% +// }% +// \kern-.15em% +// \TeX} +// This code aligns the top of the A with the T (from the perspective of TeX's +// boxes, though visually the A appears to extend above slightly). +// We compute the corresponding \raisebox when A is rendered at \scriptsize, +// which is size3, which has a scale factor of 0.7 (see Options.js). + +const latexRaiseA = metricMap['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * metricMap['Main-Regular']["A".charCodeAt(0)][1] + "em"; +defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + `L\\kern-.36em\\raisebox{${latexRaiseA}}{\\scriptsize A}` + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo + +defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + `K\\kern-.17em\\raisebox{${latexRaiseA}}{\\scriptsize A}` + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} +// \def\@hspace#1{\hskip #1\relax} +// \def\@hspacer#1{\vrule \@width\z@\nobreak +// \hskip #1\hskip \z@skip} + +defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); +defineMacro("\\@hspace", "\\hskip #1\\relax"); +defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); ////////////////////////////////////////////////////////////////////// +// mathtools.sty +//\providecommand\ordinarycolon{:} + +defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}} +//TODO(edemaine): Not yet centered. Fix via \raisebox or #726 + +defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon} + +defineMacro("\\dblcolon", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=} + +defineMacro("\\coloneqq", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}"); // \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=} + +defineMacro("\\Coloneqq", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}} + +defineMacro("\\coloneq", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}} + +defineMacro("\\Coloneq", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon} + +defineMacro("\\eqqcolon", "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); // \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon} + +defineMacro("\\Eqqcolon", "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon} + +defineMacro("\\eqcolon", "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon} + +defineMacro("\\Eqcolon", "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx} + +defineMacro("\\colonapprox", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx} + +defineMacro("\\Colonapprox", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim} + +defineMacro("\\colonsim", "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim} + +defineMacro("\\Colonsim", "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}"); // Some Unicode characters are implemented with macros to mathtools functions. + +defineMacro("\u2254", "\\coloneqq"); // := + +defineMacro("\u2255", "\\eqqcolon"); // =: + +defineMacro("\u2A74", "\\Coloneqq"); // ::= +////////////////////////////////////////////////////////////////////// +// colonequals.sty +// Alternate names for mathtools's macros: + +defineMacro("\\ratio", "\\vcentcolon"); +defineMacro("\\coloncolon", "\\dblcolon"); +defineMacro("\\colonequals", "\\coloneqq"); +defineMacro("\\coloncolonequals", "\\Coloneqq"); +defineMacro("\\equalscolon", "\\eqqcolon"); +defineMacro("\\equalscoloncolon", "\\Eqqcolon"); +defineMacro("\\colonminus", "\\coloneq"); +defineMacro("\\coloncolonminus", "\\Coloneq"); +defineMacro("\\minuscolon", "\\eqcolon"); +defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals. + +defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals. + +defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions: + +defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); +defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts + +defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); +defineMacro("\\limsup", "\\DOTSB\\mathop{\\operatorname{lim\\,sup}}\\limits"); +defineMacro("\\liminf", "\\DOTSB\\mathop{\\operatorname{lim\\,inf}}\\limits"); ////////////////////////////////////////////////////////////////////// +// semantic +// The semantic package renders the next two items by calling a glyph from the +// bbold package. Those glyphs do not exist in the KaTeX fonts. Hence the macros. + +defineMacro("\u27e6", "\\mathopen{[\\mkern-3.2mu[}"); // blackboard bold [ + +defineMacro("\u27e7", "\\mathclose{]\\mkern-3.2mu]}"); // blackboard bold ] +// TODO: Create variable sized versions of the last two items. I believe that +// will require new font glyphs. +////////////////////////////////////////////////////////////////////// +// texvc.sty +// The texvc package contains macros available in mediawiki pages. +// We omit the functions deprecated at +// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax +// We also omit texvc's \O, which conflicts with \text{\O} + +defineMacro("\\darr", "\\downarrow"); +defineMacro("\\dArr", "\\Downarrow"); +defineMacro("\\Darr", "\\Downarrow"); +defineMacro("\\lang", "\\langle"); +defineMacro("\\rang", "\\rangle"); +defineMacro("\\uarr", "\\uparrow"); +defineMacro("\\uArr", "\\Uparrow"); +defineMacro("\\Uarr", "\\Uparrow"); +defineMacro("\\N", "\\mathbb{N}"); +defineMacro("\\R", "\\mathbb{R}"); +defineMacro("\\Z", "\\mathbb{Z}"); +defineMacro("\\alef", "\\aleph"); +defineMacro("\\alefsym", "\\aleph"); +defineMacro("\\Alpha", "\\mathrm{A}"); +defineMacro("\\Beta", "\\mathrm{B}"); +defineMacro("\\bull", "\\bullet"); +defineMacro("\\Chi", "\\mathrm{X}"); +defineMacro("\\clubs", "\\clubsuit"); +defineMacro("\\cnums", "\\mathbb{C}"); +defineMacro("\\Complex", "\\mathbb{C}"); +defineMacro("\\Dagger", "\\ddagger"); +defineMacro("\\diamonds", "\\diamondsuit"); +defineMacro("\\empty", "\\emptyset"); +defineMacro("\\Epsilon", "\\mathrm{E}"); +defineMacro("\\Eta", "\\mathrm{H}"); +defineMacro("\\exist", "\\exists"); +defineMacro("\\harr", "\\leftrightarrow"); +defineMacro("\\hArr", "\\Leftrightarrow"); +defineMacro("\\Harr", "\\Leftrightarrow"); +defineMacro("\\hearts", "\\heartsuit"); +defineMacro("\\image", "\\Im"); +defineMacro("\\infin", "\\infty"); +defineMacro("\\Iota", "\\mathrm{I}"); +defineMacro("\\isin", "\\in"); +defineMacro("\\Kappa", "\\mathrm{K}"); +defineMacro("\\larr", "\\leftarrow"); +defineMacro("\\lArr", "\\Leftarrow"); +defineMacro("\\Larr", "\\Leftarrow"); +defineMacro("\\lrarr", "\\leftrightarrow"); +defineMacro("\\lrArr", "\\Leftrightarrow"); +defineMacro("\\Lrarr", "\\Leftrightarrow"); +defineMacro("\\Mu", "\\mathrm{M}"); +defineMacro("\\natnums", "\\mathbb{N}"); +defineMacro("\\Nu", "\\mathrm{N}"); +defineMacro("\\Omicron", "\\mathrm{O}"); +defineMacro("\\plusmn", "\\pm"); +defineMacro("\\rarr", "\\rightarrow"); +defineMacro("\\rArr", "\\Rightarrow"); +defineMacro("\\Rarr", "\\Rightarrow"); +defineMacro("\\real", "\\Re"); +defineMacro("\\reals", "\\mathbb{R}"); +defineMacro("\\Reals", "\\mathbb{R}"); +defineMacro("\\Rho", "\\mathrm{R}"); +defineMacro("\\sdot", "\\cdot"); +defineMacro("\\sect", "\\S"); +defineMacro("\\spades", "\\spadesuit"); +defineMacro("\\sub", "\\subset"); +defineMacro("\\sube", "\\subseteq"); +defineMacro("\\supe", "\\supseteq"); +defineMacro("\\Tau", "\\mathrm{T}"); +defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}"); + +defineMacro("\\weierp", "\\wp"); +defineMacro("\\Zeta", "\\mathrm{Z}"); + +/** + * This file contains the “gullet” where macros are expanded + * until only non-macro tokens remain. + */ +// List of commands that act like macros but aren't defined as a macro, +// function, or symbol. Used in `isDefined`. +const implicitCommands = { + "\\relax": true, + // MacroExpander.js + "^": true, + // Parser.js + "_": true, + // Parser.js + "\\limits": true, + // Parser.js + "\\nolimits": true // Parser.js + +}; +class MacroExpander { + constructor(input, settings, mode) { + this.settings = void 0; + this.expansionCount = void 0; + this.lexer = void 0; + this.macros = void 0; + this.stack = void 0; + this.mode = void 0; + this.settings = settings; + this.expansionCount = 0; + this.feed(input); // Make new global namespace + + this.macros = new Namespace(builtinMacros, settings.macros); + this.mode = mode; + this.stack = []; // contains tokens in REVERSE order + } + /** + * Feed a new input string to the same MacroExpander + * (with existing macros etc.). + */ + + + feed(input) { + this.lexer = new Lexer(input); + } + /** + * Switches between "text" and "math" modes. + */ + + + switchMode(newMode) { + this.mode = newMode; + } + /** + * Start a new group nesting within all namespaces. + */ + + + beginGroup() { + this.macros.beginGroup(); + } + /** + * End current group nesting within all namespaces. + */ + + + endGroup() { + this.macros.endGroup(); + } + /** + * Returns the topmost token on the stack, without expanding it. + * Similar in behavior to TeX's `\futurelet`. + */ + + + future() { + if (this.stack.length === 0) { + this.pushToken(this.lexer.lex()); + } + + return this.stack[this.stack.length - 1]; + } + /** + * Remove and return the next unexpanded token. + */ + + + popToken() { + this.future(); // ensure non-empty stack + + return this.stack.pop(); + } + /** + * Add a given token to the token stack. In particular, this get be used + * to put back a token returned from one of the other methods. + */ + + + pushToken(token) { + this.stack.push(token); + } + /** + * Append an array of tokens to the token stack. + */ + + + pushTokens(tokens) { + this.stack.push(...tokens); + } + /** + * Consume all following space tokens, without expansion. + */ + + + consumeSpaces() { + for (;;) { + const token = this.future(); + + if (token.text === " ") { + this.stack.pop(); + } else { + break; + } + } + } + /** + * Consume the specified number of arguments from the token stream, + * and return the resulting array of arguments. + */ + + + consumeArgs(numArgs) { + const args = []; // obtain arguments, either single token or balanced {…} group + + for (let i = 0; i < numArgs; ++i) { + this.consumeSpaces(); // ignore spaces before each argument + + const startOfArg = this.popToken(); + + if (startOfArg.text === "{") { + const arg = []; + let depth = 1; + + while (depth !== 0) { + const tok = this.popToken(); + arg.push(tok); + + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; + } else if (tok.text === "EOF") { + throw new ParseError("End of input in macro argument", startOfArg); + } + } + + arg.pop(); // remove last } + + arg.reverse(); // like above, to fit in with stack order + + args[i] = arg; + } else if (startOfArg.text === "EOF") { + throw new ParseError("End of input expecting macro argument"); + } else { + args[i] = [startOfArg]; + } + } + + return args; + } + /** + * Expand the next token only once if possible. + * + * If the token is expanded, the resulting tokens will be pushed onto + * the stack in reverse order and will be returned as an array, + * also in reverse order. + * + * If not, the next token will be returned without removing it + * from the stack. This case can be detected by a `Token` return value + * instead of an `Array` return value. + * + * In either case, the next token will be on the top of the stack, + * or the stack will be empty. + * + * Used to implement `expandAfterFuture` and `expandNextToken`. + * + * At the moment, macro expansion doesn't handle delimited macros, + * i.e. things like those defined by \def\foo#1\end{…}. + * See the TeX book page 202ff. for details on how those should behave. + */ + + + expandOnce() { + const topToken = this.popToken(); + const name = topToken.text; + + const expansion = this._getExpansion(name); + + if (expansion == null) { + // mainly checking for undefined here + // Fully expanded + this.pushToken(topToken); + return topToken; + } + + this.expansionCount++; + + if (this.expansionCount > this.settings.maxExpand) { + throw new ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting"); + } + + let tokens = expansion.tokens; + + if (expansion.numArgs) { + const args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders + + tokens = tokens.slice(); // make a shallow copy + + for (let i = tokens.length - 1; i >= 0; --i) { + let tok = tokens[i]; + + if (tok.text === "#") { + if (i === 0) { + throw new ParseError("Incomplete placeholder at end of macro body", tok); + } + + tok = tokens[--i]; // next token on stack + + if (tok.text === "#") { + // ## → # + tokens.splice(i + 1, 1); // drop first # + } else if (/^[1-9]$/.test(tok.text)) { + // replace the placeholder with the indicated argument + tokens.splice(i, 2, ...args[+tok.text - 1]); + } else { + throw new ParseError("Not a valid argument number", tok); + } + } + } + } // Concatenate expansion onto top of stack. + + + this.pushTokens(tokens); + return tokens; + } + /** + * Expand the next token only once (if possible), and return the resulting + * top token on the stack (without removing anything from the stack). + * Similar in behavior to TeX's `\expandafter\futurelet`. + * Equivalent to expandOnce() followed by future(). + */ + + + expandAfterFuture() { + this.expandOnce(); + return this.future(); + } + /** + * Recursively expand first token, then return first non-expandable token. + */ + + + expandNextToken() { + for (;;) { + const expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. + + if (expanded instanceof Token) { + // \relax stops the expansion, but shouldn't get returned (a + // null return value couldn't get implemented as a function). + if (expanded.text === "\\relax") { + this.stack.pop(); + } else { + return this.stack.pop(); // === expanded + } + } + } // Flow unable to figure out that this pathway is impossible. + // https://github.com/facebook/flow/issues/4808 + + + throw new Error(); // eslint-disable-line no-unreachable + } + /** + * Fully expand the given macro name and return the resulting list of + * tokens, or return `undefined` if no such macro is defined. + */ + + + expandMacro(name) { + if (!this.macros.get(name)) { + return undefined; + } + + const output = []; + const oldStackLength = this.stack.length; + this.pushToken(new Token(name)); + + while (this.stack.length > oldStackLength) { + const expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded. + + if (expanded instanceof Token) { + output.push(this.stack.pop()); + } + } + + return output; + } + /** + * Fully expand the given macro name and return the result as a string, + * or return `undefined` if no such macro is defined. + */ + + + expandMacroAsText(name) { + const tokens = this.expandMacro(name); + + if (tokens) { + return tokens.map(token => token.text).join(""); + } else { + return tokens; + } + } + /** + * Returns the expanded macro as a reversed array of tokens and a macro + * argument count. Or returns `null` if no such macro. + */ + + + _getExpansion(name) { + const definition = this.macros.get(name); + + if (definition == null) { + // mainly checking for undefined here + return definition; + } + + const expansion = typeof definition === "function" ? definition(this) : definition; + + if (typeof expansion === "string") { + let numArgs = 0; + + if (expansion.indexOf("#") !== -1) { + const stripped = expansion.replace(/##/g, ""); + + while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { + ++numArgs; + } + } + + const bodyLexer = new Lexer(expansion); + const tokens = []; + let tok = bodyLexer.lex(); + + while (tok.text !== "EOF") { + tokens.push(tok); + tok = bodyLexer.lex(); + } + + tokens.reverse(); // to fit in with stack using push and pop + + const expanded = { + tokens, + numArgs + }; + return expanded; + } + + return expansion; + } + /** + * Determine whether a command is currently "defined" (has some + * functionality), meaning that it's a macro (in the current group), + * a function, a symbol, or one of the special commands listed in + * `implicitCommands`. + */ + + + isDefined(name) { + return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name); + } + +} + +// Mapping of Unicode accent characters to their LaTeX equivalent in text and +// math mode (when they exist). +var unicodeAccents = { + '\u0301': { + text: "\\'", + math: '\\acute' + }, + '\u0300': { + text: '\\`', + math: '\\grave' + }, + '\u0308': { + text: '\\"', + math: '\\ddot' + }, + '\u0303': { + text: '\\~', + math: '\\tilde' + }, + '\u0304': { + text: '\\=', + math: '\\bar' + }, + '\u0306': { + text: '\\u', + math: '\\breve' + }, + '\u030c': { + text: '\\v', + math: '\\check' + }, + '\u0302': { + text: '\\^', + math: '\\hat' + }, + '\u0307': { + text: '\\.', + math: '\\dot' + }, + '\u030a': { + text: '\\r', + math: '\\mathring' + }, + '\u030b': { + text: '\\H' + } +}; + +// This file is GENERATED by unicodeMake.js. DO NOT MODIFY. +var unicodeSymbols = { + "\u00e1": "\u0061\u0301", + // á = \'{a} + "\u00e0": "\u0061\u0300", + // à = \`{a} + "\u00e4": "\u0061\u0308", + // ä = \"{a} + "\u01df": "\u0061\u0308\u0304", + // ǟ = \"\={a} + "\u00e3": "\u0061\u0303", + // ã = \~{a} + "\u0101": "\u0061\u0304", + // ā = \={a} + "\u0103": "\u0061\u0306", + // ă = \u{a} + "\u1eaf": "\u0061\u0306\u0301", + // ắ = \u\'{a} + "\u1eb1": "\u0061\u0306\u0300", + // ằ = \u\`{a} + "\u1eb5": "\u0061\u0306\u0303", + // ẵ = \u\~{a} + "\u01ce": "\u0061\u030c", + // ǎ = \v{a} + "\u00e2": "\u0061\u0302", + // â = \^{a} + "\u1ea5": "\u0061\u0302\u0301", + // ấ = \^\'{a} + "\u1ea7": "\u0061\u0302\u0300", + // ầ = \^\`{a} + "\u1eab": "\u0061\u0302\u0303", + // ẫ = \^\~{a} + "\u0227": "\u0061\u0307", + // ȧ = \.{a} + "\u01e1": "\u0061\u0307\u0304", + // ǡ = \.\={a} + "\u00e5": "\u0061\u030a", + // å = \r{a} + "\u01fb": "\u0061\u030a\u0301", + // ǻ = \r\'{a} + "\u1e03": "\u0062\u0307", + // ḃ = \.{b} + "\u0107": "\u0063\u0301", + // ć = \'{c} + "\u010d": "\u0063\u030c", + // č = \v{c} + "\u0109": "\u0063\u0302", + // ĉ = \^{c} + "\u010b": "\u0063\u0307", + // ċ = \.{c} + "\u010f": "\u0064\u030c", + // ď = \v{d} + "\u1e0b": "\u0064\u0307", + // ḋ = \.{d} + "\u00e9": "\u0065\u0301", + // é = \'{e} + "\u00e8": "\u0065\u0300", + // è = \`{e} + "\u00eb": "\u0065\u0308", + // ë = \"{e} + "\u1ebd": "\u0065\u0303", + // ẽ = \~{e} + "\u0113": "\u0065\u0304", + // ē = \={e} + "\u1e17": "\u0065\u0304\u0301", + // ḗ = \=\'{e} + "\u1e15": "\u0065\u0304\u0300", + // ḕ = \=\`{e} + "\u0115": "\u0065\u0306", + // ĕ = \u{e} + "\u011b": "\u0065\u030c", + // ě = \v{e} + "\u00ea": "\u0065\u0302", + // ê = \^{e} + "\u1ebf": "\u0065\u0302\u0301", + // ế = \^\'{e} + "\u1ec1": "\u0065\u0302\u0300", + // ề = \^\`{e} + "\u1ec5": "\u0065\u0302\u0303", + // ễ = \^\~{e} + "\u0117": "\u0065\u0307", + // ė = \.{e} + "\u1e1f": "\u0066\u0307", + // ḟ = \.{f} + "\u01f5": "\u0067\u0301", + // ǵ = \'{g} + "\u1e21": "\u0067\u0304", + // ḡ = \={g} + "\u011f": "\u0067\u0306", + // ğ = \u{g} + "\u01e7": "\u0067\u030c", + // ǧ = \v{g} + "\u011d": "\u0067\u0302", + // ĝ = \^{g} + "\u0121": "\u0067\u0307", + // ġ = \.{g} + "\u1e27": "\u0068\u0308", + // ḧ = \"{h} + "\u021f": "\u0068\u030c", + // ȟ = \v{h} + "\u0125": "\u0068\u0302", + // ĥ = \^{h} + "\u1e23": "\u0068\u0307", + // ḣ = \.{h} + "\u00ed": "\u0069\u0301", + // í = \'{i} + "\u00ec": "\u0069\u0300", + // ì = \`{i} + "\u00ef": "\u0069\u0308", + // ï = \"{i} + "\u1e2f": "\u0069\u0308\u0301", + // ḯ = \"\'{i} + "\u0129": "\u0069\u0303", + // ĩ = \~{i} + "\u012b": "\u0069\u0304", + // ī = \={i} + "\u012d": "\u0069\u0306", + // ĭ = \u{i} + "\u01d0": "\u0069\u030c", + // ǐ = \v{i} + "\u00ee": "\u0069\u0302", + // î = \^{i} + "\u01f0": "\u006a\u030c", + // ǰ = \v{j} + "\u0135": "\u006a\u0302", + // ĵ = \^{j} + "\u1e31": "\u006b\u0301", + // ḱ = \'{k} + "\u01e9": "\u006b\u030c", + // ǩ = \v{k} + "\u013a": "\u006c\u0301", + // ĺ = \'{l} + "\u013e": "\u006c\u030c", + // ľ = \v{l} + "\u1e3f": "\u006d\u0301", + // ḿ = \'{m} + "\u1e41": "\u006d\u0307", + // ṁ = \.{m} + "\u0144": "\u006e\u0301", + // ń = \'{n} + "\u01f9": "\u006e\u0300", + // ǹ = \`{n} + "\u00f1": "\u006e\u0303", + // ñ = \~{n} + "\u0148": "\u006e\u030c", + // ň = \v{n} + "\u1e45": "\u006e\u0307", + // ṅ = \.{n} + "\u00f3": "\u006f\u0301", + // ó = \'{o} + "\u00f2": "\u006f\u0300", + // ò = \`{o} + "\u00f6": "\u006f\u0308", + // ö = \"{o} + "\u022b": "\u006f\u0308\u0304", + // ȫ = \"\={o} + "\u00f5": "\u006f\u0303", + // õ = \~{o} + "\u1e4d": "\u006f\u0303\u0301", + // ṍ = \~\'{o} + "\u1e4f": "\u006f\u0303\u0308", + // ṏ = \~\"{o} + "\u022d": "\u006f\u0303\u0304", + // ȭ = \~\={o} + "\u014d": "\u006f\u0304", + // ō = \={o} + "\u1e53": "\u006f\u0304\u0301", + // ṓ = \=\'{o} + "\u1e51": "\u006f\u0304\u0300", + // ṑ = \=\`{o} + "\u014f": "\u006f\u0306", + // ŏ = \u{o} + "\u01d2": "\u006f\u030c", + // ǒ = \v{o} + "\u00f4": "\u006f\u0302", + // ô = \^{o} + "\u1ed1": "\u006f\u0302\u0301", + // ố = \^\'{o} + "\u1ed3": "\u006f\u0302\u0300", + // ồ = \^\`{o} + "\u1ed7": "\u006f\u0302\u0303", + // ỗ = \^\~{o} + "\u022f": "\u006f\u0307", + // ȯ = \.{o} + "\u0231": "\u006f\u0307\u0304", + // ȱ = \.\={o} + "\u0151": "\u006f\u030b", + // ő = \H{o} + "\u1e55": "\u0070\u0301", + // ṕ = \'{p} + "\u1e57": "\u0070\u0307", + // ṗ = \.{p} + "\u0155": "\u0072\u0301", + // ŕ = \'{r} + "\u0159": "\u0072\u030c", + // ř = \v{r} + "\u1e59": "\u0072\u0307", + // ṙ = \.{r} + "\u015b": "\u0073\u0301", + // ś = \'{s} + "\u1e65": "\u0073\u0301\u0307", + // ṥ = \'\.{s} + "\u0161": "\u0073\u030c", + // š = \v{s} + "\u1e67": "\u0073\u030c\u0307", + // ṧ = \v\.{s} + "\u015d": "\u0073\u0302", + // ŝ = \^{s} + "\u1e61": "\u0073\u0307", + // ṡ = \.{s} + "\u1e97": "\u0074\u0308", + // ẗ = \"{t} + "\u0165": "\u0074\u030c", + // ť = \v{t} + "\u1e6b": "\u0074\u0307", + // ṫ = \.{t} + "\u00fa": "\u0075\u0301", + // ú = \'{u} + "\u00f9": "\u0075\u0300", + // ù = \`{u} + "\u00fc": "\u0075\u0308", + // ü = \"{u} + "\u01d8": "\u0075\u0308\u0301", + // ǘ = \"\'{u} + "\u01dc": "\u0075\u0308\u0300", + // ǜ = \"\`{u} + "\u01d6": "\u0075\u0308\u0304", + // ǖ = \"\={u} + "\u01da": "\u0075\u0308\u030c", + // ǚ = \"\v{u} + "\u0169": "\u0075\u0303", + // ũ = \~{u} + "\u1e79": "\u0075\u0303\u0301", + // ṹ = \~\'{u} + "\u016b": "\u0075\u0304", + // ū = \={u} + "\u1e7b": "\u0075\u0304\u0308", + // ṻ = \=\"{u} + "\u016d": "\u0075\u0306", + // ŭ = \u{u} + "\u01d4": "\u0075\u030c", + // ǔ = \v{u} + "\u00fb": "\u0075\u0302", + // û = \^{u} + "\u016f": "\u0075\u030a", + // ů = \r{u} + "\u0171": "\u0075\u030b", + // ű = \H{u} + "\u1e7d": "\u0076\u0303", + // ṽ = \~{v} + "\u1e83": "\u0077\u0301", + // ẃ = \'{w} + "\u1e81": "\u0077\u0300", + // ẁ = \`{w} + "\u1e85": "\u0077\u0308", + // ẅ = \"{w} + "\u0175": "\u0077\u0302", + // ŵ = \^{w} + "\u1e87": "\u0077\u0307", + // ẇ = \.{w} + "\u1e98": "\u0077\u030a", + // ẘ = \r{w} + "\u1e8d": "\u0078\u0308", + // ẍ = \"{x} + "\u1e8b": "\u0078\u0307", + // ẋ = \.{x} + "\u00fd": "\u0079\u0301", + // ý = \'{y} + "\u1ef3": "\u0079\u0300", + // ỳ = \`{y} + "\u00ff": "\u0079\u0308", + // ÿ = \"{y} + "\u1ef9": "\u0079\u0303", + // ỹ = \~{y} + "\u0233": "\u0079\u0304", + // ȳ = \={y} + "\u0177": "\u0079\u0302", + // ŷ = \^{y} + "\u1e8f": "\u0079\u0307", + // ẏ = \.{y} + "\u1e99": "\u0079\u030a", + // ẙ = \r{y} + "\u017a": "\u007a\u0301", + // ź = \'{z} + "\u017e": "\u007a\u030c", + // ž = \v{z} + "\u1e91": "\u007a\u0302", + // ẑ = \^{z} + "\u017c": "\u007a\u0307", + // ż = \.{z} + "\u00c1": "\u0041\u0301", + // Á = \'{A} + "\u00c0": "\u0041\u0300", + // À = \`{A} + "\u00c4": "\u0041\u0308", + // Ä = \"{A} + "\u01de": "\u0041\u0308\u0304", + // Ǟ = \"\={A} + "\u00c3": "\u0041\u0303", + // Ã = \~{A} + "\u0100": "\u0041\u0304", + // Ā = \={A} + "\u0102": "\u0041\u0306", + // Ă = \u{A} + "\u1eae": "\u0041\u0306\u0301", + // Ắ = \u\'{A} + "\u1eb0": "\u0041\u0306\u0300", + // Ằ = \u\`{A} + "\u1eb4": "\u0041\u0306\u0303", + // Ẵ = \u\~{A} + "\u01cd": "\u0041\u030c", + // Ǎ = \v{A} + "\u00c2": "\u0041\u0302", + // Â = \^{A} + "\u1ea4": "\u0041\u0302\u0301", + // Ấ = \^\'{A} + "\u1ea6": "\u0041\u0302\u0300", + // Ầ = \^\`{A} + "\u1eaa": "\u0041\u0302\u0303", + // Ẫ = \^\~{A} + "\u0226": "\u0041\u0307", + // Ȧ = \.{A} + "\u01e0": "\u0041\u0307\u0304", + // Ǡ = \.\={A} + "\u00c5": "\u0041\u030a", + // Å = \r{A} + "\u01fa": "\u0041\u030a\u0301", + // Ǻ = \r\'{A} + "\u1e02": "\u0042\u0307", + // Ḃ = \.{B} + "\u0106": "\u0043\u0301", + // Ć = \'{C} + "\u010c": "\u0043\u030c", + // Č = \v{C} + "\u0108": "\u0043\u0302", + // Ĉ = \^{C} + "\u010a": "\u0043\u0307", + // Ċ = \.{C} + "\u010e": "\u0044\u030c", + // Ď = \v{D} + "\u1e0a": "\u0044\u0307", + // Ḋ = \.{D} + "\u00c9": "\u0045\u0301", + // É = \'{E} + "\u00c8": "\u0045\u0300", + // È = \`{E} + "\u00cb": "\u0045\u0308", + // Ë = \"{E} + "\u1ebc": "\u0045\u0303", + // Ẽ = \~{E} + "\u0112": "\u0045\u0304", + // Ē = \={E} + "\u1e16": "\u0045\u0304\u0301", + // Ḗ = \=\'{E} + "\u1e14": "\u0045\u0304\u0300", + // Ḕ = \=\`{E} + "\u0114": "\u0045\u0306", + // Ĕ = \u{E} + "\u011a": "\u0045\u030c", + // Ě = \v{E} + "\u00ca": "\u0045\u0302", + // Ê = \^{E} + "\u1ebe": "\u0045\u0302\u0301", + // Ế = \^\'{E} + "\u1ec0": "\u0045\u0302\u0300", + // Ề = \^\`{E} + "\u1ec4": "\u0045\u0302\u0303", + // Ễ = \^\~{E} + "\u0116": "\u0045\u0307", + // Ė = \.{E} + "\u1e1e": "\u0046\u0307", + // Ḟ = \.{F} + "\u01f4": "\u0047\u0301", + // Ǵ = \'{G} + "\u1e20": "\u0047\u0304", + // Ḡ = \={G} + "\u011e": "\u0047\u0306", + // Ğ = \u{G} + "\u01e6": "\u0047\u030c", + // Ǧ = \v{G} + "\u011c": "\u0047\u0302", + // Ĝ = \^{G} + "\u0120": "\u0047\u0307", + // Ġ = \.{G} + "\u1e26": "\u0048\u0308", + // Ḧ = \"{H} + "\u021e": "\u0048\u030c", + // Ȟ = \v{H} + "\u0124": "\u0048\u0302", + // Ĥ = \^{H} + "\u1e22": "\u0048\u0307", + // Ḣ = \.{H} + "\u00cd": "\u0049\u0301", + // Í = \'{I} + "\u00cc": "\u0049\u0300", + // Ì = \`{I} + "\u00cf": "\u0049\u0308", + // Ï = \"{I} + "\u1e2e": "\u0049\u0308\u0301", + // Ḯ = \"\'{I} + "\u0128": "\u0049\u0303", + // Ĩ = \~{I} + "\u012a": "\u0049\u0304", + // Ī = \={I} + "\u012c": "\u0049\u0306", + // Ĭ = \u{I} + "\u01cf": "\u0049\u030c", + // Ǐ = \v{I} + "\u00ce": "\u0049\u0302", + // Î = \^{I} + "\u0130": "\u0049\u0307", + // İ = \.{I} + "\u0134": "\u004a\u0302", + // Ĵ = \^{J} + "\u1e30": "\u004b\u0301", + // Ḱ = \'{K} + "\u01e8": "\u004b\u030c", + // Ǩ = \v{K} + "\u0139": "\u004c\u0301", + // Ĺ = \'{L} + "\u013d": "\u004c\u030c", + // Ľ = \v{L} + "\u1e3e": "\u004d\u0301", + // Ḿ = \'{M} + "\u1e40": "\u004d\u0307", + // Ṁ = \.{M} + "\u0143": "\u004e\u0301", + // Ń = \'{N} + "\u01f8": "\u004e\u0300", + // Ǹ = \`{N} + "\u00d1": "\u004e\u0303", + // Ñ = \~{N} + "\u0147": "\u004e\u030c", + // Ň = \v{N} + "\u1e44": "\u004e\u0307", + // Ṅ = \.{N} + "\u00d3": "\u004f\u0301", + // Ó = \'{O} + "\u00d2": "\u004f\u0300", + // Ò = \`{O} + "\u00d6": "\u004f\u0308", + // Ö = \"{O} + "\u022a": "\u004f\u0308\u0304", + // Ȫ = \"\={O} + "\u00d5": "\u004f\u0303", + // Õ = \~{O} + "\u1e4c": "\u004f\u0303\u0301", + // Ṍ = \~\'{O} + "\u1e4e": "\u004f\u0303\u0308", + // Ṏ = \~\"{O} + "\u022c": "\u004f\u0303\u0304", + // Ȭ = \~\={O} + "\u014c": "\u004f\u0304", + // Ō = \={O} + "\u1e52": "\u004f\u0304\u0301", + // Ṓ = \=\'{O} + "\u1e50": "\u004f\u0304\u0300", + // Ṑ = \=\`{O} + "\u014e": "\u004f\u0306", + // Ŏ = \u{O} + "\u01d1": "\u004f\u030c", + // Ǒ = \v{O} + "\u00d4": "\u004f\u0302", + // Ô = \^{O} + "\u1ed0": "\u004f\u0302\u0301", + // Ố = \^\'{O} + "\u1ed2": "\u004f\u0302\u0300", + // Ồ = \^\`{O} + "\u1ed6": "\u004f\u0302\u0303", + // Ỗ = \^\~{O} + "\u022e": "\u004f\u0307", + // Ȯ = \.{O} + "\u0230": "\u004f\u0307\u0304", + // Ȱ = \.\={O} + "\u0150": "\u004f\u030b", + // Ő = \H{O} + "\u1e54": "\u0050\u0301", + // Ṕ = \'{P} + "\u1e56": "\u0050\u0307", + // Ṗ = \.{P} + "\u0154": "\u0052\u0301", + // Ŕ = \'{R} + "\u0158": "\u0052\u030c", + // Ř = \v{R} + "\u1e58": "\u0052\u0307", + // Ṙ = \.{R} + "\u015a": "\u0053\u0301", + // Ś = \'{S} + "\u1e64": "\u0053\u0301\u0307", + // Ṥ = \'\.{S} + "\u0160": "\u0053\u030c", + // Š = \v{S} + "\u1e66": "\u0053\u030c\u0307", + // Ṧ = \v\.{S} + "\u015c": "\u0053\u0302", + // Ŝ = \^{S} + "\u1e60": "\u0053\u0307", + // Ṡ = \.{S} + "\u0164": "\u0054\u030c", + // Ť = \v{T} + "\u1e6a": "\u0054\u0307", + // Ṫ = \.{T} + "\u00da": "\u0055\u0301", + // Ú = \'{U} + "\u00d9": "\u0055\u0300", + // Ù = \`{U} + "\u00dc": "\u0055\u0308", + // Ü = \"{U} + "\u01d7": "\u0055\u0308\u0301", + // Ǘ = \"\'{U} + "\u01db": "\u0055\u0308\u0300", + // Ǜ = \"\`{U} + "\u01d5": "\u0055\u0308\u0304", + // Ǖ = \"\={U} + "\u01d9": "\u0055\u0308\u030c", + // Ǚ = \"\v{U} + "\u0168": "\u0055\u0303", + // Ũ = \~{U} + "\u1e78": "\u0055\u0303\u0301", + // Ṹ = \~\'{U} + "\u016a": "\u0055\u0304", + // Ū = \={U} + "\u1e7a": "\u0055\u0304\u0308", + // Ṻ = \=\"{U} + "\u016c": "\u0055\u0306", + // Ŭ = \u{U} + "\u01d3": "\u0055\u030c", + // Ǔ = \v{U} + "\u00db": "\u0055\u0302", + // Û = \^{U} + "\u016e": "\u0055\u030a", + // Ů = \r{U} + "\u0170": "\u0055\u030b", + // Ű = \H{U} + "\u1e7c": "\u0056\u0303", + // Ṽ = \~{V} + "\u1e82": "\u0057\u0301", + // Ẃ = \'{W} + "\u1e80": "\u0057\u0300", + // Ẁ = \`{W} + "\u1e84": "\u0057\u0308", + // Ẅ = \"{W} + "\u0174": "\u0057\u0302", + // Ŵ = \^{W} + "\u1e86": "\u0057\u0307", + // Ẇ = \.{W} + "\u1e8c": "\u0058\u0308", + // Ẍ = \"{X} + "\u1e8a": "\u0058\u0307", + // Ẋ = \.{X} + "\u00dd": "\u0059\u0301", + // Ý = \'{Y} + "\u1ef2": "\u0059\u0300", + // Ỳ = \`{Y} + "\u0178": "\u0059\u0308", + // Ÿ = \"{Y} + "\u1ef8": "\u0059\u0303", + // Ỹ = \~{Y} + "\u0232": "\u0059\u0304", + // Ȳ = \={Y} + "\u0176": "\u0059\u0302", + // Ŷ = \^{Y} + "\u1e8e": "\u0059\u0307", + // Ẏ = \.{Y} + "\u0179": "\u005a\u0301", + // Ź = \'{Z} + "\u017d": "\u005a\u030c", + // Ž = \v{Z} + "\u1e90": "\u005a\u0302", + // Ẑ = \^{Z} + "\u017b": "\u005a\u0307", + // Ż = \.{Z} + "\u03ac": "\u03b1\u0301", + // ά = \'{α} + "\u1f70": "\u03b1\u0300", + // ὰ = \`{α} + "\u1fb1": "\u03b1\u0304", + // ᾱ = \={α} + "\u1fb0": "\u03b1\u0306", + // ᾰ = \u{α} + "\u03ad": "\u03b5\u0301", + // έ = \'{ε} + "\u1f72": "\u03b5\u0300", + // ὲ = \`{ε} + "\u03ae": "\u03b7\u0301", + // ή = \'{η} + "\u1f74": "\u03b7\u0300", + // ὴ = \`{η} + "\u03af": "\u03b9\u0301", + // ί = \'{ι} + "\u1f76": "\u03b9\u0300", + // ὶ = \`{ι} + "\u03ca": "\u03b9\u0308", + // ϊ = \"{ι} + "\u0390": "\u03b9\u0308\u0301", + // ΐ = \"\'{ι} + "\u1fd2": "\u03b9\u0308\u0300", + // ῒ = \"\`{ι} + "\u1fd1": "\u03b9\u0304", + // ῑ = \={ι} + "\u1fd0": "\u03b9\u0306", + // ῐ = \u{ι} + "\u03cc": "\u03bf\u0301", + // ό = \'{ο} + "\u1f78": "\u03bf\u0300", + // ὸ = \`{ο} + "\u03cd": "\u03c5\u0301", + // ύ = \'{υ} + "\u1f7a": "\u03c5\u0300", + // ὺ = \`{υ} + "\u03cb": "\u03c5\u0308", + // ϋ = \"{υ} + "\u03b0": "\u03c5\u0308\u0301", + // ΰ = \"\'{υ} + "\u1fe2": "\u03c5\u0308\u0300", + // ῢ = \"\`{υ} + "\u1fe1": "\u03c5\u0304", + // ῡ = \={υ} + "\u1fe0": "\u03c5\u0306", + // ῠ = \u{υ} + "\u03ce": "\u03c9\u0301", + // ώ = \'{ω} + "\u1f7c": "\u03c9\u0300", + // ὼ = \`{ω} + "\u038e": "\u03a5\u0301", + // Ύ = \'{Υ} + "\u1fea": "\u03a5\u0300", + // Ὺ = \`{Υ} + "\u03ab": "\u03a5\u0308", + // Ϋ = \"{Υ} + "\u1fe9": "\u03a5\u0304", + // Ῡ = \={Υ} + "\u1fe8": "\u03a5\u0306", + // Ῠ = \u{Υ} + "\u038f": "\u03a9\u0301", + // Ώ = \'{Ω} + "\u1ffa": "\u03a9\u0300" // Ὼ = \`{Ω} + +}; + +/* eslint no-constant-condition:0 */ + +/** + * This file contains the parser used to parse out a TeX expression from the + * input. Since TeX isn't context-free, standard parsers don't work particularly + * well. + * + * The strategy of this parser is as such: + * + * The main functions (the `.parse...` ones) take a position in the current + * parse string to parse tokens from. The lexer (found in Lexer.js, stored at + * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When + * individual tokens are needed at a position, the lexer is called to pull out a + * token, which is then used. + * + * The parser has a property called "mode" indicating the mode that + * the parser is currently in. Currently it has to be one of "math" or + * "text", which denotes whether the current environment is a math-y + * one or a text-y one (e.g. inside \text). Currently, this serves to + * limit the functions which can be used in text mode. + * + * The main functions then return an object which contains the useful data that + * was parsed at its given point, and a new position at the end of the parsed + * data. The main functions can call each other and continue the parsing by + * using the returned position as a new starting point. + * + * There are also extra `.handle...` functions, which pull out some reused + * functionality into self-contained functions. + * + * The functions return ParseNodes. + */ +class Parser { + constructor(input, settings) { + this.mode = void 0; + this.gullet = void 0; + this.settings = void 0; + this.leftrightDepth = void 0; + this.nextToken = void 0; + // Start in math mode + this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a + // new lexer (mouth) for this parser (stomach, in the language of TeX) + + this.gullet = new MacroExpander(input, settings, this.mode); // Store the settings for use in parsing + + this.settings = settings; // Count leftright depth (for \middle errors) + + this.leftrightDepth = 0; + } + /** + * Checks a result to make sure it has the right type, and throws an + * appropriate error otherwise. + */ + + + expect(text, consume = true) { + if (this.nextToken.text !== text) { + throw new ParseError("Expected '" + text + "', got '" + this.nextToken.text + "'", this.nextToken); + } + + if (consume) { + this.consume(); + } + } + /** + * Considers the current look ahead token as consumed, + * and fetches the one after that as the new look ahead. + */ + + + consume() { + this.nextToken = this.gullet.expandNextToken(); + } + /** + * Switches between "text" and "math" modes. + */ + + + switchMode(newMode) { + this.mode = newMode; + this.gullet.switchMode(newMode); + } + /** + * Main parsing function, which parses an entire input. + */ + + + parse() { + // Create a group namespace for the math expression. + // (LaTeX creates a new group for every $...$, $$...$$, \[...\].) + this.gullet.beginGroup(); // Use old \color behavior (same as LaTeX's \textcolor) if requested. + // We do this within the group for the math expression, so it doesn't + // pollute settings.macros. + + if (this.settings.colorIsTextColor) { + this.gullet.macros.set("\\color", "\\textcolor"); + } // Try to parse the input + + + this.consume(); + const parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end + + this.expect("EOF", false); // End the group namespace for the expression + + this.gullet.endGroup(); + return parse; + } + + /** + * Parses an "expression", which is a list of atoms. + * + * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This + * happens when functions have higher precendence han infix + * nodes in implicit parses. + * + * `breakOnTokenText`: The text of the token that the expression should end + * with, or `null` if something else should end the + * expression. + */ + parseExpression(breakOnInfix, breakOnTokenText) { + const body = []; // Keep adding atoms to the body until we can't parse any more atoms (either + // we reached the end, a }, or a \right) + + while (true) { + // Ignore spaces in math mode + if (this.mode === "math") { + this.consumeSpaces(); + } + + const lex = this.nextToken; + + if (Parser.endOfExpression.indexOf(lex.text) !== -1) { + break; + } + + if (breakOnTokenText && lex.text === breakOnTokenText) { + break; + } + + if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) { + break; + } + + const atom = this.parseAtom(breakOnTokenText); + + if (!atom) { + break; + } + + body.push(atom); + } + + if (this.mode === "text") { + this.formLigatures(body); + } + + return this.handleInfixNodes(body); + } + /** + * Rewrites infix operators such as \over with corresponding commands such + * as \frac. + * + * There can only be one infix operator per group. If there's more than one + * then the expression is ambiguous. This can be resolved by adding {}. + */ + + + handleInfixNodes(body) { + let overIndex = -1; + let funcName; + + for (let i = 0; i < body.length; i++) { + const node = checkNodeType(body[i], "infix"); + + if (node) { + if (overIndex !== -1) { + throw new ParseError("only one infix operator per group", node.token); + } + + overIndex = i; + funcName = node.replaceWith; + } + } + + if (overIndex !== -1 && funcName) { + let numerNode; + let denomNode; + const numerBody = body.slice(0, overIndex); + const denomBody = body.slice(overIndex + 1); + + if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { + numerNode = numerBody[0]; + } else { + numerNode = { + type: "ordgroup", + mode: this.mode, + body: numerBody + }; + } + + if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { + denomNode = denomBody[0]; + } else { + denomNode = { + type: "ordgroup", + mode: this.mode, + body: denomBody + }; + } + + let node; + + if (funcName === "\\\\abovefrac") { + node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); + } else { + node = this.callFunction(funcName, [numerNode, denomNode], []); + } + + return [node]; + } else { + return body; + } + } // The greediness of a superscript or subscript + + + /** + * Handle a subscript or superscript with nice errors. + */ + handleSupSubscript(name) { + const symbolToken = this.nextToken; + const symbol = symbolToken.text; + this.consume(); + this.consumeSpaces(); // ignore spaces before sup/subscript argument + + const group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS); + + if (!group) { + throw new ParseError("Expected group after '" + symbol + "'", symbolToken); + } + + return group; + } + /** + * Converts the textual input of an unsupported command into a text node + * contained within a color node whose color is determined by errorColor + */ + + + handleUnsupportedCmd() { + const text = this.nextToken.text; + const textordArray = []; + + for (let i = 0; i < text.length; i++) { + textordArray.push({ + type: "textord", + mode: "text", + text: text[i] + }); + } + + const textNode = { + type: "text", + mode: this.mode, + body: textordArray + }; + const colorNode = { + type: "color", + mode: this.mode, + color: this.settings.errorColor, + body: [textNode] + }; + this.consume(); + return colorNode; + } + /** + * Parses a group with optional super/subscripts. + */ + + + parseAtom(breakOnTokenText) { + // The body of an atom is an implicit group, so that things like + // \left(x\right)^2 work correctly. + const base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts + + if (this.mode === "text") { + return base; + } // Note that base may be empty (i.e. null) at this point. + + + let superscript; + let subscript; + + while (true) { + // Guaranteed in math mode, so eat any spaces first. + this.consumeSpaces(); // Lex the first token + + const lex = this.nextToken; + + if (lex.text === "\\limits" || lex.text === "\\nolimits") { + // We got a limit control + const opNode = checkNodeType(base, "op"); + + if (opNode) { + const limits = lex.text === "\\limits"; + opNode.limits = limits; + opNode.alwaysHandleSupSub = true; + } else { + throw new ParseError("Limit controls must follow a math operator", lex); + } + + this.consume(); + } else if (lex.text === "^") { + // We got a superscript start + if (superscript) { + throw new ParseError("Double superscript", lex); + } + + superscript = this.handleSupSubscript("superscript"); + } else if (lex.text === "_") { + // We got a subscript start + if (subscript) { + throw new ParseError("Double subscript", lex); + } + + subscript = this.handleSupSubscript("subscript"); + } else if (lex.text === "'") { + // We got a prime + if (superscript) { + throw new ParseError("Double superscript", lex); + } + + const prime = { + type: "textord", + mode: this.mode, + text: "\\prime" + }; // Many primes can be grouped together, so we handle this here + + const primes = [prime]; + this.consume(); // Keep lexing tokens until we get something that's not a prime + + while (this.nextToken.text === "'") { + // For each one, add another prime to the list + primes.push(prime); + this.consume(); + } // If there's a superscript following the primes, combine that + // superscript in with the primes. + + + if (this.nextToken.text === "^") { + primes.push(this.handleSupSubscript("superscript")); + } // Put everything into an ordgroup as the superscript + + + superscript = { + type: "ordgroup", + mode: this.mode, + body: primes + }; + } else if (lex.text === "%") { + this.consumeComment(); + } else { + // If it wasn't ^, _, or ', stop parsing super/subscripts + break; + } + } // Base must be set if superscript or subscript are set per logic above, + // but need to check here for type check to pass. + + + if (superscript || subscript) { + // If we got either a superscript or subscript, create a supsub + return { + type: "supsub", + mode: this.mode, + base: base, + sup: superscript, + sub: subscript + }; + } else { + // Otherwise return the original body + return base; + } + } + /** + * Parses an entire function, including its base and all of its arguments. + */ + + + parseFunction(breakOnTokenText, name, // For error reporting. + greediness) { + const token = this.nextToken; + const func = token.text; + const funcData = functions[func]; + + if (!funcData) { + return null; + } + + if (greediness != null && funcData.greediness <= greediness) { + throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token); + } else if (this.mode === "text" && !funcData.allowedInText) { + throw new ParseError("Can't use function '" + func + "' in text mode", token); + } else if (this.mode === "math" && funcData.allowedInMath === false) { + throw new ParseError("Can't use function '" + func + "' in math mode", token); + } // Consume the command token after possibly switching to the + // mode specified by the function (for instant mode switching), + // and then immediately switch back. + + + if (funcData.consumeMode) { + const oldMode = this.mode; + this.switchMode(funcData.consumeMode); + this.consume(); + this.switchMode(oldMode); + } else { + this.consume(); + } + + const _this$parseArguments = this.parseArguments(func, funcData), + args = _this$parseArguments.args, + optArgs = _this$parseArguments.optArgs; + + return this.callFunction(func, args, optArgs, token, breakOnTokenText); + } + /** + * Call a function handler with a suitable context and arguments. + */ + + + callFunction(name, args, optArgs, token, breakOnTokenText) { + const context = { + funcName: name, + parser: this, + token, + breakOnTokenText + }; + const func = functions[name]; + + if (func && func.handler) { + return func.handler(context, args, optArgs); + } else { + throw new ParseError(`No function handler for ${name}`); + } + } + /** + * Parses the arguments of a function or environment + */ + + + parseArguments(func, // Should look like "\name" or "\begin{name}". + funcData) { + const totalArgs = funcData.numArgs + funcData.numOptionalArgs; + + if (totalArgs === 0) { + return { + args: [], + optArgs: [] + }; + } + + const baseGreediness = funcData.greediness; + const args = []; + const optArgs = []; + + for (let i = 0; i < totalArgs; i++) { + const argType = funcData.argTypes && funcData.argTypes[i]; + const isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments. As the TeXbook says: + // "After you have said ‘\def\row#1#2{...}’, you are allowed to + // put spaces between the arguments (e.g., ‘\row x n’), because + // TeX doesn’t use single spaces as undelimited arguments." + + if (i > 0 && !isOptional) { + this.consumeSpaces(); + } // Also consume leading spaces in math mode, as parseSymbol + // won't know what to do with them. This can only happen with + // macros, e.g. \frac\foo\foo where \foo expands to a space symbol. + // In LaTeX, the \foo's get treated as (blank) arguments). + // In KaTeX, for now, both spaces will get consumed. + // TODO(edemaine) + + + if (i === 0 && !isOptional && this.mode === "math") { + this.consumeSpaces(); + } + + const nextToken = this.nextToken; + const arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness); + + if (!arg) { + if (isOptional) { + optArgs.push(null); + continue; + } + + throw new ParseError("Expected group after '" + func + "'", nextToken); + } + + (isOptional ? optArgs : args).push(arg); + } + + return { + args, + optArgs + }; + } + /** + * Parses a group when the mode is changing. + */ + + + parseGroupOfType(name, type, optional, greediness) { + switch (type) { + case "color": + return this.parseColorGroup(optional); + + case "size": + return this.parseSizeGroup(optional); + + case "url": + return this.parseUrlGroup(optional); + + case "math": + case "text": + return this.parseGroup(name, optional, greediness, undefined, type); + + case "original": + case null: + case undefined: + return this.parseGroup(name, optional, greediness); + + default: + throw new ParseError("Unknown group type as " + name, this.nextToken); + } + } + + consumeSpaces() { + while (this.nextToken.text === " ") { + this.consume(); + } + } + + consumeComment() { + // the newline character is normalized in Lexer, check original source + while (this.nextToken.text !== "EOF" && this.nextToken.loc && this.nextToken.loc.getSource().indexOf("\n") === -1) { + this.consume(); + } + + if (this.nextToken.text === "EOF") { + this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)"); + } + + if (this.mode === "math") { + this.consumeSpaces(); // ignore spaces in math mode + } else if (this.nextToken.loc) { + // text mode + const source = this.nextToken.loc.getSource(); + + if (source.indexOf("\n") === source.length - 1) { + this.consumeSpaces(); // if no space after the first newline + } + } + } + /** + * Parses a group, essentially returning the string formed by the + * brace-enclosed tokens plus some position information. + */ + + + parseStringGroup(modeName, // Used to describe the mode in error messages. + optional, raw) { + const groupBegin = optional ? "[" : "{"; + const groupEnd = optional ? "]" : "}"; + const nextToken = this.nextToken; + + if (nextToken.text !== groupBegin) { + if (optional) { + return null; + } else if (raw && nextToken.text !== "EOF" && /[^{}[\]]/.test(nextToken.text)) { + // allow a single character in raw string group + this.consume(); + return nextToken; + } + } + + const outerMode = this.mode; + this.mode = "text"; + this.expect(groupBegin); + let str = ""; + const firstToken = this.nextToken; + let nested = 0; // allow nested braces in raw string group + + let lastToken = firstToken; + + while (raw && nested > 0 || this.nextToken.text !== groupEnd) { + switch (this.nextToken.text) { + case "EOF": + throw new ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str)); + + case "%": + if (!raw) { + // allow % in raw string group + this.consumeComment(); + continue; + } + + break; + + case groupBegin: + nested++; + break; + + case groupEnd: + nested--; + break; + } + + lastToken = this.nextToken; + str += lastToken.text; + this.consume(); + } + + this.mode = outerMode; + this.expect(groupEnd); + return firstToken.range(lastToken, str); + } + /** + * Parses a regex-delimited group: the largest sequence of tokens + * whose concatenated strings match `regex`. Returns the string + * formed by the tokens plus some position information. + */ + + + parseRegexGroup(regex, modeName) { + const outerMode = this.mode; + this.mode = "text"; + const firstToken = this.nextToken; + let lastToken = firstToken; + let str = ""; + + while (this.nextToken.text !== "EOF" && (regex.test(str + this.nextToken.text) || this.nextToken.text === "%")) { + if (this.nextToken.text === "%") { + this.consumeComment(); + continue; + } + + lastToken = this.nextToken; + str += lastToken.text; + this.consume(); + } + + if (str === "") { + throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); + } + + this.mode = outerMode; + return firstToken.range(lastToken, str); + } + /** + * Parses a color description. + */ + + + parseColorGroup(optional) { + const res = this.parseStringGroup("color", optional); + + if (!res) { + return null; + } + + const match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); + + if (!match) { + throw new ParseError("Invalid color: '" + res.text + "'", res); + } + + let color = match[0]; + + if (/^[0-9a-f]{6}$/i.test(color)) { + // We allow a 6-digit HTML color spec without a leading "#". + // This follows the xcolor package's HTML color model. + // Predefined color names are all missed by this RegEx pattern. + color = "#" + color; + } + + return { + type: "color-token", + mode: this.mode, + color + }; + } + /** + * Parses a size specification, consisting of magnitude and unit. + */ + + + parseSizeGroup(optional) { + let res; + let isBlank = false; + + if (!optional && this.nextToken.text !== "{") { + res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); + } else { + res = this.parseStringGroup("size", optional); + } + + if (!res) { + return null; + } + + if (!optional && res.text.length === 0) { + // Because we've tested for what is !optional, this block won't + // affect \kern, \hspace, etc. It will capture the mandatory arguments + // to \genfrac and \above. + res.text = "0pt"; // Enable \above{} + + isBlank = true; // This is here specifically for \genfrac + } + + const match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); + + if (!match) { + throw new ParseError("Invalid size: '" + res.text + "'", res); + } + + const data = { + number: +(match[1] + match[2]), + // sign + magnitude, cast to number + unit: match[3] + }; + + if (!validUnit(data)) { + throw new ParseError("Invalid unit: '" + data.unit + "'", res); + } + + return { + type: "size", + mode: this.mode, + value: data, + isBlank + }; + } + /** + * Parses an URL, checking escaped letters and allowed protocols. + */ + + + parseUrlGroup(optional) { + const res = this.parseStringGroup("url", optional, true); // get raw string + + if (!res) { + return null; + } // hyperref package allows backslashes alone in href, but doesn't + // generate valid links in such cases; we interpret this as + // "undefined" behaviour, and keep them as-is. Some browser will + // replace backslashes with forward slashes. + + + const url = res.text.replace(/\\([#$%&~_^{}])/g, '$1'); + let protocol = /^\s*([^\\/#]*?)(?::|�*58|�*3a)/i.exec(url); + protocol = protocol != null ? protocol[1] : "_relative"; + const allowed = this.settings.allowedProtocols; + + if (!utils.contains(allowed, "*") && !utils.contains(allowed, protocol)) { + throw new ParseError(`Forbidden protocol '${protocol}'`, res); + } + + return { + type: "url", + mode: this.mode, + url + }; + } + /** + * If `optional` is false or absent, this parses an ordinary group, + * which is either a single nucleus (like "x") or an expression + * in braces (like "{x+y}") or an implicit group, a group that starts + * at the current position, and ends right before a higher explicit + * group ends, or at EOF. + * If `optional` is true, it parses either a bracket-delimited expression + * (like "[x+y]") or returns null to indicate the absence of a + * bracket-enclosed group. + * If `mode` is present, switches to that mode while parsing the group, + * and switches back after. + */ + + + parseGroup(name, // For error reporting. + optional, greediness, breakOnTokenText, mode) { + const outerMode = this.mode; + const firstToken = this.nextToken; + const text = firstToken.text; // Switch to specified mode + + if (mode) { + this.switchMode(mode); + } + + let result; // Try to parse an open brace + + if (text === (optional ? "[" : "{")) { + // Start a new group namespace + this.gullet.beginGroup(); // If we get a brace, parse an expression + + this.consume(); + const expression = this.parseExpression(false, optional ? "]" : "}"); + const lastToken = this.nextToken; // Switch mode back before consuming symbol after close brace + + if (mode) { + this.switchMode(outerMode); + } // End group namespace before consuming symbol after close brace + + + this.gullet.endGroup(); // Make sure we get a close brace + + this.expect(optional ? "]" : "}"); + return { + type: "ordgroup", + mode: this.mode, + loc: SourceLocation.range(firstToken, lastToken), + body: expression + }; + } else if (optional) { + // Return nothing for an optional group + result = null; + } else { + // If there exists a function with this name, parse the function. + // Otherwise, just return a nucleus + result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol(); + + if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) { + if (this.settings.throwOnError) { + throw new ParseError("Undefined control sequence: " + text, firstToken); + } + + result = this.handleUnsupportedCmd(); + } + } // Switch mode back + + + if (mode) { + this.switchMode(outerMode); + } + + return result; + } + /** + * Form ligature-like combinations of characters for text mode. + * This includes inputs like "--", "---", "``" and "''". + * The result will simply replace multiple textord nodes with a single + * character in each value by a single textord node having multiple + * characters in its value. The representation is still ASCII source. + * The group will be modified in place. + */ + + + formLigatures(group) { + let n = group.length - 1; + + for (let i = 0; i < n; ++i) { + const a = group[i]; // $FlowFixMe: Not every node type has a `text` property. + + const v = a.text; + + if (v === "-" && group[i + 1].text === "-") { + if (i + 1 < n && group[i + 2].text === "-") { + group.splice(i, 3, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 2]), + text: "---" + }); + n -= 2; + } else { + group.splice(i, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 1]), + text: "--" + }); + n -= 1; + } + } + + if ((v === "'" || v === "`") && group[i + 1].text === v) { + group.splice(i, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 1]), + text: v + v + }); + n -= 1; + } + } + } + /** + * Parse a single symbol out of the string. Here, we handle single character + * symbols and special functions like verbatim + */ + + + parseSymbol() { + const nucleus = this.nextToken; + let text = nucleus.text; + + if (/^\\verb[^a-zA-Z]/.test(text)) { + this.consume(); + let arg = text.slice(5); + const star = arg.charAt(0) === "*"; + + if (star) { + arg = arg.slice(1); + } // Lexer's tokenRegex is constructed to always have matching + // first/last characters. + + + if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { + throw new ParseError(`\\verb assertion failed -- + please report what input caused this bug`); + } + + arg = arg.slice(1, -1); // remove first and last char + + return { + type: "verb", + mode: "text", + body: arg, + star + }; + } else if (text === "%") { + this.consumeComment(); + return this.parseSymbol(); + } // At this point, we should have a symbol, possibly with accents. + // First expand any accented base symbol according to unicodeSymbols. + + + if (unicodeSymbols.hasOwnProperty(text[0]) && !symbols[this.mode][text[0]]) { + // This behavior is not strict (XeTeX-compatible) in math mode. + if (this.settings.strict && this.mode === "math") { + this.settings.reportNonstrict("unicodeTextInMathMode", `Accented Unicode text character "${text[0]}" used in ` + `math mode`, nucleus); + } + + text = unicodeSymbols[text[0]] + text.substr(1); + } // Strip off any combining characters + + + const match = combiningDiacriticalMarksEndRegex.exec(text); + + if (match) { + text = text.substring(0, match.index); + + if (text === 'i') { + text = '\u0131'; // dotless i, in math and text mode + } else if (text === 'j') { + text = '\u0237'; // dotless j, in math and text mode + } + } // Recognize base symbol + + + let symbol; + + if (symbols[this.mode][text]) { + if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) { + this.settings.reportNonstrict("unicodeTextInMathMode", `Latin-1/Unicode text character "${text[0]}" used in ` + `math mode`, nucleus); + } + + const group = symbols[this.mode][text].group; + const loc = SourceLocation.range(nucleus); + let s; + + if (ATOMS.hasOwnProperty(group)) { + // $FlowFixMe + const family = group; + s = { + type: "atom", + mode: this.mode, + family, + loc, + text + }; + } else { + // $FlowFixMe + s = { + type: group, + mode: this.mode, + loc, + text + }; + } + + symbol = s; + } else if (text.charCodeAt(0) >= 0x80) { + // no symbol for e.g. ^ + if (this.settings.strict) { + if (!supportedCodepoint(text.charCodeAt(0))) { + this.settings.reportNonstrict("unknownSymbol", `Unrecognized Unicode character "${text[0]}"` + ` (${text.charCodeAt(0)})`, nucleus); + } else if (this.mode === "math") { + this.settings.reportNonstrict("unicodeTextInMathMode", `Unicode text character "${text[0]}" used in math mode`, nucleus); + } + } + + symbol = { + type: "textord", + mode: this.mode, + loc: SourceLocation.range(nucleus), + text + }; + } else { + return null; // EOF, ^, _, {, }, etc. + } + + this.consume(); // Transform combining characters into accents + + if (match) { + for (let i = 0; i < match[0].length; i++) { + const accent = match[0][i]; + + if (!unicodeAccents[accent]) { + throw new ParseError(`Unknown accent ' ${accent}'`, nucleus); + } + + const command = unicodeAccents[accent][this.mode]; + + if (!command) { + throw new ParseError(`Accent ${accent} unsupported in ${this.mode} mode`, nucleus); + } + + symbol = { + type: "accent", + mode: this.mode, + loc: SourceLocation.range(nucleus), + label: command, + isStretchy: false, + isShifty: true, + base: symbol + }; + } + } + + return symbol; + } + +} +Parser.endOfExpression = ["}", "\\end", "\\right", "&"]; +Parser.SUPSUB_GREEDINESS = 1; + +/** + * Provides a single function for parsing an expression using a Parser + * TODO(emily): Remove this + */ + +/** + * Parses an expression using a Parser, then returns the parsed result. + */ +const parseTree = function parseTree(toParse, settings) { + if (!(typeof toParse === 'string' || toParse instanceof String)) { + throw new TypeError('KaTeX can only parse string typed expression'); + } + + const parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors + + delete parser.gullet.macros.current["\\df@tag"]; + let tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag. + // In this case, we separately parse the tag and wrap the tree. + + if (parser.gullet.macros.get("\\df@tag")) { + if (!settings.displayMode) { + throw new ParseError("\\tag works only in display equations"); + } + + parser.gullet.feed("\\df@tag"); + tree = [{ + type: "tag", + mode: "text", + body: tree, + tag: parser.parse() + }]; + } + + return tree; +}; + +/* eslint no-console:0 */ + +/** + * Parse and build an expression, and place that expression in the DOM node + * given. + */ +let render = function render(expression, baseNode, options) { + baseNode.textContent = ""; + const node = renderToDomTree(expression, options).toNode(); + baseNode.appendChild(node); +}; // KaTeX's styles don't work properly in quirks mode. Print out an error, and +// disable rendering. + + +if (typeof document !== "undefined") { + if (document.compatMode !== "CSS1Compat") { + typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype."); + + render = function render() { + throw new ParseError("KaTeX doesn't work in quirks mode."); + }; + } +} +/** + * Parse and build an expression, and return the markup for that. + */ + + +const renderToString = function renderToString(expression, options) { + const markup = renderToDomTree(expression, options).toMarkup(); + return markup; +}; +/** + * Parse an expression and return the parse tree. + */ + + +const generateParseTree = function generateParseTree(expression, options) { + const settings = new Settings(options); + return parseTree(expression, settings); +}; +/** + * If the given error is a KaTeX ParseError and options.throwOnError is false, + * renders the invalid LaTeX as a span with hover title giving the KaTeX + * error message. Otherwise, simply throws the error. + */ + + +const renderError = function renderError(error, expression, options) { + if (options.throwOnError || !(error instanceof ParseError)) { + throw error; + } + + const node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]); + node.setAttribute("title", error.toString()); + node.setAttribute("style", `color:${options.errorColor}`); + return node; +}; +/** + * Generates and returns the katex build tree. This is used for advanced + * use cases (like rendering to custom output). + */ + + +const renderToDomTree = function renderToDomTree(expression, options) { + const settings = new Settings(options); + + try { + const tree = parseTree(expression, settings); + return buildTree(tree, expression, settings); + } catch (error) { + return renderError(error, expression, settings); + } +}; +/** + * Generates and returns the katex build tree, with just HTML (no MathML). + * This is used for advanced use cases (like rendering to custom output). + */ + + +const renderToHTMLTree = function renderToHTMLTree(expression, options) { + const settings = new Settings(options); + + try { + const tree = parseTree(expression, settings); + return buildHTMLTree(tree, expression, settings); + } catch (error) { + return renderError(error, expression, settings); + } +}; + +var katex = { + /** + * Current KaTeX version + */ + version: "0.10.0", + + /** + * Renders the given LaTeX into an HTML+MathML combination, and adds + * it as a child to the specified DOM node. + */ + render, + + /** + * Renders the given LaTeX into an HTML+MathML combination string, + * for sending to the client. + */ + renderToString, + + /** + * KaTeX error, usually during parsing. + */ + ParseError, + + /** + * Parses the given LaTeX into KaTeX's internal parse tree structure, + * without rendering to HTML or MathML. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __parse: generateParseTree, + + /** + * Renders the given LaTeX into an HTML+MathML internal DOM tree + * representation, without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToDomTree: renderToDomTree, + + /** + * Renders the given LaTeX into an HTML internal DOM tree representation, + * without MathML and without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToHTMLTree: renderToHTMLTree, + + /** + * extends internal font metrics object with a new object + * each key in the new object represents a font name + */ + __setFontMetrics: setFontMetrics, + + /** + * adds a new symbol to builtin symbols table + */ + __defineSymbol: defineSymbol, + + /** + * adds a new macro to builtin macro list + */ + __defineMacro: defineMacro, + + /** + * Expose the dom tree node types, which can be useful for type checking nodes. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __domTree: { + Span, + Anchor, + SymbolNode, + SvgNode, + PathNode, + LineNode + } +}; + +export default katex; diff --git a/reflib.py b/reflib.py index dc87ca60..d89172e9 100644 --- a/reflib.py +++ b/reflib.py @@ -409,6 +409,11 @@ def findRefs(file, filename): logDiag('Matched open block pattern') attribs = matches.group('attribs') + # If the previous open block wasn't closed, raise an error + if openBlockState != 'outside': + logErr('Nested open block starting at line', line, 'of', + filename) + openBlockState = 'start' # Parse the block attributes diff --git a/reflow_count.py b/reflow_count.py index 5e8f1a7e..3b429960 100644 --- a/reflow_count.py +++ b/reflow_count.py @@ -1,2 +1,2 @@ # The value to start tagging VU statements at, unless overridden by -nextvu -startVUID = 2609 +startVUID = 2632 diff --git a/xml/check_spec_links.py b/xml/check_spec_links.py index 8ce6f39e..c8c858bc 100755 --- a/xml/check_spec_links.py +++ b/xml/check_spec_links.py @@ -20,2186 +20,118 @@ # used in the AsciiDoctor source for the spec, especially # related to the validity of the entities linked-to. -import argparse -import html -import json -import re -from abc import ABC, abstractmethod -from collections import namedtuple -from enum import Enum -from io import StringIO from pathlib import Path -from sys import exit, stdout -from xml.etree import ElementTree -from inspect import currentframe, getframeinfo from reg import Registry +from spec_tools.entity_db import EntityDatabase +from spec_tools.macro_checker import MacroChecker +from spec_tools.macro_checker_file import MacroCheckerFile +from spec_tools.main import checkerMain +from spec_tools.shared import (AUTO_FIX_STRING, EXTENSION_CATEGORY, MessageId, + MessageType) ### # "Configuration" constants -NAME_PREFIX = 'vk' - -MISSING_VALIDITY_SUPPRESSIONS = set() -ENTITIES_WITHOUT_VALIDITY = set( - ['VkBaseOutStructure', 'VkBaseInStructure']) - -# These are marked with the code: macro -SYSTEM_TYPES = set(['void', 'char', 'float', 'size_t', 'uintptr_t', - 'int8_t', 'uint8_t', - 'int32_t', 'uint32_t', - 'int64_t', 'uint64_t']) - -PLATFORM_REQUIRES = 'vk_platform' EXTRA_DEFINES = [] # TODO - defines mentioned in spec but not needed in registry + +# These are marked with the code: macro +SYSTEM_TYPES = ['void', 'char', 'float', 'size_t', 'uintptr_t', + 'int8_t', 'uint8_t', + 'int32_t', 'uint32_t', + 'int64_t', 'uint64_t'] + ROOT = Path(__file__).resolve().parent.parent -REGISTRY_FILE = ROOT / 'xml/vk.xml' -ALL_DOCS = [str(fn) - for fn in sorted((ROOT / 'chapters/').glob('**/*.txt'))] -ALL_DOCS.extend([str(fn) - for fn in sorted((ROOT / 'appendices/').glob('**/*.txt'))]) - -INCLUDE = re.compile( - r'include::(?P((../){1,4}|\{INCS-VAR\}/))(?P[\w]+)/(?P\w+)/(?P[^./]+).txt[[][]]') -ANCHOR = re.compile(r'\[\[(?P[^\]]+)\]\]') - -BRACKETS = re.compile(r'\[(?P.*)\]') - - -def makeRefPageRE(field_name): - return re.compile(r",{}='(?P[^']*)'".format(field_name)) - - -REF_PAGE_TAGS = { - field: makeRefPageRE(field) for field in ['refpage', 'desc', 'xrefs', 'type'] -} - -MEMBER_REFERENCE = re.compile( - r'\b(?P(?P[fs](text|link)):(?P[\w*]+))(?P::)(?P(?Ppname:?)(?P[\w]+))\b' -) - -PRECEDING_MEMBER_REFERENCE = re.compile( - r'\b(?P[fs](text|link)):(?P[\w*]+)::$') - -HEADING_COMMAND = re.compile( - r'=+ (?P{}[\w]+)'.format(NAME_PREFIX) -) - -SUSPECTED_MISSING_MACRO = re.compile( - r'\b(?[vV][kK][\w*]+)\b(?!>>)' -) - -OPEN_LINK = re.compile( - r'.*(?]*$' -) - -CLOSE_LINK = re.compile( - r'[^<]*>>.*$' -) - -SKIP_LINE = re.compile( - r'^(ifdef:)|(endif:).*' -) - -INTERNAL_PLACEHOLDER = re.compile( - r'(?P__+)([a-zA-Z]+)(?P=delim)' -) - -CATEGORIES_WITH_VALIDITY = set(['protos', 'structs']) - - -LEADING_SPACES = re.compile(r'^(?P\s*)(?P.*)') +DEFAULT_DISABLED_MESSAGES = set([ + MessageId.LEGACY, + MessageId.REFPAGE_MISSING, + MessageId.MISSING_MACRO, + MessageId.EXTENSION, + # TODO *text macro checking actually needs fixing for Vulkan + MessageId.MISUSED_TEXT, + MessageId.MISSING_TEXT +]) CWD = Path('.').resolve() -if hasattr(stdout, 'isatty') and stdout.isatty(): - try: - from termcolor import colored as colored_impl - HAVE_COLOR = True - except ImportError: - HAVE_COLOR = False -else: - HAVE_COLOR = False -try: - from tabulate import tabulate_impl - HAVE_TABULATE = True -except ImportError: - HAVE_TABULATE = False +class VulkanEntityDatabase(EntityDatabase): + """Vulkan-specific subclass of EntityDatabase.""" -AUTO_FIX_STRING = 'Note: Auto-fix available.' -EXTENSION_CATEGORY = 'extension' + def makeRegistry(self): + registryFile = str(ROOT / 'xml/vk.xml') + registry = Registry() + registry.loadFile(registryFile) + return registry + def getNamePrefix(self): + return "vk" -def colored(s, color=None, attrs=None): - if HAVE_COLOR: - return colored_impl(s, color, attrs=attrs) - return s + def getPlatformRequires(self): + return 'vk_platform' + def getSystemTypes(self): + return SYSTEM_TYPES -def colWidth(collection, columnNum): - MIN_PADDING = 5 - return MIN_PADDING + max([len(row[columnNum]) for row in collection]) - - -def alternateTabulate(collection, headers=None): - if headers is None: - fullTable = collection - else: - underline = ['-' * len(header) for header in headers] - fullTable = [headers, underline] + collection - widths = [colWidth(collection, colNum) - for colNum in range(len(fullTable[0]))] - widths[-1] = None - - lines = [] - for row in fullTable: - fields = [] - for data, width in zip(row, widths): - if width: - spaces = ' ' * (width-len(data)) - fields.append(data + spaces) - else: - fields.append(data) - lines.append(''.join(fields)) - return '\n'.join(lines) - - -def printTabulated(collection, headers=None): - if HAVE_TABULATE: - print(tabulate_impl(collection, headers=headers)) - else: - print(alternateTabulate(collection, headers=headers)) - - -def generateInclude(dir_traverse, generated_type, category, entity): - return 'include::{directory_traverse}{generated_type}/{category}/{entity_name}.txt[]'.format( - directory_traverse=dir_traverse, - generated_type=generated_type, - category=category, - entity_name=entity) - - -def regenerateIncludeFromMatch(match, generated_type): - return generateInclude(match.group('directory_traverse'), generated_type, match.group('category'), - match.group('entity_name')) - - -def shouldEntityBeText(entity, subscript): - entity_only = entity - if subscript: - if subscript == '[]' or subscript == '[i]' or subscript.startswith('[_') or subscript.endswith('_]'): - return True - entity_only = entity[:-len(subscript)] - - if ('*' in entity) or entity.startswith('_') or entity_only.endswith('_'): - return True - - if INTERNAL_PLACEHOLDER.search(entity): - return True - return False - - -EntityData = namedtuple( - 'EntityData', ['entity', 'macro', 'elem', 'filename', 'category', 'directory']) - - -def entityToDict(data): - return { - 'macro': data.macro, - 'filename': data.filename, - 'category': data.category - } - - -class MessageType(Enum): - WARNING = 1 - ERROR = 2 - NOTE = 3 - - def __str__(self): - return str(self.name).lower() - - def formattedWithColon(self): - if self == MessageType.WARNING: - return colored(str(self) + ':', 'magenta', attrs=['bold']) - if self == MessageType.ERROR: - return colored(str(self) + ':', 'red', attrs=['bold']) - return str(self) + ':' - - -MessageContext = namedtuple('MessageContext', - ['filename', 'lineNum', 'line', - 'match', 'group']) - - -class MessageId(Enum): - MISSING_TEXT = 1 - LEGACY = 2 - WRONG_MACRO = 3 - MISSING_MACRO = 4 - BAD_ENTITY = 5 - BAD_ENUMERANT = 6 - BAD_MACRO = 7 - UNRECOGNIZED_CONTEXT = 8 - UNKNOWN_MEMBER = 9 - DUPLICATE_INCLUDE = 10 - UNKNOWN_INCLUDE = 11 - API_VALIDITY_ORDER = 12 - UNDOCUMENTED_MEMBER = 13 - MEMBER_PNAME_MISSING = 14 - MISSING_VALIDITY_INCLUDE = 15 - MISSING_API_INCLUDE = 16 - MISUSED_TEXT = 17 - EXTENSION = 18 - REFPAGE_TAG = 19 - REFPAGE_MISSING_DESC = 20 - REFPAGE_XREFS = 21 - REFPAGE_XREFS_COMMA = 22 - REFPAGE_TYPE = 23 - REFPAGE_NAME = 24 - - def __str__(self): - return self.name.lower() - - def enable_arg(self): - return 'W{}'.format(self.name.lower()) - - def disable_arg(self): - return 'Wno_{}'.format(self.name.lower()) - - def desc(self): - - if self == MessageId.MISSING_TEXT: - return "a *text: macro is expected but not found" - elif self == MessageId.LEGACY: - return "legacy usage of *name: macro when *link: is applicable" - elif self == MessageId.WRONG_MACRO: - return "wrong macro used for an entity" - elif self == MessageId.MISSING_MACRO: - return "a macro might be missing" - elif self == MessageId.BAD_ENTITY: - return "entity not recognized, etc." - elif self == MessageId.BAD_ENUMERANT: - return "unrecognized enumerant value used in ename:" - elif self == MessageId.BAD_MACRO: - return "unrecognized macro used" - elif self == MessageId.UNRECOGNIZED_CONTEXT: - return "pname used with an unrecognized context" - elif self == MessageId.UNKNOWN_MEMBER: - return "pname used but member/argument by that name not found" - elif self == MessageId.DUPLICATE_INCLUDE: - return "duplicated include line" - elif self == MessageId.UNKNOWN_INCLUDE: - return "include line specified file we wouldn't expect to exists" - elif self == MessageId.API_VALIDITY_ORDER: - return "saw API include after validity include" - elif self == MessageId.UNDOCUMENTED_MEMBER: - return "saw an apparent struct/function documentation, but missing a member" - elif self == MessageId.MEMBER_PNAME_MISSING: - return "pname: missing from a 'scope' operator" - elif self == MessageId.MISSING_VALIDITY_INCLUDE: - return "missing validity include" - elif self == MessageId.MISSING_API_INCLUDE: - return "missing API include" - elif self == MessageId.MISUSED_TEXT: - return "a *text: macro is found but not expected" - elif self == MessageId.EXTENSION: - return "an extension name is incorrectly marked" - elif self == MessageId.REFPAGE_TAG: - return "a refpage tag is missing an expected field" - elif self == MessageId.REFPAGE_MISSING_DESC: - return "a refpage tag has an empty description" - elif self == MessageId.REFPAGE_XREFS: - return "an unrecognized entity is mentioned in xrefs of a refpage tag" - elif self == MessageId.REFPAGE_XREFS_COMMA: - return "a comma was founds in xrefs of a refpage tag, which is space-delimited" - elif self == MessageId.REFPAGE_TYPE: - return "a refpage tag has an incorrect type field" - elif self == MessageId.REFPAGE_NAME: - return "a refpage tag has an unrecognized entity name in its refpage field" - - @classmethod - def default_set(self): - return set([self.WRONG_MACRO, - self.BAD_ENTITY, - self.BAD_ENUMERANT, - self.BAD_MACRO, - self.UNKNOWN_MEMBER, - self.DUPLICATE_INCLUDE, - self.UNKNOWN_INCLUDE, - self.API_VALIDITY_ORDER, - self.UNDOCUMENTED_MEMBER, - self.MEMBER_PNAME_MISSING, - self.MISSING_VALIDITY_INCLUDE, - self.MISSING_API_INCLUDE - ]) - - -def getInterestedRange(message_context): - return (message_context.match.start(), message_context.match.end()) - - -def getHighlightedRange(message_context): - if message_context.group is not None: - return (message_context.match.start(message_context.group), - message_context.match.end(message_context.group)) - return getInterestedRange(message_context) - - -def getColumn(message_context): - if message_context.group is not None: - return message_context.match.start(message_context.group) - return message_context.match.start() - - -def toNameAndLine(context): - """Convert MessageContext into a simple filename:line string""" - return '{}:{}'.format(str(Path(context.filename).relative_to(ROOT)), context.lineNum) - - -def likelyRecognizedEntity(entity_name): - return entity_name.lower().startswith(NAME_PREFIX) - - -class Message(object): - def __init__(self, message_id, message_type, message, context, replacement=None, see_also=None, fix=None, frame=None): - self.message_id = message_id - self.message_type = message_type - if isinstance(message, str): - self.message = [message] - else: - self.message = message - self.context = context - self.replacement = replacement - self.fix = fix - if see_also is None: - self.see_also = None - elif isinstance(see_also, MessageContext): - self.see_also = [see_also] - else: - self.see_also = see_also - - self.script_location = None - if frame: - try: - frameinfo = getframeinfo(frame) - self.script_location = "{}:{}".format( - frameinfo.filename, frameinfo.lineno) - finally: - del frame - - -def s_suffix(num): - """Simplify pluralization.""" - if num > 1: - return 's' - return '' - - -def pluralize(word, num): - if num == 1: - return word - if word.endswith('y'): - return word[:-1]+'ies' - return word + 's' - - -def printLineSubsetWithHighlighting(line, start, end, highlightStart=None, highlightEnd=None, maxLen=120, replacement=None): - if highlightStart is None: - highlightStart = start - if highlightEnd is None: - highlightEnd = end - - start = min(start, highlightStart) - end = max(end, highlightEnd) - - tildeLength = highlightEnd - highlightStart - 1 - caretLoc = highlightStart - continuation = '[...]' - - if len(line) > maxLen: - # Too long - - # the max is to handle -1 from .find() (which indicates "not found") - followingSpaceIndex = max(end, line.find(' ', min(len(line), end + 1))) - - # Maximum length has decreased by at least - # the length of a single continuation we absolutely need. - maxLen -= len(continuation) - - if followingSpaceIndex <= maxLen: - # We can grab the whole beginning of the line and not adjust caretLoc - line = line[:maxLen] + continuation - - elif (len(line) - followingSpaceIndex) < 5: - # We need to truncate the beginning, but we're close to the end of line. - newBeginning = len(line) - maxLen - - caretLoc += len(continuation) - caretLoc -= newBeginning - line = continuation + line[newBeginning:] - else: - # Need to truncate the beginning of the string too. - newEnd = followingSpaceIndex - - # Now we need two continuations (and to adjust caret to the right accordingly) - maxLen -= len(continuation) - caretLoc += len(continuation) - - newBeginning = newEnd - maxLen - caretLoc -= newBeginning - - line = continuation + line[newBeginning:newEnd] + continuation - print(line) - - spaces = ' ' * caretLoc - tildes = '~' * tildeLength - print(spaces + colored('^' + tildes, 'green')) - if replacement is not None: - print(spaces + colored(replacement, 'green')) - - -class MacroCheckerFile(object): - def __init__(self, checker, filename, enabled_messages, stream_maker): - self.checker = checker - self.filename = filename - self.stream_maker = stream_maker - self.enabled_messages = enabled_messages - self.fixes = set() - self.messages = [] - - self.pname_data = None - self.pname_mentions = {} - - self.lines = [] - - # For both of these: - # keys: entity name - # values: MessageContext - self.fs_api_includes = {} - self.validity_includes = {} - - self.in_code_block = False - - def numDiagnostics(self): - return len(self.messages) - - def numErrors(self): - return self.numMessagesOfType(MessageType.ERROR) - - def numMessagesOfType(self, message_type): - return len([msg for msg in self.messages if msg.message_type == message_type]) - - def hasFixes(self): - return len(self.fixes) > 0 - - def printMessageCounts(self): - for message_type in [MessageType.ERROR, MessageType.WARNING]: - count = len( - [msg for msg in self.messages if msg.message_type == message_type]) - if count > 0: - print('{num} {mtype}{s} generated.'.format( - num=count, mtype=message_type, s=s_suffix(count))) - - def diag(self, severity, message_id, messageLines, group=None, replacement=None, context=None, fix=None, see_also=None, frame=None): - if message_id not in self.enabled_messages: - return - - if not frame: - frame = currentframe().f_back - if context is None: - message = Message(message_id=message_id, - message_type=severity, - message=messageLines, - context=self.storeMessageContext(group=group), - replacement=replacement, - see_also=see_also, - fix=fix, - frame=frame) - else: - message = Message(message_id=message_id, - message_type=severity, - message=messageLines, - context=context, - replacement=replacement, - see_also=see_also, - fix=fix, - frame=frame) - if fix is not None: - self.fixes.add(fix) - self.messages.append(message) - - def warning(self, message_id, messageLines, group=None, replacement=None, context=None, fix=None, see_also=None, frame=None): - if not frame: - frame = currentframe().f_back - self.diag(MessageType.WARNING, message_id, messageLines, group, - replacement, context, fix, see_also) - - def error(self, message_id, messageLines, group=None, replacement=None, context=None, fix=None, see_also=None, frame=None): - if not frame: - frame = currentframe().f_back - self.diag(MessageType.ERROR, message_id, messageLines, group, - replacement, context, fix, see_also) - - def storeMessageContext(self, group=None, match=None): - """Create message context from corresponding instance variables.""" - if match is None: - match = self.match - return MessageContext(filename=self.filename, - lineNum=self.lineNum, - line=self.line, - match=match, - group=group) - - def makeFix(self, newMacro=None, newEntity=None, data=None): - return (self.makeSearch(), self.makeMacroMarkup(newMacro, newEntity, data)) - - def makeSearch(self): - return '{}:{}'.format(self.macro, self.entity) - - def makeMacroMarkup(self, newMacro=None, newEntity=None, data=None): - if not newEntity: - if data: - newEntity = data.entity - else: - newEntity = self.entity - if not newMacro: - if data: - newMacro = data.macro - else: - newMacro = self.macro - if not data: - data = self.checker.findEntity(newEntity) - if data and data.category == EXTENSION_CATEGORY: - return self.makeExtensionLink(newEntity) - return '{}:{}'.format(newMacro, newEntity) - - def makeExtensionLink(self, newEntity=None): - if not newEntity: - newEntity = self.entity - return '`<<{}>>`'.format(newEntity) - - def hasMember(self, elem, memberName): - pass - - def checkRecognizedEntity(self): - """Returns true if there is no need to perform further checks on this match. - - Helps avoid duplicate warnings/errors.""" - entity = self.entity - macro = self.macro - if self.checker.findMacroAndEntity(macro, entity) is not None: - # We know this macro-entity combo - return True - - # We don't know this macro-entity combo. - possibleCats = self.checker.categoriesByMacro.get(macro) - if possibleCats is None: - possibleCats = ['???'] - msg = ['Definition of link target {} with macro {} (used for {} {}) does not exist.'.format( - entity, - macro, - pluralize('category', len(possibleCats)), - ', '.join(possibleCats))] - - data = self.checker.findEntity(entity) - if data: - # We found the goof: incorrect macro - message_type = MessageType.WARNING - message_id = MessageId.WRONG_MACRO - group = 'macro' - - if data.category == EXTENSION_CATEGORY: - # Ah, this is an extension - msg.append( - 'This is apparently an extension name, which should be marked up as a link.') - message_id = MessageId.EXTENSION - group = None # replace the whole thing - else: - - # Non-extension, we found the macro though. - msg.append('Apparently matching entity in category {} found.'.format( - data.category)) - if data.macro[0] == macro[0] and data.macro[1:] == 'link' and macro[1:] == 'name': - # This is legacy markup - msg.append( - 'This is legacy markup that has not been updated yet.') - message_id = MessageId.LEGACY - else: - message_type = MessageType.ERROR - - msg.append(AUTO_FIX_STRING) - self.diag(message_type, message_id, msg, - group=group, replacement=self.makeMacroMarkup(data=data), fix=self.makeFix(data=data)) - return True - - see_also = [] - dataArray = self.checker.findEntityCaseInsensitive(entity) - if dataArray: - # We might have found the goof... - - if len(dataArray) == 1: - # Yep, found the goof - incorrect macro and entity capitalization - data = dataArray[0] - self.error(MessageId.WRONG_MACRO, msg + ['Apparently matching entity in category {} found by searching case-insensitively.'.format(data.category)], - replacement=self.makeMacroMarkup(data=data), - fix=self.makeFix(data=data)) - return True - else: - # Ugh, more than one resolution - msg.append( - 'More than one apparent match found by searching case-insensitively, cannot auto-fix.') - see_also = dataArray[:] - - # OK, so we don't recognize this entity (and couldn't auto-fix it). - - if macro in self.checker.linkedMacros: - # This should be linked, which means we should know the target. - if not likelyRecognizedEntity(entity): - newMacro = macro[0] + 'name' - if newMacro in self.checker.categoriesByMacro: - self.error(MessageId.BAD_ENTITY, msg + - ['Entity name fits the pattern for this API, which would mean it should be a "name" macro instead of "link"'], - group='macro', replacement=newMacro, fix=self.makeFix(newMacro=newMacro), see_also=see_also) - else: - self.error(MessageId.BAD_ENTITY, msg + - ['Entity name does not fit the pattern for this API, which would mean it should be a "name" macro', - 'However, {} is not a known macro so cannot auto-fix.'.format(newMacro)], see_also=see_also) - else: - # no idea why it's missing, it just is. Human brains required. - if not self.checkText(): - self.error(MessageId.BAD_ENTITY, msg + ['Might be a misspelling or the wrong macro.'], - see_also=see_also) - - elif macro == 'ename': - # TODO This might be an ambiguity in the style guide - ename might be a known enumerant value, - # or it might be an enumerant value in an external library, etc. that we don't know about - so - # hard to check this. - if likelyRecognizedEntity(entity): - if not self.checkText(): - self.warning(MessageId.BAD_ENUMERANT, msg + - ['Unrecognized ename:{} that we would expect to recognize since it fits the pattern for this API.'.format(entity)], see_also=see_also) - else: - # This is fine - it doesn't need to be recognized since it's not linked. - pass - # Don't skip other tests. - return False - - def checkText(self): - ### - # Wildcards (or leading or trailing underscore, or square brackets with nothing or a placeholder) if and only if a 'text' macro - macro = self.macro - entity = self.entity - shouldBeText = shouldEntityBeText(entity, self.subscript) - if shouldBeText and not self.macro.endswith('text') and not self.macro == 'code': - newMacro = macro[0] + 'text' - if newMacro in self.checker.categoriesByMacro: - self.error(MessageId.MISSING_TEXT, - ['Asterisk/leading or trailing underscore/bracket found - macro should end with "text:", probably {}:'.format(newMacro), - AUTO_FIX_STRING], - group='macro', replacement=newMacro, fix=self.makeFix(newMacro=newMacro)) - else: - self.error(MessageId.MISSING_TEXT, - ['Asterisk/leading or trailing underscore/bracket found, so macro should end with "text:".', - 'However {}: is not a known macro so cannot auto-fix.'.format(newMacro)], - group='macro') - return True - elif macro.endswith('text') and not shouldBeText: - msg = [ - "No asterisk/leading or trailing underscore/bracket in the entity, so this might be a mistaken use of the 'text' macro {}:".format(macro)] - data = self.checker.findEntity(entity) - if data: - # We found the goof: incorrect macro - msg.append('Apparently matching entity in category {} found.'.format( - data.category)) - msg.append(AUTO_FIX_STRING) - replacement = self.makeFix(data=data) - if data.category == EXTENSION_CATEGORY: - self.error(MessageId.EXTENSION, msg, - replacement=replacement, fix=replacement) - else: - self.error(MessageId.WRONG_MACRO, msg, - group='macro', replacement=data.macro, fix=replacement) - else: - msg.append('Entity not found in spec, either.') - if macro[0] != 'e': - # Only suggest a macro if we aren't in elink/ename/etext, since ename and elink are not related - # in an equivalent way to the relationship between flink and fname. - newMacro = macro[0] + 'name' - if newMacro in self.checker.categoriesByMacro: - msg.append( - 'Consider if {}: might be the correct macro to use here.'.format(newMacro)) - else: - msg.append( - 'Cannot suggest a new macro because {}: is not a known macro.'.format(newMacro)) - self.warning(MessageId.MISUSED_TEXT, msg) - return True - return False - - def checkPname(self, pname_context): - if '*' in pname_context: - # This context has a placeholder, can't verify it. - return - - entity = self.entity - - context_data = self.checker.findEntity(pname_context) - members = self.checker.getMemberNames(pname_context) - - if context_data and not members: - # This is a recognized parent entity that doesn't have detectable member names, - # skip validation - # TODO: Annotate parameters of function pointer types with and ? - return - if not members: - self.warning(MessageId.UNRECOGNIZED_CONTEXT, - 'pname context entity was un-recognized {}'.format(pname_context)) - return - - if entity not in members: - self.warning(MessageId.UNKNOWN_MEMBER, ["Could not find member/param named '{}' in {}".format(entity, pname_context), - 'Known {} mamber/param names are: {}'.format( - pname_context, ', '.join(members))], group='entity_name') - - def processMatch(self): - match = self.match - entity = self.entity - macro = self.macro - - ### - # Track entities that we're actually linking to. - ### - if macro in self.checker.linkedMacros: - self.checker.addLinkToEntity(entity, self.storeMessageContext()) - - ### - # Link everything that should be, and nothing that shouldn't be - ### - if self.checkRecognizedEntity(): - # if this returns true, then there is no need to do the remaining checks on this match - return - - ### - # Non-existent macros - if macro in self.checker.NON_EXISTENT_MACROS: - self.error(MessageId.BAD_MACRO, '{} is not a macro provided in the specification, despite resembling other macros.'.format( - macro), group='macro') - - ### - # Wildcards (or leading underscore, or square brackets) if and only if a 'text' macro - self.checkText() - - # Do some validation of pname references. - if macro == 'pname': - # See if there's an immediately-preceding entity - preceding = self.line[:match.start()] - scope = PRECEDING_MEMBER_REFERENCE.search(preceding) - if scope: - # Yes there is, check it out. - self.checkPname(scope.group('entity_name')) - elif self.pname_data is not None: - # No, but there is a pname_context - self.checkPname(self.pname_data.entity) - if self.pname_data.entity in self.pname_mentions and self.pname_mentions[self.pname_data.entity] is not None: - # Record this mention, in case we're in the documentation block. - self.pname_mentions[self.pname_data.entity].add(entity) - else: - # no, and no existing pname_context from an include - can't check this. - pass - - def recordInclude(self, include_dict, generated_type=None): - entity = self.match.group('entity_name') - if generated_type is None: - generated_type = self.match.group('generated_type') - - if entity in include_dict: - self.warning(MessageId.DUPLICATE_INCLUDE, - "Included {} docs for {} when they were already included.".format(generated_type, - entity), see_also=include_dict[entity]) - include_dict[entity].append(self.storeMessageContext()) - else: - include_dict[entity] = [self.storeMessageContext()] - - def checkRefPageXref(self, referenced_entity, line_context): - data = self.checker.findEntity(referenced_entity) - if data: - # This is OK - return - context = line_context - match = re.search(r'\b{}\b'.format(referenced_entity), self.line) - if match: - context = self.storeMessageContext( - group=None, match=match) - msg = [ - "Found reference page markup, with an unrecognized entity listed: {}".format(referenced_entity)] - - see_also = None - dataArray = self.checker.findEntityCaseInsensitive( - referenced_entity) - - if dataArray: - # We might have found the goof... - - if len(dataArray) == 1: - # Yep, found the goof - incorrect entity capitalization - data = dataArray[0] - new_entity = data.entity - self.error(MessageId.REFPAGE_XREFS, msg + ['Apparently matching entity in category {} found by searching case-insensitively.'.format(data.category)], - replacement=new_entity, - fix=(referenced_entity, new_entity), - context=context) - return - - # Ugh, more than one resolution - msg.append( - 'More than one apparent match found by searching case-insensitively, cannot auto-fix.') - see_also = dataArray[:] - - # Multiple or no resolutions found - self.error(MessageId.REFPAGE_XREFS, - msg, - see_also=see_also, - context=context) - - def checkRefPageXrefs(self, xrefs_match): - text = xrefs_match.group('text') - context = self.storeMessageContext(group='text', match=xrefs_match) - if ',' in text: - self.error(MessageId.REFPAGE_XREFS_COMMA, - "Found reference page markup, with an unexpected comma in the (space-delimited) field xrefs='{}'".format( - text), - context=context) - return - - refs = text.split() - # Don't do this if we found a comma, since that's a clearer error message - for entity in refs: - self.checkRefPageXref(entity, context) - - def checkRefPage(self): - line = self.line - - # Should always be found - self.match = BRACKETS.match(line) - - data = None - directory = None - refpage = REF_PAGE_TAGS['refpage'].search(line) - if refpage: - text = refpage.group('text') - data = self.checker.findEntity(text) - if data: - directory = data.directory - else: - # TODO suggest fixes here if applicable - context = self.storeMessageContext( - group='text', match=refpage) - self.error(MessageId.REFPAGE_NAME, - "Found reference page markup, but refpage='{}' does not refer to a recognized entity".format( - text), - context=context) - - else: - self.error(MessageId.REFPAGE_TAG, - "Found apparent reference page markup, but missing refpage='...'", - group=None) - - desc = REF_PAGE_TAGS['desc'].search(line) - if desc: - text = desc.group('text') - if not text: - context = self.storeMessageContext(group=None, match=desc) - self.warning(MessageId.REFPAGE_MISSING_DESC, - "Found reference page markup, but desc='' is empty", - context=context) - else: - self.error(MessageId.REFPAGE_TAG, - "Found apparent reference page markup, but missing desc='...'", - group=None) - - ref_type = REF_PAGE_TAGS['type'].search(line) - if ref_type: - text = ref_type.group('text') - if directory and not text == directory: - context = self.storeMessageContext( - group='text', match=ref_type) - self.error(MessageId.REFPAGE_TYPE, - "Found reference page markup, but type='{}' is not the expected value '{}'".format( - text, directory), - context=context) - else: - self.error(MessageId.REFPAGE_TAG, - "Found apparent reference page markup, but missing type='...'", - group=None) - - xrefs = REF_PAGE_TAGS['xrefs'].search(line) - if xrefs: - # This field is optional - self.checkRefPageXrefs(xrefs) - - def processLine(self, lineNum, line): - self.lineNum = lineNum - self.line = line - self.match = None - self.entity = None - self.macro = None - - if line.startswith('----'): - self.in_code_block = not self.in_code_block - return - - if self.in_code_block: - # We do no processing in a code block. - return - - ### - # Detect headings - if line.startswith('=='): - # Headings cause us to clear our pname_context - self.pname_data = None - - command = HEADING_COMMAND.match(line) - if command: - data = self.checker.findEntity(command) - if data: - self.pname_data = data - return - - ### - # Detect [open, lines for manpages - # TODO: Use these for pname context too. - if line.startswith('[open,'): - self.checkRefPage() - return - - ### - # Skip comments - if line.lstrip().startswith('//'): - return - - ### - # Skip ifdef/endif - if SKIP_LINE.match(line): - return - - ### - # Detect include:::....[] lines - match = INCLUDE.match(line) - if match: - self.match = match - entity = match.group('entity_name') - - if not entity in self.checker.byEntity: - self.warning(MessageId.UNKNOWN_INCLUDE, ['Saw include for {}, but that entity is unknown.'.format(entity), - 'This could be typo, or it could be a bug in check_spec_links.']) - self.pname_data = None - return - - self.pname_data = self.checker.byEntity[entity] - - if match.group('generated_type') == 'api': - self.recordInclude(self.checker.apiIncludes) - - # Set mentions to None. The first time we see something like `* pname:paramHere`, - # we will set it to an empty set - self.pname_mentions[entity] = None - - if match.group('category') in CATEGORIES_WITH_VALIDITY: - self.fs_api_includes[entity] = self.storeMessageContext() - - if entity in self.validity_includes: - self.warning(MessageId.API_VALIDITY_ORDER, - ['/api/ include found for {} after a corresponding /validity/ include'.format(entity), - 'Validity include located at {}'.format(toNameAndLine(self.validity_includes[entity]))]) - - elif match.group('generated_type') == 'validity': - self.recordInclude(self.checker.validityIncludes) - self.validity_includes[entity] = self.storeMessageContext() - - if self.pname_mentions[entity] is not None: - # Got a validity include and we have seen at least one * pname: line since we got the API include - # so we can warn if we haven't seen a reference to every parameter/member. - members = self.checker.getMemberNames(entity) - missing = [member for member in members - if member not in self.pname_mentions[entity]] - if len(missing) > 0: - self.warning(MessageId.UNDOCUMENTED_MEMBER, - ['Validity include found for {}, but not all members/params apparently documented'.format(entity), - 'Members/params not mentioned with pname: {}'.format( - ', '.join(missing))]) - - # If we found an include line, we're done with this line. - return - - if self.pname_data is not None and '* pname:' in line: - context_entity = self.pname_data.entity - if self.pname_mentions[context_entity] is None: - # First time seeting * pname: after an api include, prepare the set that - # tracks - self.pname_mentions[context_entity] = set() - - ### - # Detect [[Entity]] anchors - for match in ANCHOR.finditer(line): - entity = match.group('entity_name') - if self.checker.findEntity(entity): - # We found an anchor with the same name as an entity - treat it like an API include - self.match = match - self.recordInclude(self.checker.apiIncludes, - generated_type='api (manual anchor)') - - ### - # Detect :: without pname - for match in MEMBER_REFERENCE.finditer(line): - if not match.group('member_macro'): - self.match = match - # Got :: but not followed by pname - - search = match.group() - replacement = match.group( - 'first_part') + '::pname:' + match.group('second_part') - self.error(MessageId.MEMBER_PNAME_MISSING, - 'Found a function parameter or struct member reference with :: but missing pname:', - group='double_colons', - replacement='::pname:', - fix=(search, replacement)) - - # check pname here because it won't come up in normal iteration below - # because of the missing macro - self.entity = match.group('entity_name') - self.checkPname(match.group('scope')) - - ### - # Look for things that seem like a missing macro. - for match in SUSPECTED_MISSING_MACRO.finditer(line): - if OPEN_LINK.match(line, endpos=match.start()): - # this is in a link, skip it. - continue - if CLOSE_LINK.match(line[match.end():]): - # this is in a link, skip it. - continue - - entity = match.group('entity_name') - self.match = match - self.entity = entity - data = self.checker.findEntity(entity) - if data: - - if data.category == EXTENSION_CATEGORY: - # Ah, this is an extension - self.warning(MessageId.EXTENSION, "Seems like this is an extension name that was not linked.", - group='entity_name', replacement=self.makeExtensionLink()) - else: - self.warning(MessageId.MISSING_MACRO, - ['Seems like a macro was omitted for this reference to a known entity in category "{}".'.format(data.category), - 'Wrap in ` ` to silence this if you do not want a verified macro here.'], - group='entity_name', - replacement=self.makeMacroMarkup(data.macro)) - else: - - dataArray = self.checker.findEntityCaseInsensitive(entity) - # We might have found the goof... - - if dataArray: - if len(dataArray) == 1: - # Yep, found the goof - incorrect macro and entity capitalization - data = dataArray[0] - if data.category == EXTENSION_CATEGORY: - # Ah, this is an extension - self.warning(MessageId.EXTENSION, - "Seems like this is an extension name that was not linked.", - group='entity_name', replacement=self.makeExtensionLink(data.entity)) - else: - self.warning(MessageId.MISSING_MACRO, - 'Seems like a macro was omitted for this reference to a known entity in category "{}", found by searching case-insensitively.'.format( - data.category), - replacement=self.makeMacroMarkup(data=data)) - - else: - # Ugh, more than one resolution - - self.warning(MessageId.MISSING_MACRO, - ['Seems like a macro was omitted for this reference to a known entity, found by searching case-insensitively.', - 'More than one apparent match.'], - group='entity_name', see_also=dataArray[:]) - - ### - # Main operations: detect markup macros - for match in self.checker.regex.finditer(line): - self.match = match - self.macro = match.group('macro') - self.entity = match.group('entity_name') - self.subscript = match.group('subscript') - self.processMatch() - - def process(self): - with self.stream_maker.make_stream() as f: - for lineIndex, line in enumerate(f): - trimmedLine = line.rstrip() - self.lines.append(trimmedLine) - self.processLine(lineIndex + 1, trimmedLine) - - # Check that every include of an /api/ file in the protos or structs category - # had a matching /validity/ include - for entity, includeContext in self.fs_api_includes.items(): - if not self.checker.entityHasValidity(entity): - continue - - if entity in MISSING_VALIDITY_SUPPRESSIONS: - continue - - if entity not in self.validity_includes: - self.warning(MessageId.MISSING_VALIDITY_INCLUDE, - ['Saw /api/ include for {}, but no matching /validity/ include'.format(entity), - 'Expected a line with ' + regenerateIncludeFromMatch(includeContext.match, 'validity')], - context=includeContext) - - # Check that we never include a /validity/ file without a matching /api/ include - for entity, includeContext in self.validity_includes.items(): - if entity not in self.fs_api_includes: - self.warning(MessageId.MISSING_API_INCLUDE, - ['Saw /validity/ include for {}, but no matching /api/ include'.format(entity), - 'Expected a line with ' + regenerateIncludeFromMatch(includeContext.match, 'api')], - context=includeContext) - - if not self.numDiagnostics(): - # no problems, exit quietly - return - - print('\nFor file {}:'.format(self.filename)) - - self.printMessageCounts() - numFixes = len(self.fixes) - if numFixes > 0: - fixes = ', '.join(['{} -> {}'.format(search, replace) - for search, replace in self.fixes]) - - print('{} unique auto-fix {} recorded: {}'.format(numFixes, - pluralize( - 'pattern', numFixes), - fixes)) - - -class MacroChecker(object): - def __init__(self, enabled_messages): - self.enabled_messages = enabled_messages - - self.files = [] - - self.byEntity = {} - self.byLowercaseEntity = {} - self.byMacroAndEntity = {} - - self.categoriesByMacro = {} - - # keys: entity names. values: MessageContext - self.links = {} - self.apiIncludes = {} - self.validityIncludes = {} - self.headings = {} - - # Entities that get a generated/api/category/entity.txt file. - self.generatingEntities = {} - - # The rest are added later inside addMacros - - self.linkedMacros = set(['basetype']) - - self.registryFile = str(REGISTRY_FILE) - self.registry = Registry() - self.registry.loadFile(self.registryFile) - self.registry.parseTree() - - self.addMacro('basetype', ['basetypes']) - self.addMacro('code', ['code']) - self.addMacros('f', ['link', 'name', 'text'], ['protos']) - self.addMacros('s', ['link', 'name', 'text'], ['structs', 'handles']) - self.addMacros('e', ['link', 'name', 'text'], ['enums']) - self.addMacros('p', ['name', 'text'], ['parameter', 'member']) + def populateMacros(self): self.addMacros('t', ['link', 'name'], ['funcpointers', 'flags']) - self.addMacros('d', ['link', 'name'], ['defines', 'configdefines']) - - self.NON_EXISTENT_MACROS = set(['plink', 'ttext', 'dtext']) - for macro in self.NON_EXISTENT_MACROS: - # Still search for them - self.addMacro(macro, None) - - # the "formatting" group is to strip matching */**/_/__ surrounding an entire macro. - self.regex = re.compile( - r'(?P\**|_*)(?P{}):(?P[\w*]+((?P[\[][^\]]*[\]]))?)(?P=formatting)'.format('|'.join([re.escape(macro) for macro in self.categoriesByMacro]))) - - for t in SYSTEM_TYPES: - self.addEntity(t, 'code', generates=False) - - for name, info in self.registry.typedict.items(): - if name in SYSTEM_TYPES: - # We already added these. - continue - - requires = info.elem.get('requires') - if requires == PLATFORM_REQUIRES: - # Ah, no, don't skip this, it's just in the platform header file. - # TODO are these code or basetype? - self.addEntity(name, 'code', elem=info.elem) - continue - - if requires and not requires.lower().startswith(NAME_PREFIX): - # This is an externally-defined type, will skip it. - continue - - protect = info.elem.get('protect') - if protect: - self.addEntity(protect, 'dlink', category='configdefines') - - cat = info.elem.get('category') - if cat == 'struct': - self.addEntity(name, 'slink', elem=info.elem) - - elif cat == 'union': - # TODO: is this right? - self.addEntity(name, 'slink', elem=info.elem) - - elif cat == 'enum': - self.addEntity( - name, 'elink', elem=info.elem) - - elif cat == 'handle': - self.addEntity(name, 'slink', elem=info.elem, - category='handles') - - elif cat == 'bitmask': - self.addEntity( - name, 'tlink', elem=info.elem, category='flags') - - elif cat == 'basetype': - self.addEntity(name, 'basetype', - elem=info.elem) - - elif cat == 'define': - self.addEntity(name, 'dlink', elem=info.elem) - - elif cat == 'funcpointer': - self.addEntity(name, 'tlink', elem=info.elem) - - elif cat == 'include': - # skip - continue - - elif cat is None: - self.addEntity(name, 'code', elem=info.elem) - - else: - raise RuntimeError('unrecognized category {}'.format(cat)) - - for name, info in self.registry.enumdict.items(): - self.addEntity(name, 'ename', elem=info.elem, - category='enumvalues') - - for name, info in self.registry.cmddict.items(): - self.addEntity(name, 'flink', elem=info.elem, - category='commands', directory='protos') - - for name, info in self.registry.extdict.items(): - # Only get the protect strings and name from extensions - - self.addEntity(name, None, category=EXTENSION_CATEGORY, - generates=False) - protect = info.elem.get('protect') - if protect: - self.addEntity(protect, 'dlink', category='configdefines') + def populateEntities(self): # These are not mentioned in the XML for name in EXTRA_DEFINES: self.addEntity(name, 'dlink', category='configdefines') - def addMacro(self, macro, categories): - self.categoriesByMacro[macro] = categories - def addMacros(self, letter, macroTypes, categories): - for macroType in macroTypes: - macro = letter + macroType - self.addMacro(macro, categories) - if macroType == 'link': - self.linkedMacros.add(macro) +class VulkanMacroCheckerFile(MacroCheckerFile): + """Vulkan-specific subclass of MacroCheckerFile.""" - def addEntity(self, entityName, macro, category=None, elem=None, filename=None, directory=None, generates=True): - if category is None: - category = self.categoriesByMacro.get(macro)[0] - if directory is None: - directory = category + def handleWrongMacro(self, msg, data): + """Report an appropriate message when we found that the macro used is incorrect. - # Don't generate a filename for ename or code, or configdefines because there are no files for those. - if filename is None and macro not in ['ename', 'code'] and category != 'configdefines' and generates: - filename = '{}/{}.txt'.format(directory, entityName) + May be overridden depending on each API's behavior regarding macro misuse: + e.g. in some cases, it may be considered a MessageId.LEGACY warning rather than + a MessageId.WRONG_MACRO or MessageId.EXTENSION. + """ + message_type = MessageType.WARNING + message_id = MessageId.WRONG_MACRO + group = 'macro' - data = EntityData( - entity=entityName, - macro=macro, - elem=elem, - filename=filename, - category=category, - directory=directory - ) - if entityName in self.byEntity: - # skip - return - if entityName.lower() not in self.byLowercaseEntity: - self.byLowercaseEntity[entityName.lower()] = [] - - self.byEntity[entityName] = data - self.byLowercaseEntity[entityName.lower()].append(data) - self.byMacroAndEntity[(macro, entityName)] = data - if generates and filename is not None: - self.generatingEntities[entityName] = data - - def haveLinkTarget(self, entity): - if not self.findEntity(entity): - return None - if entity in self.apiIncludes: - return True - return entity in self.headings - - def hasFixes(self): - for f in self.files: - if f.hasFixes(): - return True - return False - - def addLinkToEntity(self, entity, context): - if entity not in self.links: - self.links[entity] = [] - self.links[entity].append(context) - - def findMacroAndEntity(self, macro, entity): - return self.byMacroAndEntity.get((macro, entity)) - - def findEntity(self, entity): - return self.byEntity.get(entity) - - def findEntityCaseInsensitive(self, entity): - return self.byLowercaseEntity.get(entity.lower()) - - def getMemberElems(self, commandOrStruct): - data = self.findEntity(commandOrStruct) - - if not data: - return None - if data.macro == 'slink': - tag = 'member' + if data.category == EXTENSION_CATEGORY: + # Ah, this is an extension + msg.append( + 'This is apparently an extension name, which should be marked up as a link.') + message_id = MessageId.EXTENSION + group = None # replace the whole thing else: - tag = 'param' - return data.elem.findall('.//{}'.format(tag)) - - def getMemberNames(self, commandOrStruct): - members = self.getMemberElems(commandOrStruct) - if not members: - return [] - ret = [] - for member in members: - name_tag = member.find('name') - if name_tag: - ret.append(name_tag.text) - return ret - - def entityHasValidity(self, entity): - # Related to ValidityGenerator.isStructAlwaysValid - data = self.findEntity(entity) - if not data: - return None - - if entity in ENTITIES_WITHOUT_VALIDITY: - return False - - if data.category == 'protos': - # All protos have validity - return True - - if data.category not in CATEGORIES_WITH_VALIDITY: - return False - - # Handle structs here. - members = self.getMemberElems(entity) - if not members: - return None - for member in members: - - if member.find('name').text in ['next', 'type']: - return True - - if member.find('type').text in ['void', 'char']: - return True - - if member.get('noautovalidity'): - # Not generating validity for this member, skip it - continue - - if member.get('len'): - # Array - return True - - typetail = member.find('type').tail - if typetail and '*' in typetail: - # Pointer - return True - - if member.get('category') in ['handle', 'enum', 'bitmask'] == 'type': - return True - - if member.get('category') in ['struct', 'union'] and self.entityHasValidity(member.find('type').text): - # struct or union member - recurse - return True - - # Got this far - no validity needed - return False - - def processFile(self, filename): - class FileStreamMaker(object): - def __init__(self, filename): - self.filename = filename - - def make_stream(self): - return open(self.filename, 'r', encoding='utf-8') - - f = MacroCheckerFile(self, filename, self.enabled_messages, - FileStreamMaker(filename)) - f.process() - self.files.append(f) - - def processString(self, s): - """For testing purposes""" - filename = "string{}: {}".format(len(self.files), s) - - class StringStreamMaker(object): - def __init__(self, string): - self.string = string - - def make_stream(self): - return StringIO(self.string) - - f = MacroCheckerFile(self, filename, self.enabled_messages, - StringStreamMaker(s)) - f.process() - self.files.append(f) - return f - - def numDiagnostics(self): - return sum([f.numDiagnostics() for f in self.files]) - - def numErrors(self): - return sum([f.numErrors() for f in self.files]) - - def getEntityJson(self): - """Dump the internal entity dictionary to JSON for debugging""" - d = {entity: entityToDict(data) - for entity, data in self.byEntity.items()} - return json.dumps(d, sort_keys=True, indent=4) - - def getMissingUnreferencedApiIncludes(self): - return [entity for entity, data in self.generatingEntities.items() - if (not self.haveLinkTarget(entity)) and entity not in self.links] - - def getBrokenLinks(self): - return {entity: contexts for entity, contexts in self.links.items() - if entity in self.generatingEntities and not self.haveLinkTarget(entity)} - - -class BasePrinter(ABC): - def close(self): - pass - - def getRelativeFilename(self, fn): - try: - return str(Path(fn).relative_to(CWD)) - except ValueError: - return str(Path(fn)) - - def formatContext(self, context, message_type=None): - return self.formatContextBrief(context) - - def formatContextBrief(self, context, with_color=True): - return '{}:{}:{}'.format(self.getRelativeFilename(context.filename), - context.lineNum, getColumn(context)) - - def formatMessageTypeBrief(self, message_type, with_color=True): - return '{}:'.format(message_type) - - def formatEntityBrief(self, entity_data, with_color=True): - return '{}:{}'.format(entity_data.macro, entity_data.entity) - - def formatBrief(self, obj, with_color=True): - if isinstance(obj, MessageContext): - return self.formatContextBrief(obj, with_color) - if isinstance(obj, MessageType): - return self.formatMessageTypeBrief(obj, with_color) - if isinstance(obj, EntityData): - return self.formatEntityBrief(obj, with_color) - return str(obj) - - @abstractmethod - def outputMessage(self, msg): - raise NotImplementedError - - @abstractmethod - def outputFallback(self, msg): - raise NotImplementedError - - def outputCheckerFile(self, fileChecker): - for m in fileChecker.messages: - self.output(m) - - def outputChecker(self, checker): - for f in checker.files: - self.output(f) - - def output(self, obj): - if isinstance(obj, Message): - self.outputMessage(obj) - elif isinstance(obj, MacroCheckerFile): - self.outputCheckerFile(obj) - elif isinstance(obj, MacroChecker): - self.outputChecker(obj) - else: - self.outputFallback(self.formatBrief(obj)) - - @abstractmethod - def outputResults(self, checker, broken_links=True, missing_includes=False): - raise NotImplementedError - - -class ConsolePrinter(BasePrinter): - - def formatFilename(self, fn, with_color=True): - return self.getRelativeFilename(fn) - - def formatMessageTypeBrief(self, message_type, with_color=True): - if with_color: - return message_type.formattedWithColon() - else: - return super(ConsolePrinter, self).formatMessageTypeBrief(message_type, with_color) - - def outputFallback(self, obj): - print(obj) - - def outputMessage(self, msg): - highlightStart, highlightEnd = getHighlightedRange(msg.context) - - fileAndLine = colored('{}:'.format( - self.formatBrief(msg.context)), attrs=['bold']) - - headingSize = len('{context}: {mtype}: '.format( - context=self.formatBrief(msg.context), - mtype=self.formatBrief(msg.message_type, False))) - indent = ' ' * headingSize - printedHeading = False - - lines = msg.message[:] - if msg.see_also is not None and len(msg.see_also) != 0: - lines.append('See also:') - for see in msg.see_also: - lines.append(' {}'.format(self.formatBrief(see))) - - if msg.fix is not None: - lines.append('Note: Auto-fix available') - - for line in msg.message: - if not printedHeading: - scriptloc = '' - if msg.script_location: - scriptloc = ', ' + msg.script_location - print('{fileLine} {mtype} {msg} (-{arg}{loc})'.format( - fileLine=fileAndLine, mtype=msg.message_type.formattedWithColon(), - msg=colored(line, attrs=['bold']), arg=msg.message_id.enable_arg(), loc=scriptloc)) - printedHeading = True + # Non-extension, we found the macro though. + if data.macro[0] == self.macro[0] and data.macro[1:] == 'link' and self.macro[1:] == 'name': + # First letter matches, old is 'name', new is 'link': + # This is legacy markup + msg.append( + 'This is legacy markup that has not been updated yet.') + message_id = MessageId.LEGACY else: - print(colored(indent + line, attrs=['bold'])) + # Not legacy, just wrong. + message_type = MessageType.ERROR - if len(msg.message) > 1: - # extra blank line after multiline message - print('') - start, end = getInterestedRange(msg.context) - printLineSubsetWithHighlighting( - msg.context.line, - start, end, - highlightStart, highlightEnd, - replacement=msg.replacement) - - def outputBrokenLinks(self, checker, broken): - print('Missing API includes that are referenced by a linking macro: these result in broken links in the spec!') - - def makeRowOfBroken(entity, uses): - fn = checker.findEntity(entity).filename - anchor = '[[{}]]'.format(entity) - locations = ', '.join([toNameAndLine(context) - for context in uses]) - return (fn, anchor, locations) - printTabulated(sorted([makeRowOfBroken(entity, uses) - for entity, uses in broken.items()]), - headers=['Include File', 'Anchor in lieu of include', 'Links to this entity']) - - def outputMissingIncludes(self, checker, missing): - print( - 'Missing, but unreferenced, API includes/anchors - potentially not-documented entities:') - - def makeRowOfMissing(entity): - fn = checker.findEntity(entity).filename - anchor = '[[{}]]'.format(entity) - return (fn, anchor) - printTabulated(sorted([makeRowOfMissing(entity) for entity in missing]), - headers=['Include File', 'Anchor in lieu of include']) - - def outputResults(self, checker, broken_links=True, missing_includes=False): - self.output(checker) - if broken_links: - broken = checker.getBrokenLinks() - if len(broken) > 0: - self.outputBrokenLinks(checker, broken) - if missing_includes: - missing = checker.getMissingUnreferencedApiIncludes() - if len(missing) > 0: - self.outputMissingIncludes(checker, missing) + msg.append(AUTO_FIX_STRING) + self.diag(message_type, message_id, msg, + group=group, replacement=self.makeMacroMarkup(data=data), fix=self.makeFix(data=data)) -MESSAGE_TYPE_STYLES = { - MessageType.ERROR: 'danger', - MessageType.WARNING: 'warning', - MessageType.NOTE: 'secondary' -} - - -MESSAGE_TYPE_ICONS = { - MessageType.ERROR: '⊗', # makeIcon('times-circle'), - MessageType.WARNING: '⚠', # makeIcon('exclamation-triangle'), - MessageType.NOTE: 'ℹ' # makeIcon('info-circle') -} - -LINK_ICON = '🔗' # link icon - - -class HTMLPrinter(BasePrinter): - def __init__(self, filename): - self.f = open(filename, 'w', encoding='utf-8') - self.f.write(""" - - - - - - - - - check_spec_links results - - -
-

check_spec_links.py Scan Results

- """) - # - self.filenameTransformer = re.compile(r'[^\w]+') - self.fileRange = {} - self.fileLines = {} - self.backLink = namedtuple( - 'BackLink', ['lineNum', 'col', 'end_col', 'target', 'tooltip', 'message_type']) - self.fileBackLinks = {} - - self.nextAnchor = 0 - - def close(self): - self.f.write(""" -
- - - - - - - - - - - """) - self.f.close() - - def recordUsage(self, context, linkBackTooltip=None, linkBackTarget=None, linkBackType=MessageType.NOTE): - BEFORE_CONTEXT = 6 - AFTER_CONTEXT = 3 - # Clamp because we need accurate start line number to make line number display right - start = max(1, context.lineNum - BEFORE_CONTEXT) - stop = context.lineNum + AFTER_CONTEXT + 1 - if context.filename not in self.fileRange: - self.fileRange[context.filename] = range(start, stop) - self.fileBackLinks[context.filename] = [] - else: - oldRange = self.fileRange[context.filename] - self.fileRange[context.filename] = range( - min(start, oldRange.start), max(stop, oldRange.stop)) - - if linkBackTarget is not None: - start_col, end_col = getHighlightedRange(context) - self.fileBackLinks[context.filename].append(self.backLink( - lineNum=context.lineNum, col=start_col, end_col=end_col, - target=linkBackTarget, tooltip=linkBackTooltip, - message_type=linkBackType)) - - def formatFilename(self, fn): - return '{relative}'.format( - href=fn, - relative=self.getRelativeFilename(fn)) - - def formatContext(self, context, message_type=None): - if message_type is None: - icon = LINK_ICON - else: - icon = MESSAGE_TYPE_ICONS[message_type] - return 'In context: {icon}{relative}:{lineNum}:{col}'.format( - href=self.getAnchorLinkForContext(context), - icon=icon, - id=self.makeIdentifierFromFilename(context.filename), - relative=self.getRelativeFilename(context.filename), - lineNum=context.lineNum, - col=getColumn(context)) - - def makeIdentifierFromFilename(self, fn): - return self.filenameTransformer.sub('_', self.getRelativeFilename(fn)) - - def getAnchorLinkForContext(self, context): - return '#excerpt-{}.{}'.format(self.makeIdentifierFromFilename(context.filename), context.lineNum) - - def outputFallback(self, obj): - self.f.write(obj) - - def getUniqueAnchor(self): - """Create and return a new unique string usable as a link anchor""" - anchor = 'anchor-{}'.format(self.nextAnchor) - self.nextAnchor += 1 - return anchor - - def outputMessage(self, msg): - anchor = self.getUniqueAnchor() - - self.recordUsage(msg.context, - linkBackTarget=anchor, - linkBackTooltip='{}: {} [...]'.format( - msg.message_type, msg.message[0]), - linkBackType=msg.message_type) - - self.f.write(""" -
-
-
{icon} {t} Line {lineNum}, Column {col} (-{arg})
-

- """.format( - anchor=anchor, - icon=MESSAGE_TYPE_ICONS[msg.message_type], - style=MESSAGE_TYPE_STYLES[msg.message_type], - t=self.formatBrief(msg.message_type), - lineNum=msg.context.lineNum, - col=getColumn(msg.context), - arg=msg.message_id.enable_arg())) - self.f.write(self.formatContext(msg.context)) - self.f.write('
') - for line in msg.message: - self.f.write(html.escape(line)) - self.f.write('
\n') - self.f.write('

\n') - if msg.see_also is not None and len(msg.see_also) != 0: - self.f.write('

See also:

    \n') - for see in msg.see_also: - if isinstance(see, MessageContext): - self.f.write( - '
  • {}
  • \n'.format(self.formatContext(see))) - self.recordUsage(see, - linkBackTarget=anchor, - linkBackType=MessageType.NOTE, - linkBackTooltip='see-also associated with {} at {}'.format(msg.message_type, self.formatContextBrief(see))) - else: - self.f.write('
  • {}
  • \n'.format(self.formatBrief(see))) - self.f.write('
') - if msg.replacement is not None: - self.f.write( - '
Hover the highlight text to view suggested replacement.
') - if msg.fix is not None: - self.f.write( - '
Note: Auto-fix available.
') - if msg.script_location: - self.f.write( - '

Message originated at {}

'.format(msg.script_location)) - self.f.write('
'.format(
-            msg.context.lineNum))
-        highlightStart, highlightEnd = getHighlightedRange(msg.context)
-        self.f.write(html.escape(msg.context.line[:highlightStart]))
-        self.f.write(
-            '')
-        self.f.write(html.escape(
-            msg.context.line[highlightStart:highlightEnd]))
-        self.f.write('')
-        self.f.write(html.escape(msg.context.line[highlightEnd:]))
-        self.f.write('
') - - def outputCheckerFile(self, fileChecker): - # Save lines for later - self.fileLines[fileChecker.filename] = fileChecker.lines - - if not fileChecker.numDiagnostics(): - return - - self.f.write(""" -
-
-
-
- -
- """.format(id=self.makeIdentifierFromFilename(fileChecker.filename), relativefn=html.escape(self.getRelativeFilename(fileChecker.filename)))) - self.f.write('
') - warnings = fileChecker.numMessagesOfType(MessageType.WARNING) - if warnings > 0: - self.f.write(""" - {icon} - {num} warnings""".format(num=warnings, icon=MESSAGE_TYPE_ICONS[MessageType.WARNING])) - self.f.write('
\n
') - errors = fileChecker.numMessagesOfType(MessageType.ERROR) - if errors > 0: - self.f.write(""" - {icon} - {num} errors""".format(num=errors, icon=MESSAGE_TYPE_ICONS[MessageType.ERROR])) - self.f.write(""" -
-
-
-
-
- """.format( - linkicon=LINK_ICON, - id=self.makeIdentifierFromFilename(fileChecker.filename), fn=html.escape(fileChecker.filename))) - super(HTMLPrinter, self).outputCheckerFile(fileChecker) - - self.f.write(""" -
-
-
- - """.format(id=self.makeIdentifierFromFilename(fileChecker.filename))) - - def outputChecker(self, checker): - self.f.write( - '

Per-File Warnings and Errors

\n') - self.f.write('
\n') - super(HTMLPrinter, self).outputChecker(checker) - self.f.write("""
-
\n""") - - def outputBrokenLinks(self, checker, broken): - - self.f.write(""" -
-

Missing Referenced API Includes

-

Items here have been referenced by a linking macro, so these are all broken links in the spec!

- - - - - - """) - - for entity in sorted(broken): - uses = broken[entity] - category = checker.findEntity(entity).category - anchor = self.getUniqueAnchor() - asciidocAnchor = '[[{}]]'.format(entity) - include = generateInclude(dir_traverse='../../generated/', - generated_type='api', - category=category, - entity=entity) - self.f.write(""" - - - - """) - self.f.write("""
Add line to include this fileor add this macro insteadLinks to this entity
{}{}
    - """.format(anchor, include, asciidocAnchor)) - for context in uses: - self.f.write( - '
  • {}
  • '.format(self.formatContext(context, MessageType.NOTE))) - self.recordUsage(context, - linkBackTooltip='Link broken in spec: {} not included'.format( - fn), - linkBackTarget=anchor, - linkBackType=MessageType.NOTE) - self.f.write("""
""") - - def outputMissingIncludes(self, checker, missing): - self.f.write(""" -
-

Missing Unreferenced API Includes

-

These items are expected to be generated in the spec build process, but aren't included. - However, as they also are not referenced by any linking macros, they aren't broken links - at worst they are undocumented entities, - at best they are errors in check_spec_links.py logic computing which entities get generated files.

- - - - - """) - - for entity in sorted(missing): - fn = checker.findEntity(entity).filename - anchor = '[[{}]]'.format(entity) - self.f.write(""" - - - - """.format(filename=fn, anchor=anchor)) - self.f.write("""
Add line to include this fileor add this macro instead
{filename}{anchor}
""") - - def outputFileExcerpt(self, filename): - self.f.write("""
-
-
-
- """.format(id=self.makeIdentifierFromFilename(filename), fn=self.getRelativeFilename(filename))) - lines = self.fileLines[filename] - r = self.fileRange[filename] - self.f.write("""
""".format(
-            id=self.makeIdentifierFromFilename(filename),
-            start=r.start))
-        for lineNum, line in enumerate(lines[(r.start - 1):(r.stop - 1)], r.start):
-            # self.f.write(line)
-            lineLinks = [x for x in self.fileBackLinks[filename]
-                         if x.lineNum == lineNum]
-            # opened_links = 0
-            for col, char in enumerate(line):
-                colLinks = [x for x in lineLinks if x.col == col]
-                # opened_links += len(colLinks)
-                for link in colLinks:
-                    # TODO right now the syntax highlighting is interfering with the link! so the link-generation is commented out,
-                    # only generating the emoji icon.
-
-                    # self.f.write('{icon}'.format(
-                    #     target=link.target, title=html.escape(link.tooltip), icon=MESSAGE_TYPE_ICONS[link.message_type]))
-                    self.f.write(MESSAGE_TYPE_ICONS[link.message_type])
-                    self.f.write('Cross reference: {t} {title}'.format(
-                        title=html.escape(link.tooltip, False), t=link.message_type))
-
-                    # If you uncomment the following line, don't uncomment anything related to opened_links
-                    # self.f.write('')
-
-                # Write the actual character
-                self.f.write(html.escape(char))
-                # Close any applicable links
-                # links_to_close = len([x for x in lineLinks if x.end_col == col])
-                # self.f.write('' * links_to_close)
-                # opened_links -= links_to_close
-
-            # Close any leftovers
-            # self.f.write('' * opened_links)
-            self.f.write('\n')
-
-        self.f.write('
') - self.f.write('
\n') - self.f.write('
\n') - - def outputResults(self, checker, broken_links=True, missing_includes=False): - self.output(checker) - if broken_links: - broken = checker.getBrokenLinks() - if len(broken) > 0: - self.outputBrokenLinks(checker, broken) - if missing_includes: - missing = checker.getMissingUnreferencedApiIncludes() - if len(missing) > 0: - self.outputMissingIncludes(checker, missing) - - self.f.write(""" -
-

Excerpts of referenced files

""") - for fn in self.fileRange: - self.outputFileExcerpt(fn) - self.f.write('
\n') +def makeMacroChecker(enabled_messages): + entity_db = VulkanEntityDatabase() + return MacroChecker(enabled_messages, entity_db, VulkanMacroCheckerFile, ROOT) if __name__ == '__main__': - enabled_messages = MessageId.default_set() + default_enabled_messages = set(MessageId).difference( + DEFAULT_DISABLED_MESSAGES) - disable_args = [] - enable_args = [] + all_docs = [str(fn) + for fn in sorted((ROOT / 'chapters/').glob('**/*.txt'))] + all_docs.extend([str(fn) + for fn in sorted((ROOT / 'appendices/').glob('**/*.txt'))]) - parser = argparse.ArgumentParser() - parser.add_argument("-Werror", "--warning_error", - help="Make warnings act as errors, exiting with non-zero error code", - action="store_true") - parser.add_argument("--include_warn", - help="List all expected but unseen include files, not just those that are referenced.", - action='store_true') - parser.add_argument("--include_error", - help="Make expected but unseen include files cause exiting with non-zero error code", - action='store_true') - parser.add_argument("--broken_error", - help="Make missing include/anchor for linked-to entities cause exiting with non-zero error code. Weaker version of --include_error.", - action='store_true') - parser.add_argument("--dump_entities", - help="Just dump the parsed entity data to entities.json and exit.", - action='store_true') - parser.add_argument("--html", - help="Output messages to the named HTML file instead of stdout.") - parser.add_argument("file", - help="Only check the indicated file(s). By default, all chapters and extensions are checked.", - nargs="*") - parser.add_argument("--ignore_count", - type=int, - help="Ignore up to the given number of errors without exiting with a non-zero error code.") - parser.add_argument("-Wall", - help="Enable all warning categories.", - action='store_true') - - for message_id in MessageId: - enable_arg = message_id.enable_arg() - enable_args.append((message_id, enable_arg)) - - disable_arg = message_id.disable_arg() - disable_args.append((message_id, disable_arg)) - if message_id in enabled_messages: - parser.add_argument('-' + disable_arg, action="store_true", - help="Disable message category {}: {}".format(str(message_id), message_id.desc())) - # Don't show the enable flag in help since it's enabled by default - parser.add_argument('-' + enable_arg, action="store_true", - help=argparse.SUPPRESS) - else: - parser.add_argument('-' + enable_arg, action="store_true", - help="Enable message category {}: {}".format(str(message_id), message_id.desc())) - # Don't show the disable flag in help since it's disabled by default - parser.add_argument('-' + disable_arg, action="store_true", - help=argparse.SUPPRESS) - - args = parser.parse_args() - - arg_dict = vars(args) - for message_id, arg in enable_args: - if args.Wall or (arg in arg_dict and arg_dict[arg]): - enabled_messages.add(message_id) - - for message_id, arg in disable_args: - if arg in arg_dict and arg_dict[arg]: - enabled_messages.discard(message_id) - - checker = MacroChecker(enabled_messages) - - if args.dump_entities: - with open('entities.json', 'w', encoding='utf-8') as f: - f.write(checker.getEntityJson()) - exit(0) - - if args.file: - files = [str(Path(f).resolve()) for f in args.file] - else: - files = ALL_DOCS - - for fn in files: - checker.processFile(fn) - - if args.html: - printer = HTMLPrinter(args.html) - else: - printer = ConsolePrinter() - - if args.file: - printer.output("Only checked specified files.") - for f in args.file: - printer.output(f) - else: - printer.output("Checked all chapters and extensions.") - - if args.warning_error: - numErrors = checker.numDiagnostics() - else: - numErrors = checker.numErrors() - - check_includes = args.include_warn - check_broken = not args.file - - if args.file and check_includes: - print('Note: forcing --include_warn off because only checking supplied files.') - check_includes = False - - printer.outputResults(checker, broken_links=(not args.file), - missing_includes=check_includes) - - if check_broken: - numErrors += len(checker.getBrokenLinks()) - - if args.file and args.include_error: - print('Note: forcing --include_error off because only checking supplied files.') - args.include_error = False - if args.include_error: - numErrors += len(checker.getMissingUnreferencedApiIncludes()) - - printer.close() - - if args.broken_error and not args.file: - numErrors += len(checker.getBrokenLinks()) - - if checker.hasFixes(): - fixFn = 'applyfixes.sh' - print('Saving shell script to apply fixes as {}'.format(fixFn)) - with open(fixFn, 'w', encoding='utf-8') as f: - f.write('#!/bin/sh -e\n') - for fileChecker in checker.files: - wroteComment = False - for msg in fileChecker.messages: - if msg.fix is not None: - if not wroteComment: - f.write('\n# {}\n'.format(fileChecker.filename)) - wroteComment = True - search, replace = msg.fix - f.write( - r"sed -i -r 's~\b{}\b~{}~g' {}".format(re.escape(search), replace, fileChecker.filename)) - f.write('\n') - - print('Total number of errors with this run: {}'.format(numErrors)) - - if args.ignore_count: - if numErrors > args.ignore_count: - # Exit with non-zero error code so that we "fail" CI, etc. - print('Exceeded specified limit of {}, so exiting with error'.format( - args.ignore_count)) - exit(1) - else: - print('At or below specified limit of {}, so exiting with success'.format( - args.ignore_count)) - exit(0) - - if numErrors: - # Exit with non-zero error code so that we "fail" CI, etc. - print('Exiting with error') - exit(1) - else: - print('Exiting with success') - exit(0) + checkerMain(default_enabled_messages, makeMacroChecker, + all_docs) diff --git a/xml/spec_tools/__init__.py b/xml/spec_tools/__init__.py new file mode 100644 index 00000000..07490c2e --- /dev/null +++ b/xml/spec_tools/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/python3 -i +# +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik diff --git a/xml/spec_tools/base_printer.py b/xml/spec_tools/base_printer.py new file mode 100644 index 00000000..6c1557ee --- /dev/null +++ b/xml/spec_tools/base_printer.py @@ -0,0 +1,172 @@ +"""Provides the BasePrinter base class for MacroChecker/Message output techniques.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +from abc import ABC, abstractmethod +from pathlib import Path + +from .macro_checker import MacroChecker +from .macro_checker_file import MacroCheckerFile +from .shared import EntityData, Message, MessageContext, MessageType + + +def getColumn(message_context): + """Return the (zero-based) column number of the message context. + + If a group is specified: returns the column of the start of the group. + If no group, but a match is specified: returns the column of the start of the match. + If no match: returns column 0 (whole line). + """ + if not message_context.match: + # whole line + return 0 + if message_context.group is not None: + return message_context.match.start(message_context.group) + return message_context.match.start() + + +class BasePrinter(ABC): + """Base class for a way of outputting results of a checker execution.""" + + def __init__(self): + """Constructor.""" + self.cwd = None + + def close(self): + """Write the tail end of the output and close it, if applicable. + + Override if you want to print a summary or are writing to a file. + """ + pass + + ### + # Output methods: these should all print/output directly. + def output(self, obj): + """Output any object. + + Delegates to other output* methods, if type known, + otherwise uses self.outputFallback(). + """ + if isinstance(obj, Message): + self.outputMessage(obj) + elif isinstance(obj, MacroCheckerFile): + self.outputCheckerFile(obj) + elif isinstance(obj, MacroChecker): + self.outputChecker(obj) + else: + self.outputFallback(self.formatBrief(obj)) + + @abstractmethod + def outputResults(self, checker, broken_links=True, + missing_includes=False): + """Output the full results of a checker run. + + Must be implemented. Typically will call self.output() + on the MacroChecker, as well as possibly outputting + broken links (if broken_links==True) + and missing includes (if missing_includes==True). + """ + raise NotImplementedError + + def outputChecker(self, checker): + """Output the contents of a MacroChecker object. + + Default implementation calls self.output() on every MacroCheckerFile. + """ + for f in checker.files: + self.output(f) + + def outputCheckerFile(self, fileChecker): + """Output the contents of a MacroCheckerFile object. + + Default implementation calls self.output() on every Message. + """ + for m in fileChecker.messages: + self.output(m) + + @abstractmethod + def outputMessage(self, msg): + """Output a Message. + + Must be implemented. + """ + raise NotImplementedError + + @abstractmethod + def outputFallback(self, msg): + """Output some text in a general way. + + Must be implemented. + """ + raise NotImplementedError + + ### + # Format methods: these should all return a string. + def formatContext(self, context, message_type=None): + """Format a message context in a verbose way, if applicable. + + May override, default implementation delegates to self.formatContextBrief(). + """ + return self.formatContextBrief(context) + + def formatContextBrief(self, context, with_color=True): + """Format a message context in a brief way. + + May override, default is relativeFilename:line:column + """ + return '{}:{}:{}'.format(self.getRelativeFilename(context.filename), + context.lineNum, getColumn(context)) + + def formatMessageTypeBrief(self, message_type, with_color=True): + """Format a message type in a brief way. + + May override, default is message_type: + """ + return '{}:'.format(message_type) + + def formatEntityBrief(self, entity_data, with_color=True): + """Format an entity in a brief way. + + May override, default is macro:entity. + """ + return '{}:{}'.format(entity_data.macro, entity_data.entity) + + def formatBrief(self, obj, with_color=True): + """Format any object in a brief way. + + Delegates to other format*Brief methods, if known, + otherwise uses str(). + """ + if isinstance(obj, MessageContext): + return self.formatContextBrief(obj, with_color) + if isinstance(obj, MessageType): + return self.formatMessageTypeBrief(obj, with_color) + if isinstance(obj, EntityData): + return self.formatEntityBrief(obj, with_color) + return str(obj) + + ### + # Helper function + def getRelativeFilename(self, fn): + """Return the given filename relative to the current directory, if possible.""" + if not self.cwd: + # lazy init this member. + self.cwd = Path('.').resolve() + try: + return str(Path(fn).relative_to(self.cwd)) + except ValueError: + return str(Path(fn)) diff --git a/xml/spec_tools/console_printer.py b/xml/spec_tools/console_printer.py new file mode 100644 index 00000000..99fd0fba --- /dev/null +++ b/xml/spec_tools/console_printer.py @@ -0,0 +1,265 @@ +"""Defines ConsolePrinter, a BasePrinter subclass for appealing console output.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +from pathlib import Path +from sys import exit, stdout + +from .base_printer import BasePrinter +from .shared import (colored, getHighlightedRange, getInterestedRange, + toNameAndLine) + +try: + from tabulate import tabulate_impl + HAVE_TABULATE = True +except ImportError: + HAVE_TABULATE = False + + +def colWidth(collection, columnNum): + """Compute the required width of a column in a collection of row-tuples.""" + MIN_PADDING = 5 + return MIN_PADDING + max([len(row[columnNum]) for row in collection]) + + +def alternateTabulate(collection, headers=None): + """Minimal re-implementation of the tabulate module.""" + if headers is None: + fullTable = collection + else: + underline = ['-' * len(header) for header in headers] + fullTable = [headers, underline] + collection + widths = [colWidth(collection, colNum) + for colNum in range(len(fullTable[0]))] + widths[-1] = None + + lines = [] + for row in fullTable: + fields = [] + for data, width in zip(row, widths): + if width: + spaces = ' ' * (width - len(data)) + fields.append(data + spaces) + else: + fields.append(data) + lines.append(''.join(fields)) + return '\n'.join(lines) + + +def printTabulated(collection, headers=None): + """Call either tabulate.tabulate(), or our internal alternateTabulate().""" + if HAVE_TABULATE: + print(tabulate_impl(collection, headers=headers)) + else: + print(alternateTabulate(collection, headers=headers)) + + +def printLineSubsetWithHighlighting( + line, start, end, highlightStart=None, highlightEnd=None, maxLen=120, replacement=None): + """Print a (potential subset of a) line, with highlighting/underline and optional replacement. + + Will print at least the characters line[start:end], and potentially more if possible + to do so without making the output too wide. + Will highlight (underline) line[highlightStart:highlightEnd], where the default + value for highlightStart is simply start, and the default value for highlightEnd is simply end. + Replacment, if supplied, will be aligned with the highlighted range. + + Output is intended to look like part of a Clang compile error/warning message. + """ + # Fill in missing start/end with start/end of range. + if highlightStart is None: + highlightStart = start + if highlightEnd is None: + highlightEnd = end + + # Expand interested range start/end. + start = min(start, highlightStart) + end = max(end, highlightEnd) + + tildeLength = highlightEnd - highlightStart - 1 + caretLoc = highlightStart + continuation = '[...]' + + if len(line) > maxLen: + # Too long + + # the max is to handle -1 from .find() (which indicates "not found") + followingSpaceIndex = max(end, line.find(' ', min(len(line), end + 1))) + + # Maximum length has decreased by at least + # the length of a single continuation we absolutely need. + maxLen -= len(continuation) + + if followingSpaceIndex <= maxLen: + # We can grab the whole beginning of the line, + # and not adjust caretLoc + line = line[:maxLen] + continuation + + elif (len(line) - followingSpaceIndex) < 5: + # We need to truncate the beginning, + # but we're close to the end of line. + newBeginning = len(line) - maxLen + + caretLoc += len(continuation) + caretLoc -= newBeginning + line = continuation + line[newBeginning:] + else: + # Need to truncate the beginning of the string too. + newEnd = followingSpaceIndex + + # Now we need two continuations + # (and to adjust caret to the right accordingly) + maxLen -= len(continuation) + caretLoc += len(continuation) + + newBeginning = newEnd - maxLen + caretLoc -= newBeginning + + line = continuation + line[newBeginning:newEnd] + continuation + print(line) + + spaces = ' ' * caretLoc + tildes = '~' * tildeLength + print(spaces + colored('^' + tildes, 'green')) + if replacement is not None: + print(spaces + colored(replacement, 'green')) + + +class ConsolePrinter(BasePrinter): + """Implementation of BasePrinter for generating diagnostic reports in colored, helpful console output.""" + + ### + # Output methods: these all print directly. + def outputResults(self, checker, broken_links=True, + missing_includes=False): + """Output the full results of a checker run. + + Includes the diagnostics, broken links (if desired), + and missing includes (if desired). + """ + self.output(checker) + if broken_links: + broken = checker.getBrokenLinks() + if len(broken) > 0: + self.outputBrokenLinks(checker, broken) + if missing_includes: + missing = checker.getMissingUnreferencedApiIncludes() + if len(missing) > 0: + self.outputMissingIncludes(checker, missing) + + def outputBrokenLinks(self, checker, broken): + """Output a table of broken links. + + Called by self.outputResults(). + """ + print('Missing API includes that are referenced by a linking macro: these result in broken links in the spec!') + + def makeRowOfBroken(entity, uses): + fn = checker.findEntity(entity).filename + anchor = '[[{}]]'.format(entity) + locations = ', '.join([toNameAndLine(context, root_path=checker.root_path) + for context in uses]) + return (fn, anchor, locations) + printTabulated(sorted([makeRowOfBroken(entity, uses) + for entity, uses in broken.items()]), + headers=['Include File', 'Anchor in lieu of include', 'Links to this entity']) + + def outputMissingIncludes(self, checker, missing): + """Output a table of missing includes. + + Called by self.outputResults(). + """ + print( + 'Missing, but unreferenced, API includes/anchors - potentially not-documented entities:') + + def makeRowOfMissing(entity): + fn = checker.findEntity(entity).filename + anchor = '[[{}]]'.format(entity) + return (fn, anchor) + printTabulated(sorted([makeRowOfMissing(entity) for entity in missing]), + headers=['Include File', 'Anchor in lieu of include']) + + def outputMessage(self, msg): + """Output a Message, with highlighted range and replacement, if appropriate.""" + highlightStart, highlightEnd = getHighlightedRange(msg.context) + + if '\n' in msg.context.filename: + # This is a multi-line string "filename". + # Extra blank line and delimiter line for readability: + print() + print('--------------------------------------------------------------------') + + fileAndLine = colored('{}:'.format( + self.formatBrief(msg.context)), attrs=['bold']) + + headingSize = len('{context}: {mtype}: '.format( + context=self.formatBrief(msg.context), + mtype=self.formatBrief(msg.message_type, False))) + indent = ' ' * headingSize + printedHeading = False + + lines = msg.message[:] + if msg.see_also is not None and len(msg.see_also) != 0: + lines.append('See also:') + for see in msg.see_also: + lines.append(' {}'.format(self.formatBrief(see))) + + if msg.fix is not None: + lines.append('Note: Auto-fix available') + + for line in msg.message: + if not printedHeading: + scriptloc = '' + if msg.script_location: + scriptloc = ', ' + msg.script_location + print('{fileLine} {mtype} {msg} (-{arg}{loc})'.format( + fileLine=fileAndLine, mtype=msg.message_type.formattedWithColon(), + msg=colored(line, attrs=['bold']), arg=msg.message_id.enable_arg(), loc=scriptloc)) + printedHeading = True + else: + print(colored(indent + line, attrs=['bold'])) + + if len(msg.message) > 1: + # extra blank line after multiline message + print('') + start, end = getInterestedRange(msg.context) + printLineSubsetWithHighlighting( + msg.context.line, + start, end, + highlightStart, highlightEnd, + replacement=msg.replacement) + + def outputFallback(self, obj): + """Output by calling print.""" + print(obj) + + ### + # Format methods: these all return a string. + def formatFilename(self, fn, with_color=True): + """Format a local filename, as a relative path if possible.""" + return self.getRelativeFilename(fn) + + def formatMessageTypeBrief(self, message_type, with_color=True): + """Format a message type briefly, applying color if desired and possible. + + Delegates to the superclass if not formatting with color. + """ + if with_color: + return message_type.formattedWithColon() + else: + return super(ConsolePrinter, self).formatMessageTypeBrief( + message_type, with_color) diff --git a/xml/spec_tools/entity_db.py b/xml/spec_tools/entity_db.py new file mode 100644 index 00000000..3bfd906c --- /dev/null +++ b/xml/spec_tools/entity_db.py @@ -0,0 +1,541 @@ +"""Provides EntityDatabase, a class that keeps track of spec-defined entities and associated macros.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +from abc import ABC, abstractmethod +from collections import namedtuple + +from .shared import (CATEGORIES_WITH_VALIDITY, EXTENSION_CATEGORY, + NON_EXISTENT_MACROS, EntityData) + + +def _entityToDict(data): + return { + 'macro': data.macro, + 'filename': data.filename, + 'category': data.category, + 'directory': data.directory + } + + +class EntityDatabase(ABC): + """Parsed and processed information from the registry XML. + + Must be subclasses for each specific API. + """ + + ### + # Methods that must be implemented in subclasses. + ### + @abstractmethod + def makeRegistry(self): + """Return a Registry object that has already had loadFile() and parseTree() called. + + Called only once during construction. + """ + raise NotImplementedError + + @abstractmethod + def getNamePrefix(self): + """Return the (two-letter) prefix of all entity names for this API. + + Called only once during construction. + """ + raise NotImplementedError + + @abstractmethod + def getPlatformRequires(self): + """Return the 'requires' string associated with external/platform definitions. + + This is the string found in the requires attribute of the XML for entities that + are externally defined in a platform include file, like the question marks in: + + + + In Vulkan, this is 'vk_platform'. + + Called only once during construction. + """ + raise NotImplementedError + + ### + # Methods that it is optional to **override** + ### + def getSystemTypes(self): + """Return an enumerable of strings that name system types. + + System types use the macro `code`, and they do not generate API/validity includes. + + Called only once during construction. + """ + return [] + + def populateMacros(self): + """Perform API-specific calls, if any, to self.addMacro() and self.addMacros(). + + It is recommended to implement/override this and call + self.addMacros(..., ..., [..., "flags"]), + since the base implementation, in _basicPopulateMacros(), + does not add any macros as pertaining to the category "flags". + + Called only once during construction. + """ + pass + + def populateEntities(self): + """Perform API-specific calls, if any, to self.addEntity().""" + pass + + def getEntitiesWithoutValidity(self): + """Return an enumerable of entity names that do not generate validity includes.""" + return [self.mixed_case_name_prefix + + x for x in ['BaseInStructure', 'BaseOutStructure']] + + ### + # Methods that it is optional to **extend** + ### + def handleType(self, name, info, requires): + """Add entities, if appropriate, for an item in registry.typedict. + + Called at construction for every name, info in registry.typedict.items() + not immediately skipped, + to perform the correct associated addEntity() call, if applicable. + The contents of the requires attribute, if any, is passed in requires. + + May be extended by API-specific code to handle some cases preferentially, + then calling the super implementation to handle the rest. + """ + if requires == self.platform_requires: + # Ah, no, don't skip this, it's just in the platform header file. + # TODO are these code or basetype? + self.addEntity(name, 'code', elem=info.elem, generates=False) + return + + protect = info.elem.get('protect') + if protect: + self.addEntity(protect, 'dlink', + category='configdefines', generates=False) + + cat = info.elem.get('category') + if cat == 'struct': + self.addEntity(name, 'slink', elem=info.elem) + + elif cat == 'union': + # TODO: is this right? + self.addEntity(name, 'slink', elem=info.elem) + + elif cat == 'enum': + self.addEntity( + name, 'elink', elem=info.elem) + + elif cat == 'handle': + self.addEntity(name, 'slink', elem=info.elem, + category='handles') + + elif cat == 'bitmask': + self.addEntity( + name, 'tlink', elem=info.elem, category='flags') + + elif cat == 'basetype': + self.addEntity(name, 'basetype', + elem=info.elem) + + elif cat == 'define': + self.addEntity(name, 'dlink', elem=info.elem) + + elif cat == 'funcpointer': + self.addEntity(name, 'tlink', elem=info.elem) + + elif cat == 'include': + # skip + return + + elif cat is None: + self.addEntity(name, 'code', elem=info.elem, generates=False) + + else: + raise RuntimeError('unrecognized category {}'.format(cat)) + + def handleCommand(self, name, info): + """Add entities, if appropriate, for an item in registry.cmddict. + + Called at construction for every name, info in registry.cmddict.items(). + Calls self.addEntity() accordingly. + """ + self.addEntity(name, 'flink', elem=info.elem, + category='commands', directory='protos') + + def handleExtension(self, name, info): + """Add entities, if appropriate, for an item in registry.extdict. + + Called at construction for every name, info in registry.extdict.items(). + Calls self.addEntity() accordingly. + """ + # Only get the protect strings and name from extensions + + self.addEntity(name, None, category=EXTENSION_CATEGORY, + generates=False) + protect = info.elem.get('protect') + if protect: + self.addEntity(protect, 'dlink', category='configdefines') + + def handleEnumValue(self, name, info): + """Add entities, if appropriate, for an item in registry.enumdict. + + Called at construction for every name, info in registry.enumdict.items(). + Calls self.addEntity() accordingly. + """ + self.addEntity(name, 'ename', elem=info.elem, + category='enumvalues', generates=False) + + ### + # END of methods intended to be implemented, overridden, or extended in child classes! + ### + + ### + # Accessors + ### + def findMacroAndEntity(self, macro, entity): + """Look up EntityData by macro and entity pair.""" + return self._byMacroAndEntity.get((macro, entity)) + + def findEntity(self, entity): + """Look up EntityData by entity name (case-sensitive).""" + return self._byEntity.get(entity) + + def findEntityCaseInsensitive(self, entity): + """Look up EntityData by entity name (case-insensitive).""" + return self._byLowercaseEntity.get(entity.lower()) + + def getMemberElems(self, commandOrStruct): + """Given a command or struct name, retrieve the ETree elements for each member/param. + + Returns None if the entity is not found or doesn't have members/params. + """ + data = self.findEntity(commandOrStruct) + + if not data: + return None + if data.macro == 'slink': + tag = 'member' + else: + tag = 'param' + return data.elem.findall('.//{}'.format(tag)) + + def getMemberNames(self, commandOrStruct): + """Given a command or struct name, retrieve the names of each member/param. + + Returns an empty list if the entity is not found or doesn't have members/params. + """ + members = self.getMemberElems(commandOrStruct) + if not members: + return [] + ret = [] + for member in members: + name_tag = member.find('name') + if name_tag: + ret.append(name_tag.text) + return ret + + def getEntityJson(self): + """Dump the internal entity dictionary to JSON for debugging.""" + import json + d = {entity: _entityToDict(data) + for entity, data in self._byEntity.items()} + return json.dumps(d, sort_keys=True, indent=4) + + def entityHasValidity(self, entity): + """Estimate if we expect to see a validity include for an entity name. + + Returns None if the entity name is not known, + otherwise a boolean: True if a validity include is expected. + + Related to ValidityGenerator.isStructAlwaysValid. + """ + data = self.findEntity(entity) + if not data: + return None + + if entity in self.entities_without_validity: + return False + + if data.category == 'protos': + # All protos have validity + return True + + if data.category not in CATEGORIES_WITH_VALIDITY: + return False + + # Handle structs here. + members = self.getMemberElems(entity) + if not members: + return None + for member in members: + + if member.find('name').text in ['next', 'type']: + return True + + if member.find('type').text in ['void', 'char']: + return True + + if member.get('noautovalidity'): + # Not generating validity for this member, skip it + continue + + if member.get('len'): + # Array + return True + + typetail = member.find('type').tail + if typetail and '*' in typetail: + # Pointer + return True + + if member.get('category') in [ + 'handle', 'enum', 'bitmask'] == 'type': + return True + + if member.get('category') in ['struct', 'union'] and self.entityHasValidity( + member.find('type').text): + # struct or union member - recurse + return True + + # Got this far - no validity needed + return False + + def likelyRecognizedEntity(self, entity_name): + """Guess (based on name prefix alone) if an entity is likely to be recognized.""" + return entity_name.lower().startswith(self.name_prefix) + + def isLinkedMacro(self, macro): + """Identify if a macro is considered a "linked" macro.""" + return macro in self._linkedMacros + + def isValidMacro(self, macro): + """Identify if a macro is known and valid.""" + if macro not in self._categoriesByMacro: + return False + + return macro not in NON_EXISTENT_MACROS + + def getCategoriesForMacro(self, macro): + """Identify the categories associated with a (known, valid) macro.""" + if macro in self._categoriesByMacro: + return self._categoriesByMacro[macro] + return None + + @property + def macros(self): + """Return the collection of all known entity-related markup macros.""" + return self._categoriesByMacro.keys() + + ### + # Methods only used during initial setup/population of this data structure + ### + def addMacro(self, macro, categories, link=False): + """Add a single markup macro to the collection of categories by macro. + + Also adds the macro to the set of linked macros if link=True. + + If a macro has already been supplied to a call, later calls for that macro have no effect. + """ + if macro in self._categoriesByMacro: + return + self._categoriesByMacro[macro] = categories + if link: + self._linkedMacros.add(macro) + + def addMacros(self, letter, macroTypes, categories): + """Add markup macros associated with a leading letter to the collection of categories by macro. + + Also, those macros created using 'link' in macroTypes will also be added to the set of linked macros. + + Basically automates a number of calls to addMacro(). + """ + for macroType in macroTypes: + macro = letter + macroType + self.addMacro(macro, categories, link=(macroType == 'link')) + + def addEntity(self, entityName, macro, category=None, elem=None, + generates=True, directory=None, filename=None): + """Add an entity (command, structure type, enum, enum value, etc) in the database. + + If an entityName has already been supplied to a call, later calls for that entityName have no effect. + + Arguments: + entityName -- the name of the entity. + macro -- the macro (without the trailing colon) that should be used to refer to this entity. + + Optional keyword arguments: + category -- If not manually specified, looked up based on the macro. + elem -- The ETree element associated with the entity in the registry XML. + generates -- Indicates whether this entity generates api and validity include files. + Defaults to True. + directory -- The directory that include files (under api/ and validity/) are generated in. + If not specified (and generates is True), the default is the same as the category, + which is almost always correct. + filename -- The relative filename (under api/ or validity/) where includes are generated for this. + This only matters if generates is True (default). If not specified and generates is True, + one will be generated based on directory and entityName. + """ + if entityName in self._byEntity: + # skip if already recorded. + return + + # Look up category based on the macro, if category isn't specified. + if category is None: + category = self._categoriesByMacro.get(macro)[0] + + # If directory isn't specified and this entity generates, + # the directory is the same as the category. + if directory is None and generates: + directory = category + + # Don't generate a filename if this entity doesn't generate includes. + if filename is None and generates: + filename = '{}/{}.txt'.format(directory, entityName) + + data = EntityData( + entity=entityName, + macro=macro, + elem=elem, + filename=filename, + category=category, + directory=directory + ) + if entityName.lower() not in self._byLowercaseEntity: + self._byLowercaseEntity[entityName.lower()] = [] + + self._byEntity[entityName] = data + self._byLowercaseEntity[entityName.lower()].append(data) + self._byMacroAndEntity[(macro, entityName)] = data + if generates and filename is not None: + self.generatingEntities[entityName] = data + + def __init__(self): + """Constructor: Do not extend or override. + + Changing the behavior of other parts of this logic should be done by + implementing, extending, or overriding (as documented): + + - Implement makeRegistry() + - Implement getNamePrefix() + - Implement getPlatformRequires() + - Override getSystemTypes() + - Override populateMacros() + - Override populateEntities() + - Extend handleType() + - Extend handleCommand() + - Extend handleExtension() + - Extend handleEnumValue() + """ + # Internal data that we don't want consumers of the class touching for fear of + # breaking invariants + self._byEntity = {} + self._byLowercaseEntity = {} + self._byMacroAndEntity = {} + self._categoriesByMacro = {} + self._linkedMacros = set() + + # Entities that get a generated/api/category/entity.txt file. + self.generatingEntities = {} + + # Name prefix members + self.name_prefix = self.getNamePrefix().lower() + self.mixed_case_name_prefix = self.name_prefix[:1].upper( + ) + self.name_prefix[1:] + # Regex string for the name prefix that is case-insensitive. + self.case_insensitive_name_prefix_pattern = ''.join( + ['[{}{}]'.format(c.upper(), c) for c in self.name_prefix]) + + registry = self.makeRegistry() + self.platform_requires = self.getPlatformRequires() + + # Note: Default impl requires self.mixed_case_name_prefix + self.entities_without_validity = set(self.getEntitiesWithoutValidity()) + + # TODO: Where should flags actually go? Not mentioned in the style guide. + # TODO: What about flag wildcards? There are a few such uses... + + # Abstract method: subclass must implement to define macros for flags + self.populateMacros() + + # Now, do default macro population + self._basicPopulateMacros() + + # Abstract method: subclass must implement to add any "not from the registry" (and not system type) + # entities + self.populateEntities() + + # Now, do default entity population + self._basicPopulateEntities(registry) + + ### + # Methods only used internally during initial setup/population of this data structure + ### + + def _basicPopulateMacros(self): + """Contains calls to self.addMacro() and self.addMacros(). + + If you need to change any of these, do so in your override of populateMacros(), + which will be called first. + """ + self.addMacro('basetype', ['basetypes']) + self.addMacro('code', ['code']) + self.addMacros('f', ['link', 'name', 'text'], ['protos']) + self.addMacros('s', ['link', 'name', 'text'], ['structs', 'handles']) + self.addMacros('e', ['link', 'name', 'text'], ['enums']) + self.addMacros('p', ['name', 'text'], ['parameter', 'member']) + self.addMacros('t', ['link', 'name'], ['funcpointers']) + self.addMacros('d', ['link', 'name'], ['defines', 'configdefines']) + + for macro in NON_EXISTENT_MACROS: + # Still search for them + self.addMacro(macro, None) + + def _basicPopulateEntities(self, registry): + """Contains typical calls to self.addEntity(). + + If you need to change any of these, do so in your override of populateEntities(), + which will be called first. + """ + system_types = set(self.getSystemTypes()) + for t in system_types: + self.addEntity(t, 'code', generates=False) + + for name, info in registry.typedict.items(): + if name in system_types: + # We already added these. + continue + + requires = info.elem.get('requires') + + if requires and not requires.lower().startswith(self.name_prefix): + # This is an externally-defined type, will skip it. + continue + + # OK, we might actually add an entity here + self.handleType(name=name, info=info, requires=requires) + + for name, info in registry.enumdict.items(): + self.handleEnumValue(name, info) + + for name, info in registry.cmddict.items(): + self.handleCommand(name, info) + + for name, info in registry.extdict.items(): + self.handleExtension(name, info) diff --git a/xml/spec_tools/html_printer.py b/xml/spec_tools/html_printer.py new file mode 100644 index 00000000..cffd4baa --- /dev/null +++ b/xml/spec_tools/html_printer.py @@ -0,0 +1,454 @@ +"""Defines HTMLPrinter, a BasePrinter subclass for a single-page HTML results file.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +import html +import re +from collections import namedtuple + +from .base_printer import BasePrinter, getColumn +from .shared import (MessageContext, MessageType, generateInclude, + getHighlightedRange) + +# Bootstrap styles (for constructing CSS class names) associated with MessageType values. +MESSAGE_TYPE_STYLES = { + MessageType.ERROR: 'danger', + MessageType.WARNING: 'warning', + MessageType.NOTE: 'secondary' +} + + +# HTML Entity for a little emoji-icon associated with MessageType values. +MESSAGE_TYPE_ICONS = { + MessageType.ERROR: '⊗', # makeIcon('times-circle'), + MessageType.WARNING: '⚠', # makeIcon('exclamation-triangle'), + MessageType.NOTE: 'ℹ' # makeIcon('info-circle') +} + +LINK_ICON = '🔗' # link icon + + +class HTMLPrinter(BasePrinter): + """Implementation of BasePrinter for generating diagnostic reports in HTML format. + + Generates a single file containing neatly-formatted messages. + + The HTML file loads Bootstrap 4 as well as 'prism' syntax highlighting from CDN. + """ + + def __init__(self, filename): + """Construct by opening the file.""" + self.f = open(filename, 'w', encoding='utf-8') + self.f.write(""" + + + + + + + + + check_spec_links results + + +
+

check_spec_links.py Scan Results

+ """) + # + self.filenameTransformer = re.compile(r'[^\w]+') + self.fileRange = {} + self.fileLines = {} + self.backLink = namedtuple( + 'BackLink', ['lineNum', 'col', 'end_col', 'target', 'tooltip', 'message_type']) + self.fileBackLinks = {} + + self.nextAnchor = 0 + + def close(self): + """Write the tail end of the file and close it.""" + self.f.write(""" +
+ + + + + + + + + + + """) + self.f.close() + + ### + # Output methods: these all write to the HTML file. + def outputResults(self, checker, broken_links=True, + missing_includes=False): + """Output the full results of a checker run. + + Includes the diagnostics, broken links (if desired), + missing includes (if desired), and excerpts of all files with diagnostics. + """ + self.output(checker) + if broken_links: + broken = checker.getBrokenLinks() + if len(broken) > 0: + self.outputBrokenLinks(checker, broken) + if missing_includes: + missing = checker.getMissingUnreferencedApiIncludes() + if len(missing) > 0: + self.outputMissingIncludes(checker, missing) + + self.f.write(""" +
+

Excerpts of referenced files

""") + for fn in self.fileRange: + self.outputFileExcerpt(fn) + self.f.write('
\n') + + def outputChecker(self, checker): + """Output the contents of a MacroChecker object. + + Starts and ends the accordion populated by outputCheckerFile(). + """ + self.f.write( + '

Per-File Warnings and Errors

\n') + self.f.write('
\n') + super(HTMLPrinter, self).outputChecker(checker) + self.f.write("""
+
\n""") + + def outputCheckerFile(self, fileChecker): + """Output the contents of a MacroCheckerFile object. + + Stashes the lines of the file for later excerpts, + and outputs any diagnostics in an accordion card. + """ + # Save lines for later + self.fileLines[fileChecker.filename] = fileChecker.lines + + if not fileChecker.numDiagnostics(): + return + + self.f.write(""" +
+
+
+
+ +
+ """.format(id=self.makeIdentifierFromFilename(fileChecker.filename), relativefn=html.escape(self.getRelativeFilename(fileChecker.filename)))) + self.f.write('
') + warnings = fileChecker.numMessagesOfType(MessageType.WARNING) + if warnings > 0: + self.f.write(""" + {icon} + {num} warnings""".format(num=warnings, icon=MESSAGE_TYPE_ICONS[MessageType.WARNING])) + self.f.write('
\n
') + errors = fileChecker.numMessagesOfType(MessageType.ERROR) + if errors > 0: + self.f.write(""" + {icon} + {num} errors""".format(num=errors, icon=MESSAGE_TYPE_ICONS[MessageType.ERROR])) + self.f.write(""" +
+
+
+
+
+ """.format( + linkicon=LINK_ICON, + id=self.makeIdentifierFromFilename(fileChecker.filename), fn=html.escape(fileChecker.filename))) + super(HTMLPrinter, self).outputCheckerFile(fileChecker) + + self.f.write(""" +
+
+
+ + """.format(id=self.makeIdentifierFromFilename(fileChecker.filename))) + + def outputMessage(self, msg): + """Output a Message.""" + anchor = self.getUniqueAnchor() + + self.recordUsage(msg.context, + linkBackTarget=anchor, + linkBackTooltip='{}: {} [...]'.format( + msg.message_type, msg.message[0]), + linkBackType=msg.message_type) + + self.f.write(""" +
+
+
{icon} {t} Line {lineNum}, Column {col} (-{arg})
+

+ """.format( + anchor=anchor, + icon=MESSAGE_TYPE_ICONS[msg.message_type], + style=MESSAGE_TYPE_STYLES[msg.message_type], + t=self.formatBrief(msg.message_type), + lineNum=msg.context.lineNum, + col=getColumn(msg.context), + arg=msg.message_id.enable_arg())) + self.f.write(self.formatContext(msg.context)) + self.f.write('
') + for line in msg.message: + self.f.write(html.escape(line)) + self.f.write('
\n') + self.f.write('

\n') + if msg.see_also is not None and len(msg.see_also) != 0: + self.f.write('

See also:

    \n') + for see in msg.see_also: + if isinstance(see, MessageContext): + self.f.write( + '
  • {}
  • \n'.format(self.formatContext(see))) + self.recordUsage(see, + linkBackTarget=anchor, + linkBackType=MessageType.NOTE, + linkBackTooltip='see-also associated with {} at {}'.format(msg.message_type, self.formatContextBrief(see))) + else: + self.f.write('
  • {}
  • \n'.format(self.formatBrief(see))) + self.f.write('
') + if msg.replacement is not None: + self.f.write( + '
Hover the highlight text to view suggested replacement.
') + if msg.fix is not None: + self.f.write( + '
Note: Auto-fix available.
') + if msg.script_location: + self.f.write( + '

Message originated at {}

'.format(msg.script_location)) + self.f.write('
'.format(
+            msg.context.lineNum))
+        highlightStart, highlightEnd = getHighlightedRange(msg.context)
+        self.f.write(html.escape(msg.context.line[:highlightStart]))
+        self.f.write(
+            '')
+        self.f.write(html.escape(
+            msg.context.line[highlightStart:highlightEnd]))
+        self.f.write('')
+        self.f.write(html.escape(msg.context.line[highlightEnd:]))
+        self.f.write('
') + + def outputBrokenLinks(self, checker, broken): + """Output a table of broken links. + + Called by self.outputResults(). + """ + self.f.write(""" +
+

Missing Referenced API Includes

+

Items here have been referenced by a linking macro, so these are all broken links in the spec!

+ + + + + + """) + + for entity in sorted(broken): + uses = broken[entity] + category = checker.findEntity(entity).category + anchor = self.getUniqueAnchor() + asciidocAnchor = '[[{}]]'.format(entity) + include = generateInclude(dir_traverse='../../generated/', + generated_type='api', + category=category, + entity=entity) + self.f.write(""" + + + + """) + self.f.write("""
Add line to include this fileor add this macro insteadLinks to this entity
{}{}
    + """.format(anchor, include, asciidocAnchor)) + for context in uses: + self.f.write( + '
  • {}
  • '.format(self.formatContext(context, MessageType.NOTE))) + self.recordUsage( + context, + linkBackTooltip='Link broken in spec: {} not seen'.format( + include), + linkBackTarget=anchor, + linkBackType=MessageType.NOTE) + self.f.write("""
""") + + def outputMissingIncludes(self, checker, missing): + """Output a table of missing includes. + + Called by self.outputResults(). + """ + self.f.write(""" +
+

Missing Unreferenced API Includes

+

These items are expected to be generated in the spec build process, but aren't included. + However, as they also are not referenced by any linking macros, they aren't broken links - at worst they are undocumented entities, + at best they are errors in check_spec_links.py logic computing which entities get generated files.

+ + + + + """) + + for entity in sorted(missing): + fn = checker.findEntity(entity).filename + anchor = '[[{}]]'.format(entity) + self.f.write(""" + + + + """.format(filename=fn, anchor=anchor)) + self.f.write("""
Add line to include this fileor add this macro instead
{filename}{anchor}
""") + + def outputFileExcerpt(self, filename): + """Output a card containing an excerpt of a file, sufficient to show locations of all diagnostics plus some context. + + Called by self.outputResults(). + """ + self.f.write("""
+
+
+
+ """.format(id=self.makeIdentifierFromFilename(filename), fn=self.getRelativeFilename(filename))) + lines = self.fileLines[filename] + r = self.fileRange[filename] + self.f.write("""
""".format(
+            id=self.makeIdentifierFromFilename(filename),
+            start=r.start))
+        for lineNum, line in enumerate(
+                lines[(r.start - 1):(r.stop - 1)], r.start):
+            # self.f.write(line)
+            lineLinks = [x for x in self.fileBackLinks[filename]
+                         if x.lineNum == lineNum]
+            for col, char in enumerate(line):
+                colLinks = [x for x in lineLinks if x.col == col]
+                for link in colLinks:
+                    # TODO right now the syntax highlighting is interfering with the link! so the link-generation is commented out,
+                    # only generating the emoji icon.
+
+                    # self.f.write('{icon}'.format(
+                    # target=link.target, title=html.escape(link.tooltip),
+                    # icon=MESSAGE_TYPE_ICONS[link.message_type]))
+                    self.f.write(MESSAGE_TYPE_ICONS[link.message_type])
+                    self.f.write('Cross reference: {t} {title}'.format(
+                        title=html.escape(link.tooltip, False), t=link.message_type))
+
+                    # self.f.write('')
+
+                # Write the actual character
+                self.f.write(html.escape(char))
+            self.f.write('\n')
+
+        self.f.write('
') + self.f.write('
\n') + self.f.write('
\n') + + def outputFallback(self, obj): + """Output some text in a general way.""" + self.f.write(obj) + + ### + # Format method: return a string. + def formatContext(self, context, message_type=None): + """Format a message context in a verbose way.""" + if message_type is None: + icon = LINK_ICON + else: + icon = MESSAGE_TYPE_ICONS[message_type] + return 'In context: {icon}{relative}:{lineNum}:{col}'.format( + href=self.getAnchorLinkForContext(context), + icon=icon, + id=self.makeIdentifierFromFilename(context.filename), + relative=self.getRelativeFilename(context.filename), + lineNum=context.lineNum, + col=getColumn(context)) + + ### + # Internal methods: not mandated by parent class. + def recordUsage(self, context, linkBackTooltip=None, + linkBackTarget=None, linkBackType=MessageType.NOTE): + """Internally record a 'usage' of something. + + Increases the range of lines that are included in the excerpts, + and records back-links if appropriate. + """ + BEFORE_CONTEXT = 6 + AFTER_CONTEXT = 3 + # Clamp because we need accurate start line number to make line number + # display right + start = max(1, context.lineNum - BEFORE_CONTEXT) + stop = context.lineNum + AFTER_CONTEXT + 1 + if context.filename not in self.fileRange: + self.fileRange[context.filename] = range(start, stop) + self.fileBackLinks[context.filename] = [] + else: + oldRange = self.fileRange[context.filename] + self.fileRange[context.filename] = range( + min(start, oldRange.start), max(stop, oldRange.stop)) + + if linkBackTarget is not None: + start_col, end_col = getHighlightedRange(context) + self.fileBackLinks[context.filename].append(self.backLink( + lineNum=context.lineNum, col=start_col, end_col=end_col, + target=linkBackTarget, tooltip=linkBackTooltip, + message_type=linkBackType)) + + def makeIdentifierFromFilename(self, fn): + """Compute an acceptable HTML anchor name from a filename.""" + return self.filenameTransformer.sub('_', self.getRelativeFilename(fn)) + + def getAnchorLinkForContext(self, context): + """Compute the anchor link to the excerpt for a MessageContext.""" + return '#excerpt-{}.{}'.format( + self.makeIdentifierFromFilename(context.filename), context.lineNum) + + def getUniqueAnchor(self): + """Create and return a new unique string usable as a link anchor.""" + anchor = 'anchor-{}'.format(self.nextAnchor) + self.nextAnchor += 1 + return anchor diff --git a/xml/spec_tools/macro_checker.py b/xml/spec_tools/macro_checker.py new file mode 100644 index 00000000..8f8a478c --- /dev/null +++ b/xml/spec_tools/macro_checker.py @@ -0,0 +1,234 @@ +"""Provides the MacroChecker class.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +from io import StringIO +import re + +from .entity_db import EntityDatabase +from .shared import EXTENSION_CATEGORY + + +class MacroChecker(object): + """Perform and track checking of one or more files in an API spec. + + This does not necessarily need to be subclassed per-API: it is sufficiently + parameterized in the constructor for expected usage. + """ + + def __init__(self, enabled_messages, entity_db, + macro_checker_file_type, root_path): + """Construct an object that tracks checking one or more files in an API spec. + + enabled_messages -- a set of MessageId that should be enabled. + entity_db -- an object of a EntityDatabase subclass for this API. + macro_checker_file_type -- Type to instantiate to create the right + MacroCheckerFile subclass for this API. + root_path -- A Path object for the root of this repository. + """ + self.enabled_messages = enabled_messages + self.entity_db = entity_db + self.macro_checker_file_type = macro_checker_file_type + self.root_path = root_path + + self.files = [] + + self.refpages = set() + + # keys: entity names. values: MessageContext + self.links = {} + self.apiIncludes = {} + self.validityIncludes = {} + self.headings = {} + + # Regexes that are members because they depend on the name prefix. + + # apiPrefix, followed by some word characters or * as many times as desired, + # NOT followed by >> and NOT preceded by one of the characters in that first character class. + # (which distinguish "names being used somewhere other than prose"). + self.suspected_missing_macro_re = re.compile( + r'\b(?{}[\w*]+)\b(?!>>)'.format( + self.entity_db.case_insensitive_name_prefix_pattern) + ) + self.heading_command_re = re.compile( + r'=+ (?P{}[\w]+)'.format(self.entity_db.name_prefix) + ) + + macros_pattern = '|'.join([re.escape(macro) + for macro in self.entity_db.macros]) + # the "formatting" group is to strip matching */**/_/__ + # surrounding an entire macro. + self.macro_re = re.compile( + r'(?P\**|_*)(?P{}):(?P[\w*]+((?P[\[][^\]]*[\]]))?)(?P=formatting)'.format(macros_pattern)) + + def haveLinkTarget(self, entity): + """Report if we have parsed an API include (or heading) for an entity. + + None if there is no entity with that name. + """ + if not self.findEntity(entity): + return None + if entity in self.apiIncludes: + return True + return entity in self.headings + + def hasFixes(self): + """Report if any files have auto-fixes.""" + for f in self.files: + if f.hasFixes(): + return True + return False + + def addLinkToEntity(self, entity, context): + """Record seeing a link to an entity's docs from a context.""" + if entity not in self.links: + self.links[entity] = [] + self.links[entity].append(context) + + def seenRefPage(self, entity): + """Check if a ref-page markup block has been seen for an entity.""" + return entity in self.refpages + + def addRefPage(self, entity): + """Record seeing a ref-page markup block for an entity.""" + self.refpages.add(entity) + + def findMacroAndEntity(self, macro, entity): + """Look up EntityData by macro and entity pair. + + Forwards to the EntityDatabase. + """ + return self.entity_db.findMacroAndEntity(macro, entity) + + def findEntity(self, entity): + """Look up EntityData by entity name (case-sensitive). + + Forwards to the EntityDatabase. + """ + return self.entity_db.findEntity(entity) + + def findEntityCaseInsensitive(self, entity): + """Look up EntityData by entity name (case-insensitive). + + Forwards to the EntityDatabase. + """ + return self.entity_db.findEntityCaseInsensitive(entity) + + def getMemberNames(self, commandOrStruct): + """Given a command or struct name, retrieve the names of each member/param. + + Returns an empty list if the entity is not found or doesn't have members/params. + + Forwards to the EntityDatabase. + """ + return self.entity_db.getMemberNames(commandOrStruct) + + def likelyRecognizedEntity(self, entity_name): + """Guess (based on name prefix alone) if an entity is likely to be recognized. + + Forwards to the EntityDatabase. + """ + return self.entity_db.likelyRecognizedEntity(entity_name) + + def isLinkedMacro(self, macro): + """Identify if a macro is considered a "linked" macro. + + Forwards to the EntityDatabase. + """ + return self.entity_db.isLinkedMacro(macro) + + def processFile(self, filename): + """Parse an .adoc file belonging to the spec and check it for errors.""" + class FileStreamMaker(object): + def __init__(self, filename): + self.filename = filename + + def make_stream(self): + return open(self.filename, 'r', encoding='utf-8') + + f = self.macro_checker_file_type(self, filename, self.enabled_messages, + FileStreamMaker(filename)) + f.process() + self.files.append(f) + + def processString(self, s): + """Process a string as if it were a spec file. + + Used for testing purposes. + """ + if "\n" in s.rstrip(): + # remove leading spaces from each line to allow easier + # block-quoting in tests + s = "\n".join([line.lstrip() for line in s.split("\n")]) + # fabricate a "filename" that will display better. + filename = "string{}\n****START OF STRING****\n{}\n****END OF STRING****\n".format( + len(self.files), s.rstrip()) + + else: + filename = "string{}: {}".format( + len(self.files), s.rstrip()) + + class StringStreamMaker(object): + def __init__(self, string): + self.string = string + + def make_stream(self): + return StringIO(self.string) + + f = self.macro_checker_file_type(self, filename, self.enabled_messages, + StringStreamMaker(s)) + f.process() + self.files.append(f) + return f + + def numDiagnostics(self): + """Return the total number of diagnostics (warnings and errors) over all the files processed.""" + return sum([f.numDiagnostics() for f in self.files]) + + def numErrors(self): + """Return the total number of errors over all the files processed.""" + return sum([f.numErrors() for f in self.files]) + + def getMissingUnreferencedApiIncludes(self): + """Return the unreferenced entity names that we expected to see an API include or link target for, but did not. + + Counterpart to getBrokenLinks(): This method returns the entity names + that were not used in a linking macro (and thus wouldn't create a broken link), + but were nevertheless expected and not seen. + """ + return [entity for entity, _ in self.entity_db.generatingEntities.items() + if (not self.haveLinkTarget(entity)) and entity not in self.links] + + def getBrokenLinks(self): + """Return the entity names and usage contexts that we expected to see an API include or link target for, but did not. + + Counterpart to getMissingUnreferencedApiIncludes(): This method returns only the + entity names that were used in a linking macro (and thus create a broken link), + but were not seen. The values of the dictionary are a list of MessageContext objects + for each linking macro usage for this entity name. + """ + return {entity: contexts for entity, contexts in self.links.items() + if entity in self.entity_db.generatingEntities and not self.haveLinkTarget(entity)} + + def getMissingRefPages(self): + """Return a list of entities that we expected, but did not see, a ref page block for. + + The heuristics here are rather crude: we expect a ref page for every generating entry. + """ + missing = sorted([entity for entity, _ in self.entity_db.generatingEntities.items() + if entity not in self.refpages]) + return missing diff --git a/xml/spec_tools/macro_checker_file.py b/xml/spec_tools/macro_checker_file.py new file mode 100644 index 00000000..d60382e4 --- /dev/null +++ b/xml/spec_tools/macro_checker_file.py @@ -0,0 +1,1574 @@ +"""Provides MacroCheckerFile, a subclassable type that validates a single file in the spec.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +import logging +import re +from collections import OrderedDict, namedtuple +from enum import Enum +from inspect import currentframe, getframeinfo + +from .shared import (AUTO_FIX_STRING, CATEGORIES_WITH_VALIDITY, + EXTENSION_CATEGORY, NON_EXISTENT_MACROS, EntityData, + Message, MessageContext, MessageId, MessageType, + generateInclude, toNameAndLine) + +# Code blocks may start and end with any number of ---- +CODE_BLOCK_DELIM = '----' + +# Mostly for ref page blocks, but also used elsewhere? +REF_PAGE_LIKE_BLOCK_DELIM = '--' + +# For insets/blocks like the implicit valid usage +# TODO think it must start with this - does it have to be exactly this? +BOX_BLOCK_DELIM = '****' + + +INTERNAL_PLACEHOLDER = re.compile( + r'(?P__+)([a-zA-Z]+)(?P=delim)' +) + +# Matches a generated (api or validity) include line. +INCLUDE = re.compile( + r'include::(?P((../){1,4}|\{INCS-VAR\}/)(generated/)?)(?P[\w]+)/(?P\w+)/(?P[^./]+).txt[[][]]') + +# Matches an [[AnchorLikeThis]] +ANCHOR = re.compile(r'\[\[(?P[^\]]+)\]\]') + +# Looks for flink:foo:: or slink::foo:: at the end of string: +# used to detect explicit pname context. +PRECEDING_MEMBER_REFERENCE = re.compile( + r'\b(?P[fs](text|link)):(?P[\w*]+)::$') + +# Matches something like slink:foo::pname:bar as well as +# the under-marked-up slink:foo::bar. +MEMBER_REFERENCE = re.compile( + r'\b(?P(?P[fs](text|link)):(?P[\w*]+))(?P::)(?P(?Ppname:?)(?P[\w]+))\b' +) + +# Matches if a string ends while a link is still "open". +# (first half of a link being broken across two lines, +# or containing our interested area when matched against the text preceding). +# Used to skip checking in some places. +OPEN_LINK = re.compile( + r'.*(?]*$' +) + +# Matches if a string begins and is followed by a link "close" without a matching open. +# (second half of a link being broken across two lines) +# Used to skip checking in some places. +CLOSE_LINK = re.compile( + r'[^<]*>>.*$' +) + +# Matches if a line should be skipped without further considering. +# At the moment, just matches ifdef: and endif: +SKIP_LINE = re.compile( + r'^(ifdef:)|(endif:).*' +) + +# Matches the whole inside of a refpage tag. +BRACKETS = re.compile(r'\[(?P.*)\]') + +# Matches a key='value' pair from a ref page tag. +REF_PAGE_ATTRIB = re.compile( + r"(?P[a-z]+)='(?P[^'\\]*(?:\\.[^'\\]*)*)'") + + +class Attrib(Enum): + """Attributes of a ref page.""" + + REFPAGE = 'refpage' + DESC = 'desc' + TYPE = 'type' + XREFS = 'xrefs' + + +VALID_REF_PAGE_ATTRIBS = set( + [e.value for e in Attrib]) + +AttribData = namedtuple('AttribData', ['match', 'key', 'value']) + + +def makeAttribFromMatch(match): + """Turn a match of REF_PAGE_ATTRIB into an AttribData value.""" + return AttribData(match=match, key=match.group( + 'key'), value=match.group('value')) + + +def parseRefPageAttribs(line): + """Parse a ref page tag into a dictionary of attribute_name: AttribData.""" + return {m.group('key'): makeAttribFromMatch(m) + for m in REF_PAGE_ATTRIB.finditer(line)} + + +def regenerateIncludeFromMatch(match, generated_type): + """Create an include directive from an INCLUDE match and a (new or replacement) generated_type.""" + return generateInclude( + match.group('directory_traverse'), + generated_type, + match.group('category'), + match.group('entity_name')) + + +BlockEntry = namedtuple( + 'BlockEntry', ['delimiter', 'context', 'block_type', 'refpage']) + + +class BlockType(Enum): + """Enumeration of the various distinct block types known.""" + CODE = 'code' + REF_PAGE_LIKE = 'ref-page-like' # with or without a ref page tag before + BOX = 'box' + + @classmethod + def lineToBlockType(self, line): + """Return a BlockType if the given line is a block delimiter. + + Returns None otherwise. + """ + if line == REF_PAGE_LIKE_BLOCK_DELIM: + return BlockType.REF_PAGE_LIKE + elif line.startswith(CODE_BLOCK_DELIM): + return BlockType.CODE + elif line.startswith(BOX_BLOCK_DELIM): + return BlockType.BOX + else: + return None + + +def _pluralize(word, num): + if num == 1: + return word + if word.endswith('y'): + return word[:-1] + 'ies' + return word + 's' + + +def _s_suffix(num): + """Simplify pluralization.""" + if num > 1: + return 's' + return '' + + +def shouldEntityBeText(entity, subscript): + """Determine if an entity name appears to use placeholders, wildcards, etc. and thus merits use of a *text macro. + + Call with the entity and subscript groups from a match of MacroChecker.macro_re. + """ + entity_only = entity + if subscript: + if subscript == '[]' or subscript == '[i]' or subscript.startswith( + '[_') or subscript.endswith('_]'): + return True + entity_only = entity[:-len(subscript)] + + if ('*' in entity) or entity.startswith('_') or entity_only.endswith('_'): + return True + + if INTERNAL_PLACEHOLDER.search(entity): + return True + return False + + +class MacroCheckerFile(object): + """Object performing processing of a single AsciiDoctor file from a specification. + + For testing purposes, may also process a string as if it were a file. + """ + + def __init__(self, checker, filename, enabled_messages, stream_maker): + """Construct a MacroCheckerFile object. + + Typically called by MacroChecker.processFile or MacroChecker.processString(). + + Arguments: + checker -- A MacroChecker object. + filename -- A string to use in messages to refer to this checker, typically the file name. + enabled_messages -- A set() of MessageId values that should be considered "enabled" and thus stored. + stream_maker -- An object with a makeStream() method that returns a stream. + """ + self.checker = checker + self.filename = filename + self.stream_maker = stream_maker + self.enabled_messages = enabled_messages + self.missing_validity_suppressions = set( + self.getMissingValiditySuppressions()) + + self.logger = logging.getLogger(__name__) + self.logger.addHandler(logging.NullHandler()) + + self.fixes = set() + self.messages = [] + + self.pname_data = None + self.pname_mentions = {} + + self.refpage_includes = {} + + self.lines = [] + + # For both of these: + # keys: entity name + # values: MessageContext + self.fs_api_includes = {} + self.validity_includes = {} + + self.in_code_block = False + self.in_ref_page = False + self.prev_line_ref_page_tag = None + self.current_ref_page = None + + # Stack of block-starting delimiters. + self.block_stack = [] + + # Regexes that are members because they depend on the name prefix. + self.suspected_missing_macro_re = self.checker.suspected_missing_macro_re + self.heading_command_re = self.checker.heading_command_re + + ### + # Main process/checking methods, arranged roughly from largest scope to smallest scope. + ### + + def process(self): + """Check the stream (file, string) created by the streammaker supplied to the constructor. + + This is the top-level method for checking a spec file. + """ + self.logger.info("processing file %s", self.filename) + + # File content checks - performed line-by-line + with self.stream_maker.make_stream() as f: + # Iterate through lines, calling processLine on each. + for lineIndex, line in enumerate(f): + trimmedLine = line.rstrip() + self.lines.append(trimmedLine) + self.processLine(lineIndex + 1, trimmedLine) + + # End of file checks follow: + + # Check "state" at end of file: should have blocks closed. + if self.prev_line_ref_page_tag: + self.error(MessageId.REFPAGE_BLOCK, + "Reference page tag seen, but block not opened before end of file.", + context=self.storeMessageContext(match=None)) + + if self.block_stack: + locations = [x.context for x in self.block_stack] + formatted_locations = ['{} opened at {}'.format(x.delimiter, self.getBriefLocation(x.context)) + for x in self.block_stack] + self.logger.warn("Unclosed blocks: %s", + ', '.join(formatted_locations)) + + self.error(MessageId.UNCLOSED_BLOCK, + ["Reached end of page, with these unclosed blocks remaining:"] + + formatted_locations, + context=self.storeMessageContext(match=None), + see_also=locations) + + # Check that every include of an /api/ file in the protos or structs category + # had a matching /validity/ include + for entity, includeContext in self.fs_api_includes.items(): + if not self.checker.entity_db.entityHasValidity(entity): + continue + + if entity in self.missing_validity_suppressions: + continue + + if entity not in self.validity_includes: + self.warning(MessageId.MISSING_VALIDITY_INCLUDE, + ['Saw /api/ include for {}, but no matching /validity/ include'.format(entity), + 'Expected a line with ' + regenerateIncludeFromMatch(includeContext.match, 'validity')], + context=includeContext) + + # Check that we never include a /validity/ file + # without a matching /api/ include + for entity, includeContext in self.validity_includes.items(): + if entity not in self.fs_api_includes: + self.error(MessageId.MISSING_API_INCLUDE, + ['Saw /validity/ include for {}, but no matching /api/ include'.format(entity), + 'Expected a line with ' + regenerateIncludeFromMatch(includeContext.match, 'api')], + context=includeContext) + + if not self.numDiagnostics(): + # no problems, exit quietly + return + + print('\nFor file {}:'.format(self.filename)) + + self.printMessageCounts() + numFixes = len(self.fixes) + if numFixes > 0: + fixes = ', '.join(['{} -> {}'.format(search, replace) + for search, replace in self.fixes]) + + print('{} unique auto-fix {} recorded: {}'.format(numFixes, + _pluralize('pattern', numFixes), fixes)) + + def processLine(self, lineNum, line): + """Check the contents of a single line from a file. + + Eventually populates self.match, self.entity, self.macro, + before calling processMatch. + """ + self.lineNum = lineNum + self.line = line + self.match = None + self.entity = None + self.macro = None + + self.logger.debug("processing line %d", lineNum) + + if self.processPossibleBlockDelimiter(): + # This is a block delimiter - proceed to next line. + # Block-type-specific stuff goes in processBlockOpen and processBlockClosed. + return + + if self.in_code_block: + # We do no processing in a code block. + return + + ### + # Detect if the previous line was [open,...] starting a refpage + # but this line isn't -- + # If the line is some other block delimiter, + # the related code in self.processPossibleBlockDelimiter() + # would have handled it. + # (because execution would never get to here for that line) + if self.prev_line_ref_page_tag: + self.handleExpectedRefpageBlock() + + ### + # Detect headings + if line.startswith('=='): + # Headings cause us to clear our pname_context + self.pname_data = None + + command = self.heading_command_re.match(line) + if command: + data = self.checker.findEntity(command) + if data: + self.pname_data = data + return + + ### + # Detect [open, lines for manpages + if line.startswith('[open,'): + self.checkRefPage() + return + + ### + # Skip comments + if line.lstrip().startswith('//'): + return + + ### + # Skip ifdef/endif + if SKIP_LINE.match(line): + return + + ### + # Detect include:::....[] lines + match = INCLUDE.match(line) + if match: + self.match = match + entity = match.group('entity_name') + + data = self.checker.findEntity(entity) + if not data: + self.error(MessageId.UNKNOWN_INCLUDE, + 'Saw include for {}, but that entity is unknown.'.format(entity)) + self.pname_data = None + return + + self.pname_data = data + + if match.group('generated_type') == 'api': + self.recordInclude(self.checker.apiIncludes) + + # Set mentions to None. The first time we see something like `* pname:paramHere`, + # we will set it to an empty set + self.pname_mentions[entity] = None + + if match.group('category') in CATEGORIES_WITH_VALIDITY: + self.fs_api_includes[entity] = self.storeMessageContext() + + if entity in self.validity_includes: + name_and_line = toNameAndLine( + self.validity_includes[entity], root_path=self.checker.root_path) + self.error(MessageId.API_VALIDITY_ORDER, + ['/api/ include found for {} after a corresponding /validity/ include'.format(entity), + 'Validity include located at {}'.format(name_and_line)]) + + elif match.group('generated_type') == 'validity': + self.recordInclude(self.checker.validityIncludes) + self.validity_includes[entity] = self.storeMessageContext() + + if entity not in self.pname_mentions: + self.error(MessageId.API_VALIDITY_ORDER, + '/validity/ include found for {} without a preceding /api/ include'.format(entity)) + return + + if self.pname_mentions[entity] is not None: + # Got a validity include and we have seen at least one * pname: line + # since we got the API include + # so we can warn if we haven't seen a reference to every + # parameter/member. + members = self.checker.getMemberNames(entity) + missing = [member for member in members + if member not in self.pname_mentions[entity]] + if len(missing) > 0: + self.error(MessageId.UNDOCUMENTED_MEMBER, + ['Validity include found for {}, but not all members/params apparently documented'.format(entity), + 'Members/params not mentioned with pname: {}'.format(', '.join(missing))]) + + # If we found an include line, we're done with this line. + return + + if self.pname_data is not None and '* pname:' in line: + context_entity = self.pname_data.entity + if self.pname_mentions[context_entity] is None: + # First time seeting * pname: after an api include, prepare the set that + # tracks + self.pname_mentions[context_entity] = set() + + ### + # Detect [[Entity]] anchors + for match in ANCHOR.finditer(line): + entity = match.group('entity_name') + if self.checker.findEntity(entity): + # We found an anchor with the same name as an entity: + # treat it (mostly) like an API include + self.match = match + self.recordInclude(self.checker.apiIncludes, + generated_type='api (manual anchor)') + + ### + # Detect :: without pname + for match in MEMBER_REFERENCE.finditer(line): + if not match.group('member_macro'): + self.match = match + # Got :: but not followed by pname + + search = match.group() + replacement = match.group( + 'first_part') + '::pname:' + match.group('second_part') + self.error(MessageId.MEMBER_PNAME_MISSING, + 'Found a function parameter or struct member reference with :: but missing pname:', + group='double_colons', + replacement='::pname:', + fix=(search, replacement)) + + # check pname here because it won't come up in normal iteration below + # because of the missing macro + self.entity = match.group('entity_name') + self.checkPname(match.group('scope')) + + ### + # Look for things that seem like a missing macro. + for match in self.suspected_missing_macro_re.finditer(line): + if OPEN_LINK.match(line, endpos=match.start()): + # this is in a link, skip it. + continue + if CLOSE_LINK.match(line[match.end():]): + # this is in a link, skip it. + continue + + entity = match.group('entity_name') + self.match = match + self.entity = entity + data = self.checker.findEntity(entity) + if data: + + if data.category == EXTENSION_CATEGORY: + # Ah, this is an extension + self.warning(MessageId.EXTENSION, "Seems like this is an extension name that was not linked.", + group='entity_name', replacement=self.makeExtensionLink()) + else: + self.warning(MessageId.MISSING_MACRO, + ['Seems like a "{}" macro was omitted for this reference to a known entity in category "{}".'.format(data.macro, data.category), + 'Wrap in ` ` to silence this if you do not want a verified macro here.'], + group='entity_name', + replacement=self.makeMacroMarkup(data.macro)) + else: + + dataArray = self.checker.findEntityCaseInsensitive(entity) + # We might have found the goof... + + if dataArray: + if len(dataArray) == 1: + # Yep, found the goof: + # incorrect macro and entity capitalization + data = dataArray[0] + if data.category == EXTENSION_CATEGORY: + # Ah, this is an extension + self.warning(MessageId.EXTENSION, + "Seems like this is an extension name that was not linked.", + group='entity_name', replacement=self.makeExtensionLink(data.entity)) + else: + self.warning(MessageId.MISSING_MACRO, + 'Seems like a macro was omitted for this reference to a known entity in category "{}", found by searching case-insensitively.'.format( + data.category), + replacement=self.makeMacroMarkup(data=data)) + + else: + # Ugh, more than one resolution + + self.warning(MessageId.MISSING_MACRO, + ['Seems like a macro was omitted for this reference to a known entity, found by searching case-insensitively.', + 'More than one apparent match.'], + group='entity_name', see_also=dataArray[:]) + + ### + # Main operations: detect markup macros + for match in self.checker.macro_re.finditer(line): + self.match = match + self.macro = match.group('macro') + self.entity = match.group('entity_name') + self.subscript = match.group('subscript') + self.processMatch() + + def processPossibleBlockDelimiter(self): + """Look at the current line, and if it's a delimiter, update the block stack. + + Calls self.processBlockDelimiter() as required. + + Returns True if a delimiter was processed, False otherwise. + """ + line = self.line + new_block_type = BlockType.lineToBlockType(line) + if not new_block_type: + return False + + ### + # Detect if the previous line was [open,...] starting a refpage + # but this line is some block delimiter other than -- + # Must do this here because if we get a different block open instead of the one we want, + # the order of block opening will be wrong. + if new_block_type != BlockType.REF_PAGE_LIKE and self.prev_line_ref_page_tag: + self.handleExpectedRefpageBlock() + + # Delegate to the main process for delimiters. + self.processBlockDelimiter(line, new_block_type) + + return True + + def processBlockDelimiter(self, line, new_block_type, context=None): + """Update the block stack based on the current or supplied line. + + Calls self.processBlockOpen() or self.processBlockClosed() as required. + + Called by self.processPossibleBlockDelimiter() both in normal operation, as well as + when "faking" a ref page block open. + + Returns BlockProcessResult. + """ + if not context: + context = self.storeMessageContext() + + location = self.getBriefLocation(context) + + top = self.getInnermostBlockEntry() + top_delim = self.getInnermostBlockDelimiter() + if top_delim == line: + self.processBlockClosed() + return + + if top and top.block_type == new_block_type: + # Same block type, but not matching - might be an error? + # TODO maybe create a diagnostic here? + self.logger.warn( + "processPossibleBlockDelimiter: %s: Matched delimiter type %s, but did not exactly match current delim %s to top of stack %s, may be a typo?", + location, new_block_type, line, top_delim) + + # Empty stack, or top doesn't match us. + self.processBlockOpen(new_block_type, delimiter=line) + + def processBlockOpen(self, block_type, context=None, delimiter=None): + """Do any block-type-specific processing and push the new block. + + Must call self.pushBlock(). + May be overridden (carefully) or extended. + + Called by self.processBlockDelimiter(). + """ + if block_type == BlockType.REF_PAGE_LIKE: + if self.prev_line_ref_page_tag: + if self.current_ref_page: + refpage = self.current_ref_page + else: + refpage = '?refpage-with-invalid-tag?' + + self.logger.info( + 'processBlockOpen: Opening refpage for %s', refpage) + # Opening of refpage block "consumes" the preceding ref + # page context + self.prev_line_ref_page_tag = None + self.pushBlock(block_type, refpage=refpage, + context=context, delimiter=delimiter) + self.in_ref_page = True + return + + if block_type == BlockType.CODE: + self.in_code_block = True + + self.pushBlock(block_type, context=context, delimiter=delimiter) + + def processBlockClosed(self): + """Do any block-type-specific processing and pop the top block. + + Must call self.popBlock(). + May be overridden (carefully) or extended. + + Called by self.processPossibleBlockDelimiter(). + """ + old_top = self.popBlock() + + if old_top.block_type == BlockType.CODE: + self.in_code_block = False + + elif old_top.block_type == BlockType.REF_PAGE_LIKE and old_top.refpage: + self.logger.info( + 'processBlockClosed: Closing refpage for %s', old_top.refpage) + # leaving a ref page so reset associated state. + self.current_ref_page = None + self.prev_line_ref_page_tag = None + self.in_ref_page = False + + def processMatch(self): + """Process a match of the macro:entity regex for correctness.""" + match = self.match + entity = self.entity + macro = self.macro + + ### + # Track entities that we're actually linking to. + ### + if self.checker.entity_db.isLinkedMacro(macro): + self.checker.addLinkToEntity(entity, self.storeMessageContext()) + + ### + # Link everything that should be, and nothing that shouldn't be + ### + if self.checkRecognizedEntity(): + # if this returns true, + # then there is no need to do the remaining checks on this match + return + + ### + # Non-existent macros + if macro in NON_EXISTENT_MACROS: + self.error(MessageId.BAD_MACRO, '{} is not a macro provided in the specification, despite resembling other macros.'.format( + macro), group='macro') + + ### + # Wildcards (or leading underscore, or square brackets) + # if and only if a 'text' macro + self.checkText() + + # Do some validation of pname references. + if macro == 'pname': + # See if there's an immediately-preceding entity + preceding = self.line[:match.start()] + scope = PRECEDING_MEMBER_REFERENCE.search(preceding) + if scope: + # Yes there is, check it out. + self.checkPname(scope.group('entity_name')) + elif self.current_ref_page is not None: + # No, but there is a current ref page: very reliable + self.checkPnameImpliedContext(self.current_ref_page) + elif self.pname_data is not None: + # No, but there is a pname_context - better than nothing. + self.checkPnameImpliedContext(self.pname_data) + else: + # no, and no existing context we can imply: + # can't check this. + pass + + def checkRecognizedEntity(self): + """Check the current macro:entity match to see if it is recognized. + + Returns True if there is no need to perform further checks on this match. + + Helps avoid duplicate warnings/errors: typically each macro should have at most + one of this class of errors. + """ + entity = self.entity + macro = self.macro + if self.checker.findMacroAndEntity(macro, entity) is not None: + # We know this macro-entity combo + return True + + # We don't know this macro-entity combo. + possibleCats = self.checker.entity_db.getCategoriesForMacro(macro) + if possibleCats is None: + possibleCats = ['???'] + msg = ['Definition of link target {} with macro {} (used for {} {}) does not exist.'.format( + entity, + macro, + _pluralize('category', len(possibleCats)), + ', '.join(possibleCats))] + + data = self.checker.findEntity(entity) + if data: + # We found the goof: incorrect macro + msg.append('Apparently matching entity in category {} found.'.format( + data.category)) + self.handleWrongMacro(msg, data) + return True + + see_also = [] + dataArray = self.checker.findEntityCaseInsensitive(entity) + if dataArray: + # We might have found the goof... + + if len(dataArray) == 1: + # Yep, found the goof: + # incorrect macro and entity capitalization + data = dataArray[0] + msg.append('Apparently matching entity in category {} found by searching case-insensitively.'.format( + data.category)) + self.handleWrongMacro(msg, data) + return True + else: + # Ugh, more than one resolution + msg.append( + 'More than one apparent match found by searching case-insensitively, cannot auto-fix.') + see_also = dataArray[:] + + # OK, so we don't recognize this entity (and couldn't auto-fix it). + + if self.checker.isLinkedMacro(macro): + # This should be linked, which means we should know the target. + if self.checker.likelyRecognizedEntity(entity): + # Should be linked and it matches our pattern, + # so probably not wrong macro. + # Human brains required. + if not self.checkText(): + self.error(MessageId.BAD_ENTITY, msg + ['Might be a misspelling, or, less likely, the wrong macro.'], + see_also=see_also) + else: + # Doesn't match our pattern, + # so probably should be name instead of link. + newMacro = macro[0] + 'name' + if self.checker.entity_db.isValidMacro(newMacro): + self.error(MessageId.BAD_ENTITY, msg + + ['Entity name does not fit the pattern for this API, which would mean it should be a "name" macro instead of a "link" macro'], + group='macro', replacement=newMacro, fix=self.makeFix(newMacro=newMacro), see_also=see_also) + else: + self.error(MessageId.BAD_ENTITY, msg + + ['Entity name does not fit the pattern for this API, which would mean it should be a "name" macro instead of a "link" macro', + 'However, {} is not a known macro so cannot auto-fix.'.format(newMacro)], see_also=see_also) + + elif macro == 'ename': + # TODO This might be an ambiguity in the style guide - ename might be a known enumerant value, + # or it might be an enumerant value in an external library, etc. that we don't know about - so + # hard to check this. + if self.checker.likelyRecognizedEntity(entity): + if not self.checkText(): + self.warning(MessageId.BAD_ENUMERANT, msg + + ['Unrecognized ename:{} that we would expect to recognize since it fits the pattern for this API.'.format(entity)], see_also=see_also) + else: + # This is fine: + # it doesn't need to be recognized since it's not linked. + pass + # Don't skip other tests. + return False + + def checkText(self): + """Evaluate the usage (or non-usage) of a *text macro. + + Wildcards (or leading or trailing underscore, or square brackets with + nothing or a placeholder) if and only if a 'text' macro. + + Called by checkRecognizedEntity() when appropriate. + """ + macro = self.macro + entity = self.entity + shouldBeText = shouldEntityBeText(entity, self.subscript) + if shouldBeText and not self.macro.endswith( + 'text') and not self.macro == 'code': + newMacro = macro[0] + 'text' + if self.checker.entity_db.getCategoriesForMacro(newMacro): + self.error(MessageId.MISSING_TEXT, + ['Asterisk/leading or trailing underscore/bracket found - macro should end with "text:", probably {}:'.format(newMacro), + AUTO_FIX_STRING], + group='macro', replacement=newMacro, fix=self.makeFix(newMacro=newMacro)) + else: + self.error(MessageId.MISSING_TEXT, + ['Asterisk/leading or trailing underscore/bracket found, so macro should end with "text:".', + 'However {}: is not a known macro so cannot auto-fix.'.format(newMacro)], + group='macro') + return True + elif macro.endswith('text') and not shouldBeText: + msg = [ + "No asterisk/leading or trailing underscore/bracket in the entity, so this might be a mistaken use of the 'text' macro {}:".format(macro)] + data = self.checker.findEntity(entity) + if data: + # We found the goof: incorrect macro + msg.append('Apparently matching entity in category {} found.'.format( + data.category)) + msg.append(AUTO_FIX_STRING) + replacement = self.makeFix(data=data) + if data.category == EXTENSION_CATEGORY: + self.error(MessageId.EXTENSION, msg, + replacement=replacement, fix=replacement) + else: + self.error(MessageId.WRONG_MACRO, msg, + group='macro', replacement=data.macro, fix=replacement) + else: + msg.append('Entity not found in spec, either.') + if macro[0] != 'e': + # Only suggest a macro if we aren't in elink/ename/etext, + # since ename and elink are not related in an equivalent way + # to the relationship between flink and fname. + newMacro = macro[0] + 'name' + if self.checker.entity_db.getCategoriesForMacro(newMacro): + msg.append( + 'Consider if {}: might be the correct macro to use here.'.format(newMacro)) + else: + msg.append( + 'Cannot suggest a new macro because {}: is not a known macro.'.format(newMacro)) + self.warning(MessageId.MISUSED_TEXT, msg) + return True + return False + + def checkPnameImpliedContext(self, pname_context): + """Handle pname: macros not immediately preceded by something like flink:entity or slink:entity. + + Also records pname: mentions of members/parameters for completeness checking in doc blocks. + + Contains call to self.checkPname(). + Called by self.processMatch() + """ + self.checkPname(pname_context.entity) + if pname_context.entity in self.pname_mentions and \ + self.pname_mentions[pname_context.entity] is not None: + # Record this mention, + # in case we're in the documentation block. + self.pname_mentions[pname_context.entity].add(self.entity) + + def checkPname(self, pname_context): + """Check the current match (as a pname: usage) with the given entity as its 'pname context', if possible. + + e.g. slink:foo::pname:bar, pname_context would be 'foo', while self.entity would be 'bar', etc. + + Called by self.processLine(), self.processMatch(), as well as from self.checkPnameImpliedContext(). + """ + if '*' in pname_context: + # This context has a placeholder, can't verify it. + return + + entity = self.entity + + context_data = self.checker.findEntity(pname_context) + members = self.checker.getMemberNames(pname_context) + + if context_data and not members: + # This is a recognized parent entity that doesn't have detectable member names, + # skip validation + # TODO: Annotate parameters of function pointer types with + # and ? + return + if not members: + self.warning(MessageId.UNRECOGNIZED_CONTEXT, + 'pname context entity was un-recognized {}'.format(pname_context)) + return + + if entity not in members: + self.warning(MessageId.UNKNOWN_MEMBER, ["Could not find member/param named '{}' in {}".format(entity, pname_context), + 'Known {} mamber/param names are: {}'.format( + pname_context, ', '.join(members))], group='entity_name') + + def checkIncludeRefPageRelation(self, entity, generated_type): + """Identify if our current ref page (or lack thereof) is appropriate for an include just recorded. + + Called by self.recordInclude(). + """ + if not self.in_ref_page: + # Not in a ref page block: This probably means this entity needs a + # ref-page block added. + self.handleIncludeMissingRefPage(entity, generated_type) + return + + if not isinstance(self.current_ref_page, EntityData): + # This isn't a fully-valid ref page, so can't check the includes any better. + return + + ref_page_entity = self.current_ref_page.entity + if ref_page_entity not in self.refpage_includes: + self.refpage_includes[ref_page_entity] = set() + expected_ref_page_entity = self.computeExpectedRefPageFromInclude( + entity) + self.refpage_includes[ref_page_entity].add((generated_type, entity)) + + if ref_page_entity == expected_ref_page_entity: + # OK, this is a total match. + pass + elif expected_ref_page_entity.startswith(ref_page_entity): + # This appears to be a promoted synonym which is OK. + pass + else: + # OK, we are in a ref page block that doesn't match + self.handleIncludeMismatchRefPage(entity, generated_type) + + def checkRefPage(self): + """Check if the current line (a refpage tag) meets requirements. + + Called by self.processLine(). + """ + line = self.line + + # Should always be found + self.match = BRACKETS.match(line) + + data = None + directory = None + if self.in_ref_page: + msg = ["Found reference page markup, but we are already in a refpage block.", + "The block before the first message of this type is most likely not closed.", ] + # Fake-close the previous ref page, if it's trivial to do so. + if self.getInnermostBlockEntry().block_type == BlockType.REF_PAGE_LIKE: + msg.append( + "Pretending that there was a line with `--` immediately above to close that ref page, for more readable messages.") + self.processBlockDelimiter( + REF_PAGE_LIKE_BLOCK_DELIM, BlockType.REF_PAGE_LIKE) + else: + msg.append( + "Ref page wasn't the last block opened, so not pretending to auto-close it for more readable messages.") + + self.error(MessageId.REFPAGE_BLOCK, msg) + + attribs = parseRefPageAttribs(line) + + unknown_attribs = set(attribs.keys()).difference( + VALID_REF_PAGE_ATTRIBS) + if unknown_attribs: + self.error(MessageId.REFPAGE_UNKNOWN_ATTRIB, + "Found unknown attrib(s) in reference page markup: " + ','.join(unknown_attribs)) + + # Required field: refpage='xrValidEntityHere' + if Attrib.REFPAGE.value in attribs: + attrib = attribs[Attrib.REFPAGE.value] + text = attrib.value + self.entity = text + + context = self.storeMessageContext( + group='value', match=attrib.match) + if self.checker.seenRefPage(text): + self.error(MessageId.REFPAGE_DUPLICATE, + ["Found reference page markup when we already saw refpage='{}' elsewhere.".format( + text), + "This (or the other mention) may be a copy-paste error."], + context=context) + self.checker.addRefPage(text) + + data = self.checker.findEntity(text) + if data: + # OK, this is a known entity that we're seeing a refpage for. + directory = data.directory + self.current_ref_page = data + else: + # TODO suggest fixes here if applicable + self.error(MessageId.REFPAGE_NAME, + "Found reference page markup, but refpage='{}' does not refer to a recognized entity".format( + text), + context=context) + + else: + self.error(MessageId.REFPAGE_TAG, + "Found apparent reference page markup, but missing refpage='...'", + group=None) + + # Required field: desc='preferably non-empty' + if Attrib.DESC.value in attribs: + attrib = attribs[Attrib.DESC.value] + text = attrib.value + if not text: + context = self.storeMessageContext( + group=None, match=attrib.match) + self.warning(MessageId.REFPAGE_MISSING_DESC, + "Found reference page markup, but desc='' is empty", + context=context) + else: + self.error(MessageId.REFPAGE_TAG, + "Found apparent reference page markup, but missing desc='...'", + group=None) + + # Required field: type='protos' for example + # (used by genRef.py to compute the macro to use) + if Attrib.TYPE.value in attribs: + attrib = attribs[Attrib.TYPE.value] + text = attrib.value + if directory and not text == directory: + context = self.storeMessageContext( + group='value', match=attrib.match) + self.error(MessageId.REFPAGE_TYPE, + "Found reference page markup, but type='{}' is not the expected value '{}'".format( + text, directory), + context=context) + else: + self.error(MessageId.REFPAGE_TAG, + "Found apparent reference page markup, but missing type='...'", + group=None) + + # Optional field: xrefs='spaceDelimited validEntities' + if Attrib.XREFS.value in attribs: + # This field is optional + self.checkRefPageXrefs(attribs[Attrib.XREFS.value]) + self.prev_line_ref_page_tag = self.storeMessageContext() + + def checkRefPageXrefs(self, xrefs_attrib): + """Check all cross-refs indicated in an xrefs attribute for a ref page. + + Called by self.checkRefPage(). + + Argument: + xrefs_attrib -- A match of REF_PAGE_ATTRIB where the group 'key' is 'xrefs'. + """ + text = xrefs_attrib.value + context = self.storeMessageContext( + group='value', match=xrefs_attrib.match) + + def splitRefs(s): + """Split the string on whitespace, into individual references.""" + return s.split() # [x for x in s.split() if x] + + def remakeRefs(refs): + """Re-create a xrefs string from something list-shaped.""" + return ' '.join(refs) + + refs = splitRefs(text) + + # Pre-checking if messages are enabled, so that we can correctly determine + # the current string following any auto-fixes: + # the fixes for messages directly in this method would interact, + # and thus must be in the order specified here. + + if self.messageEnabled(MessageId.REFPAGE_XREFS_COMMA) and ',' in text: + old_text = text + # Re-split after replacing commas. + refs = splitRefs(text.replace(',', ' ')) + # Re-create the space-delimited text. + text = remakeRefs(refs) + self.error(MessageId.REFPAGE_XREFS_COMMA, + "Found reference page markup, with an unexpected comma in the (space-delimited) xrefs attribute", + context=context, + replacement=text, + fix=(old_text, text)) + + # We could conditionally perform this creation, but the code complexity would increase substantially, + # for presumably minimal runtime improvement. + unique_refs = OrderedDict.fromkeys(refs) + if self.messageEnabled(MessageId.REFPAGE_XREF_DUPE) and len(unique_refs) != len(refs): + # TODO is it safe to auto-fix here? + old_text = text + text = remakeRefs(unique_refs.keys()) + self.warning(MessageId.REFPAGE_XREF_DUPE, + ["Reference page for {} contains at least one duplicate in its cross-references.".format( + self.entity), + "Look carefully to see if this is a copy and paste error and should be changed to a different but related entity:", + "auto-fix simply removes the duplicate."], + context=context, + replacement=text, + fix=(old_text, text)) + + if self.messageEnabled(MessageId.REFPAGE_SELF_XREF) and self.entity and self.entity in unique_refs: + # Not modifying unique_refs here because that would accidentally affect the whitespace auto-fix. + new_text = remakeRefs( + [x for x in unique_refs.keys() if x != self.entity]) + + # DON'T AUTOFIX HERE because these are likely copy-paste between related entities: + # e.g. a Create function and the associated CreateInfo struct. + self.warning(MessageId.REFPAGE_SELF_XREF, + ["Reference page for {} included itself in its cross-references.".format(self.entity), + "This is typically a copy and paste error, and the dupe should likely be changed to a different but related entity.", + "Not auto-fixing for this reason."], + context=context, + replacement=new_text,) + + # We didn't have another reason to replace the whole attribute value, + # so let's make sure it doesn't have any extra spaces + if self.messageEnabled(MessageId.REFPAGE_WHITESPACE) and xrefs_attrib.value == text: + old_text = text + text = remakeRefs(unique_refs.keys()) + if old_text != text: + self.warning(MessageId.REFPAGE_WHITESPACE, + ["Cross-references for reference page for {} had non-minimal whitespace,".format(self.entity), + "and no other enabled message has re-constructed this value already."], + context=context, + replacement=text, + fix=(old_text, text)) + + for entity in unique_refs.keys(): + self.checkRefPageXref(entity, context) + + def checkRefPageXref(self, referenced_entity, line_context): + """Check a single cross-reference entry for a refpage. + + Called by self.checkRefPageXrefs(). + + Arguments: + referenced_entity -- The individual entity under consideration from the xrefs='...' string. + line_context -- A MessageContext referring to the entire line. + """ + data = self.checker.findEntity(referenced_entity) + if data: + # This is OK + return + context = line_context + match = re.search(r'\b{}\b'.format(referenced_entity), self.line) + if match: + context = self.storeMessageContext( + group=None, match=match) + msg = ["Found reference page markup, with an unrecognized entity listed: {}".format( + referenced_entity)] + + see_also = None + dataArray = self.checker.findEntityCaseInsensitive( + referenced_entity) + + if dataArray: + # We might have found the goof... + + if len(dataArray) == 1: + # Yep, found the goof - incorrect entity capitalization + data = dataArray[0] + new_entity = data.entity + self.error(MessageId.REFPAGE_XREFS, msg + [ + 'Apparently matching entity in category {} found by searching case-insensitively.'.format( + data.category), + AUTO_FIX_STRING], + replacement=new_entity, + fix=(referenced_entity, new_entity), + context=context) + return + + # Ugh, more than one resolution + msg.append( + 'More than one apparent match found by searching case-insensitively, cannot auto-fix.') + see_also = dataArray[:] + + # Multiple or no resolutions found + self.error(MessageId.REFPAGE_XREFS, + msg, + see_also=see_also, + context=context) + + ### + # Message-related methods. + ### + + def warning(self, message_id, messageLines, context=None, group=None, + replacement=None, fix=None, see_also=None, frame=None): + """Log a warning for the file, if the message ID is enabled. + + Wrapper around self.diag() that automatically sets severity as well as frame. + + Arguments: + message_id -- A MessageId value. + messageLines -- A string or list of strings containing a human-readable error description. + + Optional, named arguments: + context -- A MessageContext. If None, will be constructed from self.match and group. + group -- The name of the regex group in self.match that contains the problem. Only used if context is None. + If needed and is None, self.group is used instead. + replacement -- The string, if any, that should be suggested as a replacement for the group in question. + Does not create an auto-fix: sometimes we want to show a possible fix but aren't confident enough + (or can't easily phrase a regex) to do it automatically. + fix -- A (old text, new text) pair if this error is auto-fixable safely. + see_also -- An optional array of other MessageContext locations relevant to this message. + frame -- The 'inspect' stack frame corresponding to the location that raised this message. + If None, will assume it is the direct caller of self.warning(). + """ + if not frame: + frame = currentframe().f_back + self.diag(MessageType.WARNING, message_id, messageLines, group=group, + replacement=replacement, context=context, fix=fix, see_also=see_also, frame=frame) + + def error(self, message_id, messageLines, group=None, replacement=None, + context=None, fix=None, see_also=None, frame=None): + """Log an error for the file, if the message ID is enabled. + + Wrapper around self.diag() that automatically sets severity as well as frame. + + Arguments: + message_id -- A MessageId value. + messageLines -- A string or list of strings containing a human-readable error description. + + Optional, named arguments: + context -- A MessageContext. If None, will be constructed from self.match and group. + group -- The name of the regex group in self.match that contains the problem. Only used if context is None. + If needed and is None, self.group is used instead. + replacement -- The string, if any, that should be suggested as a replacement for the group in question. + Does not create an auto-fix: sometimes we want to show a possible fix but aren't confident enough + (or can't easily phrase a regex) to do it automatically. + fix -- A (old text, new text) pair if this error is auto-fixable safely. + see_also -- An optional array of other MessageContext locations relevant to this message. + frame -- The 'inspect' stack frame corresponding to the location that raised this message. + If None, will assume it is the direct caller of self.error(). + """ + if not frame: + frame = currentframe().f_back + self.diag(MessageType.ERROR, message_id, messageLines, group=group, + replacement=replacement, context=context, fix=fix, see_also=see_also, frame=frame) + + def diag(self, severity, message_id, messageLines, context=None, group=None, + replacement=None, fix=None, see_also=None, frame=None): + """Log a diagnostic for the file, if the message ID is enabled. + + Also records the auto-fix, if applicable. + + Arguments: + severity -- A MessageType value. + message_id -- A MessageId value. + messageLines -- A string or list of strings containing a human-readable error description. + + Optional, named arguments: + context -- A MessageContext. If None, will be constructed from self.match and group. + group -- The name of the regex group in self.match that contains the problem. Only used if context is None. + If needed and is None, self.group is used instead. + replacement -- The string, if any, that should be suggested as a replacement for the group in question. + Does not create an auto-fix: sometimes we want to show a possible fix but aren't confident enough + (or can't easily phrase a regex) to do it automatically. + fix -- A (old text, new text) pair if this error is auto-fixable safely. + see_also -- An optional array of other MessageContext locations relevant to this message. + frame -- The 'inspect' stack frame corresponding to the location that raised this message. + If None, will assume it is the direct caller of self.diag(). + """ + if not self.messageEnabled(message_id): + self.logger.debug( + 'Discarding a %s message because it is disabled.', message_id) + return + + if isinstance(messageLines, str): + messageLines = [messageLines] + + self.logger.info('Recording a %s message: %s', + message_id, ' '.join(messageLines)) + + # Ensure all auto-fixes are marked as such. + if fix is not None and AUTO_FIX_STRING not in messageLines: + messageLines.append(AUTO_FIX_STRING) + + if not frame: + frame = currentframe().f_back + if context is None: + message = Message(message_id=message_id, + message_type=severity, + message=messageLines, + context=self.storeMessageContext(group=group), + replacement=replacement, + see_also=see_also, + fix=fix, + frame=frame) + else: + message = Message(message_id=message_id, + message_type=severity, + message=messageLines, + context=context, + replacement=replacement, + see_also=see_also, + fix=fix, + frame=frame) + if fix is not None: + self.fixes.add(fix) + self.messages.append(message) + + def messageEnabled(self, message_id): + """Return true if the given message ID is enabled.""" + return message_id in self.enabled_messages + + ### + # Accessors for externally-interesting information + + def numDiagnostics(self): + """Count the total number of diagnostics (errors or warnings) for this file.""" + return len(self.messages) + + def numErrors(self): + """Count the total number of errors for this file.""" + return self.numMessagesOfType(MessageType.ERROR) + + def numMessagesOfType(self, message_type): + """Count the number of messages of a particular type (severity).""" + return len( + [msg for msg in self.messages if msg.message_type == message_type]) + + def hasFixes(self): + """Return True if any messages included auto-fix patterns.""" + return len(self.fixes) > 0 + + ### + # Assorted internal methods. + def printMessageCounts(self): + """Print a simple count of each MessageType of diagnostics.""" + for message_type in [MessageType.ERROR, MessageType.WARNING]: + count = self.numMessagesOfType(message_type) + if count > 0: + print('{num} {mtype}{s} generated.'.format( + num=count, mtype=message_type, s=_s_suffix(count))) + + def dumpInternals(self): + """Dump internal variables to screen, for debugging.""" + print('self.lineNum: ', self.lineNum) + print('self.line:', self.line) + print('self.prev_line_ref_page_tag: ', self.prev_line_ref_page_tag) + print('self.current_ref_page:', self.current_ref_page) + + def getMissingValiditySuppressions(self): + """Return an enumerable of entity names that we shouldn't warn about missing validity. + + May override. + """ + return [] + + def recordInclude(self, include_dict, generated_type=None): + """Store the current line as being the location of an include directive or equivalent. + + Reports duplicate include errors, as well as include/ref-page mismatch or missing ref-page, + by calling self.checkIncludeRefPageRelation() for "actual" includes (where generated_type is None). + + Arguments: + include_dict -- The include dictionary to update: one of self.apiIncludes or self.validityIncludes. + generated_type -- The type of include (e.g. 'api', 'valid', etc). By default, extracted from self.match. + """ + entity = self.match.group('entity_name') + if generated_type is None: + generated_type = self.match.group('generated_type') + + # Only checking the ref page relation if it's retrieved from regex. + # Otherwise it might be a manual anchor recorded as an include, + # etc. + self.checkIncludeRefPageRelation(entity, generated_type) + + if entity in include_dict: + self.error(MessageId.DUPLICATE_INCLUDE, + "Included {} docs for {} when they were already included.".format(generated_type, + entity), see_also=include_dict[entity]) + include_dict[entity].append(self.storeMessageContext()) + else: + include_dict[entity] = [self.storeMessageContext()] + + def getInnermostBlockEntry(self): + """Get the BlockEntry for the top block delim on our stack.""" + if not self.block_stack: + return None + return self.block_stack[-1] + + def getInnermostBlockDelimiter(self): + """Get the delimiter for the top block on our stack.""" + top = self.getInnermostBlockEntry() + if not top: + return None + return top.delimiter + + def pushBlock(self, block_type, refpage=None, context=None, delimiter=None): + """Push a new entry on the block stack.""" + if not delimiter: + self.logger.info("pushBlock: not given delimiter") + delimiter = self.line + if not context: + context = self.storeMessageContext() + + old_top_delim = self.getInnermostBlockDelimiter() + + self.block_stack.append(BlockEntry( + delimiter=delimiter, + context=context, + refpage=refpage, + block_type=block_type)) + + location = self.getBriefLocation(context) + self.logger.info( + "pushBlock: %s: Pushed %s delimiter %s, previous top was %s, now %d elements on the stack", + location, block_type.value, delimiter, old_top_delim, len(self.block_stack)) + + self.dumpBlockStack() + + def popBlock(self): + """Pop and return the top entry from the block stack.""" + old_top = self.block_stack.pop() + location = self.getBriefLocation(old_top.context) + self.logger.info( + "popBlock: %s: popping %s delimiter %s, now %d elements on the stack", + location, old_top.block_type.value, old_top.delimiter, len(self.block_stack)) + + self.dumpBlockStack() + + return old_top + + def dumpBlockStack(self): + self.logger.debug('Block stack, top first:') + for distFromTop, x in enumerate(reversed(self.block_stack)): + self.logger.debug(' - block_stack[%d]: Line %d: "%s" refpage=%s', + -1 - distFromTop, + x.context.lineNum, x.delimiter, x.refpage) + + def getBriefLocation(self, context): + """Format a context briefly - omitting the filename if it has newlines in it.""" + if '\n' in context.filename: + return 'input string line {}'.format(context.lineNum) + return '{}:{}'.format( + context.filename, context.lineNum) + + ### + # Handlers for a variety of diagnostic-meriting conditions + # + # Split out for clarity and for allowing fine-grained override on a per-project basis. + ### + + def handleIncludeMissingRefPage(self, entity, generated_type): + """Report a message about an include outside of a ref-page block.""" + msg = ["Found {} include for {} outside of a reference page block.".format(generated_type, entity), + "This is probably a missing reference page block."] + refpage = self.computeExpectedRefPageFromInclude(entity) + data = self.checker.findEntity(refpage) + if data: + msg.append('Expected ref page block might start like:') + msg.append(self.makeRefPageTag(refpage, data=data)) + else: + msg.append( + "But, expected ref page entity name {} isn't recognized...".format(refpage)) + self.warning(MessageId.REFPAGE_MISSING, msg) + + def handleIncludeMismatchRefPage(self, entity, generated_type): + """Report a message about an include not matching its containing ref-page block.""" + self.warning(MessageId.REFPAGE_MISMATCH, "Found {} include for {}, inside the reference page block of {}".format( + generated_type, entity, self.current_ref_page.entity)) + + def handleWrongMacro(self, msg, data): + """Report an appropriate message when we found that the macro used is incorrect. + + May be overridden depending on each API's behavior regarding macro misuse: + e.g. in some cases, it may be considered a MessageId.LEGACY warning rather than + a MessageId.WRONG_MACRO or MessageId.EXTENSION. + """ + message_type = MessageType.WARNING + message_id = MessageId.WRONG_MACRO + group = 'macro' + + if data.category == EXTENSION_CATEGORY: + # Ah, this is an extension + msg.append( + 'This is apparently an extension name, which should be marked up as a link.') + message_id = MessageId.EXTENSION + group = None # replace the whole thing + else: + # Non-extension, we found the macro though. + message_type = MessageType.ERROR + msg.append(AUTO_FIX_STRING) + self.diag(message_type, message_id, msg, + group=group, replacement=self.makeMacroMarkup(data=data), fix=self.makeFix(data=data)) + + def handleExpectedRefpageBlock(self): + """Handle expecting to see -- to start a refpage block, but not seeing that at all.""" + self.error(MessageId.REFPAGE_BLOCK, + ["Expected, but did not find, a line containing only -- following a reference page tag,", + "Pretending to insert one, for more readable messages."], + see_also=[self.prev_line_ref_page_tag]) + # Fake "in ref page" regardless, to avoid spurious extra errors. + self.processBlockDelimiter('--', BlockType.REF_PAGE_LIKE, + context=self.prev_line_ref_page_tag) + + ### + # Construct related values (typically named tuples) based on object state and supplied arguments. + # + # Results are typically supplied to another method call. + ### + + def storeMessageContext(self, group=None, match=None): + """Create message context from corresponding instance variables. + + Arguments: + group -- The regex group name, if any, identifying the part of the match to highlight. + match -- The regex match. If None, will use self.match. + """ + if match is None: + match = self.match + return MessageContext(filename=self.filename, + lineNum=self.lineNum, + line=self.line, + match=match, + group=group) + + def makeFix(self, newMacro=None, newEntity=None, data=None): + """Construct a fix pair for replacing the old macro:entity with new. + + Wrapper around self.makeSearch() and self.makeMacroMarkup(). + """ + return (self.makeSearch(), self.makeMacroMarkup( + newMacro, newEntity, data)) + + def makeSearch(self): + """Construct the string self.macro:self.entity, for use in the old text part of a fix pair.""" + return '{}:{}'.format(self.macro, self.entity) + + def makeMacroMarkup(self, newMacro=None, newEntity=None, data=None): + """Construct appropriate markup for referring to an entity. + + Typically constructs macro:entity, but can construct `<>` if the supplied + entity is identified as an extension. + + Arguments: + newMacro -- The macro to use. Defaults to data.macro (if available), otherwise self.macro. + newEntity -- The entity to use. Defaults to data.entity (if available), otherwise self.entity. + data -- An EntityData value corresponding to this entity. If not provided, will be looked up by newEntity. + """ + if not newEntity: + if data: + newEntity = data.entity + else: + newEntity = self.entity + if not newMacro: + if data: + newMacro = data.macro + else: + newMacro = self.macro + if not data: + data = self.checker.findEntity(newEntity) + if data and data.category == EXTENSION_CATEGORY: + return self.makeExtensionLink(newEntity) + return '{}:{}'.format(newMacro, newEntity) + + def makeExtensionLink(self, newEntity=None): + """Create a correctly-formatted link to an extension. + + Result takes the form `<>`. + + Argument: + newEntity -- The extension name to link to. Defaults to self.entity. + """ + if not newEntity: + newEntity = self.entity + return '`<<{}>>`'.format(newEntity) + + def computeExpectedRefPageFromInclude(self, entity): + """Compute the expected ref page entity based on an include entity name.""" + # No-op in general. + return entity + + def makeRefPageTag(self, entity, data=None, + ref_type=None, desc='', xrefs=[]): + """Construct a ref page tag string from attribute values.""" + if ref_type is None and data is not None: + ref_type = data.directory + if ref_type is None: + ref_type = "????" + return "[open,refpage='{}',type='{}',desc='{}',xrefs='{}']".format( + entity, ref_type, desc, ' '.join(xrefs)) diff --git a/xml/spec_tools/main.py b/xml/spec_tools/main.py new file mode 100644 index 00000000..c1c4aeff --- /dev/null +++ b/xml/spec_tools/main.py @@ -0,0 +1,247 @@ +"""Provides a re-usable command-line interface to a MacroChecker.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + + +import argparse +import logging +import re +from pathlib import Path + +from .shared import MessageId + + +def checkerMain(default_enabled_messages, make_macro_checker, + all_docs, available_messages=None): + """Perform the bulk of the work for a command-line interface to a MacroChecker. + + Arguments: + default_enabled_messages -- The MessageId values that should be enabled by default. + make_macro_checker -- A function that can be called with a set of enabled MessageId to create a + properly-configured MacroChecker. + all_docs -- A list of all spec documentation files. + available_messages -- a list of all MessageId values that can be generated for this project. + Defaults to every value. (e.g. some projects don't have MessageId.LEGACY) + """ + enabled_messages = set(default_enabled_messages) + if not available_messages: + available_messages = list(MessageId) + + disable_args = [] + enable_args = [] + + parser = argparse.ArgumentParser() + parser.add_argument( + "--verbose", + "-v", + help="Output 'info'-level development logging messages.", + action="store_true") + parser.add_argument( + "--debug", + "-d", + help="Output 'debug'-level development logging messages (more verbose than -v).", + action="store_true") + parser.add_argument( + "-Werror", + "--warning_error", + help="Make warnings act as errors, exiting with non-zero error code", + action="store_true") + parser.add_argument( + "--include_warn", + help="List all expected but unseen include files, not just those that are referenced.", + action='store_true') + parser.add_argument( + "-Wmissing_refpages", + help="List all entities with expected but unseen ref page blocks. NOT included in -Wall!", + action='store_true') + parser.add_argument( + "--include_error", + help="Make expected but unseen include files cause exiting with non-zero error code", + action='store_true') + parser.add_argument( + "--broken_error", + help="Make missing include/anchor for linked-to entities cause exiting with non-zero error code. Weaker version of --include_error.", + action='store_true') + parser.add_argument( + "--dump_entities", + help="Just dump the parsed entity data to entities.json and exit.", + action='store_true') + parser.add_argument( + "--html", + help="Output messages to the named HTML file instead of stdout.") + parser.add_argument( + "file", + help="Only check the indicated file(s). By default, all chapters and extensions are checked.", + nargs="*") + parser.add_argument( + "--ignore_count", + type=int, + help="Ignore up to the given number of errors without exiting with a non-zero error code.") + parser.add_argument("-Wall", + help="Enable all warning categories.", + action='store_true') + + for message_id in MessageId: + enable_arg = message_id.enable_arg() + enable_args.append((message_id, enable_arg)) + + disable_arg = message_id.disable_arg() + disable_args.append((message_id, disable_arg)) + if message_id in enabled_messages: + parser.add_argument('-' + disable_arg, action="store_true", + help="Disable message category {}: {}".format(str(message_id), message_id.desc())) + # Don't show the enable flag in help since it's enabled by default + parser.add_argument('-' + enable_arg, action="store_true", + help=argparse.SUPPRESS) + else: + parser.add_argument('-' + enable_arg, action="store_true", + help="Enable message category {}: {}".format(str(message_id), message_id.desc())) + # Don't show the disable flag in help since it's disabled by + # default + parser.add_argument('-' + disable_arg, action="store_true", + help=argparse.SUPPRESS) + + args = parser.parse_args() + + arg_dict = vars(args) + for message_id, arg in enable_args: + if args.Wall or (arg in arg_dict and arg_dict[arg]): + enabled_messages.add(message_id) + + for message_id, arg in disable_args: + if arg in arg_dict and arg_dict[arg]: + enabled_messages.discard(message_id) + + if args.verbose: + logging.basicConfig(level='INFO') + + if args.debug: + logging.basicConfig(level='DEBUG') + + checker = make_macro_checker(enabled_messages) + + if args.dump_entities: + with open('entities.json', 'w', encoding='utf-8') as f: + f.write(checker.getEntityJson()) + exit(0) + + if args.file: + files = [str(Path(f).resolve()) for f in args.file] + else: + files = all_docs + + for fn in files: + checker.processFile(fn) + + if args.html: + from .html_printer import HTMLPrinter + printer = HTMLPrinter(args.html) + else: + from .console_printer import ConsolePrinter + printer = ConsolePrinter() + + if args.file: + printer.output("Only checked specified files.") + for f in args.file: + printer.output(f) + else: + printer.output("Checked all chapters and extensions.") + + if args.warning_error: + numErrors = checker.numDiagnostics() + else: + numErrors = checker.numErrors() + + check_includes = args.include_warn + check_broken = not args.file + + if args.file and check_includes: + print('Note: forcing --include_warn off because only checking supplied files.') + check_includes = False + + printer.outputResults(checker, broken_links=(not args.file), + missing_includes=check_includes) + + if check_broken: + numErrors += len(checker.getBrokenLinks()) + + if args.file and args.include_error: + print('Note: forcing --include_error off because only checking supplied files.') + args.include_error = False + if args.include_error: + numErrors += len(checker.getMissingUnreferencedApiIncludes()) + + check_missing_refpages = args.Wmissing_refpages + if args.file and check_missing_refpages: + print('Note: forcing -Wmissing_refpages off because only checking supplied files.') + check_missing_refpages = False + + if check_missing_refpages: + missing = checker.getMissingRefPages() + if missing: + printer.output("Expected, but did not find, ref page blocks for the following {} entities: {}".format( + len(missing), + ', '.join(missing) + )) + if args.warning_error: + numErrors += len(missing) + + printer.close() + + if args.broken_error and not args.file: + numErrors += len(checker.getBrokenLinks()) + + if checker.hasFixes(): + fixFn = 'applyfixes.sh' + print('Saving shell script to apply fixes as {}'.format(fixFn)) + with open(fixFn, 'w', encoding='utf-8') as f: + f.write('#!/bin/sh -e\n') + for fileChecker in checker.files: + wroteComment = False + for msg in fileChecker.messages: + if msg.fix is not None: + if not wroteComment: + f.write('\n# {}\n'.format(fileChecker.filename)) + wroteComment = True + search, replace = msg.fix + f.write( + r"sed -i -r 's~\b{}\b~{}~g' {}".format( + re.escape(search), + replace, + fileChecker.filename)) + f.write('\n') + + print('Total number of errors with this run: {}'.format(numErrors)) + + if args.ignore_count: + if numErrors > args.ignore_count: + # Exit with non-zero error code so that we "fail" CI, etc. + print('Exceeded specified limit of {}, so exiting with error'.format( + args.ignore_count)) + exit(1) + else: + print('At or below specified limit of {}, so exiting with success'.format( + args.ignore_count)) + exit(0) + + if numErrors: + # Exit with non-zero error code so that we "fail" CI, etc. + print('Exiting with error') + exit(1) + else: + print('Exiting with success') + exit(0) diff --git a/xml/spec_tools/shared.py b/xml/spec_tools/shared.py new file mode 100644 index 00000000..90a83f3f --- /dev/null +++ b/xml/spec_tools/shared.py @@ -0,0 +1,285 @@ +"""Types, constants, and utility functions used by multiple sub-modules in spec_tools.""" + +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + +from collections import namedtuple +from enum import Enum +from inspect import currentframe, getframeinfo +from pathlib import Path +from sys import stdout + +# if we have termcolor and we know our stdout is a TTY, +# pull it in and use it. +if hasattr(stdout, 'isatty') and stdout.isatty(): + try: + from termcolor import colored as colored_impl + HAVE_COLOR = True + except ImportError: + HAVE_COLOR = False +else: + HAVE_COLOR = False + + +def colored(s, color=None, attrs=None): + """Call termcolor.colored with same arguments if this is a tty and it is available.""" + if HAVE_COLOR: + return colored_impl(s, color, attrs=attrs) + return s + + +### +# Constants used in multiple places. +AUTO_FIX_STRING = 'Note: Auto-fix available.' +EXTENSION_CATEGORY = 'extension' +CATEGORIES_WITH_VALIDITY = set(['protos', 'structs']) +NON_EXISTENT_MACROS = set(['plink', 'ttext', 'dtext']) + +### +# MessageContext: All the information about where a message relates to. +MessageContext = namedtuple('MessageContext', + ['filename', 'lineNum', 'line', + 'match', 'group']) + + +def getInterestedRange(message_context): + """Return a (start, end) pair of character index for the match in a MessageContext.""" + if not message_context.match: + # whole line + return (0, len(message_context.line)) + return (message_context.match.start(), message_context.match.end()) + + +def getHighlightedRange(message_context): + """Return a (start, end) pair of character index for the highlighted range in a MessageContext.""" + if message_context.group is not None and message_context.match is not None: + return (message_context.match.start(message_context.group), + message_context.match.end(message_context.group)) + # no group (whole match) or no match (whole line) + return getInterestedRange(message_context) + + +def toNameAndLine(context, root_path=None): + """Convert MessageContext into a simple filename:line string.""" + my_fn = Path(context.filename) + if root_path: + my_fn = my_fn.relative_to(root_path) + return '{}:{}'.format(str(my_fn), context.lineNum) + + +def generateInclude(dir_traverse, generated_type, category, entity): + """Create an include:: directive for geneated api or validity from the various pieces.""" + return 'include::{directory_traverse}{generated_type}/{category}/{entity_name}.txt[]'.format( + directory_traverse=dir_traverse, + generated_type=generated_type, + category=category, + entity_name=entity) + + +# Data stored per entity (function, struct, enumerant type, enumerant, extension, etc.) +EntityData = namedtuple( + 'EntityData', ['entity', 'macro', 'elem', 'filename', 'category', 'directory']) + + +class MessageType(Enum): + """Type of a message.""" + + WARNING = 1 + ERROR = 2 + NOTE = 3 + + def __str__(self): + """Format a MessageType as a lowercase string.""" + return str(self.name).lower() + + def formattedWithColon(self): + """Format a MessageType as a colored, lowercase string followed by a colon.""" + if self == MessageType.WARNING: + return colored(str(self) + ':', 'magenta', attrs=['bold']) + if self == MessageType.ERROR: + return colored(str(self) + ':', 'red', attrs=['bold']) + return str(self) + ':' + + +class MessageId(Enum): + """Enumerates the varieties of messages that can be generated. + + Control over enabled messages with -Wbla or -Wno_bla is per-MessageId. + """ + + MISSING_TEXT = 1 + LEGACY = 2 + WRONG_MACRO = 3 + MISSING_MACRO = 4 + BAD_ENTITY = 5 + BAD_ENUMERANT = 6 + BAD_MACRO = 7 + UNRECOGNIZED_CONTEXT = 8 + UNKNOWN_MEMBER = 9 + DUPLICATE_INCLUDE = 10 + UNKNOWN_INCLUDE = 11 + API_VALIDITY_ORDER = 12 + UNDOCUMENTED_MEMBER = 13 + MEMBER_PNAME_MISSING = 14 + MISSING_VALIDITY_INCLUDE = 15 + MISSING_API_INCLUDE = 16 + MISUSED_TEXT = 17 + EXTENSION = 18 + REFPAGE_TAG = 19 + REFPAGE_MISSING_DESC = 20 + REFPAGE_XREFS = 21 + REFPAGE_XREFS_COMMA = 22 + REFPAGE_TYPE = 23 + REFPAGE_NAME = 24 + REFPAGE_BLOCK = 25 + REFPAGE_MISSING = 26 + REFPAGE_MISMATCH = 27 + REFPAGE_UNKNOWN_ATTRIB = 28 + REFPAGE_SELF_XREF = 29 + REFPAGE_XREF_DUPE = 30 + REFPAGE_WHITESPACE = 31 + REFPAGE_DUPLICATE = 32 + UNCLOSED_BLOCK = 33 + + def __str__(self): + """Format as a lowercase string.""" + return self.name.lower() + + def enable_arg(self): + """Return the corresponding Wbla string to make the 'enable this message' argument.""" + return 'W{}'.format(self.name.lower()) + + def disable_arg(self): + """Return the corresponding Wno_bla string to make the 'enable this message' argument.""" + return 'Wno_{}'.format(self.name.lower()) + + def desc(self): + """Return a brief description of the MessageId suitable for use in --help.""" + if self == MessageId.MISSING_TEXT: + return "a *text: macro is expected but not found" + elif self == MessageId.LEGACY: + return "legacy usage of *name: macro when *link: is applicable" + elif self == MessageId.WRONG_MACRO: + return "wrong macro used for an entity" + elif self == MessageId.MISSING_MACRO: + return "a macro might be missing" + elif self == MessageId.BAD_ENTITY: + return "entity not recognized, etc." + elif self == MessageId.BAD_ENUMERANT: + return "unrecognized enumerant value used in ename:" + elif self == MessageId.BAD_MACRO: + return "unrecognized macro used" + elif self == MessageId.UNRECOGNIZED_CONTEXT: + return "pname used with an unrecognized context" + elif self == MessageId.UNKNOWN_MEMBER: + return "pname used but member/argument by that name not found" + elif self == MessageId.DUPLICATE_INCLUDE: + return "duplicated include line" + elif self == MessageId.UNKNOWN_INCLUDE: + return "include line specified file we wouldn't expect to exists" + elif self == MessageId.API_VALIDITY_ORDER: + return "saw API include after validity include" + elif self == MessageId.UNDOCUMENTED_MEMBER: + return "saw an apparent struct/function documentation, but missing a member" + elif self == MessageId.MEMBER_PNAME_MISSING: + return "pname: missing from a 'scope' operator" + elif self == MessageId.MISSING_VALIDITY_INCLUDE: + return "missing validity include" + elif self == MessageId.MISSING_API_INCLUDE: + return "missing API include" + elif self == MessageId.MISUSED_TEXT: + return "a *text: macro is found but not expected" + elif self == MessageId.EXTENSION: + return "an extension name is incorrectly marked" + elif self == MessageId.REFPAGE_TAG: + return "a refpage tag is missing an expected field" + elif self == MessageId.REFPAGE_MISSING_DESC: + return "a refpage tag has an empty description" + elif self == MessageId.REFPAGE_XREFS: + return "an unrecognized entity is mentioned in xrefs of a refpage tag" + elif self == MessageId.REFPAGE_XREFS_COMMA: + return "a comma was founds in xrefs of a refpage tag, which is space-delimited" + elif self == MessageId.REFPAGE_TYPE: + return "a refpage tag has an incorrect type field" + elif self == MessageId.REFPAGE_NAME: + return "a refpage tag has an unrecognized entity name in its refpage field" + elif self == MessageId.REFPAGE_BLOCK: + return "a refpage block is not correctly opened or closed." + elif self == MessageId.REFPAGE_MISSING: + return "an API include was found outside of a refpage block." + elif self == MessageId.REFPAGE_MISMATCH: + return "an API or validity include was found in a non-matching refpage block." + elif self == MessageId.REFPAGE_UNKNOWN_ATTRIB: + return "a refpage tag has an unrecognized attribute" + elif self == MessageId.REFPAGE_SELF_XREF: + return "a refpage tag has itself in the list of cross-references" + elif self == MessageId.REFPAGE_XREF_DUPE: + return "a refpage cross-references list has at least one duplicate" + elif self == MessageId.REFPAGE_WHITESPACE: + return "a refpage cross-references list has non-minimal whitespace" + elif self == MessageId.REFPAGE_DUPLICATE: + return "a refpage tag has been seen for a single entity for a second time" + elif self == MessageId.UNCLOSED_BLOCK: + return "one or more blocks remain unclosed at the end of a file" + + +class Message(object): + """An Error, Warning, or Note with a MessageContext, MessageId, and message text. + + May optionally have a replacement, a see_also array, an auto-fix, + and a stack frame where the message was created. + """ + + def __init__(self, message_id, message_type, message, context, + replacement=None, see_also=None, fix=None, frame=None): + """Construct a Message. + + Typically called by MacroCheckerFile.diag(). + """ + self.message_id = message_id + + self.message_type = message_type + + if isinstance(message, str): + self.message = [message] + else: + self.message = message + + self.context = context + if context is not None and context.match is not None and context.group is not None: + if context.group not in context.match.groupdict(): + raise RuntimeError( + 'Group "{}" does not exist in the match'.format(context.group)) + + self.replacement = replacement + + self.fix = fix + + if see_also is None: + self.see_also = None + elif isinstance(see_also, MessageContext): + self.see_also = [see_also] + else: + self.see_also = see_also + + self.script_location = None + if frame: + try: + frameinfo = getframeinfo(frame) + self.script_location = "{}:{}".format( + frameinfo.filename, frameinfo.lineno) + finally: + del frame diff --git a/xml/test_check_spec_links.py b/xml/test_check_spec_links.py index 1e71f286..8dfd9401 100644 --- a/xml/test_check_spec_links.py +++ b/xml/test_check_spec_links.py @@ -18,57 +18,94 @@ # # Purpose: This file contains tests for check_spec_links.py -from check_spec_links import MacroChecker, MessageId, shouldEntityBeText, ConsolePrinter import pytest +from check_spec_links import MacroChecker, MessageId, makeMacroChecker +from spec_tools.console_printer import ConsolePrinter +from spec_tools.macro_checker_file import shouldEntityBeText + +# API-specific constants +PROTO = 'vkCreateInstance' +STRUCT = 'VkInstanceCreateInfo' +EXT = 'VK_KHR_display' + class CheckerWrapper(object): """Little wrapper object for a MacroChecker. Intended for use in making test assertions shorter and easier to read.""" - def __init__(self): - self.ckr = MacroChecker(set([])) + def __init__(self, capsys): + self.ckr = makeMacroChecker(set([])) + self.capsys = capsys def enabled(self, enabled_messages): - """Updates the checker's enable message type set, from an iterable""" + """Updates the checker's enable message type set, from an iterable.""" self.ckr.enabled_messages = set(enabled_messages) return self def check(self, string): - """Checks a string (as if it were a file), outputs the results to the console, then returns the MacroFileChecker""" + """Checks a string (as if it were a file), outputs the results to the console, then returns the MacroCheckerFile.""" + + # Flush the captured output. + _ = self.capsys.readouterr() + + # Process f = self.ckr.processString(string + '\n') + + # Dump messages ConsolePrinter().output(f) return f @pytest.fixture -def ckr(): +def ckr(capsys): """Fixture - add an arg named ckr to your test function to automatically get one passed to you.""" - return CheckerWrapper() + return CheckerWrapper(capsys) -def replacement(ckr): - """Returns the replacement text associated with the first message of a file checker""" - assert(len(ckr.messages) == 1) +def msgReplacement(file_checker, which=0): + """Return the replacement text associated with the specified message.""" + assert(len(file_checker.messages) > which) + msg = file_checker.messages[which] from pprint import pprint - pprint(ckr.messages[0].script_location) - pprint(ckr.messages[0].replacement) - pprint(ckr.messages[0].fix) - return ckr.messages[0].replacement + pprint(msg.script_location) + pprint(msg.replacement) + pprint(msg.fix) + return msg.replacement + + +def loneMsgReplacement(file_checker): + """Assert there's only one message in a file checker, and return the replacement text associated with it.""" + assert(len(file_checker.messages) == 1) + return msgReplacement(file_checker) + + +def message(file_checker, which=0): + """Return a string of the message lines associated with the message of a file checker.""" + assert(len(file_checker.messages) > which) + return "\n".join(file_checker.messages[which].message) + + +def allMessages(file_checker): + """Return a list of strings, each being the combination of the message lines of a message from a file checker.""" + return ['\n'.join(msg.message) for msg in file_checker.messages] def test_missing_macro(ckr): - """Verify correct functioning of MessageId.MISSING_MACRO""" + """Verify correct functioning of MessageId.MISSING_MACRO.""" ckr.enabled([MessageId.MISSING_MACRO]) - # This should have a missing macro warning - assert(ckr.check('with vkFreeMemory by').numDiagnostics() == 1) - # These 3 should not have a missing macro warning because of their context (in a link) - assert(not ckr.check('<>').messages) + # This should have a missing macro warning + assert(ckr.check('with %s by' % PROTO).numDiagnostics() == 1) + + # These 3 should not have a missing macro warning because of their context + # (in a link) + assert(not ckr.check('<<%s' % PROTO).messages) + # These 2 are simulating links that broke over lines + assert(not ckr.check('%s>>' % PROTO).messages) assert(not ckr.check( - 'VkObjectType and Vulkan Handle Relationship>> table').messages) + '%s asdf>> table' % PROTO).messages) def test_entity_detection(ckr): @@ -93,31 +130,24 @@ def test_wrong_macro(ckr): assert(ckr.check('code:uint32_t').numErrors() == 0) -def test_legacy(ckr): - - ckr.enabled([MessageId.LEGACY]) - # Should complain about LEGACY - assert(ckr.check('sname:VkDeviceMemory').numDiagnostics() == 1) - - def test_should_entity_be_text(): # These 5 are all examples of patterns that would merit usage of a ptext/etext/etc # macro, for various reasons: # has variable in subscript assert(shouldEntityBeText('pBuffers[i]', '[i]')) - assert(shouldEntityBeText('VK_MEMORY_PLANE_[X]', '[X]')) + assert(shouldEntityBeText('API_ENUM_[X]', '[X]')) # has asterisk assert(shouldEntityBeText('maxPerStage*', None)) # double-underscores make italicized placeholders # (triple are double-underscores delimited by underscores...) - assert(shouldEntityBeText('VK_MEMORY_PLANE[__x__]', '[__x__]')) - assert(shouldEntityBeText('VK_MEMORY_PLANE___i___BIT_EXT', None)) + assert(shouldEntityBeText('API_ENUM[__x__]', '[__x__]')) + assert(shouldEntityBeText('API_ENUM___i___EXT', None)) # This shouldn't be a *text: macro because it only has single underscores - assert(False == shouldEntityBeText('VK_MEMORY_PLANE_i_BIT_EXT', None)) + assert(False == shouldEntityBeText('API_ENUM_i_EXT', None)) def test_misused_text(ckr): @@ -125,60 +155,57 @@ def test_misused_text(ckr): # but in a whole checker ckr.enabled([MessageId.MISUSED_TEXT]) - assert(ckr.check('etext:VK_MEMORY_PLANE_').numDiagnostics() == 0) - assert(ckr.check('etext:VK_MEMORY_PLANE_[X]').numDiagnostics() == 0) - assert(ckr.check('etext:VK_MEMORY_PLANE[i]').numDiagnostics() == 0) - assert(ckr.check('etext:VK_MEMORY_PLANE[__x__]').numDiagnostics() == 0) + assert(ckr.check('etext:API_ENUM_').numDiagnostics() == 0) + assert(ckr.check('etext:API_ENUM_[X]').numDiagnostics() == 0) + assert(ckr.check('etext:API_ENUM[i]').numDiagnostics() == 0) + assert(ckr.check('etext:API_ENUM[__x__]').numDiagnostics() == 0) # Should be OK, since __i__ is a placeholder here - assert(ckr.check('etext:VK_MEMORY_PLANE___i___BIT_EXT').numDiagnostics() == 0) + assert(ckr.check('etext:API_ENUM___i___EXT').numDiagnostics() == 0) # This shouldn't be a *text: macro because it only has single underscores - assert(ckr.check('VK_MEMORY_PLANE_i_BIT_EXT').numDiagnostics() == 0) + assert(ckr.check('API_ENUM_i_EXT').numDiagnostics() == 0) + def test_extension(ckr): ckr.enabled(set(MessageId)) # Check formatting of extension names: # the following is the canonical way to refer to an extension # (link wrapped in backticks) - expected_replacement='`<>`' + expected_replacement = '`<<%s>>`' % EXT # Extension name mentioned without any markup, should be added - assert(ckr.check('asdf VK_NV_mesh_shader asdf').messages) - assert(replacement(ckr.check('asdf VK_NV_mesh_shader asdf')) + assert(loneMsgReplacement(ckr.check('asdf %s asdf' % EXT)) == expected_replacement) # Extension name mentioned without any markup and wrong case, # should be added and have case fixed - assert(ckr.check('asdf VK_NV_MESH_SHADER asdf').messages) - assert(replacement(ckr.check('asdf VK_NV_MESH_SHADER asdf')) + assert(loneMsgReplacement(ckr.check('asdf %s asdf' % EXT.upper())) == expected_replacement) # Extension name using wrong/old macro: ename isn't for extensions. - assert(ckr.check('asdf ename:VK_NV_mesh_shader asdf').messages) - assert(replacement(ckr.check('asdf ename:VK_NV_mesh_shader asdf')) + assert(loneMsgReplacement(ckr.check('asdf ename:%s asdf' % EXT)) == expected_replacement) # Extension name using wrong macro: elink isn't for extensions. - assert(ckr.check('asdf elink:VK_NV_mesh_shader asdf').messages) - assert(replacement(ckr.check('asdf elink:VK_NV_mesh_shader asdf')) + assert(loneMsgReplacement(ckr.check('asdf elink:%s asdf' % EXT)) == expected_replacement) - # Extension name using wrong macro and wrong case: should have markup and case fixed - assert(ckr.check('asdf elink:VK_NV_MESH_SHADER asdf').messages) - assert(replacement(ckr.check('asdf elink:VK_NV_MESH_SHADER asdf')) + # Extension name using wrong macro and wrong case: should have markup and + # case fixed + assert(loneMsgReplacement(ckr.check('asdf elink:%s asdf' % EXT.upper())) == expected_replacement) # This shouldn't cause errors because this is how we want it to look. - assert(not ckr.check('asdf `<>` asdf').messages) + assert(not ckr.check('asdf `<<%s>>` asdf' % EXT).messages) # This doesn't (shouldn't?) cause errors because just backticks on their own # "escape" names from the "missing markup" tests. - assert(not ckr.check('asdf `VK_NV_mesh_shader` asdf').messages) + assert(not ckr.check('asdf `%s` asdf' % EXT).messages) # TODO can we auto-correct this to add the backticks? # Doesn't error now, but would be nice if it did... - assert(not ckr.check('asdf <> asdf').messages) + assert(not ckr.check('asdf <<%s>> asdf' % EXT).messages) def test_refpage_tag(ckr): @@ -197,13 +224,13 @@ def test_refpage_tag(ckr): def test_refpage_name(ckr): ckr.enabled([MessageId.REFPAGE_NAME]) - # Should not error: vkCreateInstance actually exists. + # Should not error: actually exists. assert(ckr.check( - "[open,refpage='vkCreateInstance',desc='',type='']").numDiagnostics() == 0) + "[open,refpage='%s',desc='',type='']" % PROTO).numDiagnostics() == 0) - # Should error: vkBogus does not exist. + # Should error: does not exist. assert( - ckr.check("[open,refpage='vkBogus',desc='',type='']").numDiagnostics() == 1) + ckr.check("[open,refpage='bogus',desc='',type='']").numDiagnostics() == 1) def test_refpage_missing_desc(ckr): @@ -221,37 +248,403 @@ def test_refpage_type(ckr): ckr.enabled([MessageId.REFPAGE_TYPE]) # Should not error: this is of type 'protos'. assert(not ckr.check( - "[open,refpage='vkCreateInstance',desc='',type='protos']").messages) + "[open,refpage='%s',desc='',type='protos']" % PROTO).messages) # Should error: this is of type 'protos', not 'structs'. assert( - ckr.check("[open,refpage='vkCreateInstance',desc='',type='structs']").messages) + ckr.check("[open,refpage='%s',desc='',type='structs']" % PROTO).messages) def test_refpage_xrefs(ckr): ckr.enabled([MessageId.REFPAGE_XREFS]) - # Should not error: VkInstanceCreateInfo is a valid entity to have an xref to. + # Should not error: this is a valid entity to have an xref to. assert(not ckr.check( - "[open,refpage='vkCreateInstance',desc='',type='protos',xrefs='VkInstanceCreateInfo']").messages) + "[open,refpage='',desc='',type='protos',xrefs='%s']" % STRUCT).messages) # case difference: # should error but offer a replacement. - assert(ckr.check( - "[open,refpage='vkCreateInstance',desc='',type='protos',xrefs='vkInstanceCreateInfo']").numDiagnostics() == 1) - assert(replacement(ckr.check("[open,refpage='vkCreateInstance',desc='',type='protos',xrefs='vkInstanceCreateInfo']")) - == 'VkInstanceCreateInfo') + assert(loneMsgReplacement(ckr.check("[open,refpage='',xrefs='%s']" % STRUCT.lower())) + == STRUCT) # Should error: not a valid entity. assert(ckr.check( - "[open,refpage='xrCreateInstance',desc='',type='protos',xrefs='xrBogus']").numDiagnostics() == 1) + "[open,refpage='',desc='',type='protos',xrefs='bogus']").numDiagnostics() == 1) def test_refpage_xrefs_comma(ckr): ckr.enabled([MessageId.REFPAGE_XREFS_COMMA]) # Should not error: no commas in the xrefs field assert(not ckr.check( - "[open,refpage='vkCreateInstance',desc='',type='protos',xrefs='VkInstanceCreateInfo']").messages) - # Should error: commas shouldn't be there since it's space-delimited + "[open,refpage='',xrefs='abc']").messages) + # Should error: commas shouldn't be there since it's space-delimited. + assert(loneMsgReplacement( + ckr.check("[open,refpage='',xrefs='abc,']")) == 'abc') + + # All should correct to the same thing. + equivalent_tags_with_commas = [ + "[open,refpage='',xrefs='abc, 123']", + "[open,refpage='',xrefs='abc,123']", + "[open,refpage='',xrefs='abc , 123']"] + for has_comma in equivalent_tags_with_commas: + assert(loneMsgReplacement(ckr.check(has_comma)) == 'abc 123') + + +def test_refpage_block(ckr): + """Tests of the REFPAGE_BLOCK message.""" + ckr.enabled([MessageId.REFPAGE_BLOCK]) + # Should not error: have the tag, an open, and a close + assert(not ckr.check( + """[open,] + -- + bla + --""").messages) + assert(not ckr.check( + """[open,refpage='abc'] + -- + bla + -- + + [open,refpage='123'] + -- + bla2 + --""").messages) + + # Should have 1 error: file ends immediately after tag assert(ckr.check( - "[open,refpage='vkCreateInstance',desc='',type='protos',xrefs='VkInstanceCreateInfo,']").numDiagnostics() == 1) + "[open,]").numDiagnostics() == 1) + + # Should have 1 error: line after tag isn't -- + assert(ckr.check( + """[open,] + bla + --""").numDiagnostics() == 1) + # Checking precedence of checks: this should have 1 error because line after tag isn't -- + # (but it is something that causes a line to be handled differently) + assert(ckr.check( + """[open,] + == Heading + --""").numDiagnostics() == 1) + assert(ckr.check( + """[open,] + ---- + this is in a code block + ---- + --""").numDiagnostics() == 1) + + # Should have 1 error: tag inside refpage. + tag_inside = """[open,] + -- + bla + [open,] + --""" + assert(ckr.check(tag_inside).numDiagnostics() == 1) + assert("already in a refpage block" in + message(ckr.check(tag_inside))) + + +def test_refpage_missing(ckr): + """Test the REFPAGE_MISSING message.""" + ckr.enabled([MessageId.REFPAGE_MISSING]) + # Should not error: have the tag, an open, and the include + assert(not ckr.check( + """[open,refpage='%s'] + -- + include::../../generated/api/protos/%s.txt[]""" % (PROTO, PROTO)).messages) + assert(not ckr.check( + """[open,refpage='%s'] + -- + include::../../generated/validity/protos/%s.txt[]""" % (PROTO, PROTO)).messages) + + # Should not error: manual anchors shouldn't trigger this. + assert(not ckr.check("[[%s]]" % PROTO).messages) + + # Should have 1 error: file ends immediately after include + assert(ckr.check( + "include::../../generated/api/protos/%s.txt[]" % PROTO).numDiagnostics() == 1) + assert(ckr.check( + "include::../../generated/validity/protos/%s.txt[]" % PROTO).numDiagnostics() == 1) + + # Should have 1 error: include is before the refpage open + assert(ckr.check( + """include::../../generated/api/protos/%s.txt[] + [open,refpage='%s'] + --""" % (PROTO, PROTO)).numDiagnostics() == 1) + assert(ckr.check( + """include::../../generated/validity/protos/%s.txt[] + [open,refpage='%s'] + --""" % (PROTO, PROTO)).numDiagnostics() == 1) + + +def test_refpage_mismatch(ckr): + """Test the REFPAGE_MISMATCH message.""" + ckr.enabled([MessageId.REFPAGE_MISMATCH]) + # Should not error: have the tag, an open, and a matching include + assert(not ckr.check( + """[open,refpage='%s'] + -- + include::../../generated/api/protos/%s.txt[]""" % (PROTO, PROTO)).messages) + assert(not ckr.check( + """[open,refpage='%s'] + -- + include::../../generated/validity/protos/%s.txt[]""" % (PROTO, PROTO)).messages) + + # Should error: have the tag, an open, and a mis-matching include + assert(ckr.check( + """[open,refpage='%s'] + -- + include::../../generated/api/structs/%s.txt[]""" % (PROTO, STRUCT)).numDiagnostics() == 1) + assert(ckr.check( + """[open,refpage='%s'] + -- + include::../../generated/validity/structs/%s.txt[]""" % (PROTO, STRUCT)).numDiagnostics() == 1) + + +def test_refpage_unknown_attrib(ckr): + """Check the REFPAGE_UNKNOWN_ATTRIB message.""" + ckr.enabled([MessageId.REFPAGE_UNKNOWN_ATTRIB]) + # Should not error: these are known attribute names + assert(not ckr.check( + "[open,refpage='',desc='',type='',xrefs='']").messages) + + # Should error: xref isn't an attribute name. + assert(ckr.check( + "[open,xref='']").numDiagnostics() == 1) + + +def test_refpage_self_xref(ckr): + """Check the REFPAGE_SELF_XREF message.""" + ckr.enabled([MessageId.REFPAGE_SELF_XREF]) + # Should not error: not self-referencing + assert(not ckr.check( + "[open,refpage='abc',xrefs='']").messages) + assert(not ckr.check( + "[open,refpage='abc',xrefs='123']").messages) + + # Should error: self-referencing isn't an attribute name. + assert(loneMsgReplacement( + ckr.check("[open,refpage='abc',xrefs='abc']")) == '') + assert(loneMsgReplacement( + ckr.check("[open,refpage='abc',xrefs='abc 123']")) == '123') + assert(loneMsgReplacement( + ckr.check("[open,refpage='abc',xrefs='123 abc']")) == '123') + + +def test_refpage_xref_dupe(ckr): + """Check the REFPAGE_XREF_DUPE message.""" + ckr.enabled([MessageId.REFPAGE_XREF_DUPE]) + # Should not error: no dupes + assert(not ckr.check("[open,xrefs='']").messages) + assert(not ckr.check("[open,xrefs='123']").messages) + assert(not ckr.check("[open,xrefs='abc 123']").messages) + + # Should error: one dupe. + assert(loneMsgReplacement( + ckr.check("[open,xrefs='abc abc']")) == 'abc') + assert(loneMsgReplacement( + ckr.check("[open,xrefs='abc abc']")) == 'abc') + assert(loneMsgReplacement( + ckr.check("[open,xrefs='abc abc abc']")) == 'abc') + assert(loneMsgReplacement( + ckr.check("[open,xrefs='abc 123 abc']")) == 'abc 123') + assert(loneMsgReplacement( + ckr.check("[open,xrefs='123 abc abc']")) == '123 abc') + + +def test_REFPAGE_WHITESPACE(ckr): + """Check the REFPAGE_WHITESPACE message.""" + ckr.enabled([MessageId.REFPAGE_WHITESPACE]) + # Should not error: no extra whitspace + assert(not ckr.check("[open,xrefs='']").messages) + assert(not ckr.check("[open,xrefs='123']").messages) + assert(not ckr.check("[open,xrefs='abc 123']").messages) + + # Should error: some extraneous whitespace. + assert(loneMsgReplacement( + ckr.check("[open,xrefs=' \t ']")) == '') + assert(loneMsgReplacement( + ckr.check("[open,xrefs=' abc 123 ']")) == 'abc 123') + assert(loneMsgReplacement( + ckr.check("[open,xrefs=' abc\t123 xyz ']")) == 'abc 123 xyz') + + # Should *NOT* remove self-reference, just extra whitespace + assert(loneMsgReplacement( + ckr.check("[open,refpage='abc',xrefs=' abc 123 ']")) == 'abc 123') + + # Even if we turn on the self-reference warning + ckr.enabled([MessageId.REFPAGE_WHITESPACE, MessageId.REFPAGE_SELF_XREF]) + assert(msgReplacement( + ckr.check("[open,refpage='abc',xrefs=' abc 123 ']"), 1) == 'abc 123') + + +def test_REFPAGE_DUPLICATE(ckr): + """Check the REFPAGE_DUPLICATE message.""" + ckr.enabled([MessageId.REFPAGE_DUPLICATE]) + # Should not error: no duplicate refpages. + assert(not ckr.check("[open,refpage='abc']").messages) + assert(not ckr.check("[open,refpage='123']").messages) + + # Should error: repeated refpage + assert(ckr.check( + """[open,refpage='abc'] + [open,refpage='abc']""").messages) + + # Should error: repeated refpage with something intervening + assert(ckr.check( + """[open,refpage='abc'] + [open,refpage='123'] + [open,refpage='abc']""").messages) + + +def test_UNCLOSED_BLOCK(ckr): + """Check the UNCLOSED_BLOCK message.""" + ckr.enabled([MessageId.UNCLOSED_BLOCK]) + # These should all have 0 errors + assert(not ckr.check("== Heading").messages) + assert(not ckr.check( + """**** + == Heading + ****""").messages) + assert(not ckr.check( + """**** + contents + ****""").messages) + assert(not ckr.check( + """**** + [source,c] + ---- + this is code + ---- + ****""").messages) + assert(not ckr.check( + """[open,] + -- + 123 + + [source,c] + ---- + this is code + ---- + **** + * this is in a box + **** + + Now we can close the ref page. + --""").messages) + + # These should all have 1 error because I removed a block close. + # Because some of them, the missing block close is an interior one, the stack might look weird, + # but it's still only 1 error - no matter how many are left unclosed. + assert(ckr.check( + """**** + == Heading""").numDiagnostics() == 1) + assert(ckr.check( + """**** + contents""").numDiagnostics() == 1) + assert(ckr.check( + """**** + [source,c] + ---- + this is code + ****""").numDiagnostics() == 1) + assert(ckr.check( + """**** + [source,c] + ---- + this is code + ----""").numDiagnostics() == 1) + assert(ckr.check( + """[open,] + -- + 123 + + [source,c] + ---- + this is code + ---- + **** + * this is in a box + ****""").numDiagnostics() == 1) + assert(ckr.check( + """[open,] + -- + 123 + + [source,c] + ---- + this is code + ---- + **** + * this is in a box + --""").numDiagnostics() == 1) + assert(ckr.check( + """[open,] + -- + 123 + + [source,c] + ---- + this is code + **** + * this is in a box + **** + + Now we can close the ref page. + --""").numDiagnostics() == 1) + assert(ckr.check( + """[open,] + -- + 123 + + [source,c] + ---- + this is code + **** + * this is in a box + + Now we can close the ref page. + --""").numDiagnostics() == 1) + assert(ckr.check( + """[open,] + -- + 123 + + [source,c] + ---- + this is code + **** + * this is in a box""").numDiagnostics() == 1) + + # This should have 0 errors of UNCLOSED_BLOCK: the missing opening -- should get automatically fake-inserted, + assert(not ckr.check( + """[open,] + == Heading + --""").messages) + + # Should have 1 error: block left open at end of file + assert(ckr.check( + """[open,] + -- + bla""").numDiagnostics() == 1) + + +def test_code_block_tracking(ckr): + """Check to make sure that no other messages get triggered in a code block.""" + ckr.enabled([MessageId.BAD_ENTITY]) + + # Should have 1 error: not a valid entity + assert(ckr.check("slink:BogusStruct").numDiagnostics() == 1) + assert(ckr.check( + """**** + * slink:BogusStruct + ****""").numDiagnostics() == 1) + + # should have zero errors: the invalid entity is inside a code block, + # so it shouldn't be parsed. + # (In reality, it's mostly the MISSING_MACRO message that might interact with code block tracking, + # but this is easier to test in an API-agnostic way.) + assert(not ckr.check( + """[source,c] + ---- + This code happens to include the characters slink:BogusStruct + ----""").messages) diff --git a/xml/test_check_spec_links_api_specific.py b/xml/test_check_spec_links_api_specific.py new file mode 100644 index 00000000..4074f325 --- /dev/null +++ b/xml/test_check_spec_links_api_specific.py @@ -0,0 +1,93 @@ +#!/usr/bin/python3 +# +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik +# +# Purpose: This file contains tests for check_spec_links.py +# that depend on the API being used. + +import pytest + +from check_spec_links import MacroChecker, MessageId, makeMacroChecker +from spec_tools.console_printer import ConsolePrinter +from spec_tools.macro_checker_file import shouldEntityBeText +from test_check_spec_links import (CheckerWrapper, allMessages, + loneMsgReplacement, message, msgReplacement) + + +@pytest.fixture +def ckr(capsys): + """Fixture - add an arg named ckr to your test function to automatically get one passed to you.""" + return CheckerWrapper(capsys) + + +def test_vulkan_refpage_mismatch(ckr): + """Vulkan-specific tests of the REFPAGE_MISMATCH message.""" + ckr.enabled([MessageId.REFPAGE_MISMATCH]) + # Should error: this is actually a mismatch in Vulkan + assert(ckr.check( + """[open,refpage='VkQueueFlags'] + -- + include::../api/enums/VkQueueFlagBits.txt[]""").numDiagnostics() == 1) + assert(ckr.check( + """[open,refpage='VkQueueFlags'] + -- + include::../validity/enums/VkQueueFlagBits.txt[]""").numDiagnostics() == 1) + + +def test_vulkan_refpage_missing(ckr): + """Vulkan-specific tests of the REFPAGE_MISSING message.""" + ckr.enabled([MessageId.REFPAGE_MISSING]) + + # Should error: flags are expected to have their own ref page. + assert(ckr.check( + "include::../api/flags/VkQueueFlags.txt[]").numDiagnostics() == 1) + + +def test_vulkan_refpage_block(ckr): + """Vulkan-specific tests of the REFPAGE_BLOCK message.""" + ckr.enabled([MessageId.REFPAGE_BLOCK]) + + # Should have no errors: Non-refpage usage of '--' is acceptable + assert(not ckr.check( + """-- + bla + --""").messages) + + # Should have 1 error: + # - line after tag isn't '--' + result = ckr.check( + """-- + [open,] + bla + --""") + assert(result.numDiagnostics() == 1) + # Internally, it's as if the following were the spec source, after putting in the "fake" lines + # (each of the added lines comes from one message): + # + # -- + # [open,] + # -- + # bla + # -- + assert("but did not find, a line containing only -- following a reference page tag" in message(result)) + + +def test_vulkan_legacy(ckr): + """Test the LEGACY message which is Vulkan-only.""" + ckr.enabled([MessageId.LEGACY]) + # Should complain about LEGACY + assert(ckr.check('sname:VkDeviceMemory').numDiagnostics() == 1) diff --git a/xml/test_entity_db.py b/xml/test_entity_db.py new file mode 100644 index 00000000..5dead2cb --- /dev/null +++ b/xml/test_entity_db.py @@ -0,0 +1,42 @@ +#!/usr/bin/python3 -i +# +# Copyright (c) 2018-2019 Collabora, Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Author(s): Ryan Pavlik + + +import pytest + +from check_spec_links import VulkanEntityDatabase + + +@pytest.fixture +def db(): + ret = VulkanEntityDatabase() + # print(ret.getEntityJson()) + return ret + + +def test_likely_recognized(db): + assert(db.likelyRecognizedEntity('vkBla')) + assert(db.likelyRecognizedEntity('VkBla')) + assert(db.likelyRecognizedEntity('VK_BLA')) + + +def test_db(db): + assert(db.findEntity('vkCreateInstance')) + + # VKAPI_CALL is not referenced, so not added to EntityDatabase. + # assert(db.findEntity('VKAPI_CALL')) diff --git a/xml/vk.xml b/xml/vk.xml old mode 100755 new mode 100644 index 9f7a73be..45c6b4d0 --- a/xml/vk.xml +++ b/xml/vk.xml @@ -146,7 +146,7 @@ server. // Vulkan 1.1 version number #define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 98 +#define VK_HEADER_VERSION 99
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; @@ -3432,6 +3432,11 @@ server. void* pNext VkBool32 imageFootprint + + VkStructureType sType + void* pNext + VkBool32 dedicatedAllocationImageAliasing + uint32_t shadingRatePaletteEntryCount const VkShadingRatePaletteEntryNV* pShadingRatePaletteEntries @@ -3709,6 +3714,17 @@ server. const void* pNext VkDeviceSize deviceAddress + + VkStructureType sType + void* pNext + VkImageViewType imageViewType + + + VkStructureType sType + void* pNext + VkBool32 filterCubic + VkBool32 filterCubicMinmax + Vulkan enumerant (token) definitions @@ -7867,9 +7883,11 @@ server. - - - + + + + + @@ -9759,10 +9777,14 @@ server. - + - - + + + + + + @@ -10293,10 +10315,12 @@ server. - + - - + + + + @@ -10373,5 +10397,35 @@ server. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +